From patchwork Sun Jun 19 20:36:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Atlas X-Patchwork-Id: 40188 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 9293F27BBEA; Mon, 20 Jun 2022 00:29:22 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 56A2727BBE9 for ; Mon, 20 Jun 2022 00:29:22 +0100 (BST) Received: from localhost ([::1]:35052 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o34M5-0002ac-Fn for patchwork@mira.cbaines.net; Sun, 19 Jun 2022 19:29:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47220) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o34Ln-0002Z2-QX for guix-patches@gnu.org; Sun, 19 Jun 2022 19:29:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:59542) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o34Ln-0001uv-HA for guix-patches@gnu.org; Sun, 19 Jun 2022 19:29:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1o34Ln-00013X-EJ for guix-patches@gnu.org; Sun, 19 Jun 2022 19:29:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#55920] [PATCH] build-system: chicken: Added stamp-egg-version phase References: <20220612004520.6107-1-michal_atlas@posteo.net> In-Reply-To: <20220612004520.6107-1-michal_atlas@posteo.net> Resent-From: Michal Atlas Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 19 Jun 2022 23:29:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55920 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch moreinfo To: 55920@debbugs.gnu.org Cc: Michal Atlas Received: via spool by 55920-submit@debbugs.gnu.org id=B55920.16556813213987 (code B ref 55920); Sun, 19 Jun 2022 23:29:03 +0000 Received: (at 55920) by debbugs.gnu.org; 19 Jun 2022 23:28:41 +0000 Received: from localhost ([127.0.0.1]:53434 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o34LP-00012B-CQ for submit@debbugs.gnu.org; Sun, 19 Jun 2022 19:28:41 -0400 Received: from mout02.posteo.de ([185.67.36.66]:35209) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o32Xc-0002KK-Gs for 55920@debbugs.gnu.org; Sun, 19 Jun 2022 17:33:11 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 3A9CD240108 for <55920@debbugs.gnu.org>; Sun, 19 Jun 2022 23:33:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1655674382; bh=3eof8fMg8Lar//ZQ1VN5CX6JecBSOAzGT2CK8lw81bM=; h=From:To:Cc:Subject:Date:From; b=lpfbh5Gttm6u3E1gY25DG2FxQiTm2eYblom51vDicChFoZJPCUHNvNzcMLEflic6c H1rk2R1jEXHSyYrvpfiSoVv1FqPQHmKGHxeS66xzdfS7I6C0AztToaTuElnCJ9sfVT 1tz+gh23tglmZh/DJ+zIiYPtDBEACInZ+0WW/rBYvorOwiOtlblByoel4YR1DIqQaf kaR8b/m4khTEwirRh1/grH+o5GVIQPaxs0OIZ031d8L9dR+easyNPYVONzxYUGTga+ zm2DMQ4KsymQJ1/4H6l+Nkk7OQGxjubCZJg1RTxykYt5gfGFyVifogpj/NqUPH+S1X Y3nD/St/PMUXw== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4LR5bx3blQz6tnw; Sun, 19 Jun 2022 23:33:01 +0200 (CEST) From: Michal Atlas Date: Sun, 19 Jun 2022 20:36:03 +0000 Message-Id: <20220619203602.10903-1-michal_atlas@posteo.net> MIME-Version: 1.0 X-Mailman-Approved-At: Sun, 19 Jun 2022 19:28:38 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * 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)