From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34032) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dBJg3-00056E-5e for guix-patches@gnu.org; Thu, 18 May 2017 07:33:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dBJfy-00086u-1w for guix-patches@gnu.org; Thu, 18 May 2017 07:33:07 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:49360) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dBJfx-00086q-Up for guix-patches@gnu.org; Thu, 18 May 2017 07:33:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dBJfx-0002P5-PE for guix-patches@gnu.org; Thu, 18 May 2017 07:33:01 -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> Date: Thu, 18 May 2017 13:32:08 +0200 In-Reply-To: <25c18e57.AEQAKeUK09kAAAAAAAAAAAO9aM4AAAACwQwAAAAAAAW9WABZHIAR@mailjet.com> (Arun Isaac's message of "Wed, 17 May 2017 22:22:45 +0530") Message-ID: <87vaoy764n.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: 26802@debbugs.gnu.org Arun Isaac skribis: > * guix/scripts/lint.scm (check-source-file-name): Check for version in so= urce > file name. [...] > (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 version,= 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) ? That=E2=80=99s a bit stricter but I think that=E2=80=99s what we expect. Thanks, Ludo=E2=80=99.