예제 #1
0
import os, tempfile, shutil, sys

if len(sys.argv) > 1 and sys.argv[1] == "--help":
	print "base packages which depend on packages outsite base (->base is needed)"
	sys.exit(0)

basecats = ['base']

root = tempfile.mkdtemp()
pacman.initialize(root)
if os.getcwd().split('/')[-2] == "frugalware-current":
	treename = "frugalware-current"
else:
	treename = "frugalware"
db = pacman.db_register(treename)
pacman.db_setserver(db, "file://" + os.getcwd() + "/../frugalware-%s" % sys.argv[1])
pacman.db_update(1, db)

i = pacman.db_getpkgcache(db)
while i:
	pkg = pacman.void_to_PM_PKG(pacman.list_getdata(i))
	pkgname = pacman.void_to_char(pacman.pkg_getinfo(pkg, pacman.PKG_NAME))
	group = pacman.void_to_char(pacman.list_getdata(pacman.void_to_PM_LIST(pacman.pkg_getinfo(pkg, pacman.PKG_GROUPS))))
	if group not in basecats:
		i = pacman.list_next(i)
		continue
	j = pacman.void_to_PM_LIST(pacman.pkg_getinfo(pkg, pacman.PKG_DEPENDS))
	while j:
		found = False
		dep = pacman.void_to_char(pacman.list_getdata(j)).split("<")[0].split(">")[0].split("=")[0]
		k = pacman.db_getpkgcache(db)
예제 #2
0
        arch = sys.argv[2]
    else:
        arch = sys.argv[1]

for i in ['frugalware-%s' % arch]:
    arch = i[11:]
    root = tempfile.mkdtemp()
    pacman.initialize(root)
    if os.getcwd().split('/')[-2] == "frugalware-current":
        treename = "frugalware-current"
        archive = treename
    else:
        treename = "frugalware"
        archive = treename + "-stable"
    db = pacman.db_register(treename)
    pacman.db_setserver(db, "file://" + os.getcwd() + "/../frugalware-" + arch)
    pacman.db_update(1, db)
    fdb = []
    j = pacman.db_getpkgcache(db)
    while j:
        pkg = pacman.void_to_PM_PKG(pacman.list_getdata(j))
        pkgname = pacman.void_to_char(pacman.pkg_getinfo(pkg, pacman.PKG_NAME))
        pkgver = pacman.void_to_char(
            pacman.pkg_getinfo(pkg, pacman.PKG_VERSION))
        fdb.append("%s-%s-%s.fpm" % (pkgname, pkgver, arch))
        j = pacman.list_next(j)
    pacman.release()
    shutil.rmtree(root)
    for j in os.listdir(os.getcwd() + "/../frugalware-" + arch):
        if j not in fdb and j != treename + ".fdb" and j != ".gitignore":
            print "frugalware-" + arch + "/" + j
		archlist = ["frugalware-%s" % sys.argv[1]]
if not archlist:
	archlist = os.listdir("../..")

for i in archlist:
	if not re.match("^frugalware-", i):
		continue
	arch = i[11:]
	root = tempfile.mkdtemp()
	pacman.initialize(root)
	if os.getcwd().split('/')[-3] == "frugalware-current":
		treename = "frugalware-current"
	else:
		treename = "frugalware"
	db = pacman.db_register(treename)
	pacman.db_setserver(db, "file://" + os.getcwd() + "/../../frugalware-" + arch)
	pacman.db_update(1, db)
	size = 0
	num = 0
	j = pacman.db_getpkgcache(db)
	while j:
		pkg = pacman.void_to_PM_PKG(pacman.list_getdata(j))
		pkgname = pacman.void_to_char(pacman.pkg_getinfo(pkg, pacman.PKG_NAME))
		pkgsize = pacman.void_to_unsigned_long(pacman.pkg_getinfo(pkg, pacman.PKG_SIZE))
		group = pacman.void_to_char(pacman.list_getdata(pacman.void_to_PM_LIST(pacman.pkg_getinfo(pkg, pacman.PKG_GROUPS))))
		if group[-6:] == "-extra":
			j = pacman.list_next(j)
			continue
		size += pkgsize
		num += 1
		j = pacman.list_next(j)
예제 #4
0
def dotify(s):
	return "pkg_" + s.replace("+", "plus").replace("-", "_").replace("@", "at").replace(".", "dot")

print "digraph {"
print 'label="Frugalware 0.8 i686 dependencies for the \'base\' group"'
print 'ratio=1.41'
root = tempfile.mkdtemp()
if pacman.initialize(root) == -1:
	print "initialize() failed"
treename = sys.argv[1]
local = pacman.db_register("local")
db = pacman.db_register(treename)
if not db:
	print "db_register() failed"
if pacman.db_setserver(db, "file://" + os.getcwd()) == -1:
	print "db_setserver() failed"
if pacman.db_update(1, db) == -1:
	print "db_update() failed"
if pacman.trans_init(pacman.TRANS_TYPE_SYNC, pacman.TRANS_FLAG_NOCONFLICTS, None, None, None) == -1:
	print "trans_init() failed"
i = pacman.db_getpkgcache(db)
while i:
	pkg = pacman.void_to_PM_PKG(pacman.list_getdata(i))
	pkgname = pacman.void_to_char(pacman.pkg_getinfo(pkg, pacman.PKG_NAME))
	pkgver = pacman.void_to_char(pacman.pkg_getinfo(pkg, pacman.PKG_VERSION))
	group = pacman.void_to_char(pacman.list_getdata(pacman.void_to_PM_LIST(pacman.pkg_getinfo(pkg, pacman.PKG_GROUPS))))
	if group != "base":
		i = pacman.list_next(i)
		continue
	print '%s [label="%s %s"]' % (dotify(pkgname), pkgname, pkgver)