[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#34066: patch-and-repack can truncate version number
From: |
Ludovic Courtès |
Subject: |
bug#34066: patch-and-repack can truncate version number |
Date: |
Tue, 15 Jan 2019 13:39:27 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) |
Hello!
Mark H Weaver <address@hidden> skribis:
> Efraim Flashner <address@hidden> writes:
>
>> When using 'git-fetch' for the source, when a patch is applied part of
>> the version number is truncated.
>>
>> The following derivations will be built:
>> /gnu/store/zsy0j8jfg4q4nz8xk5bpc3h5qrclm679-opencv-3.4.3-checkout.drv
>> /gnu/store/kadg4jnyar79mpz5bmmg4w3qgn0iy81r-opencv-3.4.tar.xz.drv
>
> I guess the issue is in 'tarxz-name', defined within 'patch-and-repack':
>
> (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))))
> (string-append base
> (if (equal? (file-extension base) "tar")
> ".xz"
> ".tar.xz"))))
>
> Unless the extension (everything after the last '.') of the original
> file name is composed entirely of hexadecimal characters, it is removed.
> In this case, I guess the extension is "3-checkout", so it's removed.
>
> I'm reluctant to suggest a fix until I understand the rationale for this
> behavior. It was added by Ludovic in February 2014, in commit
> 3ca00bb51e3ff906a700b6925e0ce81558c8c469.
>
> commit 3ca00bb51e3ff906a700b6925e0ce81558c8c469
> Author: Ludovic Courtès <address@hidden>
> Date: Fri Feb 28 10:41:44 2014 +0100
>
> packages: Support 'patches' and 'snippets' for sources that are directories.
>
> * guix/packages.scm (patch-and-repack)[numeric-extension?, tarxz-name]:
> New procedures.
> [builder]: Adjust to deal with SOURCE when it's a directory.
> <body>: Use 'tarxz-name'. Always add (guix build utils) to
> IMPORTED-MODULES.
>
> Do you remember why you decided to remove non-numeric extensions,
> Ludovic?
I think the reason is that if the source directory is
/gnu/store/…-opencv-1.2.3, you want to keep it as is. IOW,
‘numeric-extension?’ is trying to determine whether the extension is
part of a version number.
Obviously it’s not working well in this case. :-)
I was thinking about using ‘package-name->name+version’ to improve the
heuristic but that doesn’t look very good either:
--8<---------------cut here---------------start------------->8---
scheme@(guile-user)> (package-name->name+version "foo-1.2-checkout" #\-)
$7 = "foo-1.2"
$8 = "checkout"
--8<---------------cut here---------------end--------------->8---
Ludo’.