[arch-projects] [namcap] [PATCH] Add missing support for sha224 sums

Michael Straube michael.straube at posteo.de
Mon Jul 2 07:27:05 UTC 2018


Namcap does not support sha224 checksums but makepkg does.
Add sha224 support.

Signed-off-by: Michael Straube <michael.straube at posteo.de>
---
 Namcap/rules/arrays.py      | 2 +-
 Namcap/rules/extravars.py   | 4 ++--
 Namcap/rules/missingvars.py | 2 +-
 parsepkgbuild.sh            | 5 +++++
 4 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/Namcap/rules/arrays.py b/Namcap/rules/arrays.py
index 243816e..5ca33cc 100644
--- a/Namcap/rules/arrays.py
+++ b/Namcap/rules/arrays.py
@@ -29,7 +29,7 @@ class package(PkgbuildRule):
 		arrayvars = ['arch', 'license', 'groups', 'depends', 'makedepends',
 			 'optdepends', 'checkdepends', 'provides', 'conflicts', 'replaces',
 			 'backup', 'options', 'source', 'noextract', 'md5sums', 'sha1sums',
-			 'sha256sums', 'sha384sums', 'sha512sums', 'validpgpkeys']
+			 'sha224sums', 'sha256sums', 'sha384sums', 'sha512sums', 'validpgpkeys']
 		for i in pkginfo.pkgbuild:
 			m = re.match('\s*(.*)\s*=\s*(.*)$', i)
 			for j in arrayvars:
diff --git a/Namcap/rules/extravars.py b/Namcap/rules/extravars.py
index df0c0bf..a10a878 100644
--- a/Namcap/rules/extravars.py
+++ b/Namcap/rules/extravars.py
@@ -26,8 +26,8 @@ class package(PkgbuildRule):
 	description = "Verifies that extra variables start with an underscore"
 	def analyze(self, pkginfo, tar):
 		carch_vars = ['checkdepends', 'conflicts', 'depends', 'makedepends',
-		         'optdepends', 'provides', 'replaces', 'source', 'md5sums',
-				 'sha1sums', 'sha256sums', 'sha384sums', 'sha512sums']
+				 'optdepends', 'provides', 'replaces', 'source', 'md5sums',
+				 'sha224sums', 'sha1sums', 'sha256sums', 'sha384sums', 'sha512sums']
 		stdvars = ['arch', 'license', 'backup', 'noextract', 'pkgname',
 				 'pkgbase', 'pkgver', 'pkgrel', 'epoch', 'pkgdesc', 'groups',
 				 'url', 'install', 'changelog',
diff --git a/Namcap/rules/missingvars.py b/Namcap/rules/missingvars.py
index 2b8811c..25445e2 100644
--- a/Namcap/rules/missingvars.py
+++ b/Namcap/rules/missingvars.py
@@ -30,7 +30,7 @@ class ChecksumsRule(PkgbuildRule):
 	name = "checksums"
 	description = "Verifies checksums are included in a PKGBUILD"
 	def analyze(self, pkginfo, tar):
-		checksums=[('md5', 32), ('sha1', 40), ('sha256', 64), ('sha384', 96), ('sha512', 128)]
+		checksums=[('md5', 32), ('sha1', 40), ('sha224', 56), ('sha256', 64), ('sha384', 96), ('sha512', 128)]
 
 		if "source" in pkginfo:
 			haschecksums = False
diff --git a/parsepkgbuild.sh b/parsepkgbuild.sh
index 12874f3..a158d1e 100644
--- a/parsepkgbuild.sh
+++ b/parsepkgbuild.sh
@@ -109,6 +109,11 @@ if [ -n "$sha1sums" ]; then
 	for i in "${sha1sums[@]}"; do echo $i; done
 	echo ""
 fi
+if [ -n "$sha224sums" ]; then
+	echo "%SHA224SUMS%"
+	for i in "${sha224sums[@]}"; do echo $i; done
+	echo ""
+fi
 if [ -n "$sha256sums" ]; then
 	echo "%SHA256SUMS%"
 	for i in "${sha256sums[@]}"; do echo $i; done
-- 
2.18.0


More information about the arch-projects mailing list