guix-commits
[Top][All Lists]
Advanced

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

01/07: build: ruby-build-system: Adjust replace-git-ls-files.


From: guix-commits
Subject: 01/07: build: ruby-build-system: Adjust replace-git-ls-files.
Date: Tue, 1 Sep 2020 13:20:04 -0400 (EDT)

apteryx pushed a commit to branch core-updates
in repository guix.

commit a7b1cc333eedcfb8630fe98bfac43bf8ad86b962
Author: Maxim Cournoyer <maxim.cournoyer@gmail.com>
AuthorDate: Sat Jul 11 15:03:48 2020 -0400

    build: ruby-build-system: Adjust replace-git-ls-files.
    
    The file names returned by `find ...` instead of `git ls-files...` contains
    leading './' characters, which can cause problems when the file lists is
    further processed with regexps, for example, as was discovered while 
updating
    the ruby-asciidoctor package in commit
    5df1126c3adf557f3a5b386e391e7cb56b9c1d63.
    
    * guix/build/ruby-build-system.scm (replace-git-ls-files): Strip the first 
two
    characters ("./") of the file names returned by the 'find' command.  Fix 
typo
    in doc.  Simplify '(when (not ...' into '(unless ...'.
---
 guix/build/ruby-build-system.scm | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/guix/build/ruby-build-system.scm b/guix/build/ruby-build-system.scm
index c957a61..8a421c1 100644
--- a/guix/build/ruby-build-system.scm
+++ b/guix/build/ruby-build-system.scm
@@ -2,6 +2,7 @@
 ;;; Copyright © 2015 David Thompson <davet@gnu.org>
 ;;; Copyright © 2015 Pjotr Prins <pjotr.public01@thebird.nl>
 ;;; Copyright © 2015, 2016 Ben Woodcroft <donttrustben@gmail.com>
+;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -73,13 +74,19 @@ directory."
 
 (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
+to list 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))
+  (unless (gem-archive? source)
     (let ((gemspec (first-gemspec)))
+      ;; Do not include the freshly built .gem itself as it causes problems.
+      ;; Strip the first 2 characters ("./") to more exactly match the output
+      ;; given by 'git ls-files'.  This is useful to prevent breaking regexps
+      ;; that could be used to filter the list of files.
       (substitute* gemspec
-        (("`git ls-files`") "`find . -type f |sort`")
-        (("`git ls-files -z`") "`find . -type f -print0 |sort -z`"))))
+        (("`git ls-files`")
+         "`find . -type f -not -regex '.*\\.gem$' | sort | cut -c3-`")
+        (("`git ls-files -z`")
+         "`find . -type f -not -regex '.*\\.gem$' -print0 | sort -z | cut 
-zc3-`"))))
   #t)
 
 (define* (extract-gemspec #:key source #:allow-other-keys)



reply via email to

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