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
Exemple #2
0
	pacman = alpm
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]
#!/usr/bin/env python

import pacman
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))
	pacman = alpm
import os, tempfile, shutil, sys

if len(sys.argv) > 1:
	if sys.argv[1] == "--help":
		print "check if all the packages can be downloaded via pacman-g2 -Sw"
		sys.exit(0)

root = tempfile.mkdtemp()
if pacman.initialize(root) == -1:
	print "initialize() failed"
if os.getcwd().split('/')[-2] in ["frugalware-current", "current"]:
	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))
Exemple #5
0
    pacman = alpm
import os, tempfile, shutil, sys

if len(sys.argv) > 1:
    if sys.argv[1] == "--help":
        print "check if all the packages can be downloaded via pacman-g2 -Sw"
        sys.exit(0)

root = tempfile.mkdtemp()
if pacman.initialize(root) == -1:
    print "initialize() failed"
if os.getcwd().split('/')[-2] in ["frugalware-current", "current"]:
    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))
Exemple #6
0
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#

import pacman
import sys

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)

pacman.initialize("/") == 0
db_local = pacman.db_register("local")
result = []
get_recursive_deps(sys.argv[1], result)
print "\n".join(result)
pacman.release() == 0

# vim:set shiftwidth=4 softtabstop=4 expandtab: