all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Marius Bakke <mbakke@fastmail.com>
To: 36242@debbugs.gnu.org
Subject: bug#36242: Repacked source checkouts get a misleading file name
Date: Sun, 16 Jun 2019 11:04:26 +0200	[thread overview]
Message-ID: <874l4p52at.fsf@devup.no> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 315 bytes --]

Hello,

When repacking a source checkout (e.g. by using git-fetch with a
snippet), the generated file name contains only the first two version
identifiers.

E.g. `guix build -S eudev` returns

/gnu/store/7lgsxmr0rk9f8fbq6k0kj1aqb7lnrlll-eudev-3.2.tar.xz

...even though it should be "3.2.8".

This patch fixes it:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-packages-Keep-full-version-in-file-name-when-repacki.patch --]
[-- Type: text/x-patch, Size: 1611 bytes --]

From 0c44561d0d45de91f4674d659b86d740642ae801 Mon Sep 17 00:00:00 2001
From: Marius Bakke <mbakke@fastmail.com>
Date: Sun, 16 Jun 2019 10:50:15 +0200
Subject: [PATCH] packages: Keep full version in file name when repacking
 source checkouts.

* guix/packages.scm (patch-and-repack): If ORIGINAL-FILE-NAME is a source
checkout, drop the '-checkout' part so the version-detecting code works.
---
 guix/packages.scm | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/guix/packages.scm b/guix/packages.scm
index c94a651f27..5b8969e079 100644
--- a/guix/packages.scm
+++ b/guix/packages.scm
@@ -505,11 +505,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"
-- 
2.22.0


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

             reply	other threads:[~2019-06-16  9:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-16  9:04 Marius Bakke [this message]
2019-06-16  9:13 ` bug#36242: Repacked source checkouts get a misleading file name Efraim Flashner
2019-06-16  9:24   ` Marius Bakke
2019-06-17  9:40 ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874l4p52at.fsf@devup.no \
    --to=mbakke@fastmail.com \
    --cc=36242@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.