[pacman-dev] [PATCH] contrib/paclist - list packages installed from given repo
The paclist script provides a simple method for monitoring which packages are installed from a given repo. This is particularly useful when using a testing or unstable repository. Signed-off-by: Allan McRae <mcrae_allan@hotmail.com> --- contrib/paclist | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 51 insertions(+), 0 deletions(-) create mode 100644 contrib/paclist diff --git a/contrib/paclist b/contrib/paclist new file mode 100644 index 0000000..87592a5 --- /dev/null +++ b/contrib/paclist @@ -0,0 +1,51 @@ +#!/bin/bash +# paclist - List all packages installed from a given repo +# +# Copyright (C) 2008 Allan McRae <mcrae_allan@hotmail.com> +# +# 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 2 +# 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 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 <http://www.gnu.org/licenses/>. + + +readonly progname="paclist" +readonly version="1.0" + +if [ -z "$1" -o "$1" = "--help" -o "$1" = "-h" ]; then + echo "$progname - List all packages installed from a given repo" + echo "Usage: $progname <repo>" + echo "Example: $progname testing" + exit 0 +fi + +if [ "$1" = "--version" -o "$1" = "-v" ]; then + echo "$progname version $version" + echo "Copyright (C) 2008 Allan McRae" + exit 0 +fi + +pkglist=$(mktemp) +ret=0 +pacman -Sl $1 > $pkglist || ret=$? +if [ $ret -ne 0 ]; then + exit 1 +fi + +pacman -Q | while read pkg; do + ret=0 + grep -q "$pkg" $pkglist || ret=$? + if [ $ret -eq 0 ]; then + echo $pkg + fi +done + +rm $pkglist -- 1.5.5.1
On Thu, May 8, 2008 at 10:30 PM, Allan McRae <mcrae_allan@hotmail.com> wrote:
The paclist script provides a simple method for monitoring which packages are installed from a given repo. This is particularly useful when using a testing or unstable repository.
Signed-off-by: Allan McRae <mcrae_allan@hotmail.com>
If someone else gives me an ack saying they have looked this over, I'll pull it. Allan, I do see one small change that needs making- we need an rm call in the early exit if pacman -Sl fails. The file will still be there otherwise. -Dan
The paclist script provides a simple method for monitoring which packages are installed from a given repo. This is particularly useful when using a testing or unstable repository. Signed-off-by: Allan McRae <mcrae_allan@hotmail.com> --- contrib/paclist | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 52 insertions(+), 0 deletions(-) create mode 100755 contrib/paclist diff --git a/contrib/paclist b/contrib/paclist new file mode 100755 index 0000000..95d2d13 --- /dev/null +++ b/contrib/paclist @@ -0,0 +1,52 @@ +#!/bin/bash +# paclist - List all packages installed from a given repo +# +# Copyright (C) 2008 Allan McRae <mcrae_allan@hotmail.com> +# +# 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 2 +# 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 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 <http://www.gnu.org/licenses/>. + + +readonly progname="paclist" +readonly version="1.0" + +if [ -z "$1" -o "$1" = "--help" -o "$1" = "-h" ]; then + echo "$progname - List all packages installed from a given repo" + echo "Usage: $progname <repo>" + echo "Example: $progname testing" + exit 0 +fi + +if [ "$1" = "--version" -o "$1" = "-v" ]; then + echo "$progname version $version" + echo "Copyright (C) 2008 Allan McRae" + exit 0 +fi + +pkglist=$(mktemp) +ret=0 +pacman -Sl $1 > $pkglist || ret=$? +if [ $ret -ne 0 ]; then + rm $pkglist + exit 1 +fi + +pacman -Q | while read pkg; do + ret=0 + grep -q "$pkg" $pkglist || ret=$? + if [ $ret -eq 0 ]; then + echo $pkg + fi +done + +rm $pkglist -- 1.5.5.1
I have made a couple of additional changes apart from what Dan suggested. I also made the indentation consistent and adjusted the permissions of the script file. As an aside, git-send-email is finally working for me! Allan
participants (2)
-
Allan McRae
-
Dan McGee