Subject: bug#44736: closed (Re: bug#44736: [Shepherd PATCH] build: Add guix.scm helper file.)

From: [email-masked] (GNU bug Tracking System)
Date: Fri, 02 Jun 2023 13:55:02 +0000

Your bug report

#44736: [Shepherd PATCH] build: Add guix.scm helper file.

which was filed against the guix-patches package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
44736: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=44736
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#44736: [Shepherd PATCH] build: Add guix.scm helper file.
From: Ludovic Courtès <[email-masked]>
To: Efraim Flashner <[email-masked]>
Cc: [email-masked]
Date: Fri, 02 Jun 2023 15:54:02 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi,

Efraim Flashner <[email-masked]> skribis:

> * build-aux/guix.scm: New file.

I did something similar quite recently in the Shepherd.  Closing!

Ludo’.

Subject: [Shepherd PATCH] build: Add guix.scm helper file.
From: Efraim Flashner <[email-masked]>
To: [email-masked]
Cc: Efraim Flashner <[email-masked]>
Date: Thu, 19 Nov 2020 14:52:44 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

* build-aux/guix.scm: New file.
---
 build-aux/guix.scm | 52 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)
 create mode 100644 build-aux/guix.scm

diff --git a/build-aux/guix.scm b/build-aux/guix.scm
new file mode 100644
index 0000000..ea9c63f
--- /dev/null
+++ b/build-aux/guix.scm
@@ -0,0 +1,52 @@
+;;; guix.scm -- Guix package definition
+
+(use-modules
+  (guix packages)
+  ((guix git-download) #:select (git-version))
+  ((guix build utils) #:select (find-files))
+  ((guix gexp) #:select (local-file))
+  ((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=/var")
+       #:make-flags (list "GUILE_AUTO_COMPILE=0")
+       #: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"))
+      ;; This version FTBFS due to an import of '(ice-9 threads)' in modules/shepherd.scm
+      ;(build-from-git (specification->package "guile2.0-shepherd"))
+      )
-- 
2.29.2