unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* bug#42212: Guix version rendered as 0.0-git in info manual
@ 2020-07-05  7:59 Arun Isaac
  2020-07-09 22:29 ` Ludovic Courtès
  0 siblings, 1 reply; 19+ messages in thread
From: Arun Isaac @ 2020-07-05  7:59 UTC (permalink / raw)
  To: 42212

[-- Attachment #1: Type: text/plain, Size: 277 bytes --]


In the info manual, the Guix version is rendered as 0.0-git. For
example, in "(guix) The Store", see "The ability to connect to remote
build daemons is considered experimental as of 0.0-git". I am running
the Guix standalone system. Any idea what's going wrong?

Thanks,
Arun

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#42212: Guix version rendered as 0.0-git in info manual
  2020-07-05  7:59 bug#42212: Guix version rendered as 0.0-git in info manual Arun Isaac
@ 2020-07-09 22:29 ` Ludovic Courtès
  2020-07-15 21:42   ` Arun Isaac
                     ` (2 more replies)
  0 siblings, 3 replies; 19+ messages in thread
From: Ludovic Courtès @ 2020-07-09 22:29 UTC (permalink / raw)
  To: Arun Isaac; +Cc: 42212

Hi Arun,

Arun Isaac <arunisaac@systemreboot.net> skribis:

> In the info manual, the Guix version is rendered as 0.0-git. For
> example, in "(guix) The Store", see "The ability to connect to remote
> build daemons is considered experimental as of 0.0-git". I am running
> the Guix standalone system. Any idea what's going wrong?

Nothing!  :-)

The “0.0-git” string comes from (guix self).  As noted there, we can’t
really afford to change the version string at each commit, or we’d have
to rebuild the manual at each commit.

We could perhaps choose a more meaningful version string, though, maybe
by looking at the closest tag or something.

Thoughts?

Ludo’.




^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#42212: Guix version rendered as 0.0-git in info manual
  2020-07-09 22:29 ` Ludovic Courtès
@ 2020-07-15 21:42   ` Arun Isaac
  2020-07-15 23:26     ` Ludovic Courtès
  2020-07-16  0:46     ` Bengt Richter
  2020-07-16  9:37   ` zimoun
  2020-07-16 19:36   ` Efraim Flashner
  2 siblings, 2 replies; 19+ messages in thread
From: Arun Isaac @ 2020-07-15 21:42 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 42212

