Example #1
0
def do_sysupgrade(options):
    "Upgrade a system like pacman -Su"
    downgrade = options.sysupgrade > 1
    t = transaction.init_from_options(handle, options)
    t.sysupgrade(downgrade)
    if len(t.to_add) + len(t.to_remove) == 0:
        print("nothing to do")
        t.release()
        return 0
    else:
        ok = transaction.finalize(t)
        return 0 if ok else 1
Example #2
0
def do_sysupgrade(options):
    "Upgrade a system like pacman -Su"
    downgrade = (options.sysupgrade > 1)
    t = transaction.init_from_options(handle, options)
    t.sysupgrade(downgrade)
    if len(t.to_add) + len(t.to_remove) == 0:
        print("nothing to do")
        t.release()
        return 0
    else:
        ok = transaction.finalize(t)
        return (0 if ok else 1)
Example #3
0
def upgrade(pkgs, options):
	# prepare target list
	targets = []
	for name in pkgs:
		pkg = handle.load_pkg(name)
		targets.append(pkg)

	t = transaction.init_from_options(handle, options)

	for pkg in targets:
		t.add_pkg(pkg)

	ok = transaction.finalize(t)
	return (0 if ok else 1)
Example #4
0
def upgrade(pkgs, options):
	# prepare target list
	db = handle.get_localdb()
	targets = []
	for name in pkgs:
		pkg = pyalpm.load_pkg(name)
		targets.append(pkg)

	t = transaction.init_from_options(handle, options)

	for pkg in targets:
		t.add_pkg(pkg)

	ok = transaction.finalize(t)
	return (0 if ok else 1)
Example #5
0
def remove(pkgs, options):
	# prepare target list
	db = handle.get_localdb()
	targets = []
	for name in pkgs:
		pkg = db.get_pkg(name)
		if pkg is None:
			print("error: '%s': target not found" % name)
			return 1
		targets.append(pkg)

	t = transaction.init_from_options(handle, options)

	for pkg in targets:
		t.remove_pkg(pkg)

	ok = transaction.finalize(t)
	return (0 if ok else 1)
Example #6
0
def remove(pkgs, options):
	# prepare target list
	db = handle.get_localdb()
	targets = []
	for name in pkgs:
		pkg = db.get_pkg(name)
		if pkg is None:
			print("error: '%s': target not found" % name)
			return 1
		targets.append(pkg)

	t = transaction.init_from_options(handle, options)

	for pkg in targets:
		t.remove_pkg(pkg)

	ok = transaction.finalize(t)
	return (0 if ok else 1)
Example #7
0
def do_install(pkgs, options):
    "Install a list of packages like pacman -S"
    repos = dict((db.name, db) for db in handle.get_syncdbs())
    if len(pkgs) == 0:
        print("error: no targets specified")
        return 1

    targets = []
    for name in pkgs:
        ok, pkg = find_sync_package(name, repos)
        if not ok:
            print("error:", pkg)
            return 1
        else:
            targets.append(pkg)
    t = transaction.init_from_options(handle, options)
    [t.add_pkg(pkg) for pkg in targets]
    ok = transaction.finalize(t)
    return 0 if ok else 1
Example #8
0
def do_install(pkgs, options):
    "Install a list of packages like pacman -S"
    repos = dict((db.name, db) for db in handle.get_syncdbs())
    if len(pkgs) == 0:
        print("error: no targets specified")
        return 1

    targets = []
    for name in pkgs:
        ok, pkg = find_sync_package(name, repos)
        if not ok:
            print('error:', pkg)
            return 1
        else:
            targets.append(pkg)
    t = transaction.init_from_options(handle, options)
    [t.add_pkg(pkg) for pkg in targets]
    ok = transaction.finalize(t)
    return (0 if ok else 1)