GNU bug report logs - #55920
[PATCH] build-system: chicken: Added insert-missing-version phase

Previous Next

Package: guix-patches;

Reported by: Michal Atlas <michal_atlas <at> posteo.net>

Date: Sun, 12 Jun 2022 07:55:01 UTC

Severity: normal

Tags: moreinfo, patch

Done: Liliana Marie Prikler <liliana.prikler <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 55920 in the body.
You can then email your comments to 55920 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#55920; Package guix-patches. (Sun, 12 Jun 2022 07:55:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Michal Atlas <michal_atlas <at> posteo.net>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Sun, 12 Jun 2022 07:55:02 GMT) Full text and rfc822 format available.

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

From: Michal Atlas <michal_atlas <at> posteo.net>
To: guix-patches <at> gnu.org
Cc: Michal Atlas <michal_atlas <at> posteo.net>
Subject: [PATCH] build-system: chicken: Added insert-missing-version phase
Date: Sun, 12 Jun 2022 00:45:20 +0000
Many .egg files don't contain version information,
this causes `chicken-install` to label them {unknown},
which makes it fail compilations whenever a
dependency is tagged with a minimum-version.

I am unaware of a way to force this check to not-happen
and the version information should be included anyway,
so this patch should fix the problem.
---
 guix/build/chicken-build-system.scm | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/guix/build/chicken-build-system.scm b/guix/build/chicken-build-system.scm
