profiles: Produce a top-level Info 'dir' file.
Fixes <http://bugs.gnu.org/18305>. Reported by Brandon Invergo <brandon@gnu.org>. * guix/profiles.scm (manifest-inputs, info-dir-file): New procedures. (profile-derivation): Use them. Add #:info-dir? parameter and honor it. * guix/scripts/package.scm (guix-package): Call 'profile-derivation' with #:info-dir? #f when the 'bootstrap? option is set. * tests/profiles.scm ("profile-derivation"): Pass #:info-dir? #f.
This commit is contained in:
parent
6b74bb0ae3
commit
79ee406d51
|
@ -25,6 +25,7 @@
|
||||||
#:use-module (guix derivations)
|
#:use-module (guix derivations)
|
||||||
#:use-module (guix packages)
|
#:use-module (guix packages)
|
||||||
#:use-module (guix gexp)
|
#:use-module (guix gexp)
|
||||||
|
#:use-module (guix monads)
|
||||||
#:use-module (ice-9 match)
|
#:use-module (ice-9 match)
|
||||||
#:use-module (ice-9 regex)
|
#:use-module (ice-9 regex)
|
||||||
#:use-module (ice-9 ftw)
|
#:use-module (ice-9 ftw)
|
||||||
|
@ -353,10 +354,16 @@ Remove MANIFEST entries that have the same name and output as ENTRIES."
|
||||||
;;; Profiles.
|
;;; Profiles.
|
||||||
;;;
|
;;;
|
||||||
|
|
||||||
(define (profile-derivation manifest)
|
(define (manifest-inputs manifest)
|
||||||
"Return a derivation that builds a profile (aka. 'user environment') with
|
"Return the list of inputs for MANIFEST. Each input has one of the
|
||||||
the given MANIFEST."
|
following forms:
|
||||||
(define inputs
|
|
||||||
|
(PACKAGE OUTPUT-NAME)
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
STORE-PATH
|
||||||
|
"
|
||||||
(append-map (match-lambda
|
(append-map (match-lambda
|
||||||
(($ <manifest-entry> name version
|
(($ <manifest-entry> name version
|
||||||
output (? package? package) deps)
|
output (? package? package) deps)
|
||||||
|
@ -366,6 +373,56 @@ the given MANIFEST."
|
||||||
`(,path ,@deps)))
|
`(,path ,@deps)))
|
||||||
(manifest-entries manifest)))
|
(manifest-entries manifest)))
|
||||||
|
|
||||||
|
(define (info-dir-file manifest)
|
||||||
|
"Return a derivation that builds the 'dir' file for all the entries of
|
||||||
|
MANIFEST."
|
||||||
|
(define texinfo
|
||||||
|
;; Lazy reference.
|
||||||
|
(module-ref (resolve-interface '(gnu packages texinfo))
|
||||||
|
'texinfo))
|
||||||
|
(define build
|
||||||
|
#~(begin
|
||||||
|
(use-modules (guix build utils)
|
||||||
|
(srfi srfi-1) (srfi srfi-26)
|
||||||
|
(ice-9 ftw))
|
||||||
|
|
||||||
|
(define (info-file? file)
|
||||||
|
(or (string-suffix? ".info" file)
|
||||||
|
(string-suffix? ".info.gz" file)))
|
||||||
|
|
||||||
|
(define (info-files top)
|
||||||
|
(let ((infodir (string-append top "/share/info")))
|
||||||
|
(map (cut string-append infodir "/" <>)
|
||||||
|
(scandir infodir info-file?))))
|
||||||
|
|
||||||
|
(define (install-info info)
|
||||||
|
(zero?
|
||||||
|
(system* (string-append #+texinfo "/bin/install-info")
|
||||||
|
info (string-append #$output "/share/info/dir"))))
|
||||||
|
|
||||||
|
(mkdir-p (string-append #$output "/share/info"))
|
||||||
|
(every install-info
|
||||||
|
(append-map info-files
|
||||||
|
'#$(manifest-inputs manifest)))))
|
||||||
|
|
||||||
|
;; Don't depend on Texinfo when there's nothing to do.
|
||||||
|
(if (null? (manifest-entries manifest))
|
||||||
|
(gexp->derivation "info-dir" #~(mkdir #$output))
|
||||||
|
(gexp->derivation "info-dir" build
|
||||||
|
#:modules '((guix build utils)))))
|
||||||
|
|
||||||
|
(define* (profile-derivation manifest #:key (info-dir? #t))
|
||||||
|
"Return a derivation that builds a profile (aka. 'user environment') with
|
||||||
|
the given MANIFEST. The profile includes a top-level Info 'dir' file, unless
|
||||||
|
INFO-DIR? is #f."
|
||||||
|
(mlet %store-monad ((info-dir (if info-dir?
|
||||||
|
(info-dir-file manifest)
|
||||||
|
(return #f))))
|
||||||
|
(define inputs
|
||||||
|
(if info-dir
|
||||||
|
(cons info-dir (manifest-inputs manifest))
|
||||||
|
(manifest-inputs manifest)))
|
||||||
|
|
||||||
(define builder
|
(define builder
|
||||||
#~(begin
|
#~(begin
|
||||||
(use-modules (ice-9 pretty-print)
|
(use-modules (ice-9 pretty-print)
|
||||||
|
@ -382,7 +439,7 @@ the given MANIFEST."
|
||||||
|
|
||||||
(gexp->derivation "profile" builder
|
(gexp->derivation "profile" builder
|
||||||
#:modules '((guix build union))
|
#:modules '((guix build union))
|
||||||
#:local-build? #t))
|
#:local-build? #t)))
|
||||||
|
|
||||||
(define (profile-regexp profile)
|
(define (profile-regexp profile)
|
||||||
"Return a regular expression that matches PROFILE's name and number."
|
"Return a regular expression that matches PROFILE's name and number."
|
||||||
|
|
|
@ -744,6 +744,7 @@ more information.~%"))
|
||||||
(let* ((manifest (profile-manifest profile))
|
(let* ((manifest (profile-manifest profile))
|
||||||
(install (options->installable opts manifest))
|
(install (options->installable opts manifest))
|
||||||
(remove (options->removable opts manifest))
|
(remove (options->removable opts manifest))
|
||||||
|
(bootstrap? (assoc-ref opts 'bootstrap?))
|
||||||
(transaction (manifest-transaction (install install)
|
(transaction (manifest-transaction (install install)
|
||||||
(remove remove)))
|
(remove remove)))
|
||||||
(new (manifest-perform-transaction
|
(new (manifest-perform-transaction
|
||||||
|
@ -754,7 +755,9 @@ more information.~%"))
|
||||||
|
|
||||||
(unless (and (null? install) (null? remove))
|
(unless (and (null? install) (null? remove))
|
||||||
(let* ((prof-drv (run-with-store (%store)
|
(let* ((prof-drv (run-with-store (%store)
|
||||||
(profile-derivation new)))
|
(profile-derivation
|
||||||
|
new
|
||||||
|
#:info-dir? (not bootstrap?))))
|
||||||
(prof (derivation->output-path prof-drv)))
|
(prof (derivation->output-path prof-drv)))
|
||||||
(manifest-show-transaction (%store) manifest transaction
|
(manifest-show-transaction (%store) manifest transaction
|
||||||
#:dry-run? dry-run?)
|
#:dry-run? dry-run?)
|
||||||
|
|
|
@ -147,7 +147,8 @@
|
||||||
(mlet* %store-monad
|
(mlet* %store-monad
|
||||||
((entry -> (package->manifest-entry %bootstrap-guile))
|
((entry -> (package->manifest-entry %bootstrap-guile))
|
||||||
(guile (package->derivation %bootstrap-guile))
|
(guile (package->derivation %bootstrap-guile))
|
||||||
(drv (profile-derivation (manifest (list entry))))
|
(drv (profile-derivation (manifest (list entry))
|
||||||
|
#:info-dir? #f))
|
||||||
(profile -> (derivation->output-path drv))
|
(profile -> (derivation->output-path drv))
|
||||||
(bindir -> (string-append profile "/bin"))
|
(bindir -> (string-append profile "/bin"))
|
||||||
(_ (built-derivations (list drv))))
|
(_ (built-derivations (list drv))))
|
||||||
|
|
Loading…
Reference in New Issue