[-- Attachment #1: Type: text/plain, Size: 539 bytes --]


> The “0.0-git” string comes from (guix self).  As noted there, we can’t
> really afford to change the version string at each commit, or we’d have
> to rebuild the manual at each commit.
>
> We could perhaps choose a more meaningful version string, though, maybe
> by looking at the closest tag or something.

That sounds good, and `git describe` could provide us with the closest
tag. Unfortunately, (git) doesn't seem to be available during `guix
pull`. I'm trying to come up with workarounds. Do you have any ideas?

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#42212: Guix version rendered as 0.0-git in info manual
  2020-07-15 21:42   ` Arun Isaac
@ 2020-07-15 23:26     ` Ludovic Courtès
  2020-07-16  0:46     ` Bengt Richter
  1 sibling, 0 replies; 19+ messages in thread
From: Ludovic Courtès @ 2020-07-15 23:26 UTC (permalink / raw)
  To: Arun Isaac; +Cc: 42212

Hi,

Arun Isaac <arunisaac@systemreboot.net> skribis:

>> The “0.0-git” string comes from (guix self).  As noted there, we can’t
>> really afford to change the version string at each commit, or we’d have
>> to rebuild the manual at each commit.
>>
>> We could perhaps choose a more meaningful version string, though, maybe
>> by looking at the closest tag or something.
>
> That sounds good, and `git describe` could provide us with the closest
> tag. Unfortunately, (git) doesn't seem to be available during `guix
> pull`. I'm trying to come up with workarounds. Do you have any ideas?

I’m not sure exactly.  (guix self) receives a commit ID as #:version
(though it doesn’t have to; it can be a random string too, as in
‘build-aux/compile-as-derivation.scm’).

Maybe when (guix channels) ‘build-from-source’ invokes ‘build’, it could
pass it an optional short version identifier guaranteed to rarely
change.  (There’s a (git describe) module in Guile-Git that might be
helpful.)

That version identifier must then be passed from
‘build-aux/build-self.scm’ all the way to ‘info-manual’ in (guix self).

Thoughts?

Ludo’.




^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#42212: Guix version rendered as 0.0-git in info manual
  2020-07-15 21:42   ` Arun Isaac
  2020-07-15 23:26     ` Ludovic Courtès
@ 2020-07-16  0:46     ` Bengt Richter
  2020-07-16  5:08       ` Bengt Richter
  2020-07-16 10:06       ` zimoun
  1 sibling, 2 replies; 19+ messages in thread
From: Bengt Richter @ 2020-07-16  0:46 UTC (permalink / raw)
  To: Arun Isaac; +Cc: 42212

On +2020-07-16 03:12:37 +0530, Arun Isaac wrote:
> 
> > The “0.0-git” string comes from (guix self).  As noted there, we can’t
> > really afford to change the version string at each commit, or we’d have
> > to rebuild the manual at each commit.
> >
> > We could perhaps choose a more meaningful version string, though, maybe
> > by looking at the closest tag or something.
> 
> That sounds good, and `git describe` could provide us with the closest
> tag. Unfortunately, (git) doesn't seem to be available during `guix
> pull`. I'm trying to come up with workarounds. Do you have any ideas?

What does (copied from another laptop screen by hand, typos possible ;)
--8<---------------cut here---------------start------------->8---
readlink -f /var/guix/profiles/per-user/{$USER,root}/current-guix/manifest|xargs grep -m1 -A1 guix
--8<---------------cut here---------------end--------------->8---
get you? Anything useful?

On my other laptop, it got me (again copied/...elided from other screen)
--8<---------------cut here---------------start------------->8---
/gnu/store/.../manifest: (("guix"
/gnu/store/.../manifest-   "87850c0"
--
/gnu/store/.../manifest: (("guix"
/gnu/store/.../manifest-   "0.16.0"
--8<---------------cut here---------------end--------------->8---

You can see that's ancient, so IDK if the same command will work for you.
"guix -V" there still shows 0.16.0 (which version should that show, BTW?)

I don't know how these versions correspond to what pull creates,
but zimoun is a whiz on that stuff, so maybe he will chime in :)
(I Cc'd him to raise the probability :)

HTH
-- 
Regards,
Bengt Richter




^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#42212: Guix version rendered as 0.0-git in info manual
  2020-07-16  0:46     ` Bengt Richter
@ 2020-07-16  5:08       ` Bengt Richter
  2020-07-16 10:06       ` zimoun
  1 sibling, 0 replies; 19+ messages in thread
From: Bengt Richter @ 2020-07-16  5:08 UTC (permalink / raw)
  To: Arun Isaac; +Cc: 42212

On +2020-07-16 02:46:00 +0200, Bengt Richter wrote:
> On +2020-07-16 03:12:37 +0530, Arun Isaac wrote:
> > 
> > > The “0.0-git” string comes from (guix self).  As noted there, we can’t
> > > really afford to change the version string at each commit, or we’d have
> > > to rebuild the manual at each commit.
> > >
> > > We could perhaps choose a more meaningful version string, though, maybe
> > > by looking at the closest tag or something.
> > 
> > That sounds good, and `git describe` could provide us with the closest
> > tag. Unfortunately, (git) doesn't seem to be available during `guix
> > pull`. I'm trying to come up with workarounds. Do you have any ideas?
> 
> What does (copied from another laptop screen by hand, typos possible ;)
> --8<---------------cut here---------------start------------->8---
> readlink -f /var/guix/profiles/per-user/{$USER,root}/current-guix/manifest|xargs grep -m1 -A1 guix
> --8<---------------cut here---------------end--------------->8---
> get you? Anything useful?
> 
> On my other laptop, it got me (again copied/...elided from other screen)
> --8<---------------cut here---------------start------------->8---
> /gnu/store/.../manifest: (("guix"
> /gnu/store/.../manifest-   "87850c0"
> --
> /gnu/store/.../manifest: (("guix"
> /gnu/store/.../manifest-   "0.16.0"
> --8<---------------cut here---------------end--------------->8---
> 
> You can see that's ancient, so IDK if the same command will work for you.
> "guix -V" there still shows 0.16.0 (which version should that show, BTW?)
> 
> I don't know how these versions correspond to what pull creates,
> but zimoun is a whiz on that stuff, so maybe he will chime in :)
> (I Cc'd him to raise the probability :)

Sorry, I seem not to have succeeded with the Cc: to zimoun
Or it's been scrubbed out of the headers.
Ah, do I faintly remember that one needs a special incantation?
Sorry, I will look into it.

> 
> HTH
> -- 
> Regards,
> Bengt Richter
> 
> 
> 

-- 
Regards,
Bengt Richter




^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#42212: Guix version rendered as 0.0-git in info manual
  2020-07-09 22:29 ` Ludovic Courtès
  2020-07-15 21:42   ` Arun Isaac
@ 2020-07-16  9:37   ` zimoun
  2020-07-16  9:48     ` Ludovic Courtès
  2020-07-16 19:36   ` Efraim Flashner
  2 siblings, 1 reply; 19+ messages in thread
From: zimoun @ 2020-07-16  9:37 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 42212

Hi,

On Fri, 10 Jul 2020 at 00:29, Ludovic Courtès <ludo@gnu.org> wrote:
> Arun Isaac <arunisaac@systemreboot.net> skribis:
>
>> In the info manual, the Guix version is rendered as 0.0-git. For
>> example, in "(guix) The Store", see "The ability to connect to remote
>> build daemons is considered experimental as of 0.0-git". I am running
>> the Guix standalone system. Any idea what's going wrong?
>
> Nothing!  :-)
>
> The “0.0-git” string comes from (guix self).  As noted there, we can’t
> really afford to change the version string at each commit, or we’d have
> to rebuild the manual at each commit.

