[pacman-dev] [PATCH] contrib/paclist - list packages installed from given repo

Allan McRae mcrae_allan at hotmail.com
Thu May 8 23:30:33 EDT 2008


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 at 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 at 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





More information about the pacman-dev mailing list