index 5db9906acf..341ab64a0f 100644
--- a/guix/build/chicken-build-system.scm
+++ b/guix/build/chicken-build-system.scm
@@ -112,6 +112,17 @@ (define* (check #:key egg-name tests? #:allow-other-keys)
   (when tests?
     (invoke "chicken-install" "-cached" "-test" "-no-install" egg-name)))
 
+(define* (insert-missing-version #:key egg-name name #:allow-other-keys)
+  "Inserts version information into the .egg file if it isn't contained already"
+  (let* ([filename (string-append egg-name "/" egg-name ".egg")]
+         [egg-info (call-with-input-file filename read)]
+         [ver? (find (λ (i) (eqv? (car i) 'version)) egg-info)]
+         [ver (substring name (1+ (string-rindex name #\-)))])
+    (when (not ver?)
+      (make-file-writable filename)
+      (call-with-output-file filename
+	(λ (f) (write (cons `(version ,ver) egg-info) f))))))
+
 ;; It doesn't look like Chicken generates any unnecessary references.
 ;; So we don't have to remove them either. Nice.
 
@@ -122,6 +133,7 @@ (define %standard-phases
     (delete 'configure)
     (delete 'patch-generated-file-shebangs)
     (add-before 'unpack 'setup-chicken-environment setup-chicken-environment)
+    (add-before 'build 'insert-missing-version insert-missing-version)
     (replace 'build build)
     (delete 'check)
     (replace 'install install)

base-commit: 1643402950b2d2384ec74fb69e059cc6a4c4ebed
-- 
2.36.1





Information forwarded to guix-patches <at> gnu.org:
bug#55920; Package guix-patches. (Wed, 15 Jun 2022 11:27:02 GMT) Full text and rfc822 format available.

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

From: Liliana Marie Prikler <liliana.prikler <at> ist.tugraz.at>
To: Michal Atlas <michal_atlas <at> posteo.net>, 55920 <at> debbugs.gnu.org
Subject: Re: [PATCH] build-system: chicken: Added insert-missing-version phase
Date: Wed, 15 Jun 2022 13:26:27 +0200
Am Sonntag, dem 12.06.2022 um 00:45 +0000 schrieb Michal Atlas:
> Many .egg files don't contain version information,
> this causes `chicken-install` to label them {unknown},
> which makes it fail compilations whenever a
> dependency is tagged with a minimum-version.
> 
> I am unaware of a way to force this check to not-happen
> and the version information should be included anyway,
> so this patch should fix the problem.
> ---
Put the blurb below this line, add a ChangeLog above.

>  guix/build/chicken-build-system.scm | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/guix/build/chicken-build-system.scm
> b/guix/build/chicken-build-system.scm
> index 5db9906acf..341ab64a0f 100644
> --- a/guix/build/chicken-build-system.scm
> +++ b/guix/build/chicken-build-system.scm
> @@ -112,6 +112,17 @@ (define* (check #:key egg-name tests? #:allow-
> other-keys)
>    (when tests?
>      (invoke "chicken-install" "-cached" "-test" "-no-install" egg-
> name)))
>  
> +(define* (insert-missing-version #:key egg-name name #:allow-other-
> keys)
I find "stamp-egg-version" funnier.
> +  "Inserts version information into the .egg file if it isn't
> contained already"
> +  (let* ([filename (string-append egg-name "/" egg-name ".egg")]
> +         [egg-info (call-with-input-file filename read)]
> +         [ver? (find (λ (i) (eqv? (car i) 'version)) egg-info)]
> +         [ver (substring name (1+ (string-rindex name #\-)))])
We don't do square brackets in Guile.  Also, using λ rather than
spelling out "lambda" results in a syntax error.
> +    (when (not ver?)
> +      (make-file-writable filename)
> +      (call-with-output-file filename
> +       (λ (f) (write (cons `(version ,ver) egg-info) f))))))
"lambda".
>  ;; It doesn't look like Chicken generates any unnecessary
> references.
>  ;; So we don't have to remove them either. Nice.
>  
> @@ -122,6 +133,7 @@ (define %standard-phases
>      (delete 'configure)
>      (delete 'patch-generated-file-shebangs)
>      (add-before 'unpack 'setup-chicken-environment setup-chicken-
> environment)
> +    (add-before 'build 'insert-missing-version insert-missing-
> version)
Note that 'insert-missing-version will always be logged even if the
version is not actually missing.
>      (replace 'build build)
>      (delete 'check)
>      (replace 'install install)

Cheers




Information forwarded to guix-patches <at> gnu.org:
bug#55920; Package guix-patches. (Wed, 15 Jun 2022 11:30:02 GMT) Full text and rfc822 format available.

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

From: Maxime Devos <maximedevos <at> telenet.be>
To: Liliana Marie Prikler <liliana.prikler <at> ist.tugraz.at>, Michal Atlas
 <michal_atlas <at> posteo.net>, 55920 <at> debbugs.gnu.org
Subject: Re: [bug#55920] [PATCH] build-system: chicken: Added
 insert-missing-version phase
Date: Wed, 15 Jun 2022 13:29:09 +0200
[Message part 1 (text/plain, inline)]
Liliana Marie Prikler schreef op wo 15-06-2022 om 13:26 [+0200]:
> We don't do square brackets in Guile.  Also, using λ rather than
> spelling out "lambda" results in a syntax error.

This construct seems to work fine for me:

> (let ((id (λ (x) x))) (id 0))
$2 = 0

Greetings,
Maxime.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#55920; Package guix-patches. (Wed, 15 Jun 2022 11:33:02 GMT) Full text and rfc822 format available.

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

From: Liliana Marie Prikler <liliana.prikler <at> ist.tugraz.at>
To: Maxime Devos <maximedevos <at> telenet.be>, Michal Atlas
 <michal_atlas <at> posteo.net>, 55920 <at> debbugs.gnu.org
Subject: Re: [bug#55920] [PATCH] build-system: chicken: Added
 insert-missing-version phase
Date: Wed, 15 Jun 2022 13:32:02 +0200
Am Mittwoch, dem 15.06.2022 um 13:29 +0200 schrieb Maxime Devos:
> Liliana Marie Prikler schreef op wo 15-06-2022 om 13:26 [+0200]:
> > We don't do square brackets in Guile.  Also, using λ rather than
> > spelling out "lambda" results in a syntax error.
> 
> This construct seems to work fine for me:
> 
> > (let ((id (λ (x) x))) (id 0))
> $2 = 0
> 
> Greetings,
> Maxime.
My bad, I only typed the letter λ into a repl and brain-grepped for
syntax error.  Still, the long form ought to be used in my opinion,
because that's the one that editors are more likely to look out for.




Information forwarded to guix-patches <at> gnu.org:
bug#55920; Package guix-patches. (Wed, 15 Jun 2022 11:42:01 GMT) Full text and rfc822 format available.

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

From: Tobias Geerinckx-Rice <me <at> tobias.gr>
To: Liliana Marie Prikler <liliana.prikler <at> ist.tugraz.at>
Cc: 55920 <at> debbugs.gnu.org, guix-patches <at> gnu.org,
 Michal Atlas <michal_atlas <at> posteo.net>
Subject: Re: [bug#55920] [PATCH] build-system: chicken: Added
 insert-missing-version phase
Date: Wed, 15 Jun 2022 13:40:23 +0200
[Message part 1 (text/plain, inline)]
Liliana Marie Prikler 写道:
>Also, using λ rather than spelling out "lambda" results in a 
>syntax error.

Not true, but we conventionally don't use λ in Guix code.  There 
are a good few counterexamples that snuck in over the years, 
though.

Kind regards,

T G-R
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#55920; Package guix-patches. (Wed, 15 Jun 2022 11:42:02 GMT) Full text and rfc822 format available.

Added tag(s) moreinfo. Request was from Ludovic Courtès <ludo <at> gnu.org> to control <at> debbugs.gnu.org. (Thu, 16 Jun 2022 09:13:02 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#55920; Package guix-patches. (Sun, 19 Jun 2022 23:29:03 GMT) Full text and rfc822 format available.

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

From: Michal Atlas <michal_atlas <at> posteo.net>
To: 55920 <at> debbugs.gnu.org
Cc: Michal Atlas <michal_atlas <at> posteo.net>
Subject: [PATCH] build-system: chicken: Added stamp-egg-version phase
Date: Sun, 19 Jun 2022 20:36:03 +0000
* guix/build/chicken-build-system.scm (stamp-egg-version): New phase
Compiled eggs will now always contain some version,
falling back to the guix package version if none is provided by the egg.
(%standard-phases): Inserted the new phase

---

Many .egg files don't contain version information,
this causes `chicken-install` to label them as "unknown",
which causes it to fail compilations whenever a
dependency is tagged with a minimum-version.

I am unaware of a way to disable the version check
and the version information should be included anyway,
so this patch should fix the problem.
---
 guix/build/chicken-build-system.scm | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/guix/build/chicken-build-system.scm b/guix/build/chicken-build-system.scm
index 5db9906acf..c0a4986032 100644
--- a/guix/build/chicken-build-system.scm
+++ b/guix/build/chicken-build-system.scm
@@ -112,6 +112,17 @@ (define* (check #:key egg-name tests? #:allow-other-keys)
   (when tests?
     (invoke "chicken-install" "-cached" "-test" "-no-install" egg-name)))
 
+(define* (stamp-egg-version #:key egg-name name #:allow-other-keys)
+  "Inserts version information into the .egg file if it isn't contained already"
+  (let* ((filename (string-append egg-name "/" egg-name ".egg"))
+         (egg-info (call-with-input-file filename read))
+         (ver? (find (lambda (i) (eqv? (car i) 'version)) egg-info))
+         (ver (substring name (1+ (string-rindex name #\-)))))
+    (when (not ver?)
+      (make-file-writable filename)
+      (call-with-output-file filename
+        (lambda (f) (write (cons `(version ,ver) egg-info) f))))))
+
 ;; It doesn't look like Chicken generates any unnecessary references.
 ;; So we don't have to remove them either. Nice.
 
@@ -122,6 +133,7 @@ (define %standard-phases
     (delete 'configure)
     (delete 'patch-generated-file-shebangs)
     (add-before 'unpack 'setup-chicken-environment setup-chicken-environment)
+    (add-before 'build 'stamp-egg-version stamp-egg-version)
     (replace 'build build)
     (delete 'check)
     (replace 'install install)
-- 
2.36.1

---

Hopefully I understood your comments well.

> Note that 'insert-missing-version will always be logged
I was aware of that but
didn't find anything about making a phase optional,
good thing it has a more sensible name now.

Cheers




Reply sent to Liliana Marie Prikler <liliana.prikler <at> gmail.com>:
You have taken responsibility. (Tue, 21 Jun 2022 19:45:03 GMT) Full text and rfc822 format available.

Notification sent to Michal Atlas <michal_atlas <at> posteo.net>:
bug acknowledged by developer. (Tue, 21 Jun 2022 19:45:03 GMT) Full text and rfc822 format available.

Message #30 received at 55920-done <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: Michal Atlas <michal_atlas <at> posteo.net>, 55920-done <at> debbugs.gnu.org
Subject: Re: [PATCH] build-system: chicken: Added stamp-egg-version phase
Date: Tue, 21 Jun 2022 21:44:02 +0200
Am Sonntag, dem 19.06.2022 um 20:36 +0000 schrieb Michal Atlas:
> * guix/build/chicken-build-system.scm (stamp-egg-version): New phase
> Compiled eggs will now always contain some version,
> falling back to the guix package version if none is provided by the
> egg.
> (%standard-phases): Inserted the new phase
Pushed with some wording fixes.  Cheers




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 20 Jul 2022 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 281 days ago.

Previous Next


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