From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Subject: bug#34066: patch-and-repack can truncate version number Date: Tue, 15 Jan 2019 13:39:27 +0100 Message-ID: <871s5e2iyo.fsf@gnu.org> References: <20190114095042.GC25281@macbook41> <87va2q6hjc.fsf@netris.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([209.51.188.92]:45887) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjO0k-0007KZ-Ek for bug-guix@gnu.org; Tue, 15 Jan 2019 07:40:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjO0g-0000ZM-Kp for bug-guix@gnu.org; Tue, 15 Jan 2019 07:40:05 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:60321) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gjO0g-0000Y4-4C for bug-guix@gnu.org; Tue, 15 Jan 2019 07:40:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gjO0f-0001SP-Ve for bug-guix@gnu.org; Tue, 15 Jan 2019 07:40:02 -0500 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: <87va2q6hjc.fsf@netris.org> (Mark H. Weaver's message of "Mon, 14 Jan 2019 16:43:56 -0500") List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: Mark H Weaver Cc: 34066@debbugs.gnu.org Hello! Mark H Weaver skribis: > Efraim Flashner 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=C3=A8s > Date: Fri Feb 28 10:41:44 2014 +0100 > > packages: Support 'patches' and 'snippets' for sources that are directo= ries. >=20=20=20 > * guix/packages.scm (patch-and-repack)[numeric-extension?, tarxz-name]: > New procedures. > [builder]: Adjust to deal with SOURCE when it's a directory. > : 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/=E2=80=A6-opencv-1.2.3, you want to keep it as is. IOW, =E2=80=98numeric-extension?=E2=80=99 is trying to determine whether the ext= ension is part of a version number. Obviously it=E2=80=99s not working well in this case. :-) I was thinking about using =E2=80=98package-name->name+version=E2=80=99 to = improve the heuristic but that doesn=E2=80=99t look very good either: --8<---------------cut here---------------start------------->8--- scheme@(guile-user)> (package-name->name+version "foo-1.2-checkout" #\-) $7 =3D "foo-1.2" $8 =3D "checkout" --8<---------------cut here---------------end--------------->8--- Ludo=E2=80=99.