summaryrefslogtreecommitdiff
path: root/guix
diff options
context:
space:
mode:
Diffstat (limited to 'guix')
-rw-r--r--guix/build-system/gnu.scm8
-rw-r--r--guix/build/gnu-build-system.scm27
-rw-r--r--guix/build/utils.scm1
-rw-r--r--guix/download.scm110
-rw-r--r--guix/packages.scm3
-rw-r--r--guix/profiles.scm6
6 files changed, 57 insertions, 98 deletions
diff --git a/guix/build-system/gnu.scm b/guix/build-system/gnu.scm
index 047ace7e6b..f54afe167c 100644
--- a/guix/build-system/gnu.scm
+++ b/guix/build-system/gnu.scm
@@ -273,6 +273,10 @@ standard packages used as implicit inputs of the GNU build system."
(build (if target gnu-cross-build gnu-build))
(arguments (strip-keyword-arguments private-keywords arguments))))
+(define %license-file-regexp
+ ;; Regexp matching license files.
+ "^(COPYING.*|LICEN[CS]E.*|[Ll]icen[cs]e.*|Copy[Rr]ight(\\.(txt|md))?)$")
+
(define* (gnu-build store name input-drvs
#:key (guile #f)
(outputs '("out"))
@@ -291,6 +295,7 @@ standard packages used as implicit inputs of the GNU build system."
(strip-directories ''("lib" "lib64" "libexec"
"bin" "sbin"))
(validate-runpath? #t)
+ (license-file-regexp %license-file-regexp)
(phases '%standard-phases)
(locale "en_US.utf8")
(system (%current-system))
@@ -358,6 +363,7 @@ packages that must not be referenced."
#:patch-shebangs? ,patch-shebangs?
#:strip-binaries? ,strip-binaries?
#:validate-runpath? ,validate-runpath?
+ #:license-file-regexp ,license-file-regexp
#:strip-flags ,strip-flags
#:strip-directories ,strip-directories)))
@@ -432,6 +438,7 @@ is one of `host' or `target'."
(strip-directories ''("lib" "lib64" "libexec"
"bin" "sbin"))
(validate-runpath? #t)
+ (license-file-regexp %license-file-regexp)
(phases '%standard-phases)
(locale "en_US.utf8")
(system (%current-system))
@@ -509,6 +516,7 @@ platform."
#:patch-shebangs? ,patch-shebangs?
#:strip-binaries? ,strip-binaries?
#:validate-runpath? ,validate-runpath?
+ #:license-file-regexp ,license-file-regexp
#:strip-flags ,strip-flags
#:strip-directories ,strip-directories))))
diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm
index e37b751403..7b43361f99 100644
--- a/guix/build/gnu-build-system.scm
+++ b/guix/build/gnu-build-system.scm
@@ -29,6 +29,7 @@
#:use-module (srfi srfi-26)
#:use-module (rnrs io ports)
#:export (%standard-phases
+ %license-file-regexp
gnu-build))
;; Commentary:
@@ -641,6 +642,31 @@ which cannot be found~%"
outputs)
#t)
+(define %license-file-regexp
+ ;; Regexp matching license files.
+ "^(COPYING.*|LICEN[CS]E.*|[Ll]icen[cs]e.*|Copy[Rr]ight(\\.(txt|md))?)$")
+
+(define* (install-license-files #:key outputs
+ (license-file-regexp %license-file-regexp)
+ #:allow-other-keys)
+ "Install license files matching LICENSE-FILE-REGEXP to 'share/doc'."
+ (let* ((regexp (make-regexp license-file-regexp))
+ (out (or (assoc-ref outputs "out")
+ (match outputs
+ (((_ . output) _ ...)
+ output))))
+ (package (strip-store-file-name out))
+ (directory (string-append out "/share/doc/" package))
+ (files (scandir "." (lambda (file)
+ (regexp-exec regexp file)))))
+ (format #t "installing ~a license files~%" (length files))
+ (for-each (lambda (file)
+ (if (file-is-directory? file)
+ (copy-recursively file directory)
+ (install-file file directory)))
+ files)
+ #t))
+
(define %standard-phases
;; Standard build phases, as a list of symbol/procedure pairs.
(let-syntax ((phases (syntax-rules ()
@@ -654,6 +680,7 @@ which cannot be found~%"
validate-documentation-location
delete-info-dir-file
patch-dot-desktop-files
+ install-license-files
reset-gzip-timestamps
compress-documentation)))
diff --git a/guix/build/utils.scm b/guix/build/utils.scm
index 7391307c87..d7ed3d5177 100644
--- a/guix/build/utils.scm
+++ b/guix/build/utils.scm
@@ -29,6 +29,7 @@
#:use-module (ice-9 regex)
#:use-module (ice-9 rdelim)
#:use-module (ice-9 format)
+ #:use-module (ice-9 threads)
#:use-module (rnrs bytevectors)
#:use-module (rnrs io ports)
#:re-export (alist-cons
diff --git a/guix/download.scm b/guix/download.scm
index 8a0b19c012..55da2c1d37 100644
--- a/guix/download.scm
+++ b/guix/download.scm
@@ -447,89 +447,6 @@ download by itself using its own dependencies."
;; for that built-in is widespread.
#:local-build? #t)))
-(define* (in-band-download file-name url
- #:key system hash-algo hash
- mirrors content-addressed-mirrors
- guile)
- "Download FILE-NAME from URL using a normal, \"in-band\" fixed-output
-derivation.
-
-This is now deprecated since it has the drawback of causing bootstrapping
-issues: we may need to build GnuTLS just to be able to download the source of
-GnuTLS itself and its dependencies. See <http://bugs.gnu.org/22774>."
- (define need-gnutls?
- ;; True if any of the URLs need TLS support.
- (let ((https? (cut string-prefix? "https://" <>)))
- (match url
- ((? string?)
- (https? url))
- ((url ...)
- (any https? url)))))
-
- (define builder
- (with-imported-modules '((guix build download)
- (guix build utils)
- (guix ftp-client)
- (guix base32)
- (guix base64))
- #~(begin
- #+(if need-gnutls?
-
- ;; Add GnuTLS to the inputs and to the load path.
- #~(eval-when (load expand eval)
- (set! %load-path
- (cons (string-append #+(gnutls-package)
- "/share/guile/site/"
- (effective-version))
- %load-path)))
- #~#t)
-
- (use-modules (guix build download)
- (guix base32))
-
- (let ((value-from-environment (lambda (variable)
- (call-with-input-string
- (getenv variable)
- read))))
- (url-fetch (value-from-environment "guix download url")
- #$output
- #:mirrors (call-with-input-file #$mirrors read)
-
- ;; Content-addressed mirrors.
- #:hashes
- (value-from-environment "guix download hashes")
- #:content-addressed-mirrors
- (primitive-load #$content-addressed-mirrors)
-
- ;; No need to validate certificates since we know the
- ;; hash of the expected result.
- #:verify-certificate? #f)))))
-
- (mlet %store-monad ((guile (package->derivation guile system)))
- (gexp->derivation file-name builder
- #:guile-for-build guile
- #:system system
- #:hash-algo hash-algo
- #:hash hash
-
- ;; Use environment variables and a fixed script
- ;; name so there's only one script in store for
- ;; all the downloads.
- #:script-name "download"
- #:env-vars
- `(("guix download url" . ,(object->string url))
- ("guix download hashes"
- . ,(object->string `((,hash-algo . ,hash)))))
-
- ;; Honor the user's proxy settings.
- #:leaked-env-vars '("http_proxy" "https_proxy")
-
- ;; In general, offloading downloads is not a good
- ;; idea. Daemons before 0.8.3 would also
- ;; interpret this as "do not substitute" (see
- ;; <https://bugs.gnu.org/18747>.)
- #:local-build? #t)))
-
(define* (url-fetch url hash-algo hash
#:optional name
#:key (system (%current-system))
@@ -556,18 +473,21 @@ in the store."
(and uri (memq (uri-scheme uri) '(#f file))))
(interned-file (if uri (uri-path uri) url)
(or name file-name))
- (mlet* %store-monad ((builtins (built-in-builders*))
- (download -> (if (member "download" builtins)
- built-in-download
- in-band-download)))
- (download (or name file-name) url
- #:guile guile
- #:system system
- #:hash-algo hash-algo
- #:hash hash
- #:mirrors %mirror-file
- #:content-addressed-mirrors
- %content-addressed-mirror-file)))))
+ (mlet %store-monad ((builtins (built-in-builders*)))
+ ;; The "download" built-in builder was added in guix-daemon in
+ ;; Nov. 2016 and made it in the 0.12.0 release of Dec. 2016. We now
+ ;; require it.
+ (unless (member "download" builtins)
+ (error "'guix-daemon' is too old, please upgrade" builtins))
+
+ (built-in-download (or name file-name) url
+ #:guile guile
+ #:system system
+ #:hash-algo hash-algo
+ #:hash hash
+ #:mirrors %mirror-file
+ #:content-addressed-mirrors
+ %content-addressed-mirror-file)))))
(define* (url-fetch/tarbomb url hash-algo hash
#:optional name
diff --git a/guix/packages.scm b/guix/packages.scm
index d68af1569f..d3f3cf0fdd 100644
--- a/guix/packages.scm
+++ b/guix/packages.scm
@@ -538,7 +538,8 @@ specifies modules in scope when evaluating SNIPPET."
(setenv "LOCPATH"
(string-append #+locales "/lib/locale/"
#+(and locales
- (package-version locales))))
+ (version-major+minor
+ (package-version locales)))))
(setlocale LC_ALL "en_US.utf8"))
(setenv "PATH" (string-append #+xz "/bin" ":"
diff --git a/guix/profiles.scm b/guix/profiles.scm
index cedf9faa82..07fe2faa3c 100644
--- a/guix/profiles.scm
+++ b/guix/profiles.scm
@@ -812,7 +812,8 @@ MANIFEST. Single-file bundles are required by programs such as Git and Lynx."
;; install a UTF-8 locale.
(setenv "LOCPATH"
(string-append #+glibc-utf8-locales "/lib/locale/"
- #+(package-version glibc-utf8-locales)))
+ #+(version-major+minor
+ (package-version glibc-utf8-locales))))
(setlocale LC_ALL "en_US.utf8")
(match (append-map ca-files '#$(manifest-inputs manifest))
@@ -1254,7 +1255,8 @@ are cross-built for TARGET."
#~(begin
(setenv "LOCPATH"
#$(file-append glibc-utf8-locales "/lib/locale/"
- (package-version glibc-utf8-locales)))
+ (version-major+minor
+ (package-version glibc-utf8-locales))))
(setlocale LC_ALL "en_US.utf8")))
(define builder