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 +LtUKYjUT19NRQAA0tVLHw (envelope-from ) for ; Wed, 02 Sep 2020 17:21:12 +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 ONguJYjUT18BcQAA1q6Kng (envelope-from ) for ; Wed, 02 Sep 2020 17:21:12 +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 1EFA194050F for ; Wed, 2 Sep 2020 17:21:12 +0000 (UTC) Received: from localhost ([::1]:37592 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kDWRZ-0004W7-29 for larch@yhetil.org; Wed, 02 Sep 2020 13:21:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50640) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kDWRS-0004Vg-Mk for guix-patches@gnu.org; Wed, 02 Sep 2020 13:21:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:49062) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kDWRS-0002uP-Dy for guix-patches@gnu.org; Wed, 02 Sep 2020 13:21:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kDWRS-0004Ru-9C for guix-patches@gnu.org; Wed, 02 Sep 2020 13:21:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#43170] [PATCH 1/2] ui: Refactor the package-strings helper in show-manifest-transaction. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 02 Sep 2020 17:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 43170 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 43170@debbugs.gnu.org Cc: Maxim Cournoyer X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.159906725817068 (code B ref -1); Wed, 02 Sep 2020 17:21:02 +0000 Received: (at submit) by debbugs.gnu.org; 2 Sep 2020 17:20:58 +0000 Received: from localhost ([127.0.0.1]:60608 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kDWRO-0004RE-1D for submit@debbugs.gnu.org; Wed, 02 Sep 2020 13:20:58 -0400 Received: from lists.gnu.org ([209.51.188.17]:45452) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kDWRJ-0004Qz-Km for submit@debbugs.gnu.org; Wed, 02 Sep 2020 13:20:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50556) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kDWRJ-0004T1-Fa for guix-patches@gnu.org; Wed, 02 Sep 2020 13:20:53 -0400 Received: from mail-qk1-x743.google.com ([2607:f8b0:4864:20::743]:37420) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kDWRH-0002tA-JT for guix-patches@gnu.org; Wed, 02 Sep 2020 13:20:53 -0400 Received: by mail-qk1-x743.google.com with SMTP id b14so422819qkn.4 for ; Wed, 02 Sep 2020 10:20:51 -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=6W4IRzhJawSUuGqiigpDV+GqwbInHdKjKwFRVPzoBc4=; b=IhXleqR+FwTf3f9mhZ0pKPHtpiz9Rip40LbTH5Y4/Iljmfxz/4rhx20Eiw7BV3wv9d DQYAPBt9HvXot9FaYZeicmdgL7ruH8zpWwSBQ6tQ81IQfCx192WVvJ16VmMBBH3BsxS+ 2WeInqjWDJjUS7yqi3LVhXWCg51eN5zWoDkQSoMF1MTJmMD5FImY7lxfDovIraqpBABs oIt7STuydj2jAts/2W1Unm8iYWqmX4CHmex4eAi8uA1In0/hfkbiL8Iq2qu5RHqKBZRl ERiNMO7TyJMtF6s1Q0Iclv2rN0FDG24jM4jRy1lSDk0V5wnI3CMVN6gmKcHyy4SMMHdd QblQ== 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=6W4IRzhJawSUuGqiigpDV+GqwbInHdKjKwFRVPzoBc4=; b=sjouYUfRu1IURz7T46/M9R7LotGcBbBK6byfT5cEucFGUZV3ZKIZ2t1bawnNyLNckO NirLcg/RGtkUv3bsoeBXnqXAXBmmN+HX4IO9GNOXsCkIUbcEosftm6jBTTGdOtjLoNR3 yjgdPlQ4wXDzpNjvyZSU9BPmSeC9XPj1otFeQeFc+Bsa17TykLWJR4lUfuFkolLmcgo1 MGjc8xqFQ231p9Ddo2aMqp2Z/mtVJzH+5nQvpkBT9mcsusRRpPxLJ8Zi5mEBIPPPHT6e K0z/wII3dlRgL+OOUZmv+oBcebknXpbnnZ5FOna7bGg2tIcDviBpRMnFfKd+XLpJiqpd fBAw== X-Gm-Message-State: AOAM532oi+JGhFZR33MSmwRgE0tNXi/N1BFQY2Ee6w4aIXQ0AgqZbE+j tuQWkYf0Y7UhoGILlJl8IdG7vdgTBj7vuA== X-Google-Smtp-Source: ABdhPJyxc42OA5kK+LFET4ISwCeCOPtee5PnrCr/fXcjHj4ROXUCy9JITczTlTqV+l99QLXSve8uaA== X-Received: by 2002:a05:620a:145:: with SMTP id e5mr7766844qkn.479.1599067250325; Wed, 02 Sep 2020 10:20:50 -0700 (PDT) Received: from localhost.localdomain (dsl-10-133-254.b2b2c.ca. [72.10.133.254]) by smtp.gmail.com with ESMTPSA id f13sm188325qko.122.2020.09.02.10.20.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Sep 2020 10:20:49 -0700 (PDT) From: Maxim Cournoyer Date: Wed, 2 Sep 2020 13:20:46 -0400 Message-Id: <20200902172046.3728-1-maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Type: text/plain; charset=yes Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::743; envelope-from=maxim.cournoyer@gmail.com; helo=mail-qk1-x743.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -2.3 (--) X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=fail (rsa verify failed) header.d=gmail.com header.s=20161025 header.b=IhXleqR+; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Spam-Score: 0.09 X-TUID: 2tV/pxymXzZ9 * guix/ui.scm (show-manifest-transaction)[package-strings]: Add an OLD-VERSIONS keyword parameter. Absorb the code path previously found in the upgrade-string. Remove upgrade-string. (show-manifest-transaction): Adjust to the above changes. --- guix/ui.scm | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/guix/ui.scm b/guix/ui.scm index efc3f39186..01af3d93d3 100644 --- a/guix/ui.scm +++ b/guix/ui.scm @@ -15,6 +15,7 @@ ;;; Copyright © 2019 Tobias Geerinckx-Rice ;;; Copyright © 2019 Simon Tournier ;;; Copyright © 2020 Arun Isaac +;;; Copyright © 2020 Maxim Cournoyer ;;; ;;; This file is part of GNU Guix. ;;; @@ -1232,31 +1233,24 @@ separator between subsequent columns." (define* (show-manifest-transaction store manifest transaction #:key dry-run?) "Display what will/would be installed/removed from MANIFEST by TRANSACTION." - (define (package-strings names versions outputs) + (define* (package-strings names versions outputs #:key old-versions) (tabulate (zip (map (lambda (name output) (if (string=? output "out") name (string-append name ":" output))) names outputs) - versions) - #:initial-indent 3)) - - (define → ;an arrow that can be represented on stderr - (right-arrow (current-error-port))) - - (define (upgrade-string names old-version new-version outputs) - (tabulate (zip (map (lambda (name output) - (if (string=? output "out") - name - (string-append name ":" output))) - names outputs) - (map (lambda (old new) + (if old-versions + (map (lambda (old new) (if (string=? old new) (G_ "(dependencies or package changed)") (string-append old " " → " " new))) - old-version new-version)) + old-versions versions) + versions)) #:initial-indent 3)) + (define → ;an arrow that can be represented on stderr + (right-arrow (current-error-port))) + (let-values (((remove install upgrade downgrade) (manifest-transaction-effects manifest transaction))) (match remove @@ -1279,8 +1273,8 @@ separator between subsequent columns." (((($ name old-version) . ($ _ new-version output item)) ..1) (let ((len (length name)) - (downgrade (upgrade-string name old-version new-version - output))) + (downgrade (package-strings name new-version output + #:old-versions old-version))) (if dry-run? (format (current-error-port) (N_ "The following package would be downgraded:~%~{~a~%~}~%" @@ -1297,9 +1291,8 @@ separator between subsequent columns." (((($ name old-version) . ($ _ new-version output item)) ..1) (let ((len (length name)) - (upgrade (upgrade-string name - old-version new-version - output))) + (upgrade (package-strings name new-version output + #:old-versions old-version))) (if dry-run? (format (current-error-port) (N_ "The following package would be upgraded:~%~{~a~%~}~%" -- 2.27.0