From patchwork Thu May 21 21:43:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Simon Tournier X-Patchwork-Id: 22250 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 66B5A27BBE3; Thu, 21 May 2020 22:44:10 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,T_DKIM_INVALID,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 996CA27BBE1 for ; Thu, 21 May 2020 22:44:09 +0100 (BST) Received: from localhost ([::1]:45860 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbsz3-000515-2D for patchwork@mira.cbaines.net; Thu, 21 May 2020 17:44:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54264) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jbsyw-0004zn-Me for guix-patches@gnu.org; Thu, 21 May 2020 17:44:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:45904) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jbsyw-0003i3-DF for guix-patches@gnu.org; Thu, 21 May 2020 17:44:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jbsyw-00086J-B6 for guix-patches@gnu.org; Thu, 21 May 2020 17:44:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#41260] [PATCH v2] guix package: Support multiple profiles with '--list-installed'. References: <20200514141350.4867-1-zimon.toutoune@gmail.com> In-Reply-To: <20200514141350.4867-1-zimon.toutoune@gmail.com> Resent-From: zimoun Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 21 May 2020 21:44:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41260 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 41260@debbugs.gnu.org Cc: zimoun Received: via spool by 41260-submit@debbugs.gnu.org id=B41260.159009740331082 (code B ref 41260); Thu, 21 May 2020 21:44:02 +0000 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 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 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * 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"