unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Michal Atlas <michal_atlas@posteo.net>
To: 55920@debbugs.gnu.org
Cc: Michal Atlas <michal_atlas@posteo.net>
Subject: [bug#55920] [PATCH] build-system: chicken: Added stamp-egg-version phase
Date: Sun, 19 Jun 2022 20:36:03 +0000	[thread overview]
Message-ID: <20220619203602.10903-1-michal_atlas@posteo.net> (raw)
In-Reply-To: <20220612004520.6107-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(+)

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




  parent reply	other threads:[~2022-06-19 23:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-12  0:45 [bug#55920] [PATCH] build-system: chicken: Added insert-missing-version phase Michal Atlas
2022-06-15 11:26 ` Liliana Marie Prikler
2022-06-15 11:29   ` Maxime Devos
2022-06-15 11:32     ` Liliana Marie Prikler
2022-06-15 11:40   ` Tobias Geerinckx-Rice via Guix-patches via
2022-06-19 20:36 ` Michal Atlas [this message]
2022-06-21 19:44   ` bug#55920: [PATCH] build-system: chicken: Added stamp-egg-version phase Liliana Marie Prikler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220619203602.10903-1-michal_atlas@posteo.net \
    --to=michal_atlas@posteo.net \
    --cc=55920@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).