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: Mathieu Lirzin
Subject: Re: [PATCH 04/13] utils: Use '@' for separating package names and version numbers.
Date: Tue, 26 Jan 2016 18:57:11 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Alex Kost <address@hidden> writes:

> Mathieu Lirzin (2016-01-26 00:41 +0300) wrote:
>
>> Finally, There is some code redundancy for the emacs UI but If I
>> remember correctly there is a reason for that. (Alex?)
>
> If there is redundancy in the code, it should be removed.  I didn't find
> a procedure to make a name specification at the time, so I wrote
> 'make-package-specification' in "emacs/guix-main.scm".  I think we can
> add a general procedure to construct a name specification to (guix
> utils):

Sorry, my mind got confused. ;)

--8<---------------cut here---------------start------------->8---
(define (full-name->name+version spec)
  "Given package specification SPEC with or without output,
return two values: name and version.  For example, for SPEC
\"address@hidden:lib\", return \"foo\" and \"0.9.1b\"."
  (let-values (((name version output)
                (package-specification->name+version+output spec)))
    (values name version)))

(define (name+version->full-name name version)
  (string-append name "@" version))

(define* (make-package-specification name #:optional version output)
  (let ((full-name (if version
                       (name+version->full-name name version)
                       name)))
    (if output
        (string-append full-name ":" output)
        full-name)))
--8<---------------cut here---------------end--------------->8---

I overlooked that this code handles “full names” without having a
<package> object as an argument.

> (define* (package-name-specification name #:optional version output)
>   (let ((full-name (if version
>                        (string-append name "@" version)
>                        name)))
>     (if output
>         (string-append full-name ":" output)
>         full-name)))
>
> Then 'package-full-name' from (guix packages) and the code from
> "emacs/guix-main.scm" can use it.  WDYT?

It seems a good idea to me now.

Thanks,

--
Mathieu Lirzin



reply via email to

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