summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Atlas <michal_atlas@posteo.net>2022-06-19 20:36:03 +0000
committerLiliana Marie Prikler <liliana.prikler@gmail.com>2022-06-21 21:41:32 +0200
commit4dbe1c96e463d5de1f75c90404f738f472d91d03 (patch)
tree53de1448aa255cd4582339679420b808d88b7005
parent3589537dacf2f5e49307eaab70f4d2e0e40c0811 (diff)
downloadguix-patches-4dbe1c96e463d5de1f75c90404f738f472d91d03.tar
guix-patches-4dbe1c96e463d5de1f75c90404f738f472d91d03.tar.gz
build-system: chicken: Add version information to eggs if missing.
Chicken eggs do not always contain version information, yet dependant packages often rely on this information being present. Thus, add a version field if it is missing. * guix/build/chicken-build-system.scm (stamp-egg-version): New variable. (%standard-phases): Add ‘stamp-egg-version’. Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
-rw-r--r--guix/build/chicken-build-system.scm12
1 files changed, 12 insertions, 0 deletions
diff --git a/guix/build/chicken-build-system.scm b/guix/build/chicken-build-system.scm
index 5db9906acf..a669822dad 100644
--- a/guix/build/chicken-build-system.scm
+++ b/guix/build/chicken-build-system.scm
@@ -112,6 +112,17 @@ unpacking."
(when tests?
(invoke "chicken-install" "-cached" "-test" "-no-install" egg-name)))
+(define* (stamp-egg-version #:key egg-name name #:allow-other-keys)
+ "Check if EGG-NAME.egg contains version information and add some if not."
+ (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 @@ unpacking."
(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)