aboutsummaryrefslogtreecommitdiff
path: root/guix/scripts
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-06-11 11:19:12 +0200
committerLudovic Courtès <ludo@gnu.org>2015-06-11 11:19:12 +0200
commita43b55f1a6fa0eb712b2610b86a1775383d3f2cd (patch)
tree8ba275e9d4be71a34238d83c8fff919817c21e70 /guix/scripts
parentc2590362ad7c926050db0ea1dacd437027241520 (diff)
downloadgnu-guix-a43b55f1a6fa0eb712b2610b86a1775383d3f2cd.tar
gnu-guix-a43b55f1a6fa0eb712b2610b86a1775383d3f2cd.tar.gz
guix build: Allow directories to be passed to --with-source.
* guix/scripts/build.scm (package-with-source)[tarball-base-name]: Gracefully handle file names that lack an extension. Pass #:recursive? #t to 'download-to-store'. * guix/download.scm (download-to-store): Add #:recursive? parameter and pass it to 'add-to-store'. * doc/guix.texi (Invoking guix build): Add an example of --with-source with a directory.
Diffstat (limited to 'guix/scripts')
-rw-r--r--guix/scripts/build.scm13
1 files changed, 10 insertions, 3 deletions
diff --git a/guix/scripts/build.scm b/guix/scripts/build.scm
index 2307f76b42..7fd05da189 100644
--- a/guix/scripts/build.scm
+++ b/guix/scripts/build.scm
@@ -77,19 +77,26 @@ the new package's version number from URI."
;; Return the "base" of FILE-NAME, removing '.tar.gz' or similar
;; extensions.
;; TODO: Factorize.
- (cond ((numeric-extension? file-name)
+ (cond ((not (file-extension file-name))
+ file-name)
+ ((numeric-extension? file-name)
file-name)
((string=? (file-extension file-name) "tar")
(file-sans-extension file-name))
+ ((file-extension file-name)
+ (tarball-base-name (file-sans-extension file-name)))
(else
- (tarball-base-name (file-sans-extension file-name)))))
+ file-name)))
(let ((base (tarball-base-name (basename uri))))
(let-values (((name version)
(package-name->name+version base)))
(package (inherit p)
(version (or version (package-version p)))
- (source (download-to-store store uri))))))
+
+ ;; Use #:recursive? #t to allow for directories.
+ (source (download-to-store store uri
+ #:recursive? #t))))))
;;;