guix-commits
[Top][All Lists]
Advanced

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

02/13: guix: ruby-build-system: Add replace-git-ls-files.


From: Ben Woodcroft
Subject: 02/13: guix: ruby-build-system: Add replace-git-ls-files.
Date: Wed, 10 Aug 2016 11:57:34 +0000 (UTC)

benwoodcroft pushed a commit to branch wip-rails
in repository guix.

commit eae6c1d0d72abc29e019970aa6c7e30dfe874a4c
Author: Ben Woodcroft <address@hidden>
Date:   Mon Jul 25 21:53:35 2016 +1000

    guix: ruby-build-system: Add replace-git-ls-files.
    
    * guix/build/ruby-build-system.scm (replace-git-ls-files): New variable.
    (%standard-phases): Add it.
---
 guix/build/ruby-build-system.scm |   19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/guix/build/ruby-build-system.scm b/guix/build/ruby-build-system.scm
index 95793f7..c2d2766 100644
--- a/guix/build/ruby-build-system.scm
+++ b/guix/build/ruby-build-system.scm
@@ -1,7 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2015 David Thompson <address@hidden>
 ;;; Copyright © 2015 Pjotr Prins <address@hidden>
-;;; Copyright © 2015 Ben Woodcroft <address@hidden>
+;;; Copyright © 2015, 2016 Ben Woodcroft <address@hidden>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -69,6 +69,16 @@ directory."
 (define (first-gemspec)
   (first-matching-file "\\.gemspec$"))
 
+(define* (replace-git-ls-files #:key source #:allow-other-keys)
+  "Many gemspec files downloaded from outside rubygems.org use `git ls-files`
+to list of the files to be included in the built gem.  However, since this
+operation is not deterministic, we replace it with `find`."
+  (when (not (gem-archive? source))
+    (let ((gemspec (first-gemspec)))
+      (substitute* gemspec
+        (("`git ls-files`") "`find . -type f |sort`"))))
+  #t)
+
 (define* (extract-gemspec #:key source #:allow-other-keys)
   "Remove the original gemspec, if present, and replace it with a new one.
 This avoids issues with upstream gemspecs requiring tools such as git to
@@ -162,11 +172,12 @@ GEM-FLAGS are passed to the 'gem' invokation, if present."
 (define %standard-phases
   (modify-phases gnu:%standard-phases
     (delete 'configure)
+    (replace 'unpack unpack)
     (add-before 'build 'extract-gemspec extract-gemspec)
+    (add-after 'extract-gemspec 'replace-git-ls-files replace-git-ls-files)
     (replace 'build build)
-    (replace 'unpack unpack)
-    (replace 'install install)
-    (replace 'check check)))
+    (replace 'check check)
+    (replace 'install install)))
 
 (define* (ruby-build #:key inputs (phases %standard-phases)
                      #:allow-other-keys #:rest args)



reply via email to

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