From ab149c6ba0d19dfd6e15f2324cf9e3d6e2944ac5 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Fri, 8 Feb 2019 10:20:53 +0000 Subject: gnu: ruby-build-system: Change extract-gemspec to always return #t. * guix/build/ruby-build-system.scm (extract-gemspec): Return #t right at the end, rather than returning # when not handling a gem archive. --- guix/build/ruby-build-system.scm | 45 ++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 22 deletions(-) (limited to 'guix') diff --git a/guix/build/ruby-build-system.scm b/guix/build/ruby-build-system.scm index 3a658e2557..cdabd829e2 100644 --- a/guix/build/ruby-build-system.scm +++ b/guix/build/ruby-build-system.scm @@ -86,28 +86,29 @@ operation is not deterministic, we replace it with `find`." "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 generate the files list." - (when (gem-archive? source) - (let ((gemspec (or (false-if-exception (first-gemspec)) - ;; Make new gemspec if one wasn't shipped. - ".gemspec"))) - - (when (file-exists? gemspec) (delete-file gemspec)) - - ;; Extract gemspec from source gem. - (let ((pipe (open-pipe* OPEN_READ "gem" "spec" "--ruby" source))) - (dynamic-wind - (const #t) - (lambda () - (call-with-output-file gemspec - (lambda (out) - ;; 'gem spec' writes to stdout, but 'gem build' only reads - ;; gemspecs from a file, so we redirect the output to a file. - (while (not (eof-object? (peek-char pipe))) - (write-char (read-char pipe) out)))) - #t) - (lambda () - (close-pipe pipe))))) - #t)) + (if (gem-archive? source) + (let ((gemspec (or (false-if-exception (first-gemspec)) + ;; Make new gemspec if one wasn't shipped. + ".gemspec"))) + + (when (file-exists? gemspec) (delete-file gemspec)) + + ;; Extract gemspec from source gem. + (let ((pipe (open-pipe* OPEN_READ "gem" "spec" "--ruby" source))) + (dynamic-wind + (const #t) + (lambda () + (call-with-output-file gemspec + (lambda (out) + ;; 'gem spec' writes to stdout, but 'gem build' only reads + ;; gemspecs from a file, so we redirect the output to a file. + (while (not (eof-object? (peek-char pipe))) + (write-char (read-char pipe) out)))) + #t) + (lambda () + (close-pipe pipe))))) + (display "extract-gemspec: skipping as source is not a gem archive\n")) + #t) (define* (build #:key source #:allow-other-keys) "Build a new gem using the gemspec from the SOURCE gem." -- cgit v1.2.3 From 9be39b4c67c733058c3b709e897a8477605f6d4a Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Fri, 8 Feb 2019 10:22:39 +0000 Subject: guix: ruby-build-system: Do gem install --verbose. This is helpful as it displays more information about what gem install is doing, especially for packages with native extensions. * guix/build/ruby-build-system.scm (install): Add --verbose to gem install command. --- guix/build/ruby-build-system.scm | 1 + 1 file changed, 1 insertion(+) (limited to 'guix') diff --git a/guix/build/ruby-build-system.scm b/guix/build/ruby-build-system.scm index cdabd829e2..64b4400f1a 100644 --- a/guix/build/ruby-build-system.scm +++ b/guix/build/ruby-build-system.scm @@ -144,6 +144,7 @@ GEM-FLAGS are passed to the 'gem' invokation, if present." (or (zero? (apply system* "gem" "install" gem-file + "--verbose" "--local" "--ignore-dependencies" "--vendor" ;; Executables should go into /bin, not ;; /lib/ruby/gems. -- cgit v1.2.3 From 0168473c0a74ff1f3429e94fdb308cd20e3ea4e8 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Fri, 8 Feb 2019 19:50:29 +0000 Subject: guix: ruby-build-system: Fix removal of extension related files. This functionality was broken, possibly to do with the vendor related changes in the ruby build system. These changes restore the file removal functionality at the end of the install phase. * guix/build/ruby-build-system.scm (install): Fix removal of files related to native extensions. --- guix/build/ruby-build-system.scm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'guix') diff --git a/guix/build/ruby-build-system.scm b/guix/build/ruby-build-system.scm index 64b4400f1a..ba0de1259e 100644 --- a/guix/build/ruby-build-system.scm +++ b/guix/build/ruby-build-system.scm @@ -139,7 +139,8 @@ GEM-FLAGS are passed to the 'gem' invokation, if present." (gem-file-basename (basename gem-file)) (gem-name (substring gem-file-basename 0 - (- (string-length gem-file-basename) 4)))) + (- (string-length gem-file-basename) 4))) + (gem-dir (string-append vendor-dir "/gems/" gem-name))) (setenv "GEM_VENDOR" vendor-dir) (or (zero? @@ -165,7 +166,7 @@ GEM-FLAGS are passed to the 'gem' invokation, if present." ;; For gems with native extensions, several Makefile-related files ;; are created that contain timestamps or other elements making ;; them not reproducible. They are unnecessary so we remove them. - (when (file-exists? (string-append vendor-dir "/ext")) + (when (file-exists? (string-append gem-dir "/ext")) (for-each (lambda (file) (log-file-deletion file) (delete-file file)) @@ -174,7 +175,7 @@ GEM-FLAGS are passed to the 'gem' invokation, if present." "page-Makefile.ri") (find-files (string-append vendor-dir "/extensions") "gem_make.out") - (find-files (string-append vendor-dir "/ext") + (find-files (string-append gem-dir "/ext") "Makefile")))) #t)) -- cgit v1.2.3 From 0244952c11c0409597fce5c39dfbcafdfd2ea651 Mon Sep 17 00:00:00 2001 From: Efraim Flashner Date: Thu, 28 Mar 2019 19:17:34 +0200 Subject: build-system/ruby: Use invoke. * guix/build/ruby-build-system.scm (install): Use invoke. --- guix/build/ruby-build-system.scm | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'guix') diff --git a/guix/build/ruby-build-system.scm b/guix/build/ruby-build-system.scm index ba0de1259e..49400b204d 100644 --- a/guix/build/ruby-build-system.scm +++ b/guix/build/ruby-build-system.scm @@ -143,14 +143,13 @@ GEM-FLAGS are passed to the 'gem' invokation, if present." (gem-dir (string-append vendor-dir "/gems/" gem-name))) (setenv "GEM_VENDOR" vendor-dir) - (or (zero? - (apply system* "gem" "install" gem-file - "--verbose" - "--local" "--ignore-dependencies" "--vendor" - ;; Executables should go into /bin, not - ;; /lib/ruby/gems. - "--bindir" (string-append out "/bin") - gem-flags)) + (or (apply invoke "gem" "install" gem-file + "--verbose" + "--local" "--ignore-dependencies" "--vendor" + ;; Executables should go into /bin, not + ;; /lib/ruby/gems. + "--bindir" (string-append out "/bin") + gem-flags) (begin (let ((failed-output-dir (string-append (getcwd) "/out"))) (mkdir failed-output-dir) -- cgit v1.2.3 From 7c86fdda7ceed11377b0e17b47c91598be59be52 Mon Sep 17 00:00:00 2001 From: Efraim Flashner Date: Thu, 28 Mar 2019 20:18:02 +0200 Subject: Revert "build-system/ruby: Use invoke." This reverts commit 0244952c11c0409597fce5c39dfbcafdfd2ea651. We prefer 'invoke', but the custom error handling works better with the code as-is. --- guix/build/ruby-build-system.scm | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'guix') diff --git a/guix/build/ruby-build-system.scm b/guix/build/ruby-build-system.scm index 49400b204d..63c94765f7 100644 --- a/guix/build/ruby-build-system.scm +++ b/guix/build/ruby-build-system.scm @@ -143,13 +143,16 @@ GEM-FLAGS are passed to the 'gem' invokation, if present." (gem-dir (string-append vendor-dir "/gems/" gem-name))) (setenv "GEM_VENDOR" vendor-dir) - (or (apply invoke "gem" "install" gem-file - "--verbose" - "--local" "--ignore-dependencies" "--vendor" - ;; Executables should go into /bin, not - ;; /lib/ruby/gems. - "--bindir" (string-append out "/bin") - gem-flags) + (or (zero? + ;; 'zero? system*' allows the custom error handling to function as + ;; expected, while 'invoke' raises its own exception. + (apply system* "gem" "install" gem-file + "--verbose" + "--local" "--ignore-dependencies" "--vendor" + ;; Executables should go into /bin, not + ;; /lib/ruby/gems. + "--bindir" (string-append out "/bin") + gem-flags)) (begin (let ((failed-output-dir (string-append (getcwd) "/out"))) (mkdir failed-output-dir) -- cgit v1.2.3