From f4c42f9e68131ad4fbfb1be07fb44678eb90d6f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Mas=C5=82owski?= Date: Sat, 13 Oct 2012 18:06:52 +0200 Subject: db-list-unsigned-packages: New script. --- db-list-unsigned-packages | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100755 db-list-unsigned-packages (limited to 'db-list-unsigned-packages') diff --git a/db-list-unsigned-packages b/db-list-unsigned-packages new file mode 100755 index 0000000..35a5421 --- /dev/null +++ b/db-list-unsigned-packages @@ -0,0 +1,47 @@ +#!/bin/bash +# Copyright (C) 2012 Michał Masłowski +# +# 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 3 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 Affero General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +set -e + +# Output a list of repo/package-name-and-version pairs representing +# unsigned packages available for architecture $1 and specified for +# architecture $2 (usually $1 or any, default is to list all). + +. "$(dirname $0)/db-functions" +. "$(dirname $0)/config" + +if [ $# -lt 1 ]; then + msg "usage: $(basename $0) " + exit 1 +fi + +arch=$1 +pkgarch=$2 + +for repo in ${PKGREPOS[@]} +do + db="${FTP_BASE}/${repo}/os/${arch}/${repo}.db" + for f in $(tar tf $db | egrep /desc$) + do + if ! tar xOf $db $f | fgrep %PGPSIG% > /dev/null + then + if [ -z $2 ] || tar xOf $db $f | fgrep -A1 %ARCH% | fgrep $pkgarch > /dev/null + then + echo $repo/${f%/desc} + fi + fi + done +done -- cgit v1.2.3-2-g168b From c6542576f04e6dc159e731b50a19f1a10d9d5ff3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Mas=C5=82owski?= Date: Tue, 16 Oct 2012 15:42:10 +0200 Subject: db-list-unsigned-packages: rewrite using a helper Python script. The previous implementation parsed each tarball multiple times having quadratic time complexity in the number of packages. It was too slow for a complete run. --- db-list-unsigned-packages | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'db-list-unsigned-packages') diff --git a/db-list-unsigned-packages b/db-list-unsigned-packages index 35a5421..26e22eb 100755 --- a/db-list-unsigned-packages +++ b/db-list-unsigned-packages @@ -29,19 +29,10 @@ if [ $# -lt 1 ]; then fi arch=$1 -pkgarch=$2 +shift for repo in ${PKGREPOS[@]} do db="${FTP_BASE}/${repo}/os/${arch}/${repo}.db" - for f in $(tar tf $db | egrep /desc$) - do - if ! tar xOf $db $f | fgrep %PGPSIG% > /dev/null - then - if [ -z $2 ] || tar xOf $db $f | fgrep -A1 %ARCH% | fgrep $pkgarch > /dev/null - then - echo $repo/${f%/desc} - fi - fi - done + "$(dirname $0)/db-list-unsigned-packages.py" "$@" < "$db" done -- cgit v1.2.3-2-g168b From be6cff9570eb4e55cfef7a8a83ffd65c37aa2c91 Mon Sep 17 00:00:00 2001 From: Parabola Date: Tue, 16 Oct 2012 13:53:57 +0000 Subject: db-list-unsigned-packages: Ignore missing packages, pass the repo name. --- db-list-unsigned-packages | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'db-list-unsigned-packages') diff --git a/db-list-unsigned-packages b/db-list-unsigned-packages index 26e22eb..3b5a5bd 100755 --- a/db-list-unsigned-packages +++ b/db-list-unsigned-packages @@ -34,5 +34,5 @@ shift for repo in ${PKGREPOS[@]} do db="${FTP_BASE}/${repo}/os/${arch}/${repo}.db" - "$(dirname $0)/db-list-unsigned-packages.py" "$@" < "$db" + [ -f "$db" ] && "$(dirname $0)/db-list-unsigned-packages.py" "$repo" "$@" < "$db" done -- cgit v1.2.3-2-g168b From b6e8ebd66d22abf5439485985a7851e768c71e8a Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 8 Jan 2014 21:04:43 -0500 Subject: Be very careful about using $0. --- db-list-unsigned-packages | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'db-list-unsigned-packages') diff --git a/db-list-unsigned-packages b/db-list-unsigned-packages index 3b5a5bd..985d1c0 100755 --- a/db-list-unsigned-packages +++ b/db-list-unsigned-packages @@ -20,11 +20,11 @@ set -e # unsigned packages available for architecture $1 and specified for # architecture $2 (usually $1 or any, default is to list all). -. "$(dirname $0)/db-functions" -. "$(dirname $0)/config" +. "$(dirname "$(readlink -e "$0")")/db-functions" +. "$(dirname "$(readlink -e "$0")")/config" if [ $# -lt 1 ]; then - msg "usage: $(basename $0) " + msg "usage: ${0##*/} " exit 1 fi @@ -34,5 +34,5 @@ shift for repo in ${PKGREPOS[@]} do db="${FTP_BASE}/${repo}/os/${arch}/${repo}.db" - [ -f "$db" ] && "$(dirname $0)/db-list-unsigned-packages.py" "$repo" "$@" < "$db" + [ -f "$db" ] && "$(dirname "$(readlink -e "$0")")/db-list-unsigned-packages.py" "$repo" "$@" < "$db" done -- cgit v1.2.3-2-g168b From eefb787983d2608511214bcd682f3d8271bac60c Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 8 Jan 2014 16:44:51 -0500 Subject: Normalize to load config then local_config then db-functions --- db-list-unsigned-packages | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'db-list-unsigned-packages') diff --git a/db-list-unsigned-packages b/db-list-unsigned-packages index 985d1c0..5105096 100755 --- a/db-list-unsigned-packages +++ b/db-list-unsigned-packages @@ -20,8 +20,8 @@ set -e # unsigned packages available for architecture $1 and specified for # architecture $2 (usually $1 or any, default is to list all). -. "$(dirname "$(readlink -e "$0")")/db-functions" . "$(dirname "$(readlink -e "$0")")/config" +. "$(dirname "$(readlink -e "$0")")/db-functions" if [ $# -lt 1 ]; then msg "usage: ${0##*/} " -- cgit v1.2.3-2-g168b From 9d9116bd23720cf6c5b27aa39e5cc4c71de1fb26 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 8 Jan 2014 21:27:07 -0500 Subject: Fix some array quoting. --- db-list-unsigned-packages | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'db-list-unsigned-packages') diff --git a/db-list-unsigned-packages b/db-list-unsigned-packages index 5105096..f593686 100755 --- a/db-list-unsigned-packages +++ b/db-list-unsigned-packages @@ -31,7 +31,7 @@ fi arch=$1 shift -for repo in ${PKGREPOS[@]} +for repo in "${PKGREPOS[@]}" do db="${FTP_BASE}/${repo}/os/${arch}/${repo}.db" [ -f "$db" ] && "$(dirname "$(readlink -e "$0")")/db-list-unsigned-packages.py" "$repo" "$@" < "$db" -- cgit v1.2.3-2-g168b From df49c9b89e56b6c8d2d20cdcc9e03dc80996fcdd Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 18 Jun 2014 12:36:33 -0400 Subject: use tab indent --- db-list-unsigned-packages | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'db-list-unsigned-packages') diff --git a/db-list-unsigned-packages b/db-list-unsigned-packages index f593686..c88203b 100755 --- a/db-list-unsigned-packages +++ b/db-list-unsigned-packages @@ -33,6 +33,6 @@ shift for repo in "${PKGREPOS[@]}" do - db="${FTP_BASE}/${repo}/os/${arch}/${repo}.db" - [ -f "$db" ] && "$(dirname "$(readlink -e "$0")")/db-list-unsigned-packages.py" "$repo" "$@" < "$db" + db="${FTP_BASE}/${repo}/os/${arch}/${repo}.db" + [ -f "$db" ] && "$(dirname "$(readlink -e "$0")")/db-list-unsigned-packages.py" "$repo" "$@" < "$db" done -- cgit v1.2.3-2-g168b From 386c2d00249eb244bbcc9a173a64f9435b70180a Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 18 Jun 2014 13:45:10 -0400 Subject: Use printf formatters instead of string interpolation. I used this command to find them: egrep -r --exclude-dir={test,.git} '(plain|msg|msg2|warning|error|stat_busy|stat_done|abort|die)\s+"?[^"]*\$' --- db-list-unsigned-packages | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'db-list-unsigned-packages') diff --git a/db-list-unsigned-packages b/db-list-unsigned-packages index c88203b..095e1e6 100755 --- a/db-list-unsigned-packages +++ b/db-list-unsigned-packages @@ -24,7 +24,7 @@ set -e . "$(dirname "$(readlink -e "$0")")/db-functions" if [ $# -lt 1 ]; then - msg "usage: ${0##*/} " + msg "usage: %s " "${0##*/}" exit 1 fi -- cgit v1.2.3-2-g168b