GNU bug report logs - #26265
[PATCH 1/1] packages: Add optional `for-ui` param to `package-full-name`.

Previous Next

Package: guix-patches;

Reported by: Alex Sassmannshausen <alex.sassmannshausen <at> gmail.com>

Date: Sun, 26 Mar 2017 12:27:02 UTC

Severity: normal

Tags: patch

Merged with 26239, 26264

Done: Ricardo Wurmus <rekado <at> elephly.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 26265 in the body.
You can then email your comments to 26265 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#26265; Package guix-patches. (Sun, 26 Mar 2017 12:27:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Alex Sassmannshausen <alex.sassmannshausen <at> gmail.com>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Sun, 26 Mar 2017 12:27:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Alex Sassmannshausen <alex.sassmannshausen <at> gmail.com>
To: guix-patches <at> gnu.org
Cc: Alex Sassmannshausen <alex <at> pompo.co>
Subject: [PATCH 1/1] packages: Add optional `for-ui` param to
 `package-full-name`.
Date: Sun, 26 Mar 2017 14:25:55 +0200
* guix/packages.scm (package-full-name): Add optional parameter `for-ui`.
* guix/scripts/refresh.scm (list-dependents): Use it.
* tests/packages.scm: Add tests for `package-full-name`.
---
 guix/packages.scm        | 9 +++++----
 guix/scripts/refresh.scm | 6 +++---
 tests/packages.scm       | 4 ++++
 3 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/guix/packages.scm b/guix/packages.scm
index 4bc4b017f..5219b2acc 100644
--- a/guix/packages.scm
+++ b/guix/packages.scm
@@ -380,10 +380,11 @@ object."
 (define-condition-type &package-cross-build-system-error &package-error
   package-cross-build-system-error?)
 
-
-(define (package-full-name package)
-  "Return the full name of PACKAGE--i.e., `NAME-VERSION'."
-  (string-append (package-name package) "-" (package-version package)))
+(define* (package-full-name package #:optional for-ui)
+  "Return the full name of PACKAGE--i.e., `NAME-VERSION'.  If FOR-UI? is #t,
+return the full name of PACKAGE using \"@\" as the NAME, VERSION separator."
+  (string-append (package-name package) (if for-ui "@" "-")
+                 (package-version package)))
 
 (define (%standard-patch-inputs)
   (let* ((canonical (module-ref (resolve-interface '(gnu packages base))
diff --git a/guix/scripts/refresh.scm b/guix/scripts/refresh.scm
index 4d3c695aa..14db7deb2 100644
--- a/guix/scripts/refresh.scm
+++ b/guix/scripts/refresh.scm
@@ -327,12 +327,12 @@ WARN? is true and no updater exists for PACKAGE, print a warning."
                  (N_ "No dependents other than itself: ~{~a~}~%"
                      "No dependents other than themselves: ~{~a~^ ~}~%"
                      (length packages))
-                 (map package-full-name packages)))
+                 (map (cut package-full-name <> #t) packages)))
 
         ((x)
          (format (current-output-port)
                  (_ "A single dependent package: ~a~%")
-                 (package-full-name x)))
+                 (package-full-name x #t)))
         (lst
          (format (current-output-port)
                  (N_ "Building the following package would ensure ~d \
@@ -341,7 +341,7 @@ dependent packages are rebuilt: ~*~{~a~^ ~}~%"
 dependent packages are rebuilt: ~{~a~^ ~}~%"
                      (length covering))
                  (length covering) (length dependents)
-                 (map package-full-name covering))))
+                 (map (cut package-full-name <> #t) covering))))
       (return #t))))
 
 
diff --git a/tests/packages.scm b/tests/packages.scm
index 247f75cc4..d19a44347 100644
--- a/tests/packages.scm
+++ b/tests/packages.scm
@@ -988,6 +988,10 @@
     (lambda (key . args)
       key)))
 
+(test-assert "package-full-name"
+  (and (string=? (package-full-name (dummy-package "foo")) "foo-0")
+       (string=? (package-full-name (dummy-package "foo") #t)  "foo <at> 0")))
+
 (test-end "packages")
 
 ;;; Local Variables:
-- 
2.12.1





Merged 26264 26265. Request was from ludo <at> gnu.org (Ludovic Courtès) to control <at> debbugs.gnu.org. (Tue, 28 Mar 2017 15:05:02 GMT) Full text and rfc822 format available.

Merged 26239 26264 26265. Request was from ludo <at> gnu.org (Ludovic Courtès) to control <at> debbugs.gnu.org. (Tue, 28 Mar 2017 15:05:02 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#26265; Package guix-patches. (Tue, 28 Mar 2017 15:08:01 GMT) Full text and rfc822 format available.

Message #12 received at 26265 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Alex Sassmannshausen <alex.sassmannshausen <at> gmail.com>
Cc: 26265 <at> debbugs.gnu.org, Alex Sassmannshausen <alex <at> pompo.co>
Subject: Re: bug#26265: [PATCH 1/1] packages: Add optional `for-ui` param to
 `package-full-name`.
Date: Tue, 28 Mar 2017 17:06:51 +0200
Alex Sassmannshausen <alex.sassmannshausen <at> gmail.com> skribis:

> * guix/packages.scm (package-full-name): Add optional parameter `for-ui`.
> * guix/scripts/refresh.scm (list-dependents): Use it.
> * tests/packages.scm: Add tests for `package-full-name`.

[...]

> +(define* (package-full-name package #:optional for-ui)
> +  "Return the full name of PACKAGE--i.e., `NAME-VERSION'.  If FOR-UI? is #t,
> +return the full name of PACKAGE using \"@\" as the NAME, VERSION separator."

I’d replace ‘for-ui’ with:

  #:optional (separator "@")

I think it’s less ambiguous.

That also means that we’d need to change *non*-UI call sites, instead of
changing UI call sites.  Hopefully there are few of them, but as
discussed in the other message, it takes manual analysis to determine
which use requires a hyphen and which one does not.

Thanks,
Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 26 Apr 2017 11:24:04 GMT) Full text and rfc822 format available.

bug unarchived. Request was from Tobias Geerinckx-Rice <me <at> tobias.gr> to control <at> debbugs.gnu.org. (Sat, 06 May 2017 18:29:01 GMT) Full text and rfc822 format available.

Did not alter fixed versions and reopened. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 06 May 2017 18:31:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 26239 <at> debbugs.gnu.org and Tobias Geerinckx-Rice <me <at> tobias.gr> Request was from Ricardo Wurmus <rekado <at> elephly.net> to control <at> debbugs.gnu.org. (Sun, 18 Jun 2017 11:05:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 16 Jul 2017 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 6 years and 256 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.