Aaron Griffin wrote:
Hey guys, Does anyone have any scripts that they use for mass-rebuilds (such as the readline rebuild)? I would like to get more tools of the sort into devtools, so want to see if anyone has anything existing that I could import / use for this purpose.
If not, I will write one to do this with makechrootpkg (yay, chroots) to make this easier.
Cheers, Aaron
Not directly but the attached script could be useful. It takes a file of package names and determines the order they need built. At the moment it parses pacman output to get depends so it misses makedeps so that needs fixed. Can makeworld be adjusted to do what you are looking for? Allan #! /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]]) +")"