guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fixing non-reproducibility in some guile packages (was: guile2.2-gdbm-ff


From: Christopher Allan Webber
Subject: Fixing non-reproducibility in some guile packages (was: guile2.2-gdbm-ffi issue)
Date: Sat, 11 Feb 2017 11:08:14 -0600
User-agent: mu4e 0.9.18; emacs 25.1.1

Christopher Allan Webber writes:

> (Originally accidentally sent this to address@hidden ... sorry!)
>
> Hiya,
>
> I pushed guile2.2-gdbm because it was just a couple of lines and it
> seemed to work and didn't affect anything.  I made a mistake though that
> I didn't realize until I ran
> "guix environment --ad-hoc guile-next guile2.2-gdbm-ffi --pure".
> The trivial-build-system in guile-gdbm-ffi dumps the built module into
> (string-append out "/share/guile/site/2.0") ... oops!  Before I ran
> --pure, the 2.0 directory was on my load path, and thus I didn't bump
> into the error.  (Maybe I should have asked for review anyway...)
>
> I'm trying to think of how to fix this.  I have a very kludgy solution
> attached.  I don't feel great about it but I don't know how to signal to
> the builder whether it's using guile 2.2 or 2.0 otherwise.  Thoughts?

It turns out there was a more serious issue involved here.  The guile
input was never used... instead, we were compiling from whatever guile
process guix was using to run by using the compile-file procedure from
(system base compile).

I think this is a pretty serious bug.  It means that guile-gdbm-ffi was
never properly reproducible by our standard methods of determining
inputs.  This is entirely my fault, since I'm the one who put together
these packages.

The guile-wisp package also has this issue.  I'm going to work on a fix
for it.  In the meanwhile, here's a patch that both fixes
guile2.2-gdbm-ffi and fixes the forementioned reproducibility problem.

 - Chris

From b718720d72f1da7655db49ec6ec25b658b0ca27f Mon Sep 17 00:00:00 2001
From: Christopher Allan Webber <address@hidden>
Date: Fri, 10 Feb 2017 19:24:57 -0600
Subject: [PATCH] guile-gdbm-ffi: Write to correct guile output directory and
 use guild.

* gnu/packages/guile.scm (make-guile-gdbm-ffi): New variable.
Adapts from the previous guile-gdbm-ffi definition.  Also fixes
a bug where the guild command was not getting called, and instead
was calling the internal guile compile-file procedure.  This meant
that the package produced was dependent on whatever version of
guile was powering Guix at the time.
(guile-gdbm-ffi, guile2.2-gdbm-ffi): Use make-guile-gdbm-ffi.
---
 gnu/packages/guile.scm | 29 +++++++++++++++++++----------
 1 file changed, 19 insertions(+), 10 deletions(-)

diff --git a/gnu/packages/guile.scm b/gnu/packages/guile.scm
index 3e8ab007b..a02e4887a 100644
--- a/gnu/packages/guile.scm
+++ b/gnu/packages/guile.scm
@@ -825,9 +825,11 @@ inspired by the SCSH regular expression system.")
 ;; There are two guile-gdbm packages, one using the FFI and one with
 ;; direct C bindings, hence the verbose name.
 
-(define-public guile-gdbm-ffi
+(define (make-guile-gdbm-ffi guile-2.2?)
   (package
-    (name "guile-gdbm-ffi")
+    (name (if guile-2.2?
+              "guile2.2-gdbm-ffi"
+              "guile-gdbm-ffi"))
     (version "20120209.fa1d5b6")
     (source (origin
               (method git-fetch)
@@ -844,11 +846,12 @@ inspired by the SCSH regular expression system.")
        ((guix build utils))
        #:builder
        (begin
-         (use-modules (guix build utils)
-                      (system base compile))
+         (use-modules (guix build utils))
 
          (let* ((out (assoc-ref %outputs "out"))
-                (module-dir (string-append out "/share/guile/site/2.0"))
+                (module-dir (string-append out "/share/guile/site/"
+                                           ,(if guile-2.2?
+                                                "2.2" "2.0")))
                 (source (assoc-ref %build-inputs "source"))
                 (doc (string-append out "/share/doc"))
                 (guild (string-append (assoc-ref %build-inputs "guile")
@@ -856,7 +859,10 @@ inspired by the SCSH regular expression system.")
                 (gdbm.scm-dest
                  (string-append module-dir "/gdbm.scm"))
                 (gdbm.go-dest
-                 (string-append module-dir "/gdbm.go")))
+                 (string-append module-dir "/gdbm.go"))
+                (compile-file
+                 (lambda (in-file out-file)
+                   (system* guild "compile" "-o" out-file in-file))))
            ;; Make installation directories.
            (mkdir-p module-dir)
            (mkdir-p doc)
@@ -874,10 +880,10 @@ inspired by the SCSH regular expression system.")
                       (assoc-ref %build-inputs "gdbm"))))
 
            ;; compile to the destination
-           (compile-file gdbm.scm-dest
-                         #:output-file gdbm.go-dest)))))
+           (compile-file gdbm.scm-dest gdbm.go-dest)))))
     (inputs
-     `(("guile" ,guile-2.0)))
+     `(("guile" ,(if guile-2.2?
+                     guile-next guile-2.0))))
     (propagated-inputs
      `(("gdbm" ,gdbm)))
     (home-page "https://github.com/ijp/guile-gdbm";)
@@ -887,8 +893,11 @@ inspired by the SCSH regular expression system.")
 Guile's foreign function interface.")
     (license gpl3+)))
 
+(define-public guile-gdbm-ffi
+  (make-guile-gdbm-ffi #f))
+
 (define-public guile2.2-gdbm-ffi
-  (package-for-guile-2.2 guile-gdbm-ffi))
+  (make-guile-gdbm-ffi #t))
 
 (define-public guile-sqlite3
   (let ((commit "607721fe1174a299e45d457acacf94eefb964071"))
-- 
2.11.0

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]