unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: Mark H Weaver <mhw@netris.org>
Cc: 34066@debbugs.gnu.org
Subject: bug#34066: patch-and-repack can truncate version number
Date: Tue, 15 Jan 2019 13:39:27 +0100	[thread overview]
Message-ID: <871s5e2iyo.fsf@gnu.org> (raw)
In-Reply-To: <87va2q6hjc.fsf@netris.org> (Mark H. Weaver's message of "Mon, 14 Jan 2019 16:43:56 -0500")

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’.

  reply	other threads:[~2019-01-15 12:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2019-06-20 22:07 ` Marius Bakke

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

  List information: https://guix.gnu.org/

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

  git send-email \
    --in-reply-to=871s5e2iyo.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=34066@debbugs.gnu.org \
    --cc=mhw@netris.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 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).