[bug#55920] build-system: chicken: Added stamp-egg-version phase
Commit Message
* 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
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
@@ -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)