From: Chris Marusich <cmmarusich@gmail.com>
To: Pierre Neidhardt <ambrevar@gmail.com>
Cc: Mathieu Lirzin <mthl@gnu.org>, 31088@debbugs.gnu.org
Subject: bug#31088: Use '@' as version number separator in guix output
Date: Tue, 10 Apr 2018 21:41:23 -0700 [thread overview]
Message-ID: <877epegxsc.fsf@gmail.com> (raw)
In-Reply-To: <87k1tf5zxy.fsf@gmail.com> (Chris Marusich's message of "Mon, 09 Apr 2018 23:38:01 -0700")
[-- Attachment #1.1: Type: text/plain, Size: 2194 bytes --]
Hi,
Here's a new version of the patch. The only change is: I modified the
tests (tests/graph.scm and tests/profiles.scm) so that they also use the
package-full-name procedure's new #:delimiter keyword argument when
necessary. I intended to do that from the start, but I forgot.
Alex Kost <alezost@gmail.com> writes:
> Chris Marusich (2018-04-09 23:38 -0700) wrote:
>
> [...]
>> Because I changed the package-full-name procedure, this also fixes the
>> package names in other places, such as graphs produced by "guix graph".
>
> I recall there was some discussion about 'package-full-name' in the past
> but I remember nothing about it :-)
>
> Well, maybe it is not relevant at all, but I've found there was a
> proposition to use "@" in 'package-full-name' and it is still not used
> there. Look at:
>
> http://lists.gnu.org/archive/html/guix-devel/2016-04/msg01141.html
Yes, we need to be careful. The most obvious problem I encountered was
that the Guix daemon prohibits "@" in store item names (which I learned
only after attempting to change the delimiter everywhere and then
running some tests). However, my patch does not put the "@" symbol into
store item names. In fact, to be extra clear, I've added a comment to
the package->bag procedure to explain why we can't use "@" there.
I think the risk is fairly low that something in Guix itself will
malfunction if we make this change, since I've looked at the call sites
for package-full-name (in the guix Git repo only), I've run "make check"
successfully, and I've verified manually that a handful of guix commands
still function correctly. But you never really know until you try. We
should probably still check in some other places before changing the
default delimiter from "-" to "@". For example, we should probably
check at least the following places:
* Hydra
* Cuirass
* Emacs-Guix
Where else should we check?
If it's too risky, we can always make the default delimiter "-" and only
change it to "@" in those places where we really need to (e.g., the
package->recutils procedure in (guix ui), to fix this specific bug
report). What do you think?
--
Chris
[-- Attachment #1.2: 0001-guix-Separate-the-package-name-and-version-with-not.patch --]
[-- Type: text/x-patch, Size: 6332 bytes --]
From 67165c95ff9b52b7ae34d7c07778138548013ccd Mon Sep 17 00:00:00 2001
From: Chris Marusich <cmmarusich@gmail.com>
Date: Sun, 8 Apr 2018 16:51:42 -0700
Subject: [PATCH] guix: Separate the package name and version with "@", not
"-".
* guix/packages.scm (package-full-name): By default, use "@" to separate
the package name and package version. Add #:delimiter keyword
argument so that there is still a way to explicitly use a different
delimiter.
* gnu/packages/commencement.scm (gcc-boot0) <unpack-gmp&co>: Adjust
accordingly.
* tests/graph.scm: Adjust accordingly.
* tests/profiles.scm: Adjust accordingly.
* NEWS: Mention the change.
Fixes: <https://bugs.gnu.org/31088>.
Reported by Pierre Neidhardt <ambrevar@gmail.com>.
---
NEWS | 1 +
gnu/packages/commencement.scm | 2 +-
guix/packages.go.134WZR | 0
guix/packages.scm | 13 +++++++++----
tests/graph.scm | 3 ++-
tests/profiles.scm | 12 ++++++------
6 files changed, 19 insertions(+), 12 deletions(-)
create mode 100644 guix/packages.go.134WZR
diff --git a/NEWS b/NEWS
index 2c898e65f..9769bfc87 100644
--- a/NEWS
+++ b/NEWS
@@ -777,6 +777,7 @@ zynaddsubfx@3.0.2
** Programming interfaces
+*** package-full-name (guix packages) now uses "@" instead of "-" as its delimiter.
*** New build systems: ‘font’, ‘meson’, ‘minify’, ‘scons’, ‘texlive’
*** ‘cmake-build-system’ now supports cross-compilation
*** Various improvements to ‘asdf-build-system’, ‘emacs-build-system’,
diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index fe9fbebcc..9506fbb2b 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -282,7 +282,7 @@
;; Drop trailing letters, as gmp-6.0.0a unpacks
;; into gmp-6.0.0.
`(symlink ,(string-trim-right
- (package-full-name lib)
+ (package-full-name lib #:delimiter "-")
char-set:letter)
,(package-name lib)))
(list gmp-6.0 mpfr mpc))))
diff --git a/guix/packages.go.134WZR b/guix/packages.go.134WZR
new file mode 100644
index 000000000..e69de29bb
diff --git a/guix/packages.scm b/guix/packages.scm
index b5c0b6044..38e6344bf 100644
--- a/guix/packages.scm
+++ b/guix/packages.scm
@@ -388,10 +388,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 #:key (delimiter "@"))
+ "Return the full name of PACKAGE--i.e., `NAME@VERSION'. By specifying
+DELIMITER (a string), you can customize what will appear between the name and
+the version. By default, DELIMITER is \"@\"."
+ (string-append (package-name package) delimiter (package-version package)))
(define (%standard-patch-inputs)
(let* ((canonical (module-ref (resolve-interface '(gnu packages base))
@@ -935,6 +936,10 @@ and return it."
(($ <package> name version source build-system
args inputs propagated-inputs native-inputs
self-native-input? outputs)
+ ;; Even though we prefer to use "@" to separate the package
+ ;; name from the package version in various user-facing parts
+ ;; of Guix, checkStoreName (in nix/libstore/store-api.cc)
+ ;; prohibits the use of "@", so use "-" instead.
(or (make-bag build-system (string-append name "-" version)
#:system system
#:target target
diff --git a/tests/graph.scm b/tests/graph.scm
index 5faa19298..a2941056d 100644
--- a/tests/graph.scm
+++ b/tests/graph.scm
@@ -134,7 +134,8 @@ edges."
(map (lambda (destination)
(list "p-0.drv"
(string-append
- (package-full-name destination)
+ (package-full-name destination
+ #:delimiter "-")
".drv")))
implicit)))))))
diff --git a/tests/profiles.scm b/tests/profiles.scm
index 92eb08cb9..218bf5f8a 100644
--- a/tests/profiles.scm
+++ b/tests/profiles.scm
@@ -242,8 +242,9 @@
#:hooks '()
#:locales? #t
#:target target)))
- (define (find-input name)
- (let ((name (string-append name ".drv")))
+ (define (find-input package)
+ (let ((name (string-append (package-full-name package #:delimiter "-")
+ ".drv")))
(any (lambda (input)
(let ((input (derivation-input-path input)))
(and (string-suffix? name input) input)))
@@ -252,12 +253,11 @@
;; The inputs for grep and sed should be cross-build derivations, but that
;; for the glibc-utf8-locales should be a native build.
(return (and (string=? (derivation-system drv) (%current-system))
- (string=? (find-input (package-full-name packages:grep))
+ (string=? (find-input packages:grep)
(derivation-file-name grep))
- (string=? (find-input (package-full-name packages:sed))
+ (string=? (find-input packages:sed)
(derivation-file-name sed))
- (string=? (find-input
- (package-full-name packages:glibc-utf8-locales))
+ (string=? (find-input packages:glibc-utf8-locales)
(derivation-file-name locales))))))
(test-assert "package->manifest-entry defaults to \"out\""
--
2.17.0
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
next prev parent reply other threads:[~2018-04-11 4:42 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-07 16:58 bug#31088: Use '@' as version number separator in guix output Pierre Neidhardt
2018-04-10 6:38 ` Chris Marusich
2018-04-10 6:59 ` Pierre Neidhardt
2018-04-11 4:41 ` Chris Marusich [this message]
2018-05-01 21:04 ` Ludovic Courtès
2018-05-09 5:36 ` Chris Marusich
2018-05-09 9:15 ` Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=877epegxsc.fsf@gmail.com \
--to=cmmarusich@gmail.com \
--cc=31088@debbugs.gnu.org \
--cc=ambrevar@gmail.com \
--cc=mthl@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.