From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mathieu Lirzin Subject: [PATCH 03/13] lint: Rewrite 'check-patch-file-names'. Date: Sun, 24 Jan 2016 21:19:21 +0100 Message-ID: <1453666771-16869-4-git-send-email-mthl@gnu.org> References: <1453666771-16869-1-git-send-email-mthl@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------2.7.0.rc3" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:46217) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aNR96-0003a7-VC for guix-devel@gnu.org; Sun, 24 Jan 2016 15:20:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aNR94-0005c1-Aq for guix-devel@gnu.org; Sun, 24 Jan 2016 15:20:24 -0500 In-Reply-To: <1453666771-16869-1-git-send-email-mthl@gnu.org> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: guix-devel@gnu.org This is a multi-part message in MIME format. --------------2.7.0.rc3 Content-Type: text/plain; charset=UTF-8; format=fixed Content-Transfer-Encoding: quoted-printable * guix/scripts/lint.scm (check-patch-file-names): Improve clarity by reversing the logic. --- guix/scripts/lint.scm | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) --------------2.7.0.rc3 Content-Type: text/x-patch; name="0003-lint-Rewrite-check-patch-file-names.patch" Content-Disposition: inline; filename="0003-lint-Rewrite-check-patch-file-names.patch" Content-Transfer-Encoding: quoted-printable diff --git a/guix/scripts/lint.scm b/guix/scripts/lint.scm index 25f49a7..e729398 100644 --- a/guix/scripts/lint.scm +++ b/guix/scripts/lint.scm @@ -413,24 +413,21 @@ warning for PACKAGE mentionning the FIELD." (define (check-patch-file-names package) "Emit a warning if the patches requires by PACKAGE are badly named or = if the patch could not be found." - (guard (c ((message-condition? c) ;raised by 'search-pat= ch' + (guard (c ((message-condition? c) ;raised by 'search-patch' (emit-warning package (condition-message c) 'patch-file-names))) - (let ((patches (and=3D> (package-source package) origin-patches)) - (name (package-name package))) - (when (and patches - (any (match-lambda - ((? string? patch) - (let ((file (basename patch))) - (not (eq? (string-contains file name) 0)))) - (_ - ;; This must be an or something like t= hat. - #f)) - patches)) - (emit-warning package - (_ "file names of patches should start with \ -the package name") - 'patch-file-names))))) + (unless (every (match-lambda ;patch starts with package name? + ((? string? patch) + (and=3D> (string-contains (basename patch) + (package-name package)) + zero?)) + (_ #f)) ;must be an or something like= that. + (or (and=3D> (package-source package) origin-patches) + '())) + (emit-warning + package + (_ "file names of patches should start with the package name") + 'patch-file-names)))) =20 (define (escape-quotes str) "Replace any quote character in STR by an escaped quote character." --------------2.7.0.rc3--