From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id wITXJE26y189EQAA0tVLHw (envelope-from ) for ; Sat, 05 Dec 2020 16:50:21 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id MMOqIE26y1+LagAA1q6Kng (envelope-from ) for ; Sat, 05 Dec 2020 16:50:21 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 3679A9404D7 for ; Sat, 5 Dec 2020 16:50:21 +0000 (UTC) Received: from localhost ([::1]:58904 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1klalG-0002En-FW for larch@yhetil.org; Sat, 05 Dec 2020 11:50:18 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:45062) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1klaJw-0006lz-H9 for bug-guix@gnu.org; Sat, 05 Dec 2020 11:22:05 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:36550) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1klaJu-00027F-Hw for bug-guix@gnu.org; Sat, 05 Dec 2020 11:22:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1klaJu-0003wM-F2 for bug-guix@gnu.org; Sat, 05 Dec 2020 11:22:02 -0500 X-Loop: help-debbugs@gnu.org Subject: bug#23874: [PATCH v3 2/2] profiles: Delete duplicate manifest entries in packages->manifest. Resent-From: Leo Prikler Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Sat, 05 Dec 2020 16:22:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23874 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: 23874@debbugs.gnu.org Received: via spool by 23874-submit@debbugs.gnu.org id=B23874.160718527015075 (code B ref 23874); Sat, 05 Dec 2020 16:22:02 +0000 Received: (at 23874) by debbugs.gnu.org; 5 Dec 2020 16:21:10 +0000 Received: from localhost ([127.0.0.1]:48095 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1klaJ4-0003uz-HR for submit@debbugs.gnu.org; Sat, 05 Dec 2020 11:21:10 -0500 Received: from mailrelay.tugraz.at ([129.27.2.202]:44921) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1klaIy-0003uf-VJ for 23874@debbugs.gnu.org; Sat, 05 Dec 2020 11:21:08 -0500 Received: from localhost.localdomain (217-149-166-73.nat.highway.telekom.at [217.149.166.73]) by mailrelay.tugraz.at (Postfix) with ESMTPSA id 4CpFDt6gHCz3xCP; Sat, 5 Dec 2020 17:21:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tugraz.at; s=mailrelay; t=1607185263; bh=/f+UD7CcSHlA/nKGS8ao87ifrR1YRUm8MBLv1okFfLQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=hKKSey8HLgbZm4pmU762cTgnSsZAk8G02wEs5m2XBq0uMwn+g66t71cQcjbO29zwT yQuvFI5wQuRuLVvMiotH6oYVQ3Q+KWe/UcfO7/NcFGTetZktTV03+Nxu/qfGpsteU/ zrjRoHx45HPUH1x20vnqiIHkhvDKprKqyv3KT8pU= From: Leo Prikler Date: Sat, 5 Dec 2020 17:20:10 +0100 Message-Id: <20201205162010.26652-2-leo.prikler@student.tugraz.at> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201205162010.26652-1-leo.prikler@student.tugraz.at> References: <20201205162010.26652-1-leo.prikler@student.tugraz.at> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TUG-Backscatter-control: bt4lQm5Tva3SBgCuw0EnZw X-Spam-Scanner: SpamAssassin 3.003001 X-Spam-Score-relay: -1.9 X-Scanned-By: MIMEDefang 2.74 on 129.27.10.116 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: 3.80 Authentication-Results: aspmx1.migadu.com; dkim=fail (headers rsa verify failed) header.d=tugraz.at header.s=mailrelay header.b=hKKSey8H; dmarc=fail reason="SPF not aligned (relaxed)" header.from=student.tugraz.at (policy=none); spf=pass (aspmx1.migadu.com: domain of bug-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=bug-guix-bounces@gnu.org X-Migadu-Queue-Id: 3679A9404D7 X-Spam-Score: 3.80 X-Migadu-Scanner: ns3122888.ip-94-23-21.eu X-TUID: VB7h+aNFcykF * gnu/profiles.scm (packages->manifest): Delete duplicate entries. * tests/profiles.scm ("packages->manifest, no duplicates"): New test. --- guix/profiles.scm | 34 ++++++++++++++++++---------------- tests/profiles.scm | 10 ++++++++++ 2 files changed, 28 insertions(+), 16 deletions(-) diff --git a/guix/profiles.scm b/guix/profiles.scm index 034591eb79..59a313ea08 100644 --- a/guix/profiles.scm +++ b/guix/profiles.scm @@ -399,22 +399,24 @@ denoting a specific output of a package." 'inferior-package->manifest-entry)) (manifest - (map (match-lambda - (((? package? package) output) - (package->manifest-entry package output)) - ((? package? package) - (package->manifest-entry package)) - ((thing output) - (if inferiors-loaded? - ((inferior->entry) thing output) - (throw 'wrong-type-arg 'packages->manifest - "Wrong package object: ~S" (list thing) (list thing)))) - (thing - (if inferiors-loaded? - ((inferior->entry) thing) - (throw 'wrong-type-arg 'packages->manifest - "Wrong package object: ~S" (list thing) (list thing))))) - packages))) + (delete-duplicates + (map (match-lambda + (((? package? package) output) + (package->manifest-entry package output)) + ((? package? package) + (package->manifest-entry package)) + ((thing output) + (if inferiors-loaded? + ((inferior->entry) thing output) + (throw 'wrong-type-arg 'packages->manifest + "Wrong package object: ~S" (list thing) (list thing)))) + (thing + (if inferiors-loaded? + ((inferior->entry) thing) + (throw 'wrong-type-arg 'packages->manifest + "Wrong package object: ~S" (list thing) (list thing))))) + packages) + manifest-entry=?))) (define (manifest->gexp manifest) "Return a representation of MANIFEST as a gexp." diff --git a/tests/profiles.scm b/tests/profiles.scm index f0a1a1d11c..2dec42bec1 100644 --- a/tests/profiles.scm +++ b/tests/profiles.scm @@ -384,6 +384,16 @@ (manifest-entry-search-paths (package->manifest-entry mpl))))) +(test-assert "packages->manifest, no duplicates" + (let ((expected + (manifest + (list + (package->manifest-entry packages:guile-2.2)))) + (manifest (packages->manifest + (list packages:guile-2.2 packages:guile-2.2)))) + (every manifest-entry=? (manifest-entries expected) + (manifest-entries manifest)))) + (test-equal "packages->manifest, propagated inputs" (map (match-lambda ((label package) -- 2.29.2