[arch-projects] [dbscripts] [PATCH 1/2] db-move: Don't store filepaths as a string with whitespace splitting

2018-07-02 Thread Eli Schwartz via arch-projects
Use arrays via nameref, since makepkg does not support multidimensional
arrays, and assigning to/retrieving from an array variable with an
unknown name requires this.

Requires bash 4.3, requires that architectures never contain chars that
are invalid in a variable name -- which makepkg explicitly requires in
order to support architecture-dependent sources/dependencies, and also
incorporates into linting checks which forbid anything but [[:alnum:]_]
so that's all good.

Signed-off-by: Eli Schwartz 
---
 db-move | 20 +---
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/db-move b/db-move
index 63e5c14c..c4da5bf9 100755
--- a/db-move
+++ b/db-move
@@ -60,8 +60,10 @@ done
 
 msg "Moving packages from [%s] to [%s]..." "$repo_from" "$repo_to"
 
-declare -A add_pkgs
-declare -A remove_pkgs
+for arch in "${ARCHES[@]}"; do
+   declare -a add_pkgs_$arch
+   declare -a remove_pkgs_$arch
+done
 for pkgbase in "${args[@]:2}"; do
tag_list=""
for pkgarch in "${ARCHES[@]}" 'any'; do
@@ -95,6 +97,8 @@ for pkgbase in "${args[@]:2}"; do
 
for pkgname in "${pkgnames[@]}"; do
for tarch in "${tarches[@]}"; do
+   declare -n add_pkgs="add_pkgs_${tarch}"
+   declare -n 
remove_pkgs="remove_pkgs_${tarch}"
pkgpath=$(getpkgfile 
"${ftppath_from}/${tarch}/${pkgname}-${pkgver}-${pkgarch}"${PKGEXTS})
pkgfile="${pkgpath##*/}"
 
@@ -102,8 +106,8 @@ for pkgbase in "${args[@]:2}"; do
if [[ -f 
${FTP_BASE}/${PKGPOOL}/${pkgfile}.sig ]]; then
ln -s 
"../../../${PKGPOOL}/${pkgfile}.sig" "${ftppath_to}/${tarch}/"
fi
-   
add_pkgs[${tarch}]+="${FTP_BASE}/${PKGPOOL}/${pkgfile} "
-   remove_pkgs[${tarch}]+="${pkgname} "
+   
add_pkgs+=("${FTP_BASE}/${PKGPOOL}/${pkgfile}")
+   remove_pkgs+=("${pkgname}")
done
done
fi
@@ -113,9 +117,11 @@ for pkgbase in "${args[@]:2}"; do
 done
 
 for tarch in "${ARCHES[@]}"; do
-   if [[ -n ${add_pkgs[${tarch}]} ]]; then
-   arch_repo_modify add "${repo_to}" "${tarch}" 
${add_pkgs[${tarch}]}
-   arch_repo_modify remove "${repo_from}" "${tarch}" 
${remove_pkgs[${tarch}]}
+   declare -n add_pkgs="add_pkgs_${tarch}"
+   declare -n remove_pkgs="remove_pkgs_${tarch}"
+   if [[ -n ${add_pkgs[@]} ]]; then
+   arch_repo_modify add "${repo_to}" "${tarch}" "${add_pkgs[@]}"
+   arch_repo_modify remove "${repo_from}" "${tarch}" 
"${remove_pkgs[@]}"
fi
 done
 
-- 
2.18.0


[arch-projects] [dbscripts] [PATCH 2/2] hoist $tarch handling above $pkgname, since it is more efficient

2018-07-02 Thread Eli Schwartz via arch-projects
Signed-off-by: Eli Schwartz 
---
 db-move | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/db-move b/db-move
index c4da5bf9..b6448898 100755
--- a/db-move
+++ b/db-move
@@ -95,10 +95,10 @@ for pkgbase in "${args[@]:2}"; do
arch_svn rm --force -q "${svnrepo_from}"
tag_list+=", $pkgarch"
 
-   for pkgname in "${pkgnames[@]}"; do
-   for tarch in "${tarches[@]}"; do
-   declare -n add_pkgs="add_pkgs_${tarch}"
-   declare -n 
remove_pkgs="remove_pkgs_${tarch}"
+   for tarch in "${tarches[@]}"; do
+   declare -n add_pkgs="add_pkgs_${tarch}"
+   declare -n remove_pkgs="remove_pkgs_${tarch}"
+   for pkgname in "${pkgnames[@]}"; do
pkgpath=$(getpkgfile 
"${ftppath_from}/${tarch}/${pkgname}-${pkgver}-${pkgarch}"${PKGEXTS})
pkgfile="${pkgpath##*/}"
 
-- 
2.18.0


[arch-projects] [namcap] [PATCH] tests: pacman 5.1

2018-07-02 Thread Michael Straube via arch-projects
Signed-off-by: Michael Straube 
---
 Namcap/tests/package/test_sodepends.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Namcap/tests/package/test_sodepends.py 
b/Namcap/tests/package/test_sodepends.py
index 3a3d7b6..4188c35 100644
--- a/Namcap/tests/package/test_sodepends.py
+++ b/Namcap/tests/package/test_sodepends.py
@@ -56,13 +56,13 @@ package() {
)
self.assertEqual(pkg.detected_deps['pacman'], [
('libraries-needed %s %s',
-(str(['usr/lib/libalpm.so.10']), str(["usr/bin/main"]))
+(str(['usr/lib/libalpm.so.11']), str(["usr/bin/main"]))
)]
)
e, w, i = Namcap.depends.analyze_depends(pkg)
self.assertEqual(e, [
('dependency-detected-not-included %s (%s)',
-   ('pacman', "libraries ['usr/lib/libalpm.so.10'] 
needed in files ['usr/bin/main']"))
+   ('pacman', "libraries ['usr/lib/libalpm.so.11'] 
needed in files ['usr/bin/main']"))
])
self.assertEqual(w, [])
 
-- 
2.18.0


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

2018-07-02 Thread Michael Straube via arch-projects
Namcap does not support sha224 checksums but makepkg does.
Add sha224 support.

Signed-off-by: Michael Straube 
---
 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