unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* bug#34066: patch-and-repack can truncate version number
@ 2019-01-14  9:50 Efraim Flashner
  2019-01-14 21:43 ` Mark H Weaver
  2019-06-20 22:07 ` Marius Bakke
  0 siblings, 2 replies; 4+ messages in thread
From: Efraim Flashner @ 2019-01-14  9:50 UTC (permalink / raw)
  To: 34066

[-- Attachment #1: Type: text/plain, Size: 509 bytes --]

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


-- 
Efraim Flashner   <efraim@flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#34066: patch-and-repack can truncate version number
  2019-01-14  9:50 bug#34066: patch-and-repack can truncate version number Efraim Flashner
@ 2019-01-14 21:43 ` Mark H Weaver
  2019-01-15 12:39   ` Ludovic Courtès
  2019-06-20 22:07 ` Marius Bakke
  1 sibling, 1 reply; 4+ messages in thread
From: Mark H Weaver @ 2019-01-14 21:43 UTC (permalink / raw)
  To: Efraim Flashner; +Cc: 34066

Hi Efraim,

Efraim Flashner <efraim@flashner.co.il> 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 <ludo@gnu.org>
  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?

     Thanks,
       Mark

^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#34066: patch-and-repack can truncate version number
  2019-01-14 21:43 ` Mark H Weaver
@ 2019-01-15 12:39   ` Ludovic Courtès
  0 siblings, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2019-01-15 12:39 UTC (permalink / raw)
  To: Mark H Weaver; +Cc: 34066

Hello!

Mark H Weaver <mhw@netris.org> skribis:

> Efraim Flashner <efraim@flashner.co.il> 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 <ludo@gnu.org>
>   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’.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#34066: patch-and-repack can truncate version number
  2019-01-14  9:50 bug#34066: patch-and-repack can truncate version number Efraim Flashner
  2019-01-14 21:43 ` Mark H Weaver
@ 2019-06-20 22:07 ` Marius Bakke
  1 sibling, 0 replies; 4+ messages in thread
From: Marius Bakke @ 2019-06-20 22:07 UTC (permalink / raw)
  To: Efraim Flashner, 34066-done

[-- Attachment #1: Type: text/plain, Size: 400 bytes --]

Efraim Flashner <efraim@flashner.co.il> 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

Fixed in 814e12dc87a191718374d811c0a3024d38dffcbb.

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-06-20 22:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-14  9:50 bug#34066: patch-and-repack can truncate version number Efraim Flashner
2019-01-14 21:43 ` Mark H Weaver
2019-01-15 12:39   ` Ludovic Courtès
2019-06-20 22:07 ` Marius Bakke

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).