GNU bug report logs - #50377
[PATCH 0/2] Support 'git describe' style commit IDs in transformations

Previous Next

Package: guix-patches;

Reported by: Marius Bakke <marius <at> gnu.org>

Date: Sat, 4 Sep 2021 18:09:02 UTC

Severity: normal

Tags: patch

Done: Marius Bakke <marius <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


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

From: Ludovic Courtès <ludo <at> gnu.org>
To: Marius Bakke <marius <at> gnu.org>
Cc: 50377 <at> debbugs.gnu.org
Subject: Re: bug#50377: [PATCH 0/2] Support 'git describe' style commit IDs
 in transformations
Date: Mon, 06 Sep 2021 23:04:47 +0200
Marius Bakke <marius <at> gnu.org> skribis:

> * guix/transformations.scm (transform-package-source-commit): Look for
> 'git describe' style IDs and use it as the version if applicable.
> * tests/transformations.scm
> ("options->transformation, with-commit, 'git describe' style version"): New
> test.

[...]

> +      (version (cond ((and (string-contains commit "-g")
> +                           (match (string-split commit #\-)
> +                             ((version ... revision g+commit)
> +                              (and (> (string-length g+commit) 4)
> +                                   (string-every char-set:digit revision)
> +                                   (string-every char-set:hex-digit
> +                                                 (string-drop g+commit 1))))
> +                             (_ #f)))
> +                      ;; This looks like a 'git describe' style ID.  Drop
> +                      ;; the 'v' prefix if applicable.
> +                      (if (and (string-prefix? "v" commit)
> +                               (char-set-contains? char-set:digit
> +                                                   (string-take
> +                                                    (string-drop commit 1)
> +                                                    1)))
> +                          (string-drop commit 1)
> +                          commit))
> +                     ((and (> (string-length commit) 1)
> +                           (string-prefix? "v" commit)
> +                           (char-set-contains? char-set:digit
> +                                               (string-ref commit 1)))
> +                      (string-drop commit 1))       ;looks like a tag like "v1.0"
> +                     (else
> +                      (string-append "git."
> +                                     (if (< (string-length commit) 7)
> +                                         commit
> +                                         (string-take commit 7))))))

For clarity, I’d extract this as a ‘commit->version-string’ procedure.

Like Xinglu writes, it’d be great to add a sentence in the manual about
these IDs.

Apart from that, it’s a good idea and it LGTM!

Thanks,
Ludo’.




This bug report was last modified 3 years and 261 days ago.

Previous Next


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