From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52710) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dBSZd-0005D9-NB for guix-patches@gnu.org; Thu, 18 May 2017 17:03:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dBSZa-0007jg-Kq for guix-patches@gnu.org; Thu, 18 May 2017 17:03:05 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:51262) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dBSZa-0007ja-Hx for guix-patches@gnu.org; Thu, 18 May 2017 17:03:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dBSZa-0006yZ-8y for guix-patches@gnu.org; Thu, 18 May 2017 17:03:02 -0400 Subject: bug#26802: [PATCH 3/4] guix: lint: Check for version in source file name. Resent-Message-ID: From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) References: <20170517165246.14042-1-arunisaac@systemreboot.net> <25c18e57.AEQAKeUK09kAAAAAAAAAAAO9aM4AAAACwQwAAAAAAAW9WABZHIAR@mailjet.com> <87vaoy764n.fsf@gnu.org> Date: Thu, 18 May 2017 23:01:55 +0200 In-Reply-To: (Arun Isaac's message of "Thu, 18 May 2017 23:29:53 +0530") Message-ID: <87vaox98vw.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Arun Isaac Cc: Alex Kost , 26802@debbugs.gnu.org Arun Isaac skribis: >>> (define (origin-file-name-valid? origin) >>> - ;; Return #f if the source file name contains only a version or is= #f; >>> - ;; indicates that the origin needs a 'file-name' field. >>> + ;; Return #f if the source file name is #f, contains only a versio= n, or >>> + ;; does not contain a version; indicates that the origin needs a >>> + ;; 'file-name' field. >>> (let ((file-name (origin-actual-file-name origin)) >>> (version (package-version package))) >>> (and file-name >>> ;; Common in many projects is for the filename to start >>> ;; with a "v" followed by the version, >>> ;; e.g. "v3.2.0.tar.gz". >>> - (not (string-match (string-append "^v?" version) file-name)= )))) >>> + (not (string-match (string-append "^v?" version) file-name)) >>> + (string-match version file-name)))) >> >> What about simply: >> >> (string-prefix? (string-append (package-name package) "-" >> (package-version package)) >> file-name) > > This will break all those emacs, python, etc. packages that have > "emacs-", "python-" prefixes in the package-name, but not in their > source file names. We'll have to add the file-name field to practically > every Guix package. I'm not sure this is a good idea. Oh right, my bad. > Couldn't we drop patch 3, and just use patch 4 to fix this bug? Well patch 3 is OK after all, if you want to push it. As for the patch 4, I prefer to let Alex reply! Thanks, Ludo=E2=80=99.