From f2e66663c2e00b482cdf5ba83173291d30363e7c Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 6 May 2018 16:41:50 +0200 Subject: self: Add "guix-packages-base" derivation. This introduces an intermediate derivation, thereby reducing the amount of rebuild that needs to happen when "leaf" package modules are modified. * guix/self.scm (compiled-guix)[*core-package-modules*]: New variable. [*package-modules*, *system-modules*, *cli-modules*]: Depend on it. Add it to the directory union. --- guix/self.scm | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) (limited to 'guix') diff --git a/guix/self.scm b/guix/self.scm index 6220efb397..4378a3dee5 100644 --- a/guix/self.scm +++ b/guix/self.scm @@ -260,13 +260,18 @@ list of file-name/file-like objects suitable as inputs to 'imported-files'." #:extensions dependencies #:guile-for-build guile-for-build)) - (define *package-modules* - (scheme-node "guix-packages" + (define *core-package-modules* + (scheme-node "guix-packages-base" `((gnu packages) - ,@(scheme-modules* source "gnu/packages")) + (gnu packages base)) (list *core-modules* *extra-modules*) #:extensions dependencies - #:extra-files ;all the non-Scheme files + + ;; Add all the non-Scheme files here. We must do it here so + ;; that 'search-patches' & co. can find them. Ideally we'd + ;; keep them next to the .scm files that use them but it's + ;; difficult to do (XXX). + #:extra-files (file-imports source "gnu/packages" (lambda (file stat) (and (eq? 'regular (stat:type stat)) @@ -276,13 +281,21 @@ list of file-name/file-like objects suitable as inputs to 'imported-files'." (not (string-suffix? "~" file))))) #:guile-for-build guile-for-build)) + (define *package-modules* + (scheme-node "guix-packages" + (scheme-modules* source "gnu/packages") + (list *core-modules* *extra-modules* *core-package-modules*) + #:extensions dependencies + #:guile-for-build guile-for-build)) + (define *system-modules* (scheme-node "guix-system" `((gnu system) (gnu services) ,@(scheme-modules* source "gnu/system") ,@(scheme-modules* source "gnu/services")) - (list *package-modules* *extra-modules* *core-modules*) + (list *core-package-modules* *package-modules* + *extra-modules* *core-modules*) #:extensions dependencies #:extra-files (file-imports source "gnu/system/examples" (const #t)) @@ -292,7 +305,8 @@ list of file-name/file-like objects suitable as inputs to 'imported-files'." (define *cli-modules* (scheme-node "guix-cli" (scheme-modules* source "/guix/scripts") - (list *core-modules* *extra-modules* *package-modules* + (list *core-modules* *extra-modules* + *core-package-modules* *package-modules* *system-modules*) #:extensions dependencies #:guile-for-build guile-for-build)) @@ -330,6 +344,7 @@ list of file-name/file-like objects suitable as inputs to 'imported-files'." *cli-modules* *system-modules* *package-modules* + *core-package-modules* *extra-modules* *core-modules*)) -- cgit v1.2.3 From 16e7afb924deb145325144a2dcd0e2cc21228f89 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 7 May 2018 10:36:13 +0200 Subject: pack: Do not autoload (gnu packages base). * guix/scripts/pack.scm: Do not autoload (gnu packages base). Previously, we could end up with 'canonical-package' as an unbound variable because of the incorrect autoload spec. --- guix/scripts/pack.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'guix') diff --git a/guix/scripts/pack.scm b/guix/scripts/pack.scm index 488638adc5..b90bc41bc4 100644 --- a/guix/scripts/pack.scm +++ b/guix/scripts/pack.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2015, 2017 Ludovic Courtès +;;; Copyright © 2015, 2017, 2018 Ludovic Courtès ;;; Copyright © 2017 Efraim Flashner ;;; Copyright © 2017 Ricardo Wurmus ;;; Copyright © 2018 Konrad Hinsen @@ -37,7 +37,7 @@ #:use-module (gnu packages bootstrap) #:use-module (gnu packages compression) #:use-module (gnu packages guile) - #:autoload (gnu packages base) (tar) + #:use-module (gnu packages base) #:autoload (gnu packages package-management) (guix) #:autoload (gnu packages gnupg) (libgcrypt) #:autoload (gnu packages guile) (guile2.0-json guile-json) -- cgit v1.2.3 From aad16cc1965ab3488449c262455eb29b15c77e95 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 7 May 2018 10:44:18 +0200 Subject: pack: Honor package transformation options. Previously they would silently be ignored. * guix/scripts/pack.scm (guix-pack)[manifest-from-args]: Add 'store' parameter. Call 'options->transformation' and use it. Move 'with-store' and 'parameterize' around the 'let'. * tests/guix-pack.sh: Add test using '--with-source'. --- guix/scripts/pack.scm | 67 ++++++++++++++++++++++++++++----------------------- tests/guix-pack.sh | 7 ++++++ 2 files changed, 44 insertions(+), 30 deletions(-) (limited to 'guix') diff --git a/guix/scripts/pack.scm b/guix/scripts/pack.scm index b90bc41bc4..1f493d8a09 100644 --- a/guix/scripts/pack.scm +++ b/guix/scripts/pack.scm @@ -43,6 +43,7 @@ #:autoload (gnu packages guile) (guile2.0-json guile-json) #:use-module (srfi srfi-1) #:use-module (srfi srfi-9) + #:use-module (srfi srfi-26) #:use-module (srfi srfi-37) #:use-module (ice-9 match) #:export (compressor? @@ -397,9 +398,14 @@ Create a bundle of PACKAGE.\n")) (read/eval-package-expression exp)) (x #f))) - (define (manifest-from-args opts) - (let ((packages (filter-map maybe-package-argument opts)) - (manifest-file (assoc-ref opts 'manifest))) + (define (manifest-from-args store opts) + (let* ((transform (options->transformation opts)) + (packages (map (match-lambda + (((? package? package) output) + (list (transform store package) + output))) + (filter-map maybe-package-argument opts))) + (manifest-file (assoc-ref opts 'manifest))) (cond ((and manifest-file (not (null? packages))) (leave (G_ "both a manifest and a package list were given~%"))) @@ -409,33 +415,34 @@ Create a bundle of PACKAGE.\n")) (else (packages->manifest packages))))) (with-error-handling - (let* ((dry-run? (assoc-ref opts 'dry-run?)) - (manifest (manifest-from-args opts)) - (pack-format (assoc-ref opts 'format)) - (name (string-append (symbol->string pack-format) - "-pack")) - (target (assoc-ref opts 'target)) - (bootstrap? (assoc-ref opts 'bootstrap?)) - (compressor (if bootstrap? - bootstrap-xz - (assoc-ref opts 'compressor))) - (tar (if bootstrap? - %bootstrap-coreutils&co - tar)) - (symlinks (assoc-ref opts 'symlinks)) - (build-image (match (assq-ref %formats pack-format) - ((? procedure? proc) proc) - (#f - (leave (G_ "~a: unknown pack format") - format)))) - (localstatedir? (assoc-ref opts 'localstatedir?))) - (with-store store - (parameterize ((%graft? (assoc-ref opts 'graft?)) - (%guile-for-build (package-derivation - store - (if (assoc-ref opts 'bootstrap?) - %bootstrap-guile - (canonical-package guile-2.2))))) + (with-store store + (parameterize ((%graft? (assoc-ref opts 'graft?)) + (%guile-for-build (package-derivation + store + (if (assoc-ref opts 'bootstrap?) + %bootstrap-guile + (canonical-package guile-2.2)) + #:graft? (assoc-ref opts 'graft?)))) + (let* ((dry-run? (assoc-ref opts 'dry-run?)) + (manifest (manifest-from-args store opts)) + (pack-format (assoc-ref opts 'format)) + (name (string-append (symbol->string pack-format) + "-pack")) + (target (assoc-ref opts 'target)) + (bootstrap? (assoc-ref opts 'bootstrap?)) + (compressor (if bootstrap? + bootstrap-xz + (assoc-ref opts 'compressor))) + (tar (if bootstrap? + %bootstrap-coreutils&co + tar)) + (symlinks (assoc-ref opts 'symlinks)) + (build-image (match (assq-ref %formats pack-format) + ((? procedure? proc) proc) + (#f + (leave (G_ "~a: unknown pack format") + format)))) + (localstatedir? (assoc-ref opts 'localstatedir?))) ;; Set the build options before we do anything else. (set-build-options-from-command-line store opts) diff --git a/tests/guix-pack.sh b/tests/guix-pack.sh index d34f72015f..ec56ac96a2 100644 --- a/tests/guix-pack.sh +++ b/tests/guix-pack.sh @@ -83,3 +83,10 @@ guix pack --dry-run --bootstrap -f docker -S /opt/gnu=/ guile-bootstrap # Build a tarball pack of cross-compiled software. Use coreutils because # guile-bootstrap is not intended to be cross-compiled. guix pack --dry-run --bootstrap --target=arm-unknown-linux-gnueabihf coreutils + +# Make sure package transformation options are honored. +mkdir -p "$test_directory" +drv1="`guix pack -n guile 2>&1 | grep pack.*\.drv`" +drv2="`guix pack -n --with-source=guile=$test_directory guile 2>&1 | grep pack.*\.drv`" +test -n "$drv1" +test "$drv1" != "$drv2" -- cgit v1.2.3 From d26727a143fab0dded1dbc848899270dbacd5dad Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 7 May 2018 14:04:19 +0200 Subject: pack: Fix handling of '-e'. Fixes a regression introduced in aad16cc1965ab3488449c262455eb29b15c77e95. Reported by Julien Lepiller. * guix/scripts/pack.scm (guix-pack)[manifest-from-args]: In 'match-lambda', add clause for single packages. * tests/guix-pack.sh: Add test for '-e'. --- guix/scripts/pack.scm | 5 +++-- tests/guix-pack.sh | 7 +++++-- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'guix') diff --git a/guix/scripts/pack.scm b/guix/scripts/pack.scm index 1f493d8a09..0e09a01496 100644 --- a/guix/scripts/pack.scm +++ b/guix/scripts/pack.scm @@ -402,8 +402,9 @@ Create a bundle of PACKAGE.\n")) (let* ((transform (options->transformation opts)) (packages (map (match-lambda (((? package? package) output) - (list (transform store package) - output))) + (list (transform store package) output)) + ((? package? package) + (list (transform store package) "out"))) (filter-map maybe-package-argument opts))) (manifest-file (assoc-ref opts 'manifest))) (cond diff --git a/tests/guix-pack.sh b/tests/guix-pack.sh index ec56ac96a2..5584c10e00 100644 --- a/tests/guix-pack.sh +++ b/tests/guix-pack.sh @@ -35,8 +35,11 @@ export GUIX_BUILD_OPTIONS # Build a tarball with no compression. guix pack --compression=none --bootstrap guile-bootstrap -# Build a tarball (with compression). -guix pack --bootstrap guile-bootstrap +# Build a tarball (with compression). Check that '-e' works as well. +out1="`guix pack --bootstrap guile-bootstrap`" +out2="`guix pack --bootstrap -e '(@ (gnu packages bootstrap) %bootstrap-guile)'`" +test -n "$out1" +test "$out1" = "$out2" # Build a tarball with a symlink. the_pack="`guix pack --bootstrap -S /opt/gnu/bin=bin guile-bootstrap`" -- cgit v1.2.3