Why is it an issue if the manual is substituted?


> We could perhaps choose a more meaningful version string, though, maybe
> by looking at the closest tag or something.

For example, when I pull I have something like:

   /gnu/store/…-guix-1b2141743-modules.drv

so why this commit ID could not be reused in the manual?  For example,
the devel version of the manual contains the commit ID, see [1].

1: https://guix.gnu.org/manual/devel/en/guix.html#The-Store

All the best,
simon

ps:
Sorry Ludo for the double sending, I missed the "reply all".




^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#42212: Guix version rendered as 0.0-git in info manual
  2020-07-16  9:37   ` zimoun
@ 2020-07-16  9:48     ` Ludovic Courtès
  2020-07-16 10:19       ` zimoun
  0 siblings, 1 reply; 19+ messages in thread
From: Ludovic Courtès @ 2020-07-16  9:48 UTC (permalink / raw)
  To: zimoun; +Cc: 42212

Hi,

zimoun <zimon.toutoune@gmail.com> skribis:

> On Fri, 10 Jul 2020 at 00:29, Ludovic Courtès <ludo@gnu.org> wrote:
>> Arun Isaac <arunisaac@systemreboot.net> skribis:
>>
>>> In the info manual, the Guix version is rendered as 0.0-git. For
>>> example, in "(guix) The Store", see "The ability to connect to remote
>>> build daemons is considered experimental as of 0.0-git". I am running
>>> the Guix standalone system. Any idea what's going wrong?
>>
>> Nothing!  :-)
>>
>> The “0.0-git” string comes from (guix self).  As noted there, we can’t
>> really afford to change the version string at each commit, or we’d have
>> to rebuild the manual at each commit.
>
> Why is it an issue if the manual is substituted?

If it has to be rebuilt at every commit, chances are you won’t get
substitutes because it has to be built on the build farm, too.  :-)

Ludo’.




^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#42212: Guix version rendered as 0.0-git in info manual
  2020-07-16  0:46     ` Bengt Richter
  2020-07-16  5:08       ` Bengt Richter
@ 2020-07-16 10:06       ` zimoun
  1 sibling, 0 replies; 19+ messages in thread
From: zimoun @ 2020-07-16 10:06 UTC (permalink / raw)
  To: Bengt Richter; +Cc: 42212

Dear Bengt,

On Thu, 16 Jul 2020 at 02:46, Bengt Richter <bokr@bokr.com> wrote:

> readlink -f /var/guix/profiles/per-user/{$USER,root}/current-guix/manifest|xargs grep -m1 -A1 guix
>
> get you? Anything useful?

I am not sure the issue is to get the commit identifier. :-)

Otherwise, the Guix schemish way is something like:

