From 4cc2ed98cf7837e042ad4234c91fe730259a7170 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 28 Aug 2015 22:07:05 +0200 Subject: utils: Add 'install-file'. * guix/build/utils.scm (install-file): New procedure. --- guix/build/utils.scm | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'guix') diff --git a/guix/build/utils.scm b/guix/build/utils.scm index 676a0120e3..16406930b5 100644 --- a/guix/build/utils.scm +++ b/guix/build/utils.scm @@ -43,6 +43,7 @@ ar-file? with-directory-excursion mkdir-p + install-file copy-recursively delete-file-recursively file-name-predicate @@ -197,6 +198,12 @@ with the bytes in HEADER, a bytevector." (apply throw args)))))) (() #t)))) +(define (install-file file directory) + "Create DIRECTORY if it does not exist and copy FILE in there under the same +name." + (mkdir-p directory) + (copy-file file (string-append directory "/" (basename file)))) + (define* (copy-recursively source destination #:key (log (current-output-port)) -- cgit v1.2.3 From 5c962e93e501039ae2658f3c9d5cfe45d50d6396 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 30 Aug 2015 14:08:44 +0200 Subject: build-system/gnu: Use monotic time to measure elapsed time. * guix/build/gnu-build-system.scm (gnu-build)[elapsed-time]: New procedure. Use it, and use (current-time time-monotonic) instead of (gettimeofday). Show one digit after the comma for the elapsed time. --- guix/build/gnu-build-system.scm | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'guix') diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm index 102207b022..0a774e1e84 100644 --- a/guix/build/gnu-build-system.scm +++ b/guix/build/gnu-build-system.scm @@ -25,6 +25,7 @@ #:use-module (ice-9 regex) #:use-module (ice-9 format) #:use-module (srfi srfi-1) + #:use-module (srfi srfi-19) #:use-module (srfi srfi-26) #:use-module (rnrs io ports) #:export (%standard-phases @@ -576,6 +577,11 @@ DOCUMENTATION-COMPRESSOR-FLAGS." #:rest args) "Build from SOURCE to OUTPUTS, using INPUTS, and by running all of PHASES in order. Return #t if all the PHASES succeeded, #f otherwise." + (define (elapsed-time end start) + (let ((diff (time-difference end start))) + (+ (time-second diff) + (/ (time-nanosecond diff) 1e9)))) + (setvbuf (current-output-port) _IOLBF) (setvbuf (current-error-port) _IOLBF) @@ -586,12 +592,13 @@ in order. Return #t if all the PHASES succeeded, #f otherwise." ;; PHASES can pick the keyword arguments it's interested in. (every (match-lambda ((name . proc) - (let ((start (gettimeofday))) + (let ((start (current-time time-monotonic))) (format #t "starting phase `~a'~%" name) (let ((result (apply proc args)) - (end (gettimeofday))) - (format #t "phase `~a' ~:[failed~;succeeded~] after ~a seconds~%" - name result (- (car end) (car start))) + (end (current-time time-monotonic))) + (format #t "phase `~a' ~:[failed~;succeeded~] after ~,1f seconds~%" + name result + (elapsed-time end start)) ;; Dump the environment variables as a shell script, for handy debugging. (system "export > $NIX_BUILD_TOP/environment-variables") -- cgit v1.2.3 From b7c7c03eb5e37fc3455e4e17b0898ffc4bca29c3 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 30 Aug 2015 14:38:10 +0200 Subject: utils: Add 'strip-store-file-name'. * guix/build/utils.scm (strip-store-file-name): New procedure. * guix/build/emacs-build-system.scm (store-directory->name-version): Remove. Update callers to use 'strip-store-file-name'. * gnu/packages/gcc.scm (make-libstdc++-doc)[arguments]: Use 'strip-store-file-name' instead of 'string-drop'. --- gnu/packages/gcc.scm | 6 +----- guix/build/emacs-build-system.scm | 17 +++++------------ guix/build/utils.scm | 7 +++++++ 3 files changed, 13 insertions(+), 17 deletions(-) (limited to 'guix') diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm index 761d3a6998..dcac16d752 100644 --- a/gnu/packages/gcc.scm +++ b/gnu/packages/gcc.scm @@ -578,11 +578,7 @@ using compilers other than GCC." (("@XSL_STYLE_DIR@") (string-append docbook "/xml/xsl/" - (string-drop - docbook - (+ 34 - (string-length - (%store-directory)))))))))) + (strip-store-file-name docbook))))))) (replace 'build (lambda _ ;; XXX: There's also a 'doc-info' target, but it diff --git a/guix/build/emacs-build-system.scm b/guix/build/emacs-build-system.scm index f18db0aadd..1c48a1ab2e 100644 --- a/guix/build/emacs-build-system.scm +++ b/guix/build/emacs-build-system.scm @@ -83,7 +83,7 @@ store in '.el' files." (let* ((out (assoc-ref outputs "out")) (elpa-name-ver (store-directory->elpa-name-version out)) (el-dir (string-append out %install-suffix "/" elpa-name-ver)) - (name-ver (store-directory->name-version out)) + (name-ver (strip-store-file-name out)) (info-dir (string-append out "/share/info/" name-ver)) (info-files (find-files el-dir "\\.info$"))) (unless (null? info-files) @@ -116,7 +116,7 @@ store in '.el' files." (filter (match-lambda ((label . directory) (emacs-package? ((compose package-name->name+version - store-directory->name-version) + strip-store-file-name) directory))) (_ #f)) inputs)) @@ -138,25 +138,18 @@ DIRS." (define (package-name-version->elpa-name-version name-ver) "Convert the Guix package NAME-VER to the corresponding ELPA name-version format. Essnetially drop the prefix used in Guix." - (let ((name (store-directory->name-version name-ver))) + (let ((name (strip-store-file-name name-ver))) (if (emacs-package? name-ver) - (store-directory->name-version name-ver) + (strip-store-file-name name-ver) name-ver))) (define (store-directory->elpa-name-version store-dir) "Given a store directory STORE-DIR return the part of the basename after the second hyphen. This corresponds to 'name-version' as used in ELPA packages." ((compose package-name-version->elpa-name-version - store-directory->name-version) + strip-store-file-name) store-dir)) -(define (store-directory->name-version store-dir) - "Given a store directory STORE-DIR return the part of the basename -after the first hyphen. This corresponds to 'name-version' of the package." - (let* ((base (basename store-dir))) - (string-drop base - (+ 1 (string-index base #\-))))) - ;; from (guix utils). Should we put it in (guix build utils)? (define (package-name->name+version name) "Given NAME, a package name like \"foo-0.9.1b\", return two values: diff --git a/guix/build/utils.scm b/guix/build/utils.scm index 16406930b5..b0abc69f0e 100644 --- a/guix/build/utils.scm +++ b/guix/build/utils.scm @@ -33,6 +33,7 @@ alist-delete) #:export (%store-directory store-file-name? + strip-store-file-name parallel-job-count directory-exists? @@ -87,6 +88,12 @@ "Return true if FILE is in the store." (string-prefix? (%store-directory) file)) +(define (strip-store-file-name file) + "Strip the '/gnu/store' and hash from FILE, a store file name. The result +is typically a \"PACKAGE-VERSION\" string." + (string-drop file + (+ 34 (string-length (%store-directory))))) + (define parallel-job-count ;; Number of processes to be passed next to GNU Make's `-j' argument. (make-parameter -- cgit v1.2.3 From 8c578a609478f808e4350c0140ca0b15c5bed0f2 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 30 Aug 2015 14:59:31 +0200 Subject: utils: Move 'package-name->name+version' to (guix build utils). * guix/utils.scm (package-name->name+version): Move to... * guix/build/utils.scm (package-name->name+version): ... here. New procedure. * guix/build/emacs-build-system.scm (package-name->name+version): Remove. --- guix/build/emacs-build-system.scm | 22 ---------------------- guix/build/utils.scm | 23 +++++++++++++++++++++++ guix/utils.scm | 26 +++----------------------- 3 files changed, 26 insertions(+), 45 deletions(-) (limited to 'guix') diff --git a/guix/build/emacs-build-system.scm b/guix/build/emacs-build-system.scm index 1c48a1ab2e..aacb5a4186 100644 --- a/guix/build/emacs-build-system.scm +++ b/guix/build/emacs-build-system.scm @@ -150,28 +150,6 @@ second hyphen. This corresponds to 'name-version' as used in ELPA packages." strip-store-file-name) store-dir)) -;; from (guix utils). Should we put it in (guix build utils)? -(define (package-name->name+version name) - "Given NAME, a package name like \"foo-0.9.1b\", return two values: -\"foo\" and \"0.9.1b\". When the version part is unavailable, NAME and -#f are returned. The first hyphen followed by a digit is considered to -introduce the version part." - ;; See also `DrvName' in Nix. - - (define number? - (cut char-set-contains? char-set:digit <>)) - - (let loop ((chars (string->list name)) - (prefix '())) - (match chars - (() - (values name #f)) - ((#\- (? number? n) rest ...) - (values (list->string (reverse prefix)) - (list->string (cons n rest)))) - ((head tail ...) - (loop tail (cons head prefix)))))) - (define %standard-phases (modify-phases gnu:%standard-phases (delete 'configure) diff --git a/guix/build/utils.scm b/guix/build/utils.scm index b0abc69f0e..27207423c0 100644 --- a/guix/build/utils.scm +++ b/guix/build/utils.scm @@ -21,6 +21,7 @@ (define-module (guix build utils) #:use-module (srfi srfi-1) #:use-module (srfi srfi-11) + #:use-module (srfi srfi-26) #:use-module (srfi srfi-60) #:use-module (ice-9 ftw) #:use-module (ice-9 match) @@ -34,6 +35,7 @@ #:export (%store-directory store-file-name? strip-store-file-name + package-name->name+version parallel-job-count directory-exists? @@ -94,6 +96,27 @@ is typically a \"PACKAGE-VERSION\" string." (string-drop file (+ 34 (string-length (%store-directory))))) +(define (package-name->name+version name) + "Given NAME, a package name like \"foo-0.9.1b\", return two values: +\"foo\" and \"0.9.1b\". When the version part is unavailable, NAME and +#f are returned. The first hyphen followed by a digit is considered to +introduce the version part." + ;; See also `DrvName' in Nix. + + (define number? + (cut char-set-contains? char-set:digit <>)) + + (let loop ((chars (string->list name)) + (prefix '())) + (match chars + (() + (values name #f)) + ((#\- (? number? n) rest ...) + (values (list->string (reverse prefix)) + (list->string (cons n rest)))) + ((head tail ...) + (loop tail (cons head prefix)))))) + (define parallel-job-count ;; Number of processes to be passed next to GNU Make's `-j' argument. (make-parameter diff --git a/guix/utils.scm b/guix/utils.scm index 44913c6159..4bfd88fbb3 100644 --- a/guix/utils.scm +++ b/guix/utils.scm @@ -29,7 +29,8 @@ #:use-module (srfi srfi-60) #:use-module (rnrs bytevectors) #:use-module ((rnrs io ports) #:select (put-bytevector)) - #:use-module ((guix build utils) #:select (dump-port)) + #:use-module ((guix build utils) + #:select (dump-port package-name->name+version)) #:use-module ((guix build syscalls) #:select (errno mkdtemp!)) #:use-module (ice-9 vlist) #:use-module (ice-9 format) @@ -39,6 +40,7 @@ #:use-module (ice-9 match) #:use-module (ice-9 format) #:use-module (system foreign) + #:re-export (package-name->name+version) #:export (bytevector->base16-string base16-string->bytevector @@ -71,7 +73,6 @@ version-prefix version-major+minor guile-version>? - package-name->name+version string-replace-substring arguments-from-environment-variable file-extension @@ -573,27 +574,6 @@ minor version numbers from version-string." (micro-version)) str)) -(define (package-name->name+version name) - "Given NAME, a package name like \"foo-0.9.1b\", return two values: -\"foo\" and \"0.9.1b\". When the version part is unavailable, NAME and -#f are returned. The first hyphen followed by a digit is considered to -introduce the version part." - ;; See also `DrvName' in Nix. - - (define number? - (cut char-set-contains? char-set:digit <>)) - - (let loop ((chars (string->list name)) - (prefix '())) - (match chars - (() - (values name #f)) - ((#\- (? number? n) rest ...) - (values (list->string (reverse prefix)) - (list->string (cons n rest)))) - ((head tail ...) - (loop tail (cons head prefix)))))) - (define (file-extension file) "Return the extension of FILE or #f if there is none." (let ((dot (string-rindex file #\.))) -- cgit v1.2.3 From df2d51f025fc7d106f837da3a2426bb7eddc76a9 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 30 Aug 2015 22:52:49 +0200 Subject: gexp: Remove duplicate 'mkdir-p' definition. * guix/gexp.scm (%mkdir-p-definition): Remove. (%utils-module): New variable. (imported-files, compiled-modules): Have gexp load %UTILS-MODULE instead of using %MKDIR-P-DEFINITION. --- guix/gexp.scm | 39 ++++++++------------------------------- 1 file changed, 8 insertions(+), 31 deletions(-) (limited to 'guix') diff --git a/guix/gexp.scm b/guix/gexp.scm index 63af40aed9..de49fef088 100644 --- a/guix/gexp.scm +++ b/guix/gexp.scm @@ -717,32 +717,11 @@ and in the current monad setting (system type, etc.)" ;;; Module handling. ;;; -(define %mkdir-p-definition - ;; The code for 'mkdir-p' is copied from (guix build utils). We use it in - ;; derivations that cannot use the #:modules argument of 'gexp->derivation' - ;; precisely because they implement that functionality. - (gexp - (define (mkdir-p dir) - (define absolute? - (string-prefix? "/" dir)) - - (define not-slash - (char-set-complement (char-set #\/))) - - (let loop ((components (string-tokenize dir not-slash)) - (root (if absolute? "" "."))) - (match components - ((head tail ...) - (let ((path (string-append root "/" head))) - (catch 'system-error - (lambda () - (mkdir path) - (loop tail path)) - (lambda args - (if (= EEXIST (system-error-errno args)) - (loop tail path) - (apply throw args)))))) - (() #t)))))) +(define %utils-module + ;; This file provides 'mkdir-p', needed to implement 'imported-files' and + ;; other primitives below. + (local-file (search-path %load-path "guix/build/utils.scm") + "build-utils.scm")) (define* (imported-files files #:key (name "file-import") @@ -763,10 +742,9 @@ system, imported, and appears under FINAL-PATH in the resulting store path." (define build (gexp (begin + (primitive-load (ungexp %utils-module)) ;for 'mkdir-p' (use-modules (ice-9 match)) - (ungexp %mkdir-p-definition) - (mkdir (ungexp output)) (chdir (ungexp output)) (for-each (match-lambda ((final-path store-path) @@ -822,13 +800,12 @@ they can refer to each other." (define build (gexp (begin + (primitive-load (ungexp %utils-module)) ;for 'mkdir-p' + (use-modules (ice-9 ftw) - (ice-9 match) (srfi srfi-26) (system base compile)) - (ungexp %mkdir-p-definition) - (define (regular? file) (not (member file '("." "..")))) -- cgit v1.2.3 From 52c20d8e1517190ca5bfbaa9f83da17587b47e9c Mon Sep 17 00:00:00 2001 From: Mark H Weaver Date: Wed, 2 Sep 2015 19:59:12 -0400 Subject: packages: Add 'armhf-linux' to '%hydra-supported-systems'. * guix/packages.scm (%hydra-supported-systems): Do not remove 'armhf-linux' from it. It is now equal to '%supported-systems'. --- guix/packages.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guix') diff --git a/guix/packages.scm b/guix/packages.scm index 3983d1409a..d338ad230b 100644 --- a/guix/packages.scm +++ b/guix/packages.scm @@ -192,7 +192,7 @@ representation." (define %hydra-supported-systems ;; This is the list of system types for which build slaves are available. - (delete "armhf-linux" %supported-systems)) + %supported-systems) ;; A package. -- cgit v1.2.3 From 92226a470ddc980e54863632e5b179bf40444bd7 Mon Sep 17 00:00:00 2001 From: Mark H Weaver Date: Thu, 3 Sep 2015 12:51:47 -0400 Subject: Build tarballs with deterministic file ordering. * guix/packages.scm (patch-and-repack)[build], gnu/system/install.scm (self-contained-tarball)[build], gnu/packages/make-bootstrap.scm (tarball-package), gnu/packages/admin.scm (isc-dhcp), gnu/packages/video.scm (avidemux): Pass "--sort=name" to 'tar'. --- gnu/packages/admin.scm | 1 + gnu/packages/make-bootstrap.scm | 3 ++- gnu/packages/video.scm | 3 ++- gnu/system/install.scm | 7 ++++++- guix/packages.scm | 1 + 5 files changed, 12 insertions(+), 3 deletions(-) (limited to 'guix') diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm index 53cf65e11a..512d604982 100644 --- a/gnu/packages/admin.scm +++ b/gnu/packages/admin.scm @@ -428,6 +428,7 @@ connection alive.") (zero? (system* "tar" "cf" "bind.tar.gz" "bind-9.9.5-P1" ;; avoid non-determinism in the archive + "--sort=name" "--mtime=@0" "--owner=root:0" "--group=root:0")))) diff --git a/gnu/packages/make-bootstrap.scm b/gnu/packages/make-bootstrap.scm index 904aaedb73..d215a02ff0 100644 --- a/gnu/packages/make-bootstrap.scm +++ b/gnu/packages/make-bootstrap.scm @@ -629,7 +629,8 @@ for `sh' in $PATH, and without nscd, and with static NSS modules." ".tar.xz") "." ;; avoid non-determinism in the archive - "--mtime=@0" "--owner=root:0" "--group=root:0")))))))))) + "--sort=name" "--mtime=@0" + "--owner=root:0" "--group=root:0")))))))))) (define %bootstrap-binaries-tarball ;; A tarball with the statically-linked bootstrap binaries. diff --git a/gnu/packages/video.scm b/gnu/packages/video.scm index 79119ef43a..c2f88e22cc 100644 --- a/gnu/packages/video.scm +++ b/gnu/packages/video.scm @@ -1015,7 +1015,8 @@ for use with HTML5 video.") (("#! /bin/sh") (string-append "#!" (which "bash")))) (system* "tar" "cjf" "ffmpeg-2.6.1.tar.bz2" "ffmpeg-2.6.1" ;; avoid non-determinism in the archive - "--mtime=@0" "--owner=root:0" "--group=root:0") + "--sort=name" "--mtime=@0" + "--owner=root:0" "--group=root:0") (delete-file-recursively "ffmpeg-2.6.1"))) (alist-replace 'configure (lambda _ diff --git a/gnu/system/install.scm b/gnu/system/install.scm index e7e5d4ae9d..880236861e 100644 --- a/gnu/system/install.scm +++ b/gnu/system/install.scm @@ -74,8 +74,13 @@ under /root/.guix-profile where GUIX is installed." ;; length limitation. (with-directory-excursion %root (zero? (system* "tar" "--xz" "--format=gnu" - "--owner=root:0" "--group=root:0" + + ;; avoid non-determinism in the archive + "--sort=name" "--mtime=@0" ;for files in /var/guix + "--owner=root:0" + "--group=root:0" + "--check-links" "-cvf" #$output ;; Avoid adding / and /var to the tarball, diff --git a/guix/packages.scm b/guix/packages.scm index d338ad230b..d73e6b0abb 100644 --- a/guix/packages.scm +++ b/guix/packages.scm @@ -482,6 +482,7 @@ IMPORTED-MODULES specify modules to use/import for use by SNIPPET." (zero? (system* (string-append #+tar "/bin/tar") "cvfa" #$output directory ;; avoid non-determinism in the archive + "--sort=name" "--mtime=@0" "--owner=root:0" "--group=root:0"))))))) -- cgit v1.2.3 From 035b6ff7079576c37af88342c7ff6f904fbc6329 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 4 Sep 2015 13:40:55 +0200 Subject: packages: Define '%hurd-systems'. * guix/packages.scm (%hurd-systems): New variable. --- guix/packages.scm | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'guix') diff --git a/guix/packages.scm b/guix/packages.scm index d73e6b0abb..68ec236451 100644 --- a/guix/packages.scm +++ b/guix/packages.scm @@ -94,6 +94,7 @@ package-grafts %supported-systems + %hurd-systems %hydra-supported-systems supported-package? @@ -190,6 +191,10 @@ representation." ;; expect all packages to build successfully here. '("x86_64-linux" "i686-linux" "armhf-linux" "mips64el-linux")) +(define %hurd-systems + ;; The GNU/Hurd systems for which support is being developed. + '("i585-gnu" "i686-gnu")) + (define %hydra-supported-systems ;; This is the list of system types for which build slaves are available. %supported-systems) -- cgit v1.2.3 From f4ae827e26b1bbbd47ac05bb2a4278d5c61c828e Mon Sep 17 00:00:00 2001 From: Mark H Weaver Date: Sun, 6 Sep 2015 12:24:08 -0400 Subject: utils: find-files: Add DIRECTORIES? and FAIL-ON-ERROR? arguments. * guix/build/utils.scm (find-files): Add DIRECTORIES? and FAIL-ON-ERROR? keyword arguments. --- guix/build/utils.scm | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'guix') diff --git a/guix/build/utils.scm b/guix/build/utils.scm index 27207423c0..971929621a 100644 --- a/guix/build/utils.scm +++ b/guix/build/utils.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2012, 2013, 2014, 2015 Ludovic Courtès ;;; Copyright © 2013 Andreas Enge ;;; Copyright © 2013 Nikita Karetnikov +;;; Copyright © 2015 Mark H Weaver ;;; ;;; This file is part of GNU Guix. ;;; @@ -316,13 +317,16 @@ name matches REGEXP." (regexp-exec file-rx (basename file))))) (define* (find-files dir #:optional (pred (const #t)) - #:key (stat lstat)) + #:key (stat lstat) + directories? + fail-on-error?) "Return the lexicographically sorted list of files under DIR for which PRED returns true. PRED is passed two arguments: the absolute file name, and its stat buffer; the default predicate always returns true. PRED can also be a regular expression, in which case it is equivalent to (file-name-predicate PRED). STAT is used to obtain file information; using 'lstat' means that -symlinks are not followed." +symlinks are not followed. If DIRECTORIES? is true, then directories will +also be included. If FAIL-ON-ERROR? is true, raise an exception upon error." (let ((pred (if (procedure? pred) pred (file-name-predicate pred)))) @@ -333,7 +337,10 @@ symlinks are not followed." (cons file result) result)) (lambda (dir stat result) ; down - result) + (if (and directories? + (pred dir stat)) + (cons dir result) + result)) (lambda (dir stat result) ; up result) (lambda (file stat result) ; skip @@ -341,6 +348,8 @@ symlinks are not followed." (lambda (file stat errno result) (format (current-error-port) "find-files: ~a: ~a~%" file (strerror errno)) + (when fail-on-error? + (error "find-files failed")) result) '() dir -- cgit v1.2.3 From 140b4bc6cd4cda79ab48c3fecc8c98afeb02cdf6 Mon Sep 17 00:00:00 2001 From: Mark H Weaver Date: Sun, 6 Sep 2015 12:26:55 -0400 Subject: packages: Build tarballs in sorted order even if tar doesn't support it. This is a followup to commit 92226a470ddc980e54863632e5b179bf40444bd7. * guix/packages.scm (patch-and-repack)[build]: Determine if tar supports the "--sort=name" option using a run-time test. If not supported, generate the sorted file list with 'find-files' and pass it to tar using "--files-from". --- guix/packages.scm | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) (limited to 'guix') diff --git a/guix/packages.scm b/guix/packages.scm index 68ec236451..da4940981d 100644 --- a/guix/packages.scm +++ b/guix/packages.scm @@ -425,6 +425,13 @@ IMPORTED-MODULES specify modules to use/import for use by SNIPPET." (srfi srfi-1) (guix build utils)) + ;; The --sort option was added to GNU tar in version 1.28, released + ;; 2014-07-28. During bootstrap we must cope with older versions. + (define tar-supports-sort? + (zero? (system* (string-append #+tar "/bin/tar") + "cf" "/dev/null" "--files-from=/dev/null" + "--sort=name"))) + (define (apply-patch patch) (format (current-error-port) "applying '~a'...~%" patch) @@ -484,13 +491,25 @@ IMPORTED-MODULES specify modules to use/import for use by SNIPPET." #~()) (begin (chdir "..") #t) - (zero? (system* (string-append #+tar "/bin/tar") - "cvfa" #$output directory - ;; avoid non-determinism in the archive - "--sort=name" - "--mtime=@0" - "--owner=root:0" - "--group=root:0"))))))) + + (unless tar-supports-sort? + (call-with-output-file ".file_list" + (lambda (port) + (for-each (lambda (name) (format port "~a~%" name)) + (find-files directory + #:directories? #t + #:fail-on-error? #t))))) + (zero? (apply system* (string-append #+tar "/bin/tar") + "cvfa" #$output + ;; avoid non-determinism in the archive + "--mtime=@0" + "--owner=root:0" + "--group=root:0" + (if tar-supports-sort? + `("--sort=name" + ,directory) + '("--no-recursion" + "--files-from=.file_list"))))))))) (let ((name (tarxz-name original-file-name)) (modules (delete-duplicates (cons '(guix build utils) modules)))) -- cgit v1.2.3 From f47fbeb23aa9bafb8b60ab753a2943134fb08297 Mon Sep 17 00:00:00 2001 From: 宋文武 Date: Fri, 11 Sep 2015 20:09:40 +0800 Subject: build-system/glib-or-gtk: Don't generate 'icon-theme.cache'. * guix/build-system/glib-or-gtk.scm (default-gtk+): Remove. (lower): Adjust accordingly. * guix/build/glib-or-gtk-build-system.scm (generate-icon-cache): Remove. (%standard-phases): Remove 'glib-or-gtk-icon-cache' phase. --- guix/build-system/glib-or-gtk.scm | 18 +++--------------- guix/build/glib-or-gtk-build-system.scm | 28 ---------------------------- 2 files changed, 3 insertions(+), 43 deletions(-) (limited to 'guix') diff --git a/guix/build-system/glib-or-gtk.scm b/guix/build-system/glib-or-gtk.scm index a1f0a9b8a4..d585d84f20 100644 --- a/guix/build-system/glib-or-gtk.scm +++ b/guix/build-system/glib-or-gtk.scm @@ -36,7 +36,7 @@ ;; This build system is an extension of the 'gnu-build-system'. It ;; accomodates the needs of applications making use of glib or gtk+ (with "or" ;; to be interpreted in the mathematical sense). This is achieved by adding -;; three phases run after the 'install' phase: +;; two phases run after the 'install' phase: ;; ;; 'glib-or-gtk-wrap' phase: ;; @@ -57,11 +57,6 @@ ;; exists and does not include a file named "gschemas.compiled", then ;; "glib-compile-schemas" is run in that directory. ;; -;; 'glib-or-gtk-icon-cache' phase: -;; -;; Looks for the existence of icon themes and, if no cache exists, generate -;; the "icon-theme.cache" file. -;; ;; Code: (define %default-modules @@ -81,22 +76,16 @@ (let ((module (resolve-interface '(gnu packages glib)))) (module-ref module 'glib))) -(define (default-gtk+) - "Return the default gtk+ package from which we use -\"gtk-update-icon-cache\"." - (let ((module (resolve-interface '(gnu packages gtk)))) - (module-ref module 'gtk+))) - (define* (lower name #:key source inputs native-inputs outputs system target - (glib (default-glib)) (gtk+ (default-gtk+)) + (glib (default-glib)) (implicit-inputs? #t) (strip-binaries? #t) #:allow-other-keys #:rest arguments) "Return a bag for NAME." (define private-keywords - '(#:source #:target #:glib #:gtk+ #:inputs #:native-inputs + '(#:source #:target #:glib #:inputs #:native-inputs #:outputs #:implicit-inputs?)) (and (not target) ;XXX: no cross-compilation @@ -108,7 +97,6 @@ '()) ,@inputs)) (build-inputs `(("glib:bin" ,glib "bin") ; to compile schemas - ("gtk+" ,gtk+) ; to generate icon cache ,@(if implicit-inputs? (standard-packages) '()) diff --git a/guix/build/glib-or-gtk-build-system.scm b/guix/build/glib-or-gtk-build-system.scm index 15d7de2236..b6291e735b 100644 --- a/guix/build/glib-or-gtk-build-system.scm +++ b/guix/build/glib-or-gtk-build-system.scm @@ -213,37 +213,9 @@ if needed." #t)))) outputs)) -(define* (generate-icon-cache #:key outputs #:allow-other-keys) - "Implement phase \"glib-or-gtk-icon-cache\": generate icon cache if -needed." - (every (match-lambda - ((output . directory) - (let ((iconsdir (string-append directory - "/share/icons"))) - (when (file-exists? iconsdir) - (with-directory-excursion iconsdir - (for-each - (lambda (dir) - (unless (file-exists? - (string-append iconsdir "/" dir "/" - "icon-theme.cache")) - (system* "gtk-update-icon-cache" - "--ignore-theme-index" - (string-append iconsdir "/" dir)))) - (scandir "." - (lambda (name) - (and - (not (equal? name ".")) - (not (equal? name "..")) - (equal? 'directory - (stat:type (stat name))))))))) - #t))) - outputs)) - (define %standard-phases (modify-phases gnu:%standard-phases (add-after 'install 'glib-or-gtk-compile-schemas compile-glib-schemas) - (add-after 'install 'glib-or-gtk-icon-cache generate-icon-cache) (add-after 'install 'glib-or-gtk-wrap wrap-all-programs))) (define* (glib-or-gtk-build #:key inputs (phases %standard-phases) -- cgit v1.2.3 From a05c06720a32220ab4b688fd2496746099a6da39 Mon Sep 17 00:00:00 2001 From: Mark H Weaver Date: Wed, 23 Sep 2015 17:34:54 -0400 Subject: emacs-build-system: Fix 'package-name-version->elpa-name-version'. Fixes a regression introduced in b7c7c03eb5e37fc3455e4e17b0898ffc4bca29c3. * guix/build/emacs-build-system.scm (package-name-version->elpa-name-version): Remove unused 'name' binding. Do not abuse 'strip-store-file-name' to remove the "emacs-" prefix, which worked before b7c7c03eb5 but not after. --- guix/build/emacs-build-system.scm | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'guix') diff --git a/guix/build/emacs-build-system.scm b/guix/build/emacs-build-system.scm index cb5bde3191..f0a9a6e125 100644 --- a/guix/build/emacs-build-system.scm +++ b/guix/build/emacs-build-system.scm @@ -138,10 +138,9 @@ DIRS." (define (package-name-version->elpa-name-version name-ver) "Convert the Guix package NAME-VER to the corresponding ELPA name-version format. Essnetially drop the prefix used in Guix." - (let ((name (strip-store-file-name name-ver))) - (if (emacs-package? name-ver) - (strip-store-file-name name-ver) - name-ver))) + (if (emacs-package? name-ver) ; checks for "emacs-" prefix + (string-drop name-ver (string-length "emacs-")) + name-ver)) (define (store-directory->elpa-name-version store-dir) "Given a store directory STORE-DIR return the part of the basename after the -- cgit v1.2.3