From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id kIC3NjVUCWC0UgAA0tVLHw (envelope-from ) for ; Thu, 21 Jan 2021 10:15:17 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id MMAAMjVUCWDpWgAAB5/wlQ (envelope-from ) for ; Thu, 21 Jan 2021 10:15:17 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 5995A940483 for ; Thu, 21 Jan 2021 10:15:17 +0000 (UTC) Received: from localhost ([::1]:47320 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l2Wzj-0003Qu-Uf for larch@yhetil.org; Thu, 21 Jan 2021 05:15:16 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34852) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l2WzZ-0003P5-Bb for guix-patches@gnu.org; Thu, 21 Jan 2021 05:15:05 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:45338) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l2WzW-0007Dp-OQ for guix-patches@gnu.org; Thu, 21 Jan 2021 05:15:05 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1l2WzW-0004Np-HO for guix-patches@gnu.org; Thu, 21 Jan 2021 05:15:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#44736] [Shepherd PATCH] build: Add guix.scm helper file. Resent-From: Efraim Flashner Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 21 Jan 2021 10:15:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 44736 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Received: via spool by 44736-submit@debbugs.gnu.org id=B44736.161122404516767 (code B ref 44736); Thu, 21 Jan 2021 10:15:02 +0000 Received: (at 44736) by debbugs.gnu.org; 21 Jan 2021 10:14:05 +0000 Received: from localhost ([127.0.0.1]:56884 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l2Wya-0004MM-Id for submit@debbugs.gnu.org; Thu, 21 Jan 2021 05:14:05 -0500 Received: from flashner.co.il ([178.62.234.194]:40814) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l2WyY-0004Li-NG for 44736@debbugs.gnu.org; Thu, 21 Jan 2021 05:14:03 -0500 Received: from localhost (unknown [31.210.181.184]) by flashner.co.il (Postfix) with ESMTPSA id 901F04001D; Thu, 21 Jan 2021 10:13:56 +0000 (UTC) Date: Thu, 21 Jan 2021 12:13:13 +0200 From: Efraim Flashner Message-ID: References: <20201119125244.3674-1-efraim@flashner.co.il> <87o8hvfy5l.fsf@gnu.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="g9War/4atCYQ6sbn" Content-Disposition: inline In-Reply-To: <87o8hvfy5l.fsf@gnu.org> X-PGP-Key-ID: 0x41AAE7DCCA3D8351 X-PGP-Key: https://flashner.co.il/~efraim/efraim_flashner.asc X-PGP-Fingerprint: A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 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: , Cc: 44736@debbugs.gnu.org Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -3.95 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: 5995A940483 X-Spam-Score: -3.95 X-Migadu-Scanner: scn1.migadu.com X-TUID: VhtguW0YIP9l --g9War/4atCYQ6sbn Content-Type: multipart/mixed; boundary="1m6biAwC4hAlK7I0" Content-Disposition: inline --1m6biAwC4hAlK7I0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jan 11, 2021 at 01:36:38PM +0100, Ludovic Court=C3=A8s wrote: > Hello! >=20 > Efraim Flashner skribis: >=20 > > * build-aux/guix.scm: New file. >=20 > Could you (1) add a copyright header, and (2) add this file to > =E2=80=98EXTRA_DIST=E2=80=99 in =E2=80=98Makefile.am=E2=80=99? Sure > > +(define (keep-file? file stat) > > + (not (any (lambda (my-string) > > + (string-contains file my-string)) > > + (list ".git" ".dir-locals.el" "build-aux")))) >=20 > FWIW, I=E2=80=99m never quite sure what to do here. In Guile-zstd, I wro= te > something that works even from a tarball (not a Git checkout), but it=E2= =80=99s > a bit verbose: >=20 > https://notabug.org/guile-zstd/guile-zstd/src/master/guix.scm Looking at that list I feel like I'm missing bits. If we go down the rabiit hole of figuring out all the different files which could possibly be included in the list I feel like we should keep it as a fancy macro somewhere. It'd almost be easier to copy the entire directory somewhere, run 'git clean -dfx' and then use that. Or to parse .gitignore or make clean. > > +(define (build-from-git base) > > + (package > > + (inherit base) > > + (version (git-version (package-version base) "HEAD" %git-commit)) > > + (source (local-file %source-dir > > + #:recursive? #t > > + #:select? keep-file?)) >=20 > [=E2=80=A6] >=20 > > +(list (build-from-git (specification->package "shepherd")) > > + (build-from-git (specification->package "guile2.2-shepherd")) > > + ;; This version FTBFS due to an import of '(ice-9 threads)' in m= odules/shepherd.scm > > + ;(build-from-git (specification->package "guile2.0-shepherd")) > > + ) >=20 > Should it be a manifest instead, so that =E2=80=98guix build -f=E2=80=99 = works? Returning a list also seems to work (ins)efraim@3900XT ~/workspace/shepherd$ guix build -f build-aux/guix.scm -n substitute: updating substitutes from 'https://ci.guix.gnu.org'... 100.0% substitute: updating substitutes from 'https://bayfront.guix.gnu.org'... 10= 0.0% The following derivations would be built: /gnu/store/g2ql360i3s02mg42l4ys27lsghpx5xqq-shepherd-0.8.1-HEAD.b482009.= drv /gnu/store/ajlqc21qqmi3fp5j30jq7vc0i1qn701y-guile2.2-shepherd-0.8.1-HEAD= =2Eb482009.drv /gnu/store/nbq7yw0zzmrwvykcld3fsbgmh39fapym-guile2.0-shepherd-0.8.1.drv > The downside of returning several packages is that =E2=80=98guix environm= ent -l > guix.scm=E2=80=99 won=E2=80=99t work. Technically it works, but it's not as useful as just getting the inputs you actually want. (ins)efraim@3900XT ~/workspace/shepherd$ guix environment -l build-aux/guix= =2Escm (ins)efraim@3900XT ~/workspace/shepherd [env]$ which -a guile /gnu/store/xlsi9fmi4blrpwn4xy8cvfq86zhag878-profile/bin/guile /home/efraim/.guix-profile/bin/guile /run/current-system/profile/bin/guile (ins)efraim@3900XT ~/workspace/shepherd [env]$ /gnu/store/xlsi9fmi4blrpwn4x= y8cvfq86zhag878-profile/bin/guile --version guile (GNU Guile) 3.0.2 Copyright (C) 2020 Free Software Foundation, Inc. License LGPLv3+: GNU LGPL 3 or later . This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. (ins)efraim@3900XT ~/workspace/shepherd$ ls /gnu/store/xlsi9fmi4blrpwn4xy8c= vfq86zhag878-profile/lib/guile/ 2.0 2.2 3.0/ > Thanks, > Ludo=E2=80=99. I also got guile2.0-shepherd to build. --=20 Efraim Flashner =D7=90=D7=A4=D7=A8=D7=99=D7=9D = =D7=A4=D7=9C=D7=A9=D7=A0=D7=A8 GPG key =3D A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Confidentiality cannot be guaranteed on emails sent or received unencrypted --1m6biAwC4hAlK7I0 Content-Type: text/plain; charset=utf-8 Content-Disposition: attachment; filename="0001-build-Add-guix.scm-helper-file.patch" Content-Transfer-Encoding: quoted-printable =46rom 3fe742290f24fa5e514a06c73247537aed3e58a4 Mon Sep 17 00:00:00 2001 =46rom: Efraim Flashner Date: Thu, 19 Nov 2020 14:51:28 +0200 Subject: [PATCH] build: Add guix.scm helper file. * build-aux/guix.scm: New file. * Makefile.am (EXTRA_DIST): Register it. --- Makefile.am | 2 +- build-aux/guix.scm | 79 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 build-aux/guix.scm diff --git a/Makefile.am b/Makefile.am index 774ebba..1c4acda 100644 --- a/Makefile.am +++ b/Makefile.am @@ -71,7 +71,7 @@ CLEANFILES =3D \ =0C # Crash handler. =20 -EXTRA_DIST =3D etc/crash-handler.c +EXTRA_DIST =3D etc/crash-handler.c build-aux/guix.scm =20 if BUILD_CRASH_HANDLER =20 diff --git a/build-aux/guix.scm b/build-aux/guix.scm new file mode 100644 index 0000000..d895db4 --- /dev/null +++ b/build-aux/guix.scm @@ -0,0 +1,79 @@ +;;; guix.scm -- Guix package definition +;; Copyright (C) 2020 Efraim Flashner +;; +;; This file is part of the GNU Shepherd. +;; +;; The GNU Shepherd is free software; you can redistribute it and/or modif= y it +;; under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 3 of the License, or (at +;; your option) any later version. +;; +;; The GNU Shepherd is distributed in the hope that it will be useful, but +;; WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with the GNU Shepherd. If not, see . + +(use-modules + (guix packages) + ((guix git-download) #:select (git-version)) + ((guix build utils) #:select (find-files)) + ((guix gexp) #:select (local-file)) + ((guix utils) #:select (substitute-keyword-arguments)) + ((gnu packages) #:select (specification->package)) + ((ice-9 popen) #:select (open-pipe)) + ((ice-9 rdelim) #:select (read-string)) + ((srfi srfi-1) #:select (any))) + +(define %source-dir (dirname (dirname (current-filename)))) + +(define %git-commit + (read-string (open-pipe "git show HEAD | head -1 | cut -d ' ' -f 2" OPEN= _READ))) + +(define (keep-file? file stat) + (not (any (lambda (my-string) + (string-contains file my-string)) + (list ".git" ".dir-locals.el" "build-aux")))) + +(define (build-from-git base) + (package + (inherit base) + (version (git-version (package-version base) "HEAD" %git-commit)) + (source (local-file %source-dir + #:recursive? #t + #:select? keep-file?)) + (native-inputs + `(("autoconf" ,(specification->package "autoconf")) + ("automake" ,(specification->package "automake")) + ("gettext" ,(specification->package "gettext")) + ("help2man" ,(specification->package "help2man")) + ("texinfo" ,(specification->package "texinfo")) + ,@(package-native-inputs base))) + (arguments + `(#:configure-flags '("--localstatedir=3D/var") + #:make-flags (list "GUILE_AUTO_COMPILE=3D0") + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'make-po-directory-writable + (lambda _ + (for-each make-file-writable + (find-files "po")) + #t))))))) + +(list (build-from-git (specification->package "shepherd")) + (build-from-git (specification->package "guile2.2-shepherd")) + (let ((base (build-from-git (specification->package "guile2.0-shephe= rd")))) + (package + (inherit base) + (arguments + (substitute-keyword-arguments (package-arguments base) + ((#:phases phases) + `(modify-phases ,phases + (add-after 'unpack 'patch-source + (lambda _ + ;; (ice-9 threads) isn't available in guile-2.0 + (substitute* "modules/shepherd.scm" + ((".*\\(ice-9 threads\\).*") "")) + #t))))))))) --=20 2.30.0 --1m6biAwC4hAlK7I0-- --g9War/4atCYQ6sbn Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAmAJU7kACgkQQarn3Mo9 g1EPCA/9EUpv+ZDRNEJLwP8KwaOiAIW9eqSsIdO2eajsJBelD8nJ5uDOZ+oNVtnW insjMQsrmvwBHGNH0JVgbKYtY+jwyLb5ZzGCTEaLZLDEzG2A+v2zMkMQVYpesvbM GhOo8DggWY8rbem3vLUKha4XIPWQ4tbqhckQLib0RbKaCD/nEwukYWkesz9xrNoB EDdblfFZWGCbYggs/n0R5gD9I1XbrecuaSO1IV/H1/L67TVGSQJGmOxPxmLOEFcI ZwNKSCzBXTOqhvNvJRaJ2QGiDTk4ZqThIFHB5tsZqzVg96yMbEuUoJoIic3zd9pY DVAhSsbhAL6ZvJBs1sx1T+Q4qKJKTkzOm/BgVR0dnwNxLUqIEP6GumQpZQJ9Wj5V RqnpCMaXFuAcFH82QeWKjskf0kDHHtRYfYMiuiPXiJ1HxJo58tnRIgQTrHNenseq oPqszGbbwCgtCpnlU//+6VO5odLZvxmUqVPW8VsFTFFJEJa+eF8+eLmn+bsbNE9p LU+eOesvMoZmlQ7zIlbZQdT3zf1pON1OnwJRL6IbCVFN3hMCAZaNal/nrHx2tE2C pjp3xmEXPon4i6G7QIv6aWJjAq9ja6QtxBUl9A50WUsrrDXiC8MHa+Iz1t2zBCzu vKmmCWhuZUVuo3MKyeUA8u4qRLK+/hr/wRWfuxkQieeVcRVwhhU= =1BJR -----END PGP SIGNATURE----- --g9War/4atCYQ6sbn--