Hi,
I have written a couple of script that other here might find useful.
To generate a list of packages on your computer that require a rebuild
for a library somane bump run "rebuildlist <library>", e.g. for the
current heimdal rebuilt, run "rebuildlist libhx509". This creates are
file called rebuildlist.txt with a list of packages that need rebuilt in
it, although it is limited to what is on your system but I do not see a
way around that.
The second script take a list of packages that need rebuilt and
annotates that list with information on the order it needs done. E.g.
for the heimdal rebuild, I ran "rebuildorder rebuildlist.txt" and got:
brasero (Requires totem-plparser)
cups (Requires libcups)
cvs
evince (Requires libspectre)
evolution-data-server (Requires gnome-vfs)
ghostscript (Requires gtk2)
gnome-panel (Requires evolution-data-server)
gnome-python-desktop (Requires gnome-vfs)
gnome-vfs (Requires smbclient, gtk2)
gstreamer0.10-bad-plugins (Requires neon)
gtk2 (Requires libcups)
hplip (Requires cups, ghostscript)
imagemagick (Requires ghostscript)
libcups
libgnomecups (Requires libcups)
libgnomeprint (Requires libgnomecups)
libspectre (Requires ghostscript)
mplayer (Requires gtk2, smbclient)
neon
openoffice-base (Requires neon)
openssh
smbclient
subversion (Requires neon)
totem-plparser (Requires evolution-data-server)
xfprint (Requires imagemagick)
The rebuildorder script is my first "real" python script so it could
probably be improved. If people think that these would be useful to have
somewhere, I can tidy them up a put them in a git repo somewhere.
Allan
#! /bin/bash
library=$1
if [ "x$library" == "x" ]; then
echo "Usage $0 <library>"
exit
fi
for pkg in $(pacman -Qq); do
echo $pkg
found=$(ldd $(pacman -Ql $pkg) 2>/dev/null | grep "${library}.so" | wc
-l)
if [ $found -ne 0 ]; then
echo $pkg >> rebuildlist.txt
fi;
done
#! /usr/bin/env python
import os, sys
def get_deps( package ):
deps = []
pkginfo = os.popen("pacman -Si " + package + " 2>
/dev/null").read().split("\n")
if pkginfo != ['']:
found = False
for i in pkginfo:
if not found:
if i[0:10] == "Depends On":
deplist = i.split()[3:]
found = True
else:
if i[0] != " ":
break
deplist += i.split()
for i in deplist:
pkg = i.split(">")[0].split("<")[0].split("=")[0]
if os.popen("pacman -Si " + pkg + " 2>
/dev/null").read().split("\n") != ['']:
deps.append(pkg)
return deps
rebuild_file = open(sys.argv[1], "r")
rebuild_list = rebuild_file.read().split()
rebuild_deps = {}
package_deps = {}
for i in rebuild_list:
package_deps[i] = get_deps(i)
for package in rebuild_list:
rebuild_deps[package] = package_deps[package][:]
pos = 0
while pos < len(rebuild_deps[package]):
dep = rebuild_deps[package][pos]
if not package_deps.has_key(dep):
package_deps[dep] = get_deps(dep)
for i in package_deps[dep]:
if not i in rebuild_deps[package]:
rebuild_deps[package].append(i)
pos += 1
for package in rebuild_list:
pos = 0
while pos < len(rebuild_deps[package]):
if rebuild_deps[package][pos] in rebuild_list:
pos += 1
else:
rebuild_deps[package].pop(pos)
filtered_deps = {}
for package in rebuild_list:
filtered_deps[package] = rebuild_deps[package][:]
if len(filtered_deps[package]) > 1:
pos=0
while pos < len(filtered_deps[package]) and
len(filtered_deps[package]) > 1:
removed = False
for i in filtered_deps[package]:
if filtered_deps[package][pos] in
rebuild_deps[i]:
filtered_deps[package].pop(pos)
removed = True
break
if not removed:
pos += 1
for package in rebuild_list:
if len(rebuild_deps[package]) == 0:
print package
else:
rebuild_deps[package].sort()
print package + " (Requires " + ", ".join(["%s" % pkg for pkg
in filtered_deps[package]]) +")"