--8<---------------cut here---------------start------------->8---
(use-modules
 (ice-9 match)
 (srfi srfi-1)
 ((guix describe) #:select (current-profile))
 ((guix config) #:select (%guix-version))
 (guix channels))

(match (current-profile)
  (#f %guix-version)   ;for lack of a better ID
  (profile
   (let ((channel (find guix-channel? (profile-channels profile))))
     (channel-commit channel))))
--8<---------------cut here---------------end--------------->8---

(From a Ludo’s hint for the last sources.json patch. :-))

All the best,
simon




^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#42212: Guix version rendered as 0.0-git in info manual
  2020-07-16  9:48     ` Ludovic Courtès
@ 2020-07-16 10:19       ` zimoun
  0 siblings, 0 replies; 19+ messages in thread
From: zimoun @ 2020-07-16 10:19 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 42212

On Thu, 16 Jul 2020 at 11:48, Ludovic Courtès <ludo@gnu.org> wrote:

>>> The “0.0-git” string comes from (guix self).  As noted there, we can’t
>>> really afford to change the version string at each commit, or we’d have
>>> to rebuild the manual at each commit.
>>
>> Why is it an issue if the manual is substituted?
>
> If it has to be rebuilt at every commit, chances are you won’t get
> substitutes because it has to be built on the build farm, too.  :-)

How Guix distinguish between "doc commit" and other commit?
I mean, is it not the latest Guix manual that "guix pull" pulls?  With
which guarantee / confidence?

BTW, as discussed elsewhere, it should not be possible to pull non
substituable commits by default, in the meaning: commit for which the
outputs are not already built by the build farm.  Well, put again on the
table CI as in [1] for a recent "again". :-)

1: https://lists.gnu.org/archive/html/guix-devel/2020-07/msg00074.html

Cheers,
simon




^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#42212: Guix version rendered as 0.0-git in info manual
  2020-07-09 22:29 ` Ludovic Courtès
  2020-07-15 21:42   ` Arun Isaac
  2020-07-16  9:37   ` zimoun
@ 2020-07-16 19:36   ` Efraim Flashner
  2020-07-17 23:55     ` bug#42212: [PATCH 0/1] Use nearest tag as the version string in documentation Arun Isaac
  2020-07-17 23:55     ` bug#42212: [PATCH 1/1] self: " Arun Isaac
  2 siblings, 2 replies; 19+ messages in thread
From: Efraim Flashner @ 2020-07-16 19:36 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 42212

[-- Attachment #1: Type: text/plain, Size: 1466 bytes --]

On Fri, Jul 10, 2020 at 12:29:39AM +0200, Ludovic Courtès wrote:
> Hi Arun,
> 
> Arun Isaac <arunisaac@systemreboot.net> skribis:
> 
> > In the info manual, the Guix version is rendered as 0.0-git. For
> > example, in "(guix) The Store", see "The ability to connect to remote
> > build daemons is considered experimental as of 0.0-git". I am running
> > the Guix standalone system. Any idea what's going wrong?
> 
> Nothing!  :-)
> 
> The “0.0-git” string comes from (guix self).  As noted there, we can’t
> really afford to change the version string at each commit, or we’d have
> to rebuild the manual at each commit.
> 
> We could perhaps choose a more meaningful version string, though, maybe
> by looking at the closest tag or something.
> 
> Thoughts?
> 

I looked into it a bit for my os-release file.
$ guile -L /path/to/checkout
(ins)scheme@(guile-user)> (use-modules ((guix config)))
(ins)scheme@(guile-user)> %guix-version
$1 = "1.0.1.19582-d7e9e"

$ guile -L ~/.cache/guix/pull/pjmkglp4t7znuugeurpurzikxq3tnlaywmisyr27shj7apsnalwq/
(ins)scheme@(guile-user)> (use-modules ((guix config)))
(ins)scheme@(guile-user)> %guix-version
$1 = "1.1.0-17.36a1925"

it seems to me that (guix config) could work

