From patchwork Mon May 27 03:49:21 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: 1127 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 1A5ACEE9B8F7 for ; Mon, 27 May 2019 03:49:47 +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 [88.198.91.70]) by apollo.archlinux.org (Postfix) with ESMTPS for ; Mon, 27 May 2019 03:49:47 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id 00AA312D9F7570; Mon, 27 May 2019 03:49:44 +0000 (UTC) Received: from luna.archlinux.org (luna.archlinux.org [5.9.250.164]) (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:44 +0000 (UTC) Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id 595C82C68A; Mon, 27 May 2019 03:49:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=archlinux.org; s=luna2; t=1558928981; bh=+kQZs6zgvoIly3A3HTGKWk8IU4qdwPZQnkMd0Rgk2ZQ=; 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=VZG7B/9H+zvmN27BjaCpH7Mu4WNy225WM7KA2jDDKOaL1COTOeyIDwBxZCqZvZpzS z4r/Tag5JYA1iGwY85xOdoGzffT+NyLxFjoVI9H5eNysG5YBqPaQYYEIXGztJ5WHfS Qm7nUceUl1SITYsEGcPxYNhN1bWh+DeBj5CPUzrw+/KXzlHJ4uBeErymNlZAr7gzXV jyp0byB95fClb+f2ZLGSgdpZ7mj8TYC0QlncYa07aLGEahs0Io780AvEGyYLJoF/vh U2fCSwZGlReIuRR8q5vKTad/GMrGMtJ4K6HuMq6zqAJzFVzW9YBp5RXvlJpaKxJRnC LCq+HeNurfU85gpkMObFB2jirkANY6evODDw/gLieHJ+LAaLUrOTH5LWvPMxgjuJ4L TOCRipWzyjwjAB0Zo3fkWKEDsXVDyy3ggNrxrl/vbd0GE7B4JkWbWpbh6tsHOK7BA7 RRSulWJZLlhsWVnNF+DUME7OjemWWdUrYvjKnjR2AymUCSZQWxBRl7Rh3EnvjZNvKH 3wrHWS7cASzwC6kyJg4ZlAuYc0A3wsyL22OKFfEEYLgHcGjYZDKH5e4UpFUwCxfg50 usR2bDJHhh+/NqCVp3crJgZ0kAaXmf/oiNbnd1T5lonTiIyCRG/DsJUbf1jT9LFzJg nGCLQYQgBwCOUMUaIS+zhGLY= Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id 6F09C2C624 for ; Mon, 27 May 2019 03:49:39 +0000 (UTC) Received: from orion.archlinux.org (orion.archlinux.org [88.198.91.70]) by luna.archlinux.org (Postfix) with ESMTPS for ; Mon, 27 May 2019 03:49:39 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id 7C10112D9F753A for ; Mon, 27 May 2019 03:49:38 +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:38 +0000 (UTC) Received: by mail-it1-x143.google.com with SMTP id a186so14914731itg.0 for ; Sun, 26 May 2019 20:49:38 -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=B/OxLZzJy4l88AhbtWJ5ZgbfdfMV5HlVa783D8YNKZ4=; b=LjEIxAbje+Zzuns2bdrwILwFCN91caqg2XHOI/dy4d6rrFxNz5nzu7hcoZmRcCvW/s OCfwRpodkcp3L0fF6e+sNghYOaLWRg3mMiE+UC8ndn7Cc6B3f9lQ/yERftNW0iKApSIJ om5ZaYZUFRYGfaFh1dfDPM4Sds74H6lriCnxB5gZe3G971LSU5uPb8Ib1+n3LwqM3k11 TNtMUuWZOZ+r40/KS0Lcxkp1zX8AU80ig4h+SDSAeaxLoabLHFOOA5VscRoH9/fi5OR4 LON4Kg4n41N1xMwyv1HhyG7FtKouQMJ1erVnrkH+RBqkhpGaqVmrzw+hqp2YK+pf+8qC rJ7A== X-Gm-Message-State: APjAAAV6QhIhPhhtlUENgz9TvvHjz0sal0D1tG40VAQE3n3EBrFVu2cJ f5jor46YUhz2ZIrOajDFCMSuv8Tk X-Google-Smtp-Source: APXvYqzIKJ2/UnX/R6hbWXjS5xGybtkVE/kurnjiIs723Elnxv5Y7k6OMaIIqtd9JImEXhXB6jtW8w== X-Received: by 2002:a24:4453:: with SMTP id o80mr26510718ita.160.1558928977037; Sun, 26 May 2019 20:49:37 -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.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 26 May 2019 20:49:36 -0700 (PDT) To: arch-projects@archlinux.org Date: Sun, 26 May 2019 23:49:21 -0400 Message-Id: <20190527034922.27316-4-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 3/4] nonuniquesources: Also warn on common filenames not overriding name to be unique 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" Filenames in source() are required to be unique. A common violation of this is from commonly named files (i.e. LICENSE) that aren't part of an upstream tarball. Warn if a source file doesn't have an overriding name, and has a commonly used name, ignoring extension and case. Signed-off-by: James P. Harvey --- Namcap/rules/nonuniquesources.py | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/Namcap/rules/nonuniquesources.py b/Namcap/rules/nonuniquesources.py index a16f56e..8d8afcd 100644 --- a/Namcap/rules/nonuniquesources.py +++ b/Namcap/rules/nonuniquesources.py @@ -26,9 +26,27 @@ from Namcap.ruleclass import PkgbuildRule class nonuniquesources(PkgbuildRule): name = "nonuniquesources" description = "Verifies the downloaded sources have a unique filename" + def analyze(self, pkginfo, tar): + filename_begins_upper_case = [ + "AUTHORS", + "CHANGELOG", + "CONTRIBUTING", + "COPYING", + "COPYRIGHT", + "HACKING", + "HISTORY", + "LICENSE", + "NEWS", + "README", + "TODO" + ] + 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))) + if '::' not in source_file: + basename = os.path.basename(source_file) + if re.match(r'^[vV]?(([0-9]){8}|([0-9]+\.?)+)\.', basename) \ + or basename.upper().split('.')[0] in filename_begins_upper_case: + self.warnings.append(("non-unique-source-name %s", basename)) # vim: set ts=4 sw=4 noet: