From: Simon Doppler <dopsi(a)dopsi.ch>
Detect if the source variable name either starts with `V`, `v` (or not)
and followed by only digits and periods.
---
Namcap/rules/pkginfo.py | 9 +++++++++
namcap-tags | 1 +
2 files changed, 10 insertions(+)
diff --git a/Namcap/rules/pkginfo.py b/Namcap/rules/pkginfo.py
index 216e417..5f90828 100644
--- a/Namcap/rules/pkginfo.py
+++ b/Namcap/rules/pkginfo.py
@@ -20,6 +20,7 @@
"These rules checks basic sanity of package metadata"
import re
+import os
from Namcap.ruleclass import PkgInfoRule
class CapsPkgnameRule(PkgInfoRule):
@@ -43,4 +44,12 @@ class LicenseRule(PkgInfoRule):
if "license" not in pkginfo or len(pkginfo["license"]) == 0:
self.errors.append(("missing-license", ()))
+class NonUniqueSourcesRule(PkgInfoRule):
+ 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:
diff --git a/namcap-tags b/namcap-tags
index 2133c45..5c236db 100644
--- a/namcap-tags
+++ b/namcap-tags
@@ -61,6 +61,7 @@ missing-makedeps %s :: Split PKGBUILD needs additional makedepends %s to work pr
no-elffiles-not-any-package :: No ELF files and not an "any" package
non-fhs-info-page %s :: Non-FHS info page (%s) found. Use /usr/share/info instead
non-fhs-man-page %s :: Non-FHS man page (%s) found. Use /usr/share/man instead
+non-unique-source-name %s :: Non-unique source name (%s). Use a unique filename.
not-a-common-license %s :: %s is not a common license (it's not in /usr/share/licenses/common/)
not-enough-checksums %s %i needed :: Not enough %s: %i needed
package-name-in-uppercase :: No upper case letters in package names
--
2.18.0