On Mon, 22 Oct 2007, Randall R Schulz wrote:-

<snip>

>Is there a CLI way to list packages grouped by repository from which
>they were installed or those that are "orphaned?" I know that the
>Repositories view in YaST Software Management will list all the
>packages available in each configured repository, but the packages I'm
>most concerned with are those that are no longer associated with any
>repository and as far as I know don't show up there.

I don't know about a way of identifying which package comes from a
particular repository, but this might help narrow things down a bit:

[EMAIL PROTECTED]:~> cat ./rpm_list.sh
#!/bin/bash

# create a temporary directory. Make sure it doesn't already exist.
#
[ -e "/tmp/rpm-temp.$$" ] && exit
mkdir -p "/tmp/rpm-temp.$$"

# extract the RPM info for all the installed packages
#
for FILE in $(rpm -qa)
do
 rpm -qi "${FILE}" >"/tmp/rpm-temp.$$/${FILE}.txt"
done

for FILE in "/tmp/rpm-temp.$$/"*
do

# skip the GPG keys
#
 TEXT=$(echo "${FILE}"|grep pubkey)
 [ -n "${TEXT}" ] && continue

# Get the distribution
#
 DIST=$(egrep "^Distribution:" "${FILE}")

# and the vendor
#
 VEND=$(egrep "Vendor:" "${FILE}")
 VEND="V${VEND##*V}"

# and display it. The test may not be required, but it's there just in case...
#
 [ -n "${DIST}" ] && printf "%-40s  %-40s  %s\n" "${VEND::40}" "${DIST::40}" 
$(basename "${FILE}")
done

# clean up
#
rm -r "/tmp/rpm-temp.$$"

# and quit
#
exit 0

Usage is simply ./rpm_list.sh . Pipe the output through sort and then
less to see the sorted list, or redirect it to a file for later
browsing.

On what is now a 10.3 system that was upgraded from 10.0, and with a few
packages added from the community repositories, here's a few snippets
from the output to show what to expect:

<snippet>
Vendor: http://packman.links2linux.de     Distribution: openSUSE 10.3 (i386)    
    ffmpeg-0.4.9-8.pm.svn20070902.txt
Vendor: Packman                           Distribution: openSUSE 10.3 (i586)    
    xmms-1.2.10-200.pm.4.txt
</snippet>

Two different vendor headers from different packages built/supplied by
Packman.

<snippet>
Vendor: (none)                            Distribution: openSUSE 10.3           
    DVDAuthorWizard-1.4.6-1.suse103.txt
</snippet>

One of my own packages. Ought to add a vendor header to it.

<snippet>
Vendor: openSUSE Build Service            Distribution: VideoLAN / 10.3         
    vlc-0.8.6c-3.2.txt
</snippet>

One from VideoLAN. Looks like they're using their own installation of
the Build Service.

<snippet>
Vendor: SUSE LINUX Products GmbH, Nuernb  Distribution: openSUSE 10.3 (i586)    
    aaa_base-10.3-90.txt
</snippet>

And, finally, one package from SUSE/Novell.


Regards,
        David Bolt

-- 
Team Acorn: http://www.distributed.net/ OGR-P2 @ 100Mnodes RC5-72 @ 15Mkeys
                 | SUSE 10.1 32bit  | openSUSE 10.2 32bit | openSUSE 10.3 32bit
SUSE 10.0 64bit  | SUSE 10.1 64bit  | openSUSE 10.2 64bit |
RISC OS 3.11     | RISC OS 3.6      | TOS 4.02            | openSUSE 10.3 PPC
-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to