def info_name(package_name, useinstalldb=False): """Fetch package information for the given package.""" installdb = pisi.db.installdb.InstallDB() packagedb = pisi.db.packagedb.PackageDB() if useinstalldb: package = installdb.get_package(package_name) repo = None else: package, repo = packagedb.get_package_repo(package_name) metadata = pisi.metadata.MetaData() metadata.package = package #FIXME: get it from sourcedb if available metadata.source = None #TODO: fetch the files from server if possible (wow, you maniac -- future exa) if useinstalldb and installdb.has_package(package.name): try: files = installdb.get_files(package.name) except pisi.Error as e: ctx.ui.warning(e) files = None else: files = None return metadata, files, repo
def snapshot(): """ Takes snapshot of the system packages. The snapshot is only a record of which packages are currently installed. The record is kept by pisi history mechanism as it works automatically on install, remove and upgrade operations. """ installdb = pisi.db.installdb.InstallDB() historydb = pisi.db.historydb.HistoryDB() historydb.create_history("snapshot") li = installdb.list_installed() progress = ctx.ui.Progress(len(li)) processed = 0 for name in installdb.list_installed(): package = installdb.get_package(name) historydb.add_package(pkgBefore=package, operation="snapshot") # Save changed config files of the package in snapshot for f in installdb.get_files(name).list: if f.type == "config" and pisi.util.config_changed(f): fpath = pisi.util.join_path(ctx.config.dest_dir(), f.path) historydb.save_config(name, fpath) processed += 1 ctx.ui.display_progress(operation="snapshot", percent=progress.update(processed), info=_("Taking snapshot of the system")) historydb.update_history()
def snapshot(): """ Takes snapshot of the system packages. The snapshot is only a record of which packages are currently installed. The record is kept by pisi history mechanism as it works automatically on install, remove and upgrade operations. """ installdb = pisi.db.installdb.InstallDB() historydb = pisi.db.historydb.HistoryDB() historydb.create_history("snapshot") li = installdb.list_installed() progress = ctx.ui.Progress(len(li)) processed = 0 for name in installdb.list_installed(): package = installdb.get_package(name) historydb.add_package(pkgBefore=package, operation="snapshot") # Save changed config files of the package in snapshot for f in installdb.get_files(name).list: if f.type == "config" and pisi.util.config_changed(f): fpath = pisi.util.join_path(ctx.config.dest_dir(), f.path) historydb.save_config(name, fpath) processed += 1 ctx.ui.display_progress(operation = "snapshot", percent = progress.update(processed), info = _("Taking snapshot of the system")) historydb.update_history()
def info_name(package_name, useinstalldb=False): """Fetch package information for the given package.""" installdb = pisi.db.installdb.InstallDB() packagedb = pisi.db.packagedb.PackageDB() if useinstalldb: package = installdb.get_package(package_name) repo = None else: package, repo = packagedb.get_package_repo(package_name) metadata = pisi.metadata.MetaData() metadata.package = package #FIXME: get it from sourcedb if available metadata.source = None #TODO: fetch the files from server if possible (wow, you maniac -- future exa) if useinstalldb and installdb.has_package(package.name): try: files = installdb.get_files(package.name) except pisi.Error, e: ctx.ui.warning(e) files = None
def rebuild_filesdb(): for pkg in list_installed(): ctx.ui.info(_('Adding \'%s\' to db... ') % pkg, noln=True) files = installdb.get_files(pkg) filesdb.add_files(pkg, files) ctx.ui.info(_('OK.'))