summary refs log tree commit diff
diff options
context:
space:
mode:
authorMarius Bakke <mbakke@fastmail.com>2019-06-16 10:50:15 +0200
committerMarius Bakke <mbakke@fastmail.com>2019-06-20 23:56:57 +0200
commit814e12dc87a191718374d811c0a3024d38dffcbb (patch)
tree7aae6adba9df379aa0a6d144aa2a2d15842941fb
parenta9a78d8bfbabcd306115684c99d3b2aa8fc75be8 (diff)
downloadguix-814e12dc87a191718374d811c0a3024d38dffcbb.tar.gz
packages: Retain version in file name when repacking source checkouts.
Fixes <https://bugs.gnu.org/34066>.

* guix/packages.scm (patch-and-repack)<tarxz-name>: If FILE-NAME is a source
checkout, reuse the name without the '-checkout' part.
-rw-r--r--guix/packages.scm13
1 files changed, 10 insertions, 3 deletions
diff --git a/guix/packages.scm b/guix/packages.scm
index 9d2ab5be0f..ac965acd2f 100644
--- a/guix/packages.scm
+++ b/guix/packages.scm
@@ -4,6 +4,7 @@
 ;;; Copyright © 2015 Eric Bavier <bavier@member.fsf.org>
 ;;; Copyright © 2016 Alex Kost <alezost@gmail.com>
 ;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2019 Marius Bakke <mbakke@fastmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -505,11 +506,17 @@ specifies modules in scope when evaluating SNIPPET."
     (and=> (file-extension file-name)
            (cut string-every char-set:hex-digit <>)))
 
+  (define (checkout? directory)
+    ;; Return true if DIRECTORY is a checkout (git, svn, etc).
+    (string-suffix? "-checkout" directory))
+
   (define (tarxz-name file-name)
     ;; Return a '.tar.xz' file name based on FILE-NAME.
-    (let ((base (if (numeric-extension? file-name)
-                    original-file-name
-                    (file-sans-extension file-name))))
+    (let ((base (cond ((numeric-extension? file-name)
+                       original-file-name)
+                      ((checkout? file-name)
+                       (string-drop-right file-name 9))
+                      (else (file-sans-extension file-name)))))
       (string-append base
                      (if (equal? (file-extension base) "tar")
                          ".xz"