aboutsummaryrefslogtreecommitdiff
path: root/guix
diff options
context:
space:
mode:
Diffstat (limited to 'guix')
-rw-r--r--guix/scripts/pack.scm72
-rw-r--r--guix/self.scm27
2 files changed, 61 insertions, 38 deletions
diff --git a/guix/scripts/pack.scm b/guix/scripts/pack.scm
index 488638adc5..0e09a01496 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 <ludo@gnu.org>
+;;; Copyright © 2015, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2018 Konrad Hinsen <konrad.hinsen@fastmail.net>
@@ -37,12 +37,13 @@
#: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)
#: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,15 @@ 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))
+ ((? package? package)
+ (list (transform store package) "out")))
+ (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 +416,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/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*))