-- 
Efraim Flashner   <efraim@flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#42212: [PATCH 0/1] Use nearest tag as the version string in documentation.
  2020-07-16 19:36   ` Efraim Flashner
@ 2020-07-17 23:55     ` Arun Isaac
  2020-07-17 23:55     ` bug#42212: [PATCH 1/1] self: " Arun Isaac
  1 sibling, 0 replies; 19+ messages in thread
From: Arun Isaac @ 2020-07-17 23:55 UTC (permalink / raw)
  To: Efraim Flashner, Ludovic Courtès; +Cc: 42212

We can't actually use (guix config) since it doesn't have a useful version
number in this stage of the build process. See the use of make-config.scm in
build-program of build-aux/build-self.scm.

We need to use the nearest tag but that requires the git repo and we drop that
in the channel checkout. See use of dot-git? in latest-channel-instance of
(guix channels). To remedy this, I am generating .version before discarding
the git repo.

WDYT?

Arun Isaac (1):
  self: Use nearest tag as the version string in documentation.

 guix/channels.scm | 15 ++++++++++++++-
 guix/self.scm     | 11 +++++++----
 2 files changed, 21 insertions(+), 5 deletions(-)

-- 
2.26.2





^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#42212: [PATCH 1/1] self: Use nearest tag as the version string in documentation.
  2020-07-16 19:36   ` Efraim Flashner
  2020-07-17 23:55     ` bug#42212: [PATCH 0/1] Use nearest tag as the version string in documentation Arun Isaac
@ 2020-07-17 23:55     ` Arun Isaac
  2020-07-20  8:13       ` Ludovic Courtès
  1 sibling, 1 reply; 19+ messages in thread
From: Arun Isaac @ 2020-07-17 23:55 UTC (permalink / raw)
  To: Efraim Flashner, Ludovic Courtès; +Cc: 42212

* guix/channels.scm (latest-channel-instance): Write nearest tag into .version
of the checkout.
* guix/self.scm (info-manual): Use nearest tag from .version as the version
string while generating documentation.
---
 guix/channels.scm | 15 ++++++++++++++-
 guix/self.scm     | 11 +++++++----
 2 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/guix/channels.scm b/guix/channels.scm
index bbabf654a9..d35cbc42cf 100644
--- a/guix/channels.scm
+++ b/guix/channels.scm
@@ -2,6 +2,7 @@
 ;;; Copyright © 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
+;;; Copyright © 2020 Arun Isaac <arunisaac@systemreboot.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -40,6 +41,7 @@
   #:use-module (guix sets)
   #:use-module (guix store)
   #:use-module (guix i18n)
+  #:use-module (guix build utils)
   #:use-module ((guix utils)
                 #:select (source-properties->location
                           &error-location
@@ -56,9 +58,11 @@
   #:autoload   (guix quirks) (%quirks %patches applicable-patch? apply-patch)
   #:use-module (ice-9 format)
   #:use-module (ice-9 match)
+  #:use-module (ice-9 popen)
   #:use-module (ice-9 vlist)
   #:use-module ((ice-9 rdelim) #:select (read-string))
   #:use-module ((rnrs bytevectors) #:select (bytevector=?))
+  #:use-module (rnrs io ports)
   #:export (channel
             channel?
             channel-name
@@ -397,7 +401,16 @@ thus potentially malicious code.")))))))
     (when (guix-channel? channel)
       ;; Apply the relevant subset of PATCHES directly in CHECKOUT.  This is
       ;; safe to do because 'switch-to-ref' eventually does a hard reset.
-      (apply-patches checkout commit patches))
+      (apply-patches checkout commit patches)
+
+      ;; Write nearest tag into .version.
+      (with-directory-excursion checkout
+        (let ((version
+               (call-with-port
+                (open-pipe* OPEN_READ "./build-aux/git-version-gen" ".tarball-version")
+                get-string-all)))
+          (call-with-output-file ".version"
+            (cut put-string <> version)))))
 
     (let* ((name     (url+commit->name (channel-url channel) commit))
            (checkout (add-to-store store name #t "sha256" checkout
diff --git a/guix/self.scm b/guix/self.scm
index f70b1ecdd8..8c94efa7de 100644
--- a/guix/self.scm
+++ b/guix/self.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2020 Arun Isaac <arunisaac@systemreboot.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -459,16 +460,18 @@ a list of extra files, such as '(\"contributing\")."
     (with-imported-modules '((guix build utils))
       #~(begin
           (use-modules (guix build utils)
+                       (rnrs io ports)
                        (ice-9 match))
 
           (mkdir #$output)
 
-          ;; Create 'version.texi'.
-          ;; XXX: Can we use a more meaningful version string yet one that
-          ;; doesn't change at each commit?
+          ;; Create 'version.texi'. Use nearest tag written in .version as the
+          ;; version string.
           (call-with-output-file "version.texi"
             (lambda (port)
-              (let ((version "0.0-git"))
+              (let* ((tag (call-with-input-file (string-append #$source "/.version")
+                            get-string-all))
+                     (version (substring tag 0 (string-index-right tag #\.))))
                 (format port "
 @set UPDATED 1 January 1970
 @set UPDATED-MONTH January 1970
-- 
2.26.2





^ permalink raw reply related	[flat|nested] 19+ messages in thread

* bug#42212: [PATCH 1/1] self: Use nearest tag as the version string in documentation.
  2020-07-17 23:55     ` bug#42212: [PATCH 1/1] self: " Arun Isaac
