guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 04/13] utils: Use '@' for separating package names and versio


From: Ludovic Courtès
Subject: Re: [PATCH 04/13] utils: Use '@' for separating package names and version numbers.
Date: Tue, 26 Jan 2016 17:22:20 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Mathieu Lirzin <address@hidden> skribis:

> From 7fef43249b704db3c4d511b2f1b62428740cfa73 Mon Sep 17 00:00:00 2001
> From: Mathieu Lirzin <address@hidden>
> Date: Sun, 24 Jan 2016 01:54:44 +0100
> Subject: [PATCH] utils: Use '@' for separating package names and version
>  numbers.
>
> Fixes <http://bugs.gnu.org/19219>.
>
> * guix/build/utils.scm (package-name->name+version): Use '@' for
> separating package names and version numbers instead of '-'.  This
> provides the ability to use numbers in package names.
> * guix/packages.scm (package-full-name): Add an optional SEPARATOR
> argument defaulting to "@".
> * doc/guix.texi (Invoking guix package, Invoking guix import): Adapt to
> the new syntax.
> * guix/ui.scm (package-specification->name+version+output): Likewise.
> * guix/scripts/import/hackage.scm (show-help): Likewise.
> * gnu/packages.scm (check-package-freshness, specification->package)
> (specification->package+output): Likewise.
> * emacs/guix-base.scm (guix-package-name-specification): Likewise.
> * emacs/guix-main.scm (full-name->name+version)
> (name+version->full-name): Likewise.
> * emacs/guix-ui-package.el (guix-packages-by-name): Likewise.
> * tests/guix-build.sh: Likewise.
> * tests/guix-lint.sh: Likewise.
> * tests/guix-package.sh: Likewise.
> * tests/ui.scm ("package-specification->name+version+output"): Likewise.
> * tests/utils.scm ("package-name->name+version"): Likewise.
> * tests/graph.scm ("bag-emerged DAG"): Use 'package-full-name' optional
> SEPARATOR argument.
> * gnu/packages/commencement.scm (gcc-boot0): Likewise.
> * NEWS: Mention new syntax.

[...]

> +++ b/guix/build/utils.scm
> @@ -2,6 +2,7 @@
>  ;;; Copyright © 2012, 2013, 2014, 2015 Ludovic Courtès <address@hidden>
>  ;;; Copyright © 2013 Andreas Enge <address@hidden>
>  ;;; Copyright © 2013 Nikita Karetnikov <address@hidden>
> +;;; Copyright © 2016 Mathieu Lirzin <address@hidden>
>  ;;; Copyright © 2015 Mark H Weaver <address@hidden>
>  ;;;
>  ;;; This file is part of GNU Guix.
> @@ -100,25 +101,13 @@ is typically a \"PACKAGE-VERSION\" string."
>                 (+ 34 (string-length (%store-directory)))))
>  
>  (define (package-name->name+version name)
> -  "Given NAME, a package name like \"foo-0.9.1b\", return two values:
> -\"foo\" and \"0.9.1b\".  When the version part is unavailable, NAME and
> -#f are returned.  The first hyphen followed by a digit is considered to
> -introduce the version part."
> +  "Given NAME, a package name like \"address@hidden", return two values: 
> \"foo\"
> +and \"0.9.1b\".  When the version part is unavailable, NAME and #f are
> +returned.  Both parts must not contain any '@'."

I think this one should remain unchanged, first because it triggers a
full rebuild ;-), and second because it has uses in
{emacs,gnu}-build-system that expect exactly these semantics.

So I think we have to simply provide a different version of that in
(guix utils) or so.

Also, I think that at least for some time, the new
‘package-name->name+version’ (maybe we could call it
‘package-specification->name+version’ for consistency) should fall back
to the old method when:

  1. The spec has no @ sign, and

  2. The specified package name was not found.

It could print a warning when the old method has been used *and* a
matching package was found, explaining that this is deprecated syntax.

WDYT?

> +(define* (package-full-name package #:optional (separator "@"))
> +  "Return a string which is the concatenation of PACKAGE name, SEPARATOR, and
> +PACKAGE version.  SEPARATOR is a optional argument defaulting to \"@\".
> +PACKAGE must be a <package> record."
> +  (string-append (package-name package) separator (package-version package)))

I wonder what will break by changing the default to address@hidden  :-)

‘package-full-name’ is used in a bunch of different places, including
user interfaces and for anchors in the generated HTML pages (is address@hidden
allowed in HTML anchor names?).

So yeah, maybe we can try, but I suspect we’ll see breakage in
unexpected places.

The rest looks good to me.

Thank you!

Ludo’.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]