コード例 #1
0
 def __init__(self, root='/'):
     self.root = root
     pc = PacmanConfig(conf=self._rp('/etc/pacman.conf'))
     # Add root path prefix, as alpm seems to expect absolute paths
     for option in ['RootDir', 'DBPath', 'GPGDir', 'LogFile']:
         pc.options[option] = self._rp(pc.options[option])
     self.handle = pc.initialize_alpm()
コード例 #2
0
ファイル: remotedb.py プロジェクト: thegala/aurbs
 def __init__(self, root="/"):
     self.root = root
     pc = PacmanConfig(conf=self._rp("/etc/pacman.conf"))
     # Add root path prefix, as alpm seems to expect absolute paths
     for option in ["RootDir", "DBPath", "GPGDir", "LogFile"]:
         pc.options[option] = self._rp(pc.options[option])
     self.handle = pc.initialize_alpm()
コード例 #3
0
ファイル: remotedb.py プロジェクト: asdil12/aurbs
	def __init__(self, root='/'):
		self.root = root
		pc = PacmanConfig(conf=self._rp('/etc/pacman.conf'))
		# Add root path prefix, as alpm seems to expect absolute paths
		for option in ['RootDir', 'DBPath', 'GPGDir', 'LogFile']:
			pc.options[option] = self._rp(pc.options[option])
		self.handle = pc.initialize_alpm()
コード例 #4
0
def remove(package_list, cache_only=None):
    """We have been told that we should remove packages"""
    if cache_only:
        return (0, "no-ops for caching", {})

    if not isinstance(package_list, list):
        return (13, "Invalid arguments passed to function", {})

    log.log_debug("Called remove_packages", package_list)

    conf = PacmanConfig('/etc/pacman.conf')
    handle = conf.initialize_alpm()

    db = handle.get_localdb()
    for package in package_list:
        if db.get_pkg(package) is None:
            return 1, package + " is not installed so it cannot be removed", {}

    t = handle.init_transaction()
    for package in package_list:
        t.remove_pkg(package)

    try:
        t.prepare()
        t.commit()
    except pyalpm.error:
        t.release()
        return 1, "packages.remove failed", {}
    t.release()

    return 0, "packages.remove OK", {}
コード例 #5
0
def fullUpdate(force=0, cache_only=None):
    """ Update all packages on the system. """
    conf = PacmanConfig('/etc/pacman.conf')
    handle = conf.initialize_alpm()

    for db in handle.get_syncdbs():
        t = handle.init_transaction()
        db.update(force)
        t.release()

    t = handle.init_transaction()
    downgrade = False
    t.sysupgrade(downgrade)
    if len(t.to_add) + len(t.to_remove) > 0:
        try:
            t.prepare()
            t.commit()
        except pyalpm.error:
            t.release()
            return 1, "packages.fullUpdate failed", {}
    t.release()
    return 0, "packages.fullUpdate OK", {}