Hi,

I attach a script tentatively called "repopkg" that lists all packages installed from a given repo. I find this useful for monitoring what I have installed from [testing]. It is not entirely fool proof as it assumes you have installed packages using "pacman -S pkg" and not "pacman -S repo/pkg".

A couple of queries. Can someone come up with a better name which is not too long? And any comments before I submit the for inclusion in the contrib directory (it is best to come as a git patch right?).
Cheers,
Allan
#!/bin/bash
# repopkg - List all packages installed from a given repo
#
# Copyright (C) 2008 Allan McRae <[EMAIL PROTECTED]>
#
# 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/>.

# TODO: Could match version numbers to catch packages
#       install with pacman -S repo/pkg


readonly progname="repopkg"
readonly version="1.0"

if [ -z "$1" -o "$1" = "--help" -o "$1" = "-h" ]; then
        echo "Usage: $progname <repo>"
        echo "Ex:    $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)
pacman -Sl > $pkglist

for pkg in $(pacman -Qq); do
  match=$(grep -m1 " $pkg " $pkglist | grep "^$1")
  if [ -n "${match}" ]; then
    echo $pkg
  fi
done

rm $pkglist
_______________________________________________
pacman-dev mailing list
pacman-dev@archlinux.org
http://archlinux.org/mailman/listinfo/pacman-dev

Reply via email to