diff options
author | Marius Bakke <mbakke@fastmail.com> | 2020-03-18 19:41:08 +0100 |
---|---|---|
committer | Marius Bakke <mbakke@fastmail.com> | 2020-03-18 19:41:08 +0100 |
commit | c4d769d359c67680fe55c3b71e659cd31837f3ec (patch) | |
tree | 928fe50be266c8975f4abad56e07ce4ebaef55fe /guix | |
parent | de2871c9faa44ee07f73470441f05d114a43bb48 (diff) | |
parent | 4de63cf3fc0a831d75cb507456821104f24800c2 (diff) |
Merge branch 'master' into core-updates
Diffstat (limited to 'guix')
-rw-r--r-- | guix/build-system/linux-module.scm | 9 | ||||
-rw-r--r-- | guix/import/opam.scm | 2 | ||||
-rw-r--r-- | guix/store.scm | 32 |
3 files changed, 23 insertions, 20 deletions
diff --git a/guix/build-system/linux-module.scm b/guix/build-system/linux-module.scm index ba76ab85c3..1e1a07d0a2 100644 --- a/guix/build-system/linux-module.scm +++ b/guix/build-system/linux-module.scm @@ -78,7 +78,8 @@ (lambda* (#:key inputs outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) (out-lib-build (string-append out "/lib/modules/build"))) - ; TODO: Only preserve the minimum, i.e. [Kbuild], Kconfig, scripts, include, ".config". + ;; TODO: Only preserve the minimum, i.e. [Kbuild], Kconfig, + ;; scripts, include, ".config". (copy-recursively "." out-lib-build) (let* ((linux (assoc-ref inputs "linux"))) (install-file (string-append linux "/System.map") @@ -111,7 +112,11 @@ ("linux-module-builder" ,(make-linux-module-builder linux)) ,@native-inputs - ;; TODO: Remove "gmp", "mpfr", "mpc" since they are only needed to compile the gcc plugins. Maybe remove "flex", "bison", "elfutils", "perl", "openssl". That leaves very little ("bc", "gcc", "kmod"). + ;; TODO: Remove "gmp", "mpfr", "mpc" since they are + ;; only needed to compile the gcc plugins. Maybe + ;; remove "flex", "bison", "elfutils", "perl", + ;; "openssl". That leaves very little ("bc", "gcc", + ;; "kmod"). ,@(package-native-inputs linux))) (outputs outputs) (build linux-module-build) diff --git a/guix/import/opam.scm b/guix/import/opam.scm index 394415fdd4..ae7df8a8b5 100644 --- a/guix/import/opam.scm +++ b/guix/import/opam.scm @@ -250,7 +250,7 @@ path to the repository." (substring version 1) version))))) -(define* (opam->guix-package name #:key repository) +(define* (opam->guix-package name #:key (repository (get-opam-repository))) "Import OPAM package NAME from REPOSITORY (a directory name) or, if REPOSITORY is #f, from the official OPAM repository. Return a 'package' sexp or #f on failure." diff --git a/guix/store.scm b/guix/store.scm index c616484577..d42f76f48d 100644 --- a/guix/store.scm +++ b/guix/store.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2018 Jan Nieuwenhuizen <janneke@gnu.org> ;;; Copyright © 2019, 2020 Mathieu Othacehe <m.othacehe@gmail.com> +;;; Copyright © 2020 Florian Pelz <pelzflorian@pelzflorian.de> ;;; ;;; This file is part of GNU Guix. ;;; @@ -43,7 +44,6 @@ #:use-module (srfi srfi-35) #:use-module (srfi srfi-39) #:use-module (ice-9 match) - #:use-module (ice-9 regex) #:use-module (ice-9 vlist) #:use-module (ice-9 popen) #:use-module (ice-9 threads) @@ -174,6 +174,7 @@ store-path? direct-store-path? derivation-path? + store-path-base store-path-package-name store-path-hash-part direct-store-path @@ -1989,29 +1990,26 @@ valid inputs." "Return #t if PATH is a derivation path." (and (store-path? path) (string-suffix? ".drv" path))) -(define store-regexp* - ;; The substituter makes repeated calls to 'store-path-hash-part', hence - ;; this optimization. - (mlambda (store) - "Return a regexp matching a file in STORE." - (make-regexp (string-append "^" (regexp-quote store) - "/([0-9a-df-np-sv-z]{32})-([^/]+)$")))) +(define (store-path-base path) + "Return the base path of a path in the store." + (and (string-prefix? (%store-prefix) path) + (let ((base (string-drop path (+ 1 (string-length (%store-prefix)))))) + (and (> (string-length base) 33) + (not (string-index base #\/)) + base)))) (define (store-path-package-name path) "Return the package name part of PATH, a file name in the store." - (let ((path-rx (store-regexp* (%store-prefix)))) - (and=> (regexp-exec path-rx path) - (cut match:substring <> 2)))) + (let ((base (store-path-base path))) + (string-drop base (+ 32 1)))) ;32 hash part + 1 hyphen (define (store-path-hash-part path) "Return the hash part of PATH as a base32 string, or #f if PATH is not a syntactically valid store path." - (and (string-prefix? (%store-prefix) path) - (let ((base (string-drop path (+ 1 (string-length (%store-prefix)))))) - (and (> (string-length base) 33) - (let ((hash (string-take base 32))) - (and (string-every %nix-base32-charset hash) - hash)))))) + (let* ((base (store-path-base path)) + (hash (string-take base 32))) + (and (string-every %nix-base32-charset hash) + hash))) (define (derivation-log-file drv) "Return the build log file for DRV, a derivation file name, or #f if it |