[PATCH] build-system: chicken: Added insert-missing-version phase

  • Done
  • quality assurance status badge
Details
6 participants
  • Liliana Marie Prikler
  • Liliana Marie Prikler
  • Ludovic Courtès
  • Maxime Devos
  • Tobias Geerinckx-Rice
  • Michal Atlas
Owner
unassigned
Submitted by
Michal Atlas
Severity
normal
M
M
Michal Atlas wrote on 12 Jun 2022 02:45
(address . guix-patches@gnu.org)(name . Michal Atlas)(address . michal_atlas@posteo.net)
20220612004520.6107-1-michal_atlas@posteo.net
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(+)

Toggle diff (34 lines)
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
L
L
Liliana Marie Prikler wrote on 15 Jun 2022 13:26
ae8d77255602d71ecc3ee958a086bde12caa6709.camel@ist.tugraz.at
Am Sonntag, dem 12.06.2022 um 00:45 +0000 schrieb Michal Atlas:
Toggle quote (9 lines)
> 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.

Toggle quote (16 lines)
>  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.
Toggle quote (6 lines)
> +  "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.
Toggle quote (4 lines)
> +    (when (not ver?)
> +      (make-file-writable filename)
> +      (call-with-output-file filename
> +       (λ (f) (write (cons `(version ,ver) egg-info) f))))))
"lambda".
Toggle quote (11 lines)
>  ;; 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.
Toggle quote (4 lines)
>      (replace 'build build)
>      (delete 'check)
>      (replace 'install install)

Cheers
M
M
Maxime Devos wrote on 15 Jun 2022 13:29
Re: [bug#55920] [PATCH] build-system: chicken: Added insert-missing-version phase
a3c2401f1cbce893ca6321e1581d52066c9384cf.camel@telenet.be
Liliana Marie Prikler schreef op wo 15-06-2022 om 13:26 [+0200]:
Toggle quote (3 lines)
> 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:

Toggle quote (1 lines)
> (let ((id (λ (x) x))) (id 0))
$2 = 0

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYqnChRccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7p5EAP4twGLABhqvSvd0rgcSUJHRe1fK
C2YKCST2OGqwzshaaAEAuuCtfjXsagO8Rf1Yd4J/+flJSLcxv4JfddfNIteW8ww=
=QPlX
-----END PGP SIGNATURE-----


L
L
Liliana Marie Prikler wrote on 15 Jun 2022 13:32
467006424789ce3b88afa95de2d170783eeda5cd.camel@ist.tugraz.at
Am Mittwoch, dem 15.06.2022 um 13:29 +0200 schrieb Maxime Devos:
Toggle quote (11 lines)
> 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.
T
T
Tobias Geerinckx-Rice wrote on 15 Jun 2022 13:40
(name . Liliana Marie Prikler)(address . liliana.prikler@ist.tugraz.at)
87bkuurw63@nckx
Liliana Marie Prikler ???
Toggle quote (3 lines)
>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
-----BEGIN PGP SIGNATURE-----

iIMEARYKACsWIQT12iAyS4c9C3o4dnINsP+IT1VteQUCYqnFZA0cbWVAdG9iaWFz
LmdyAAoJEA2w/4hPVW15Ko0BAOZ0iZzOd5Lokn9ZVSfHy92PF9vZD1AyZev6uDmV
1awwAQCap9j4WmXl8o9NqVInMvB7xkQiHS9MyAi0HYdb0r54Dw==
=GSWb
-----END PGP SIGNATURE-----

L
L
Ludovic Courtès wrote on 16 Jun 2022 11:12
control message for bug #55920
(address . control@debbugs.gnu.org)
87r13pm0pb.fsf@gnu.org
tags 55920 + moreinfo
quit
M
M
Michal Atlas wrote on 19 Jun 2022 22:36
[PATCH] build-system: chicken: Added stamp-egg-version phase
(address . 55920@debbugs.gnu.org)(name . Michal Atlas)(address . michal_atlas@posteo.net)
20220619203602.10903-1-michal_atlas@posteo.net
* 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(+)

Toggle diff (43 lines)
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
L
L
Liliana Marie Prikler wrote on 21 Jun 2022 21:44
580d9e32db0bc3036ad0d7e7a8be910281312693.camel@gmail.com
Am Sonntag, dem 19.06.2022 um 20:36 +0000 schrieb Michal Atlas:
Toggle quote (5 lines)
> * 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
Closed
?