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 6a093f1dc6bd5398115544dd229b520f9432e122 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 31 Dec 2013 15:49:06 -0500 Subject: use `readlink -e` on $0 --- db-list-unsigned-packages | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'db-list-unsigned-packages') diff --git a/db-list-unsigned-packages b/db-list-unsigned-packages index 3b5a5bd..4e90d42 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 $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) " @@ -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 12507975408257ff24f1f367b8b3b842fa779f1f Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 31 Dec 2013 17:12:16 -0500 Subject: use ${0##*/} instead of basename in "usage:" text --- 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 4e90d42..985d1c0 100755 --- a/db-list-unsigned-packages +++ b/db-list-unsigned-packages @@ -24,7 +24,7 @@ set -e . "$(dirname "$(readlink -e "$0")")/config" if [ $# -lt 1 ]; then - msg "usage: $(basename $0) " + msg "usage: ${0##*/} " exit 1 fi -- cgit v1.2.3-2-g168b From e7d2dcac7cf857fdccd82bec2bfc2a7d8e6b85c6 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 8 Jan 2014 16:53:56 -0500 Subject: Normalize to load ./config before loading ./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 39fbf0d8d3cdc666912c597d41d5b6a70fc0c725 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 8 Jan 2014 20:53:38 -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