From patchwork Mon May 27 03:49:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emil Velikov via arch-projects X-Patchwork-Id: 1125 Return-Path: Delivered-To: patchwork@archlinux.org Received: from apollo.archlinux.org (localhost [127.0.0.1]) by apollo.archlinux.org (Postfix) with ESMTP id 74D04EE9B8DA for ; Mon, 27 May 2019 03:49:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on apollo X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED=0.1, DKIM_VALID=-0.1,DKIM_VALID_AU=-0.1,MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3,SPF_HELO_NONE=0.001,T_DKIMWL_WL_HIGH=-0.01, T_DMARC_POLICY_NONE=0.01 autolearn=unavailable autolearn_force=no version=3.4.2 X-Spam-BL-Results: [127.0.9.2] Received: from orion.archlinux.org (orion.archlinux.org [IPv6:2a01:4f8:160:6087::1]) by apollo.archlinux.org (Postfix) with ESMTPS for ; Mon, 27 May 2019 03:49:40 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id 141C812D9F753F; Mon, 27 May 2019 03:49:39 +0000 (UTC) Received: from luna.archlinux.org (luna.archlinux.org [IPv6:2a01:4f8:160:3033::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits)) (No client certificate requested) by orion.archlinux.org (Postfix) with ESMTPS; Mon, 27 May 2019 03:49:39 +0000 (UTC) Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id F357B2C61E; Mon, 27 May 2019 03:49:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=archlinux.org; s=luna2; t=1558928979; bh=IdJI36vHrfxSIvUYHPSnOzKwzvjgYhL6v0C/zbFpx7c=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc; b=JUpZ0e1q9q2t07tQnC4ixd2QaA/yQgvvHbLY2S3jEbD2WPB/RW8lFv8XLErFhrBAP COQIuUkye7dIEQ5Xs3e9gi6vC2XZbWMIgRBZQAzoVYMwMMc+rUPjfUH04FImNThIK5 /03G3kugJrzp2KEra63WLbyv6oImGk9/Pr5HjOf5iaawWCGijVAujkDwXlqMQtVGSp 7kluHg+xGeLkxvNKdIkKgvJrIQ5WNGGqiVcqlbVPpB0L//hVHIcBHJJnxvFnPg0xAe 2ZJdyLuPi42+K2ZgNfxD6ozU7yh0r3bYXAseHb6cSnxgiuyqtqLQA9DjfWRbaD4UdK VO/3QqiibK8mVGIE/U83Xfr80XAQWvUn30GWIhTPhfTwJEbnl9rUBswxgIc53hLIUi kKn/Ghq9niIAFdncAkIr6JUDpTwFZRxmWRwL6p0o1VO6lVOMg7L3yivFDKKBjfZclf z3XKMfU4il3dp4NXA18G3bgmApGjPTQbSO9Vfs0oFlneHYgWVWMmPQfSPmSfUPbpQU gYa/ctE+2Tvy/zmFMshPWLPnLIj1rs2g1QA5RxhP21925zPevMh6gLq/y7UZVrw5rn cFDttQQv6fwBDysCnc4f4rh02AC2K7g1i4IAtyA+c/x9/kYlbzVGJCweGgLtYrYvjv Q8aZ0FQtFZgoFg7gbMvSTDOo= Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id B1E2D2C5F8 for ; Mon, 27 May 2019 03:49:35 +0000 (UTC) Received: from orion.archlinux.org (orion.archlinux.org [IPv6:2a01:4f8:160:6087::1]) by luna.archlinux.org (Postfix) with ESMTPS for ; Mon, 27 May 2019 03:49:35 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id A831812D9F752D for ; Mon, 27 May 2019 03:49:34 +0000 (UTC) Received: from mail-it1-x143.google.com (mail-it1-x143.google.com [IPv6:2607:f8b0:4864:20::143]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by orion.archlinux.org (Postfix) with ESMTPS for ; Mon, 27 May 2019 03:49:34 +0000 (UTC) Received: by mail-it1-x143.google.com with SMTP id m140so22228586itg.2 for ; Sun, 26 May 2019 20:49:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=EpLZedSCjD5xUdBSxlWSrOk/YfKzOo/FSVtbn70Ru/I=; b=W0Uf3YDxiaEcIgDTNEPEeK9kZNs5yxHfGXeF8B8shejQKn9SjKfO1/jLx87SmAUmSB reHhQFQuPgZlMVmRFE15GBpfl97XDdDZEFYSvhSexyfZVLO1evfhQ4VyUcG4bFFbR3rk nXH9BBOIJ1h+ZXV4d/vx8i9rPaEgwOV/Jgyh+qtDR00ghQuira+QfuoVqsAmSQ8nXUOe EGE0n++8noEODEGKk4KtaHmykiFs8n2RaDKXsxJKTPoABAUfl/pqFC4wUzE5+zKoqwQf 8bOawAsRJChIrOrvCgwUw5KJUfRCG4mtHBZ37YuHrFxz/Ffk2tFtbv5nSSnyLeM5MuER l8mg== X-Gm-Message-State: APjAAAVXK7IjPGldEq0yYOoefdOWhNAEu0YNyWzUrBEzPuyPRCqdcc/X 9MLUTBGHcQpvZsgPK4KpWWGf5U/p X-Google-Smtp-Source: APXvYqwfgyK8Bzu9tSvsxEKa4+5Ng9pq/HCs32eHrP+GX+q8o2Rob44loBZHpFrYq/NRUQ2x+BsefQ== X-Received: by 2002:a05:660c:105:: with SMTP id w5mr18208049itj.37.1558928973224; Sun, 26 May 2019 20:49:33 -0700 (PDT) Received: from newKvm.localdomain ([2601:402:4580:e98::9943]) by smtp.gmail.com with ESMTPSA id m64sm4414072itg.4.2019.05.26.20.49.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 26 May 2019 20:49:32 -0700 (PDT) To: arch-projects@archlinux.org Date: Sun, 26 May 2019 23:49:19 -0400 Message-Id: <20190527034922.27316-2-jamespharvey20@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190527034922.27316-1-jamespharvey20@gmail.com> References: <20190527034922.27316-1-jamespharvey20@gmail.com> MIME-Version: 1.0 Subject: [arch-projects] [namcap] [PATCH 1/4] Split warning for non-unique source filenames from pkginfo rules X-BeenThere: arch-projects@archlinux.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Arch Linux projects development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: "James P. Harvey via arch-projects" Reply-To: Arch Linux projects development discussion Cc: "James P. Harvey" Errors-To: arch-projects-bounces@archlinux.org Sender: "arch-projects" This was originally here, because it used PkgInfoRule, but was changed to use PkgbuildRule and was left here. Signed-off-by: James P. Harvey --- Namcap/rules/__init__.py | 1 + Namcap/rules/nonuniquesources.py | 34 ++++++++++++++++++++++++++++++++ Namcap/rules/pkginfo.py | 11 +---------- 3 files changed, 36 insertions(+), 10 deletions(-) create mode 100644 Namcap/rules/nonuniquesources.py diff --git a/Namcap/rules/__init__.py b/Namcap/rules/__init__.py index dcc950f..111f08b 100644 --- a/Namcap/rules/__init__.py +++ b/Namcap/rules/__init__.py @@ -62,6 +62,7 @@ from . import ( makedepends, makepkgfunctions, missingvars, + nonuniquesources, pkginfo, pkgnameindesc, sfurl, diff --git a/Namcap/rules/nonuniquesources.py b/Namcap/rules/nonuniquesources.py new file mode 100644 index 0000000..a16f56e --- /dev/null +++ b/Namcap/rules/nonuniquesources.py @@ -0,0 +1,34 @@ +# +# namcap rules - package variables +# Copyright (C) 2018 Simon Doppler +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + +"These rules checks basic sanity of source files" + +import re +import os +from Namcap.ruleclass import PkgbuildRule + +class nonuniquesources(PkgbuildRule): + name = "nonuniquesources" + description = "Verifies the downloaded sources have a unique filename" + def analyze(self, pkginfo, tar): + for source_file in pkginfo["source"]: + if '::' not in source_file and re.match(r'^[vV]?(([0-9]){8}|([0-9]+\.?)+)\.', os.path.basename(source_file)): + self.warnings.append(("non-unique-source-name %s", os.path.basename(source_file))) + +# vim: set ts=4 sw=4 noet: diff --git a/Namcap/rules/pkginfo.py b/Namcap/rules/pkginfo.py index 5a42810..216e417 100644 --- a/Namcap/rules/pkginfo.py +++ b/Namcap/rules/pkginfo.py @@ -20,8 +20,7 @@ "These rules checks basic sanity of package metadata" import re -import os -from Namcap.ruleclass import PkgInfoRule,PkgbuildRule +from Namcap.ruleclass import PkgInfoRule class CapsPkgnameRule(PkgInfoRule): name = "capsnamespkg" @@ -44,12 +43,4 @@ class LicenseRule(PkgInfoRule): if "license" not in pkginfo or len(pkginfo["license"]) == 0: self.errors.append(("missing-license", ())) -class NonUniqueSourcesRule(PkgbuildRule): - name = "non-unique-source" - description = "Verifies the downloaded sources have a unique filename" - def analyze(self, pkginfo, tar): - for source_file in pkginfo["source"]: - if '::' not in source_file and re.match(r'^[vV]?(([0-9]){8}|([0-9]+\.?)+)\.', os.path.basename(source_file)): - self.warnings.append(("non-unique-source-name %s", os.path.basename(source_file))) - # vim: set ts=4 sw=4 noet: