From debbugs-submit-bounces@debbugs.gnu.org Thu May 21 17:43:22 2020 Received: (at 41260) by debbugs.gnu.org; 21 May 2020 21:43:23 +0000 Received: from localhost ([127.0.0.1]:57450 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jbsyI-00085G-JU for submit@debbugs.gnu.org; Thu, 21 May 2020 17:43:22 -0400 Received: from mail-ej1-f47.google.com ([209.85.218.47]:40069) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jbsyF-000852-Ap for 41260@debbugs.gnu.org; Thu, 21 May 2020 17:43:21 -0400 Received: by mail-ej1-f47.google.com with SMTP id d7so10639087eja.7 for <41260@debbugs.gnu.org>; Thu, 21 May 2020 14:43:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=UTSFuF1WfBA5RYyYMImITAPCUfvEOgGZ1QyGIg/p6wU=; b=hdzmekCal19dL2rT5Pfxu36a/OwfbdJDmKUJ8SoNAbfvBQvFZHDEPvv5KVPiLSSqQN LePTsUklaD4996lVN6w1zKPx8lDGRx7VbR24MrDv+fvtf7+MFsJr1dd4YoyXpIqPK+3U 24ipIeXTqMA4a39vK+UzE2sOwQAeRAUbgXFLUlj4bNmwa52DktZi/jTb4DCKe9lGWjSM mvglVvtq6l9+dD8VrPN8aVGJEAC9mhdgxvQ9sI9NB2BDbN8sq0phYZX0zAovSRgp67IX fwyrsWjbjHlpYgVDuvLJRiZ+uTX/YJQq8hYpRTsIy8J8a44A7M2YB2fuyun96WDIrSz5 AjFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=UTSFuF1WfBA5RYyYMImITAPCUfvEOgGZ1QyGIg/p6wU=; b=NfDkBMaYPuWy4wGj1ID19q4g3hdzXi4YdOqRlmCqU5Cqm0gap9IS1q0WTEHdjsEle/ oCK9fnFGtDrSNVPRonSP2Vh4GOe9R6S9EyJ4oyPy8I2hxFNUY+kqFE29ckUchRKxPPo5 sVcalt2HJsrIEXugqsDGlg6f8fTObbbC2pA3pkdBnll15MdKjxFWWO1OJOX/rEhlZEaZ ZsONkF9rZNG8kzCFo1QGGixYHZsKx+69jV0mPLCv49b5OUsHGoCXljc9st/F49asD+KE /uwNzUjd0cVZRQVMkn2wGhCS6cRvVK1IbESnt6AVkconRpI2aGqeJTuDUFTkUhtTRcSc xcQw== X-Gm-Message-State: AOAM533zhsXZLcqL0JstatgmOMKBzu7PkQs24CM9yQ5GBxosgmjkFka8 /QEm0ltSQUqph64e93I5czJ3EnPC X-Google-Smtp-Source: ABdhPJwmhFwudiBx8xvQoshSkwk+3yr0xn++dfi2IUgudznF7Q83oZ09S4ztg30IpJdxIrNi+mlThg== X-Received: by 2002:a17:907:392:: with SMTP id ss18mr5802854ejb.156.1590097393105; Thu, 21 May 2020 14:43:13 -0700 (PDT) Received: from localhost.localdomain (57.246.195.77.rev.sfr.net. [77.195.246.57]) by smtp.gmail.com with ESMTPSA id jp17sm5684603ejb.23.2020.05.21.14.43.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 14:43:12 -0700 (PDT) From: zimoun To: 41260@debbugs.gnu.org Subject: [PATCH v2] guix package: Support multiple profiles with '--list-installed'. Date: Thu, 21 May 2020 23:43:06 +0200 Message-Id: <20200521214306.6948-1-zimon.toutoune@gmail.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 41260 Cc: zimoun X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) * guix/scripts/package.scm (process-query): List installed multiple profiles. * tests/guix-package-net.sh: Test it. --- guix/scripts/package.scm | 20 +++++++++++--------- tests/guix-package-net.sh | 12 ++++++++++++ 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm index a69efa365e..1246147798 100644 --- a/guix/scripts/package.scm +++ b/guix/scripts/package.scm @@ -675,12 +675,13 @@ doesn't need it." (define (process-query opts) "Process any query specified by OPTS. Return #t when a query was actually processed, #f otherwise." - (let* ((profiles (match (filter-map (match-lambda - (('profile . p) p) - (_ #f)) - opts) - (() (list %current-profile)) - (lst (reverse lst)))) + (let* ((profiles (delete-duplicates + (match (filter-map (match-lambda + (('profile . p) p) + (_ #f)) + opts) + (() (list %current-profile)) + (lst (reverse lst))))) (profile (match profiles ((head tail ...) head)))) (match (assoc-ref opts 'query) @@ -718,7 +719,8 @@ processed, #f otherwise." (('list-installed regexp) (let* ((regexp (and regexp (make-regexp* regexp regexp/icase))) - (manifest (profile-manifest profile)) + (manifest (concatenate-manifests + (map profile-manifest profiles))) (installed (manifest-entries manifest))) (leave-on-EPIPE (for-each (match-lambda @@ -729,8 +731,8 @@ processed, #f otherwise." name (or version "?") output path)))) ;; Show most recently installed packages last. - (reverse installed))) - #t)) + (reverse installed)))) + #t) (('list-available regexp) (let* ((regexp (and regexp (make-regexp* regexp regexp/icase))) diff --git a/tests/guix-package-net.sh b/tests/guix-package-net.sh index 48a94865e1..3876701fa2 100644 --- a/tests/guix-package-net.sh +++ b/tests/guix-package-net.sh @@ -1,6 +1,7 @@ # GNU Guix --- Functional package management for GNU # Copyright © 2012, 2013, 2014, 2015, 2017, 2019 Ludovic Courtès # Copyright © 2013 Nikita Karetnikov +# Copyright © 2020 Simon Tournier # # This file is part of GNU Guix. # @@ -78,6 +79,17 @@ esac test "`guix package -p "$profile" -I 'g.*e' | cut -f1`" = "guile-bootstrap" +guix package --bootstrap -p "$profile_alt" -i gcc-bootstrap +installed="`guix package -p "$profile" -p "$profile_alt" -I | cut -f1 | xargs echo | sort`" +case "x$installed" in + "gcc-bootstrap guile-bootstrap make-boot0") + true;; + "*") + false;; +esac +test "`guix package -p "$profile_alt" -p "$profile" -I | wc -l`" = "3" +rm "$profile_alt" + # List generations. test "`guix package -p "$profile" -l | cut -f1 | grep guile | head -n1`" \ = " guile-bootstrap" -- 2.26.2