diff mbox series

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

Message ID 20220619203602.10903-1-michal_atlas@posteo.net
State Accepted
Headers show
Series [bug#55920] build-system: chicken: Added stamp-egg-version phase | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue

Commit Message

Michal Atlas June 19, 2022, 8:36 p.m. UTC
* 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(+)

Comments

Liliana Marie Prikler June 21, 2022, 7:44 p.m. UTC | #1
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
diff mbox series

Patch

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)