[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#55920] [PATCH] build-system: chicken: Added stamp-egg-version phase

From: Michal Atlas
Subject: [bug#55920] [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 
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 
+  (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)


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.


reply via email to

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