From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chris Marusich Subject: bug#31088: Use '@' as version number separator in guix output Date: Mon, 09 Apr 2018 23:38:01 -0700 Message-ID: <87k1tf5zxy.fsf@gmail.com> References: <871sfr2bsg.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:49948) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f5mvr-0005Zj-L2 for bug-guix@gnu.org; Tue, 10 Apr 2018 02:39:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f5mvm-0001MU-N6 for bug-guix@gnu.org; Tue, 10 Apr 2018 02:39:07 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:36599) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f5mvm-0001MO-H4 for bug-guix@gnu.org; Tue, 10 Apr 2018 02:39:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1f5mvm-0005Ue-81 for bug-guix@gnu.org; Tue, 10 Apr 2018 02:39:02 -0400 In-Reply-To: <871sfr2bsg.fsf@gmail.com> Sender: "Debbugs-submit" Resent-Message-ID: List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: Pierre Neidhardt , Mathieu Lirzin Cc: 31088@debbugs.gnu.org --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hi Pierre and Mathieu, Thank you for the bug report, Pierre! Mathieu, can you take a look at the patch I've attached to this email? It should fix this bug, but since you made similar changes in the past, I'd value your feedback. Pierre Neidhardt writes: > Would it be possible to separate the package name from the version > number with '@' instead? Pierre's suggestion makes sense to me. Starting with Mathieu's commit 1b846da8c372bee78851439fd9e72b2499115e5a about one year ago, we use "@" to separate the package name from the version in commands like "guix package -i ncdu@1.13" and also in exported scheme procedures like specification->package (defined in (gnu packages)). Before that, we used "-" instead of "@". When we made the change, it looks like we did not also update the "dependencies" output from commands like "guix package --show". I've attached a patch that fixes the issue. It applies cleanly to df154c05dc65025eac2d14ab45699b34c7a1c7c8 (the tip of the master branch at the time I drafted this email), and "make check" succeeds. With the change, the output now looks like this: $ ./pre-inst-env guix package --show=3Dncdu | recsel -p dependencies dependencies: ncurses@6.0-20170930 I was not able to run "make check-system" successfully, but there is no reason to suspect that the attached patch causes any problem, since the "check-system" target was already failing in the same way at commit df154c05dc65025eac2d14ab45699b34c7a1c7c8. I'll open up a separate bug report for that separate issue. 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'm not sure how many package rebuilds (if any?) this will cause, and I'd like to hear what Mathieu has to say about my patch, so I'll wait to push it until after I get feedback from him or another interested person. We should probably also regenerate the images in guix/doc/images (so that the delimiter used in the images is "@" instead of "-", although I'm not sure yet how to regenerate the source dot files. Mathieu, please let me know what you think! In the meantime, Pierre, you can work around the issue by writing a Guile script that gets the package version using the Guix API like so: scheme@(guile-user)> ,use (gnu packages ncdu) scheme@(guile-user)> ,use (guix packages) scheme@(guile-user)> (package-version ncdu) $1 =3D "1.13" If you aren't sure how to get started writing Guile scripts, please refer to the section "Running Guile Scripts" in the Guile manual. =2D-=20 Chris --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: attachment; filename=0001-guix-Separate-the-package-name-and-version-with-not.patch Content-Transfer-Encoding: quoted-printable From=2096160c457c852d88e9a584cb16eb7703b02d8de5 Mon Sep 17 00:00:00 2001 From: Chris Marusich 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) : Adjust accordingly. * tests/graph.scm: Adjust accordingly. * tests/profiles.scm: Adjust accordingly. * NEWS: Mention the change. Fixes: . Reported by Pierre Neidhardt . =2D-- NEWS | 1 + gnu/packages/commencement.scm | 2 +- guix/packages.go.134WZR | 0 guix/packages.scm | 13 +++++++++---- tests/graph.scm | 4 ++-- tests/profiles.scm | 11 ++++++----- 6 files changed, 19 insertions(+), 12 deletions(-) create mode 100644 guix/packages.go.134WZR diff --git a/NEWS b/NEWS index 2c898e65f..9769bfc87 100644 =2D-- a/NEWS +++ b/NEWS @@ -777,6 +777,7 @@ zynaddsubfx@3.0.2 =20 ** Programming interfaces =20 +*** package-full-name (guix packages) now uses "@" instead of "-" as its d= elimiter. *** New build systems: =E2=80=98font=E2=80=99, =E2=80=98meson=E2=80=99, = =E2=80=98minify=E2=80=99, =E2=80=98scons=E2=80=99, =E2=80=98texlive=E2=80=99 *** =E2=80=98cmake-build-system=E2=80=99 now supports cross-compilation *** Various improvements to =E2=80=98asdf-build-system=E2=80=99, =E2=80=98= emacs-build-system=E2=80=99, diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm index fe9fbebcc..9506fbb2b 100644 =2D-- 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 =2D (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 =2D-- 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?) =20 =2D =2D(define (package-full-name package) =2D "Return the full name of PACKAGE--i.e., `NAME-VERSION'." =2D (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= ))) =20 (define (%standard-patch-inputs) (let* ((canonical (module-ref (resolve-interface '(gnu packages base)) @@ -935,6 +936,10 @@ and return it." (($ 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 par= ts + ;; 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..34bc55d2a 100644 =2D-- a/tests/graph.scm +++ b/tests/graph.scm @@ -134,8 +134,8 @@ edges." (map (lambda (destination) (list "p-0.drv" (string-append =2D (package-full-name destination) =2D ".drv"))) + (package-name destination) "-" + (package-version destination) ".drv"))) implicit))))))) =20 (test-assert "bag DAG" ;a big town in Iraq diff --git a/tests/profiles.scm b/tests/profiles.scm index 92eb08cb9..dd0e19967 100644 =2D-- a/tests/profiles.scm +++ b/tests/profiles.scm @@ -242,8 +242,9 @@ #:hooks '() #:locales? #t #:target target))) =2D (define (find-input name) =2D (let ((name (string-append name ".drv"))) + (define (find-input package) + (let ((name (string-append (package-name package) "-" + (package-version package) ".drv"))) (any (lambda (input) (let ((input (derivation-input-path input))) (and (string-suffix? name input) input))) @@ -252,12 +253,12 @@ ;; 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=3D? (derivation-system drv) (%current-system)) =2D (string=3D? (find-input (package-full-name packages:gre= p)) + (string=3D? (find-input packages:grep) (derivation-file-name grep)) =2D (string=3D? (find-input (package-full-name packages:sed= )) + (string=3D? (find-input packages:sed) (derivation-file-name sed)) (string=3D? (find-input =2D (package-full-name packages:glibc-utf8-local= es)) + packages:glibc-utf8-locales) (derivation-file-name locales)))))) =20 (test-assert "package->manifest-entry defaults to \"out\"" =2D-=20 2.17.0 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEy/WXVcvn5+/vGD+x3UCaFdgiRp0FAlrMW8kACgkQ3UCaFdgi Rp3DQQ//ZP/y0XsOZ2mZvAQQtKuGtvj+DSUDab/WTdowFAjqfYc8qqr4NcxHHGsk h57eNbTx531fMPQBwOt3aVmmZyvnx2fSyhaBaX9LnmPt/H6qKe4QIaYFWVvpGZsK gkoScXH0jvo53OmcDxBKR6pox8vfs+ZDOFCw22n3jLkMHAEqhhCS5SW2wsInIEJV Y3UrRXwFTM/1QZb+cdEiaXPf9dpTDupkAcxPfGTYD68chVd4gybVI34v3REnrUpD z6Cjgu+39Z5f06yHbOFSF0WizOddbJnaXsyieVOY6a6B681hUq4QBrj0tZStfF3S fNgtHpn8KHZkP0GMzpPdJ4oh2eqYguijq893sqBFmvPC0lDDCUghkBUH47hmsVmh cKQ4izS9dC7B75RGAxmbGZRxYZtstmzTnXbpPJZ5Zf136pGvjcOGn4wmHSTdQz82 ksQvJYJfYRIaRs4aUlEdMR8HbJS8JHg98qkgyZVof/cQMesobjn3vl18QZ8GgLQr rZCksm43UlUIbcg3Yct3c70DVL+COgzAOFTVeoKzuuXKBCMeLHS9n6xp49BUepSf LLiO00XtPCHHix/7181pqNgkNMu+iuDwnPY/TUTZjzK+7U3TIwj6KPxN0jvAS8dd FiVjvPL4k7HPtJ2fIrJ2yvXfObhD8nIUImoE/OzRvELmWnQXmlI= =jjSw -----END PGP SIGNATURE----- --==-=-=--