From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 02 13:20:58 2020 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 To: guix-patches@gnu.org Subject: [PATCH 1/2] ui: Refactor the package-strings helper in show-manifest-transaction. 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-Debbugs-Envelope-To: submit Cc: Maxim Cournoyer 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: -2.3 (--) * 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