Exemplo n.º 1
0
def get_recursive_deps(name, result):
	i = pacman.db_getpkgcache(db_local)
	while i:
		pkg = pacman.void_to_PM_PKG(pacman.list_getdata(i))
		pkgname = pacman.void_to_char(pacman.pkg_getinfo(pkg, pacman.PKG_NAME))
		if pkgname == name:
			j = pacman.void_to_PM_LIST(pacman.pkg_getinfo(pkg, pacman.PKG_DEPENDS))
			while j:
				depname = pacman.void_to_char(pacman.list_getdata(j)).split("<")[0].split(">")[0].split("=")[0]
				if depname not in result:
					result.append(depname)
					get_recursive_deps(depname, result)
				j = pacman.list_next(j)
		i = pacman.list_next(i)
Exemplo n.º 2
0
def pacman_pkg_getgroups(pkg):
    i = pacman.void_to_PM_LIST(pacman.pkg_getinfo(pkg, pacman.PKG_GROUPS))
    ret = []
    while i:
        ret.append(pacman.void_to_char(pacman.list_getdata(i)))
        i = pacman.list_next(i)
    return ret
Exemplo n.º 3
0
def find_pkg(packagename):
	if pacman.initialize("/") == -1:
		fprint("initialize() failed")
		return False
	local = pacman.db_register("local")
	i = pacman.db_getpkgcache(local)
	found = False
	while i:
		pkg = pacman.void_to_PM_PKG(pacman.list_getdata(i))
		pkgname = pacman.void_to_char(pacman.pkg_getinfo(pkg, pacman.PKG_NAME))
		if pkgname == packagename:
		        found = True
		i = pacman.list_next(i)
	pacman.release()
	return found
Exemplo n.º 4
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)
		while not found and k:
			p = pacman.void_to_PM_PKG(pacman.list_getdata(k))
			if pacman.void_to_char(pacman.pkg_getinfo(p, pacman.PKG_NAME)) == dep:
				l = pacman.void_to_PM_LIST(pacman.pkg_getinfo(p, pacman.PKG_GROUPS))
				g = pacman.void_to_char(pacman.list_getdata(l))
Exemplo n.º 5
0
basecats = ['core', 'chroot-core', 'devel-core']

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))
    groups = pacman_pkg_getgroups(pkg)

    if not any_in(basecats, groups):
        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)
        while not found and k:
            p = pacman.void_to_PM_PKG(pacman.list_getdata(k))
            if pacman.void_to_char(pacman.pkg_getinfo(p,
import simplejson
import datetime

packages_as_dict = {}
root = "/"
packages_path = root + "var/cache/pacman-g2/pkg/"

if pacman.initialize(root) == -1:
    print "initializing DB failed"
    exit

db = pacman.db_register("frugalware-current")

i = pacman.db_getpkgcache(db)
while i :
    pkg = pacman.void_to_PM_PKG(pacman.list_getdata(i))
    name = pacman.void_to_char(pacman.pkg_getinfo(pkg, pacman.PKG_NAME))
    version = pacman.void_to_char(pacman.pkg_getinfo(pkg, pacman.PKG_VERSION))
    arch = pacman.void_to_char(pacman.pkg_getinfo(pkg, pacman.PKG_ARCH))
    files = None
    url = None
    builddate = None
    licenses = None

    groups = []
    j = pacman.void_to_PM_LIST(pacman.pkg_getinfo(pkg, pacman.PKG_GROUPS))
    while j:
        group = pacman.void_to_char(pacman.list_getdata(j))
        groups.append(group)
        j = pacman.list_next(j)
Exemplo n.º 7
0
	treename = "frugalware-current"
else:
	treename = "frugalware"
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() + "/../frugalware-%s" % sys.argv[1]) == -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))
	if pacman.trans_addtarget(pkgname):
		print "failed to add target '%s' (%s)" % (pkgname, pacman.strerror(pacman.cvar.pm_errno))
		break
	i = pacman.list_next(i)
junk = pacman.LISTp_new()
if pacman.trans_prepare(junk) == -1:
	print "%s:" % pacman.strerror(pacman.cvar.pm_errno)
	i = pacman.list_first(pacman.LISTp_to_LIST(junk))
	while i:
		miss = pacman.void_to_PM_DEPMISS(pacman.list_getdata(i))
		if pacman.void_to_long(pacman.dep_getinfo(miss, pacman.DEP_TYPE)) == pacman.DEP_TYPE_DEPEND:
			reason = "requires"
		else:
			reason = "is required by"
basecats = ['base', 'apps', 'lib', 'multimedia', 'network', 'devel']

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)
		while not found and k:
			p = pacman.void_to_PM_PKG(pacman.list_getdata(k))
			if pacman.void_to_char(pacman.pkg_getinfo(p, pacman.PKG_NAME)) == dep:
				l = pacman.void_to_PM_LIST(pacman.pkg_getinfo(p, pacman.PKG_GROUPS))
				g = pacman.void_to_char(pacman.list_getdata(l))
Exemplo n.º 9
0
    treename = "frugalware"
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() + "/../frugalware-%s" % sys.argv[1]) == -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))
    if pacman.trans_addtarget(pkgname):
        print "failed to add target '%s' (%s)" % (
            pkgname, pacman.strerror(pacman.cvar.pm_errno))
        break
    i = pacman.list_next(i)
junk = pacman.LISTp_new()
if pacman.trans_prepare(junk) == -1:
    print "%s:" % pacman.strerror(pacman.cvar.pm_errno)
    i = pacman.list_first(pacman.LISTp_to_LIST(junk))
    while i:
        miss = pacman.void_to_PM_DEPMISS(pacman.list_getdata(i))
        if pacman.void_to_long(pacman.dep_getinfo(
                miss, pacman.DEP_TYPE)) == pacman.DEP_TYPE_DEPEND:
            reason = "requires"
		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)
	pacman.release()
	shutil.rmtree(root)
	mbsize = round(size / 1048576.0, 1)
	if mbsize > 650.0:
		print "Size for %s is too big: %d MB (should be < %d MB; %d packages)" % (arch, mbsize, limit, num)
Exemplo n.º 11
0
 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
         if remove:
             os.rename(
                 "../frugalware-" + arch + "/" + j,
                 "/home/ftp/pub/archive/fpmjunk/" + archive +
                 "/frugalware-" + arch + "/" + j)
Exemplo n.º 12
0
basecats = ['base', 'apps', 'lib', 'multimedia', 'network', 'devel']

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)
        while not found and k:
Exemplo n.º 13
0
		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
			if remove:
				os.rename("../frugalware-" + arch + "/" + j, "/srv/ftp/pub/archive/fpmjunk/" + archive + "/frugalware-" + arch + "/" + j)
Exemplo n.º 14
0
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)
	j = pacman.void_to_PM_LIST(pacman.pkg_getinfo(pkg, pacman.PKG_DEPENDS))
	while j:
		dep = pacman.void_to_char(pacman.list_getdata(j)).split("<")[0].split(">")[0].split("=")[0]
		print "%s->%s" % (dotify(dep), dotify(pkgname))
		j = pacman.list_next(j)
	i = pacman.list_next(i)
print "}"
pacman.release()