@ 2020-07-20  8:13       ` Ludovic Courtès
  2020-07-20  8:36         ` Arun Isaac
  0 siblings, 1 reply; 19+ messages in thread
From: Ludovic Courtès @ 2020-07-20  8:13 UTC (permalink / raw)
  To: Arun Isaac; +Cc: 42212

Hi Arun,

Arun Isaac <arunisaac@systemreboot.net> skribis:

> * guix/channels.scm (latest-channel-instance): Write nearest tag into .version
> of the checkout.
> * guix/self.scm (info-manual): Use nearest tag from .version as the version
> string while generating documentation.

Thanks for looking into it!  Two comments:

> +      ;; Write nearest tag into .version.
> +      (with-directory-excursion checkout
> +        (let ((version
> +               (call-with-port
> +                (open-pipe* OPEN_READ "./build-aux/git-version-gen" ".tarball-version")
> +                get-string-all)))
> +          (call-with-output-file ".version"
> +            (cut put-string <> version)))))
>  
>      (let* ((name     (url+commit->name (channel-url channel) commit))
>             (checkout (add-to-store store name #t "sha256" checkout

I would rather not call out to ‘git-version-gen’ and instead use (git
describe) or similar.

However, unless I’m mistaken, the output of ‘git-version-gen’ changes at
each commit, so we’d be rebuilding the manual at every commit, which is
what we should avoid here.

One way to avoid that would be to look at the latest commit that touch
doc/ instead of the latest commit overall (I think that’s what zimoun
was suggesting).  Roughly run ‘git describe’ on ‘git log doc/’, so to
speak.  (Using Guile-Git.)

Thoughts?

Ludo’.




^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#42212: [PATCH 1/1] self: Use nearest tag as the version string in documentation.
  2020-07-20  8:13       ` Ludovic Courtès
@ 2020-07-20  8:36         ` Arun Isaac
  2020-07-20 12:32           ` Ludovic Courtès
  0 siblings, 1 reply; 19+ messages in thread
From: Arun Isaac @ 2020-07-20  8:36 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 42212

[-- Attachment #1: Type: text/plain, Size: 1032 bytes --]


> I would rather not call out to ‘git-version-gen’ and instead use (git
> describe) or similar.

Sure, I'll do that. Then, perhaps we should even rewrite git-version-gen
using (git describe). It would be nice to have that in guile too. WDYT?

> However, unless I’m mistaken, the output of ‘git-version-gen’ changes at
> each commit, so we’d be rebuilding the manual at every commit, which is
> what we should avoid here.

Yes, but I discard the commit part of git-version-gen's output. I keep
only the tag part.

But, like zimoun, I didn't understand why we can't rebuild the manual
every commit. Rebuilding the manual is quite cheap. So, substituting it
shouldn't be a problem, right?

> One way to avoid that would be to look at the latest commit that touch
> doc/ instead of the latest commit overall (I think that’s what zimoun
> was suggesting).  Roughly run ‘git describe’ on ‘git log doc/’, so to
> speak.  (Using Guile-Git.)

This sounds good. I'll try it and get back to you.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#42212: [PATCH 1/1] self: Use nearest tag as the version string in documentation.
  2020-07-20  8:36         ` Arun Isaac
@ 2020-07-20 12:32           ` Ludovic Courtès
  2020-07-20 13:42             ` zimoun
                               ` (2 more replies)
  0 siblings, 3 replies; 19+ messages in thread
From: Ludovic Courtès @ 2020-07-20 12:32 UTC (permalink / raw)
  To: Arun Isaac; +Cc: 42212

Arun Isaac <arunisaac@systemreboot.net> skribis:

>> I would rather not call out to ‘git-version-gen’ and instead use (git
>> describe) or similar.
>
> Sure, I'll do that. Then, perhaps we should even rewrite git-version-gen
> using (git describe). It would be nice to have that in guile too. WDYT?

Yes, but… one thing at a time.  :-)

>> However, unless I’m mistaken, the output of ‘git-version-gen’ changes at
>> each commit, so we’d be rebuilding the manual at every commit, which is
>> what we should avoid here.
>
> Yes, but I discard the commit part of git-version-gen's output. I keep
> only the tag part.
>
> But, like zimoun, I didn't understand why we can't rebuild the manual
> every commit. Rebuilding the manual is quite cheap. So, substituting it
> shouldn't be a problem, right?

Try rebuilding the manual + translations by yourself: it takes a few
minutes (see also commit a524a31de43b330c911fb08ae02fcd880d32aa04
related commits).

Also, if you don’t build it by yourself, you have to download its
substitutes, which is also not free.

So it’s really important to rebuild only when we have to.  (guix self)
is written in that spirit.

>> One way to avoid that would be to look at the latest commit that touch
>> doc/ instead of the latest commit overall (I think that’s what zimoun
>> was suggesting).  Roughly run ‘git describe’ on ‘git log doc/’, so to
>> speak.  (Using Guile-Git.)
>
> This sounds good. I'll try it and get back to you.

Thanks!

Ludo’.




^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#42212: [PATCH 1/1] self: Use nearest tag as the version string in documentation.
  2020-07-20 12:32           ` Ludovic Courtès
@ 2020-07-20 13:42             ` zimoun
  2020-07-27 23:13             ` bug#42212: [PATCH v2 0/1] " Arun Isaac
  2020-07-27 23:13             ` bug#42212: [PATCH v2 1/1] " Arun Isaac
  2 siblings, 0 replies; 19+ messages in thread
From: zimoun @ 2020-07-20 13:42 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 42212

Hi,

On Mon, 20 Jul 2020 at 14:32, Ludovic Courtès <ludo@gnu.org> wrote:

> > But, like zimoun, I didn't understand why we can't rebuild the manual
> > every commit. Rebuilding the manual is quite cheap. So, substituting it
> > shouldn't be a problem, right?
>
> Try rebuilding the manual + translations by yourself: it takes a few
> minutes (see also commit a524a31de43b330c911fb08ae02fcd880d32aa04
> related commits).
>
> Also, if you don’t build it by yourself, you have to download its
> substitutes, which is also not free.

Not free but still cheap enough. :-)

downloading from
https://ci.guix.gnu.org/nar/lzip/p8xbha1fl3j23q05iya43ypzhzjmyr0j-guix-manual
...
 guix-manual  4.4MiB

Especially compared to the other parts of "guix pull".

> So it’s really important to rebuild only when we have to.  (guix self)
> is written in that spirit.
>
> >> One way to avoid that would be to look at the latest commit that touch
> >> doc/ instead of the latest commit overall (I think that’s what zimoun
> >> was suggesting).  Roughly run ‘git describe’ on ‘git log doc/’, so to
> >> speak.  (Using Guile-Git.)

It was not what I was suggesting but it is the next step of my question. :-)

Naively, is it not a situation about kind of grafts?

If the last commit modifying the documentation is 1234abcd, then other
changes unrelated to documentation are committed, say commit wxyz5678,
I would expect to have that commit wxyz5678 appears in the
documentation. As it seems the case with
guix.gnu.org/manual/devel/en/.
So, the documentation should be built with the commit 1234abcd and
probably substituable, then grafted to refer to the last commit
wxyz5648 where it is required.  Even if referring to commit 1234abcd
will be already enough.

All the best,
simon




^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#42212: [PATCH v2 0/1] Use nearest tag as the version string in documentation
  2020-07-20 12:32           ` Ludovic Courtès
  2020-07-20 13:42             ` zimoun
@ 2020-07-27 23:13             ` Arun Isaac
  2020-07-27 23:13             ` bug#42212: [PATCH v2 1/1] " Arun Isaac
  2 siblings, 0 replies; 19+ messages in thread
From: Arun Isaac @ 2020-07-27 23:13 UTC (permalink / raw)
  To: Ludovic Courtès, Arun Isaac; +Cc: 42212

The new guile-git based patch follows. Thanks!

Arun Isaac (1):
  Use nearest tag as the version string in documentation.

 guix/channels.scm | 13 ++++++++++++-
 guix/self.scm     | 10 ++++++----
 2 files changed, 18 insertions(+), 5 deletions(-)

-- 
2.26.2





^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#42212: [PATCH v2 1/1] Use nearest tag as the version string in documentation.
  2020-07-20 12:32           ` Ludovic Courtès
  2020-07-20 13:42             ` zimoun
  2020-07-27 23:13             ` bug#42212: [PATCH v2 0/1] " Arun Isaac
@ 2020-07-27 23:13             ` Arun Isaac
  2 siblings, 0 replies; 19+ messages in thread
From: Arun Isaac @ 2020-07-27 23:13 UTC (permalink / raw)
  To: Ludovic Courtès, Arun Isaac; +Cc: 42212

* guix/channels.scm (latest-channel-instance): Write nearest tag into .version
of the checkout.
* guix/self.scm (info-manual): Use nearest tag from .version as the version
string while generating documentation.
---
 guix/channels.scm | 13 ++++++++++++-
 guix/self.scm     | 10 ++++++----
 2 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/guix/channels.scm b/guix/channels.scm
index ad2442f50e..e8941bb28e 100644
--- a/guix/channels.scm
+++ b/guix/channels.scm
@@ -2,6 +2,7 @@
 ;;; Copyright © 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
+;;; Copyright © 2020 Arun Isaac <arunisaac@systemreboot.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -393,7 +394,17 @@ thus potentially malicious code."))))))))
     (when (guix-channel? channel)
       ;; Apply the relevant subset of PATCHES directly in CHECKOUT.  This is
       ;; safe to do because 'switch-to-ref' eventually does a hard reset.
-      (apply-patches checkout commit patches))
+      (apply-patches checkout commit patches)
+
+      ;; Write into .version, the nearest tag without the "v" prefix.
+      (call-with-output-file (string-append checkout "/.version")
+        (lambda (port)
+          (display (substring
+                    (describe-format
+                     (describe-workdir (repository-open checkout))
+                     (make-describe-format-options #:abbreviated-size 0))
+                    1)
+                   port))))
 
     (let* ((name     (url+commit->name (channel-url channel) commit))
            (checkout (add-to-store store name #t "sha256" checkout
diff --git a/guix/self.scm b/guix/self.scm
index f70b1ecdd8..58ca4386f1 100644
--- a/guix/self.scm
+++ b/guix/self.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2020 Arun Isaac <arunisaac@systemreboot.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -459,16 +460,17 @@ a list of extra files, such as '(\"contributing\")."
     (with-imported-modules '((guix build utils))
       #~(begin
           (use-modules (guix build utils)
+                       (rnrs io ports)
                        (ice-9 match))
 
           (mkdir #$output)
 
-          ;; Create 'version.texi'.
-          ;; XXX: Can we use a more meaningful version string yet one that
-          ;; doesn't change at each commit?
+          ;; Create 'version.texi'. Use nearest tag written in .version as the
+          ;; version string.
           (call-with-output-file "version.texi"
             (lambda (port)
-              (let ((version "0.0-git"))
+              (let* ((version (call-with-input-file (string-append #$source "/.version")
+                                get-string-all)))
                 (format port "
 @set UPDATED 1 January 1970
 @set UPDATED-MONTH January 1970
-- 
2.26.2





^ permalink raw reply related	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2020-07-27 23:14 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-05  7:59 bug#42212: Guix version rendered as 0.0-git in info manual Arun Isaac
2020-07-09 22:29 ` Ludovic Courtès
2020-07-15 21:42   ` Arun Isaac
2020-07-15 23:26     ` Ludovic Courtès
2020-07-16  0:46     ` Bengt Richter
2020-07-16  5:08       ` Bengt Richter
2020-07-16 10:06       ` zimoun
2020-07-16  9:37   ` zimoun
2020-07-16  9:48     ` Ludovic Courtès
2020-07-16 10:19       ` zimoun
2020-07-16 19:36   ` Efraim Flashner
2020-07-17 23:55     ` bug#42212: [PATCH 0/1] Use nearest tag as the version string in documentation Arun Isaac
2020-07-17 23:55     ` bug#42212: [PATCH 1/1] self: " Arun Isaac
2020-07-20  8:13       ` Ludovic Courtès
2020-07-20  8:36         ` Arun Isaac
2020-07-20 12:32           ` Ludovic Courtès
2020-07-20 13:42             ` zimoun
2020-07-27 23:13             ` bug#42212: [PATCH v2 0/1] " Arun Isaac
2020-07-27 23:13             ` bug#42212: [PATCH v2 1/1] " Arun Isaac

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).