def install(packages, reinstall=False, ignore_file_conflicts=False, ignore_package_conflicts=False): """ Returns True if no errors occured during the operation @param packages: list of package names -> list_of_strings @param reinstall: reinstalls already installed packages else ignores @param ignore_file_conflicts: Ignores file conflicts during the installation and continues to install packages. @param ignore_package_conflicts: Ignores package conflicts during the installation and continues to install packages. """ pisi.db.historydb.HistoryDB().create_history("install") if not ctx.get_option('ignore_file_conflicts'): ctx.set_option('ignore_file_conflicts', ignore_file_conflicts) if not ctx.get_option('ignore_package_conflicts'): ctx.set_option('ignore_package_conflicts', ignore_package_conflicts) # Install pisi package files or pisi packages from a repository if packages and packages[0].endswith(ctx.const.package_suffix): return pisi.operations.install.install_pkg_files(packages, reinstall) else: return pisi.operations.install.install_pkg_names(packages, reinstall)
def run(self): self.init(database=True) source = pisi.db.sourcedb.SourceDB() imdb = pisi.db.installdb.InstallDB() installed_emerge_packages = imdb.list_installed_with_build_host( "localhost") emerge_up_list = [] for package in installed_emerge_packages: if source.has_spec(package): spec = source.get_spec(package) if spec.getSourceRelease() > imdb.get_version(package)[1]: emerge_up_list.append(package) if ctx.get_option('output_dir'): ctx.ui.info( _('Output directory: %s') % ctx.config.options.output_dir) else: ctx.ui.info(_('Outputting binary packages in the package cache.')) ctx.config.options.output_dir = ctx.config.cached_packages_dir() repos = pisi.api.list_repos() pisi.api.update_repos(repos, ctx.get_option('force')) pisi.api.emerge(emerge_up_list)
def run(self): if not self.options.quiet: self.options.debug = True if self.options.package_format == "help": self.init(False, False) ctx.ui.info(_("Supported package formats:")) for format in pisi.package.Package.formats: if format == pisi.package.Package.default_format: ctx.ui.info(_(" %s (default)") % format) else: ctx.ui.info(" %s" % format) return self.init() if ctx.get_option('output_dir'): ctx.ui.info(_('Output directory: %s') % ctx.config.options.output_dir) else: ctx.ui.info(_('Outputting packages in the working directory.')) ctx.config.options.output_dir = '.' for x in self.args or ["pspec.xml"]: if ctx.get_option('until'): pisi.api.build_until(x, ctx.get_option('until')) else: pisi.api.build(x)
def run(self): if len(self.args)==2 or len(self.args)==0: self.init() if len(self.args)==2: name = self.args[0] indexuri = self.args[1] else: name = 'pardus-2009' indexuri = 'http://paketler.pardus.org.tr/pardus-2009/pisi-index.xml.bz2' if ctx.get_option('no_fetch'): if not ctx.ui.confirm(_('Add %s repository without updating the database?\nBy confirming ' 'this you are also adding the repository to your system without ' 'checking the distribution of the repository.\n' 'Do you want to continue?') % name): return pisi.api.add_repo(name, indexuri, ctx.get_option('at')) if not ctx.get_option('no_fetch'): try: pisi.api.update_repo(name) if not ctx.get_option('ignore_check'): self.check_arch_and_distro(name) except (pisi.fetcher.FetchError, IOError): warning = _("%s repository could not be reached. Removing %s from system.") % (name, name) self.warn_and_remove(warning, name) else: self.help() return
def run(self): self.init(database = True) source = pisi.db.sourcedb.SourceDB() imdb = pisi.db.installdb.InstallDB() installed_emerge_packages = imdb.list_installed_with_build_host("localhost") emerge_up_list = [] for package in installed_emerge_packages: if source.has_spec(package): spec = source.get_spec(package) if spec.getSourceRelease() > imdb.get_version(package)[1]: emerge_up_list.append(package) if ctx.get_option('output_dir'): ctx.ui.info(_('Output directory: %s') % ctx.config.options.output_dir) else: ctx.ui.info(_('Outputting binary packages in the package cache.')) ctx.config.options.output_dir = ctx.config.cached_packages_dir() repos = pisi.api.list_repos() pisi.api.update_repos(repos, ctx.get_option('force')) pisi.api.emerge(emerge_up_list)
def run(self): self.init(write=False) if not ctx.get_option('installed'): # Graph from package database packagedb = pisi.db.packagedb.PackageDB() if ctx.get_option('repository'): repo = ctx.get_option('repository') ctx.ui.info(_('Plotting packages in repository %s') % repo) else: repo = None ctx.ui.info(_('Plotting a graph of relations among all repository packages')) if self.args: a = self.args else: a = pisi.api.list_available(repo) else: # Graph from installed packages database packagedb = pisi.db.installdb.InstallDB() if self.args: a = self.args else: # if A is empty, then graph all packages ctx.ui.info(_('Plotting a graph of relations among all installed packages')) a = pisi.api.list_installed() g = pisi.api.package_graph(a, packagedb, ignore_installed = ctx.get_option('ignore_installed')) g.write_graphviz(file(ctx.get_option('output'), 'w'))
def upgrade_base(A = set()): installdb = pisi.db.installdb.InstallDB() componentdb = pisi.db.componentdb.ComponentDB() if not ctx.config.values.general.ignore_safety and not ctx.get_option('ignore_safety'): if componentdb.has_component('system.base'): systembase = set(componentdb.get_union_component('system.base').packages) extra_installs = filter(lambda x: not installdb.has_package(x), systembase - set(A)) extra_installs = pisi.blacklist.exclude_from(extra_installs, ctx.const.blacklist) if extra_installs: ctx.ui.warning(_("Safety switch forces the installation of " "following packages:")) ctx.ui.info(util.format_by_columns(sorted(extra_installs))) G_f, install_order = operations.install.plan_install_pkg_names(extra_installs) extra_upgrades = filter(lambda x: is_upgradable(x), systembase - set(install_order)) upgrade_order = [] extra_upgrades = pisi.blacklist.exclude_from(extra_upgrades, ctx.const.blacklist) if ctx.get_option('exclude_from'): extra_upgrades = pisi.blacklist.exclude_from(extra_upgrades, ctx.get_option('exclude_from')) if ctx.get_option('exclude'): extra_upgrades = pisi.blacklist.exclude(extra_upgrades, ctx.get_option('exclude')) if extra_upgrades: ctx.ui.warning(_("Safety switch forces the upgrade of " "following packages:")) ctx.ui.info(util.format_by_columns(sorted(extra_upgrades))) G_f, upgrade_order = plan_upgrade(extra_upgrades, force_replaced=False) # return packages that must be added to any installation return set(install_order + upgrade_order) else: ctx.ui.warning(_('Safety switch: The component system.base cannot be found.')) return set()
def run(self): self.init(database = True, write = False) if not self.args: self.help() return lang = ctx.get_option('language') repo = ctx.get_option('repository') if ctx.get_option('installdb'): db = pisi.db.installdb.InstallDB() pkgs = db.search_package(self.args, lang) get_info = db.get_package get_name_sum = lambda pkg:(pkg.name, pkg.summary) elif ctx.get_option('sourcedb'): db = pisi.db.sourcedb.SourceDB() pkgs = db.search_spec(self.args, lang, repo) get_info = db.get_spec get_name_sum = lambda pkg:(pkg.source.name, pkg.source.summary) else: db = pisi.db.packagedb.PackageDB() pkgs = db.search_package(self.args, lang, repo) get_info = db.get_package get_name_sum = lambda pkg:(pkg.name, pkg.summary) for pkg in pkgs: pkg_info = get_info(pkg) name, summary = get_name_sum(pkg_info) if lang and summary.has_key(lang): print "%s - %s" % (name, summary[lang]) else: print "%s - %s" % (name, summary)
def run_logged(cmd, sudo=False): """run command and get return value""" if sudo: cmd = "sudo " + cmd ctx.ui.info(_('Running ') + cmd, verbose=True) if ctx.stdout: stdout = ctx.stdout else: if ctx.get_option('debug'): stdout = None else: stdout = subprocess.PIPE if ctx.stderr: stderr = ctx.stderr else: if ctx.get_option('debug'): stderr = None else: stderr = subprocess.STDOUT p = subprocess.Popen(cmd, shell=True, stdout=stdout, stderr=stderr) out, err = p.communicate() ctx.ui.debug(_('return value for "%s" is %s') % (cmd, p.returncode)) return p.returncode
def run(self): if self.options.fetch_only: self.init(database=True, write=False) else: self.init() if not ctx.get_option('bypass_update_repo'): ctx.ui.info(_('Updating repositories')) repos = pisi.api.list_repos() pisi.api.update_repos(repos) else: ctx.ui.info(_('Will not update repositories')) repository = ctx.get_option('repository') components = ctx.get_option('component') packages = [] if components: componentdb = pisi.db.componentdb.ComponentDB() for name in components: if componentdb.has_component(name): if repository: packages.extend(componentdb.get_packages(name, walk=True, repo=repository)) else: packages.extend(componentdb.get_union_packages(name, walk=True)) packages.extend(self.args) pisi.api.upgrade(packages, repository)
def run(self): self.init() if not ctx.get_option('bypass_update_repo'): ctx.ui.info(_('Updating repositories')) repos = ctx.repodb.list() for repo in repos: pisi.api.update_repo(repo) else: ctx.ui.info(_('Will not update repositories')) if not self.args: packages = ctx.installdb.list_installed() else: packages = self.args if ctx.get_option('exclude_from'): packages = self.exclude_from(packages) if ctx.get_option('exclude'): patterns = ctx.get_option('exclude') packages = self.exclude(packages, patterns) pisi.api.upgrade(packages) self.finalize()
def upgrade_base(A=set()): installdb = pisi.db.installdb.InstallDB() componentdb = pisi.db.componentdb.ComponentDB() ignore_build = ctx.get_option("ignore_build_no") if not ctx.config.values.general.ignore_safety and not ctx.get_option("ignore_safety"): if componentdb.has_component("system.base"): systembase = set(componentdb.get_union_component("system.base").packages) extra_installs = filter(lambda x: not installdb.has_package(x), systembase - set(A)) if extra_installs: ctx.ui.warning( _("Safety switch: Following packages in system.base will be installed: ") + util.strlist(extra_installs) ) G_f, install_order = operations.install.plan_install_pkg_names(extra_installs) extra_upgrades = filter(lambda x: is_upgradable(x, ignore_build), systembase - set(install_order)) upgrade_order = [] if extra_upgrades: ctx.ui.warning( _("Safety switch: Following packages in system.base will be upgraded: ") + util.strlist(extra_upgrades) ) G_f, upgrade_order = plan_upgrade(extra_upgrades) # return packages that must be added to any installation return set(install_order + upgrade_order) else: ctx.ui.warning(_("Safety switch: the component system.base cannot be found")) return set()
def run(self): self.init(database = True, write = False) if not ctx.get_option('without_buildno'): installed = self.installdb.list_installed() else: installed = self.installdb.list_installed_without_buildno() component = ctx.get_option('component') if component: #FIXME: pisi api is insufficient to do this from sets import Set as set component_pkgs = self.componentdb.get_union_packages(component, walk=True) installed = list(set(installed) & set(component_pkgs)) installed.sort() if self.options.install_info: ctx.ui.info(_('Package Name |St| Version| Rel.| Build| Distro| Date')) print '========================================================================' for pkg in installed: package = self.installdb.get_package(pkg) inst_info = self.installdb.get_info(pkg) if self.options.long: ctx.ui.info(unicode(package)) ctx.ui.info(unicode(inst_info)) elif self.options.install_info: ctx.ui.info('%-15s |%s' % (package.name, inst_info.one_liner())) else: ctx.ui.info('%15s - %s' % (package.name, unicode(package.summary)))
def run(self): self.init(write=False) if not ctx.get_option('installed'): if ctx.get_option('repository'): repo = ctx.get_option('repository') ctx.ui.info(_('Plotting packages in repository %s') % repo) else: repo = pisi.itembyrepodb.repos if self.args: a = self.args else: ctx.ui.info(_('Plotting a graph of relations among all repository packages')) a = ctx.packagedb.list_packages(repo) else: if self.args: a = self.args else: # if A is empty, then graph all packages ctx.ui.info(_('Plotting a graph of relations among all installed packages')) a = ctx.installdb.list_installed() repo = pisi.itembyrepodb.installed g = pisi.api.package_graph(a, repo = repo, ignore_installed = ctx.get_option('ignore_installed')) g.write_graphviz(file(ctx.get_option('output'), 'w')) self.finalize()
def upgrade_base(A=set(), ignore_package_conflicts=False): ignore_build = ctx.get_option("ignore_build_no") if not ctx.get_option("ignore_safety"): if ctx.componentdb.has_component("system.base"): systembase = set(ctx.componentdb.get_union_comp("system.base").packages) extra_installs = filter(lambda x: not ctx.installdb.is_installed(x), systembase - set(A)) if extra_installs: ctx.ui.warning( _("Safety switch: Following packages in system.base will be installed: ") + util.strlist(extra_installs) ) G_f, install_order = plan_install_pkg_names(extra_installs, ignore_package_conflicts) extra_upgrades = filter(lambda x: is_upgradable(x, ignore_build), systembase - set(install_order)) upgrade_order = [] if extra_upgrades: ctx.ui.warning( _("Safety switch: Following packages in system.base will be upgraded: ") + util.strlist(extra_upgrades) ) G_f, upgrade_order = plan_upgrade(extra_upgrades, ignore_build) # return packages that must be added to any installation return set(install_order + upgrade_order) else: ctx.ui.warning(_("Safety switch: the component system.base cannot be found")) return set()
def run(self): self.init(database=False, write=False) if self.options.package_format == "help": ctx.ui.info(_("Supported package formats:")) for format in pisi.package.Package.formats: if format == pisi.package.Package.default_format: ctx.ui.info(_(" %s (default)") % format) else: ctx.ui.info(" %s" % format) return new_package = ctx.get_option("newest_package") if new_package: old_packages = self.args else: if len(self.args) < 2: self.help() return new_package = self.args[-1] old_packages = self.args[:-1] if ctx.get_option('output_dir'): ctx.ui.info(_('Output directory: %s') % ctx.config.options.output_dir) else: ctx.ui.info(_('Outputting packages in the working directory.')) ctx.config.options.output_dir = '.' from pisi.operations.delta import create_delta_packages create_delta_packages(old_packages, new_package)
def run(self): if not self.args: self.help() return # We cant use ctx.get_option as we didn't init PiSi # currently... if self.options.until: if not self.options.until in Build.steps: raise Error(_('Step must be one of %s ') % pisi.util.strlist(Build.steps)) if self.options.no_install: self.init(database=True, write=False) else: self.init() if ctx.get_option('package_format') not in Build.package_formats: raise Error(_('package_format must be one of %s ') % pisi.util.strlist(Build.package_formats)) if ctx.get_option('output_dir'): ctx.ui.info(_('Output directory: %s') % ctx.config.options.output_dir) else: ctx.ui.info(_('Outputting packages in the working directory.')) ctx.config.options.output_dir = '.' for x in self.args: if ctx.get_option('until'): pisi.api.build_until(x, ctx.get_option('until')) else: pisi.api.build(x) self.finalize()
def run(self): self.init(database=False, write=False) if self.options.package_format == "help": ctx.ui.info(_("Supported package formats:")) for format in pisi.package.Package.formats: if format == pisi.package.Package.default_format: ctx.ui.info(_(" %s (default)") % format) else: ctx.ui.info(" %s" % format) return new_package = ctx.get_option("newest_package") if new_package: old_packages = self.args else: if len(self.args) < 2: self.help() return new_package = self.args[-1] old_packages = self.args[:-1] if not ctx.get_option('output_dir'): ctx.config.options.output_dir = '.' from pisi.operations.delta import create_delta_packages create_delta_packages(old_packages, new_package)
def build(self): """Build the package in one shot.""" architecture = ctx.config.values.general.architecture if architecture in self.spec.source.excludeArch: raise ExcludedArchitectureException( _("pspec.xml avoids this package from building for '%s'") % architecture) ctx.ui.status(_("Building source package: %s") % self.spec.source.name) self.compile_comar_script() # check if all patch files exists, if there are missing no need # to unpack! self.check_patches() self.check_build_dependencies() self.fetch_component() self.fetch_source_archives() for build_type in self.build_types: self.set_build_type(build_type) self.unpack_source_archives() self.run_setup_action() self.run_build_action() if ctx.get_option('debug') and not ctx.get_option('ignore_check'): self.run_check_action() self.run_install_action() # after all, we are ready to build/prepare the packages self.build_packages()
def run(self): if len(self.args) == 2: self.init() name, indexuri = self.args if ctx.get_option("no_fetch"): if not ctx.ui.confirm( _( "Add %s repository without updating the database?\nBy confirming " "this you are also adding the repository to your system without " "checking the distribution of the repository.\n" "Do you want to continue?" ) % name ): return pisi.api.add_repo(name, indexuri, ctx.get_option("at")) if not ctx.get_option("no_fetch"): try: pisi.api.update_repo(name) except (pisi.fetcher.FetchError, IOError): warning = _("%s repository could not be reached. Removing %s from system.") % (name, name) self.warn_and_remove(warning, name) else: self.help() return
def build(self): """Build the package in one shot.""" ctx.ui.status(_("Building PiSi source package: %s") % self.spec.source.name) self.compile_action_script() self.compile_comar_script() # check if all patch files exists, if there are missing no need to unpack! self.patch_exists() self.check_build_dependencies() self.fetch_component() self.fetch_source_archive() self.unpack_source_archive() # apply the patches and prepare a source directory for build. self.apply_patches() self.run_setup_action() self.run_build_action() if ctx.get_option('debug') and not ctx.get_option('ignore_check'): self.run_check_action() self.run_install_action() # after all, we are ready to build/prepare the packages return self.build_packages()
def run(self): self.init(database = True, write = False) if not ctx.get_option('without_buildno'): installed = self.installdb.list_installed() else: installed = self.installdb.list_installed_without_buildno() component = ctx.get_option('component') if component: #FIXME: pisi api is insufficient to do this component_pkgs = self.componentdb.get_union_packages(component, walk=True) installed = list(set(installed) & set(component_pkgs)) installed.sort() # Resize the first column according to the longest package name if installed: maxlen = max([len(_p) for _p in installed]) if self.options.install_info: ctx.ui.info(_('Package Name |St| Version| Rel.| Build| Distro| Date')) print '========================================================================' for pkg in installed: package = self.installdb.get_package(pkg) inst_info = self.installdb.get_info(pkg) if self.options.long: ctx.ui.info(unicode(package)) ctx.ui.info(unicode(inst_info)) elif self.options.install_info: ctx.ui.info('%-15s |%s' % (package.name, inst_info.one_liner())) else: package.name = package.name + ' ' * (maxlen - len(package.name)) ctx.ui.info('%s - %s' % (package.name, unicode(package.summary)))
def upgrade_base(A=set(), ignore_package_conflicts=False): installdb = pisi.db.installdb.InstallDB() componentdb = pisi.db.componentdb.ComponentDB() ignore_build = ctx.get_option('ignore_build_no') if not ctx.get_option('ignore_safety'): if componentdb.has_component('system.base'): systembase = set( componentdb.get_union_component('system.base').packages) extra_installs = filter(lambda x: not installdb.has_package(x), systembase - set(A)) if extra_installs: ctx.ui.warning( _('Safety switch: Following packages in system.base will be installed: ' ) + util.strlist(extra_installs)) G_f, install_order = operations.install.plan_install_pkg_names( extra_installs, ignore_package_conflicts) extra_upgrades = filter(lambda x: is_upgradable(x, ignore_build), systembase - set(install_order)) upgrade_order = [] if extra_upgrades: ctx.ui.warning( _('Safety switch: Following packages in system.base will be upgraded: ' ) + util.strlist(extra_upgrades)) G_f, upgrade_order = plan_upgrade(extra_upgrades) # return packages that must be added to any installation return set(install_order + upgrade_order) else: ctx.ui.warning( _('Safety switch: the component system.base cannot be found')) return set()
def run(self): self.init(write=False) if not ctx.get_option('installed'): # Graph from package database packagedb = pisi.db.packagedb.PackageDB() if ctx.get_option('repository'): repo = ctx.get_option('repository') ctx.ui.info(_('Plotting packages in repository %s') % repo) else: repo = None ctx.ui.info(_('Plotting a graph of relations among all repository packages')) if self.args: a = self.args else: a = pisi.api.list_available(repo) else: # Graph from installed packages database packagedb = pisi.db.installdb.InstallDB() if self.args: a = self.args else: # if A is empty, then graph all packages ctx.ui.info(_('Plotting a graph of relations among all installed packages')) a = pisi.api.list_installed() g = pisi.api.package_graph(a, packagedb, ignore_installed = ctx.get_option('ignore_installed'), reverse = ctx.get_option('reverse')) g.write_graphviz(file(ctx.get_option('output'), 'w'))
def run(self): if len(self.args) == 2: self.init() name, indexuri = self.args if ctx.get_option('no_fetch'): if not ctx.ui.confirm( _('Add %s repository without updating the database?\nBy confirming ' 'this you are also adding the repository to your system without ' 'checking the distribution of the repository.\n' 'Do you want to continue?') % name): return pisi.api.add_repo(name, indexuri, ctx.get_option('at')) if not ctx.get_option('no_fetch'): try: pisi.api.update_repo(name) except (pisi.Error, IOError): warning = _( "%s repository could not be reached. Removing %s from system." ) % (name, name) self.warn_and_remove(warning, name) else: self.help() return
def check_path_collision(package, pkgList): """This function will check for collision of paths in a package with the paths of packages in pkgList. The return value will be the list containing the paths that collide.""" collisions = [] for pinfo in package.files: for pkg in pkgList: if pkg is package: continue for path in pkg.files: # if pinfo.path is a subpath of path.path like # the example below. path.path is marked as a # collide. Exp: # pinfo.path: /usr/share # path.path: /usr/share/doc if (path.path.endswith(ctx.const.ar_file_suffix) and ctx.get_option('create_static')) or \ (path.path.endswith(ctx.const.debug_file_suffix) and not ctx.get_option('no_debug')): # don't throw collision error for these files. # we'll handle this in gen_files_xml.. continue if util.subpath(pinfo.path, path.path): collisions.append(path.path) ctx.ui.error(_('Path %s belongs in multiple packages') % path.path) return collisions
def print_pkginfo(self, metadata, files, repo = None): import os.path if not ctx.get_option('long'): pkg = metadata.package ctx.ui.info('%15s - %s' % (pkg.name, unicode(pkg.summary))) else: ctx.ui.info(unicode(metadata.package)) if repo: deps = [x.package for x in ctx.packagedb.get_deps(metadata.package.name, repo)] print _('Dependencies:'), util.strlist(deps) revdeps = [x[0] for x in ctx.packagedb.get_rev_deps(metadata.package.name, repo)] print _('Reverse Dependencies:'), util.strlist(revdeps) if self.options.files or self.options.files_path: if files: print _('\nFiles:') for fileinfo in files.list: if self.options.files: print fileinfo else: print fileinfo.path else: ctx.ui.warning(_('File information not available')) if ctx.get_option('long'): print
def run(self): self.init(database = True, write = False) component = ctx.get_option('component') if component: #FIXME: pisi api is insufficient to do this installed = pisi.api.list_installed() component_pkgs = self.componentdb.get_union_packages(component, walk=True) pkgs = list(set(installed) & set(component_pkgs)) elif self.args: pkgs = self.args else: ctx.ui.info(_('Checking all installed packages')) pkgs = pisi.api.list_installed() check_config = ctx.get_option('config') for pkg in pkgs: ctx.ui.info(_('* Checking %s... ') % pkg, noln=True) if self.installdb.has_package(pkg): check_results = pisi.api.check(pkg, check_config) corrupted = check_results['missing'] or check_results['corrupted'] if corrupted: if check_config: ctx.ui.info(_('\nPackage %s has changed config files.') % pkg) else: ctx.ui.info(_('\nPackage %s is corrupt.') % pkg) else: ctx.ui.info(_("OK"), verbose=False) else: ctx.ui.info(_('Package %s not installed') % pkg)
def remove(A, ignore_dep = False, ignore_safety = False): """remove set A of packages from system (A is a list of package names)""" componentdb = pisi.db.componentdb.ComponentDB() installdb = pisi.db.installdb.InstallDB() A = [str(x) for x in A] # filter packages that are not installed A_0 = A = set(A) if not ctx.get_option('ignore_safety') and not ctx.config.values.general.ignore_safety and not ignore_safety: if componentdb.has_component('system.base'): systembase = set(componentdb.get_union_component('system.base').packages) refused = A.intersection(systembase) if refused: raise pisi.Error(_("Safety switch prevents the removal of " "following packages:\n") + util.format_by_columns(sorted(refused))) A = A - systembase else: ctx.ui.warning(_("Safety switch: The component system.base cannot be found.")) Ap = [] for x in A: if installdb.has_package(x): Ap.append(x) else: ctx.ui.info(_('Package %s does not exist. Cannot remove.') % x) A = set(Ap) if len(A)==0: ctx.ui.info(_('No packages to remove.')) return False if not ctx.config.get_option('ignore_dependency') and not ignore_dep: G_f, order = plan_remove(A) else: G_f = None order = A ctx.ui.info(_("""The following list of packages will be removed in the respective order to satisfy dependencies: """) + util.strlist(order)) if len(order) > len(A_0): if not ctx.ui.confirm(_('Do you want to continue?')): ctx.ui.warning(_('Package removal declined')) return False if ctx.get_option('dry_run'): return ctx.ui.notify(ui.packagestogo, order = order) for x in order: if installdb.has_package(x): atomicoperations.remove_single(x) else: ctx.ui.info(_('Package %s is not installed. Cannot remove.') % x)
def remove(A, ignore_dep=None): """remove set A of packages from system (A is a list of package names)""" A = [str(x) for x in A] # filter packages that are not installed A_0 = A = expand_components(set(A)) if not ctx.get_option('bypass_safety'): if ctx.componentdb.has_component('system.base'): systembase = set( ctx.componentdb.get_union_comp('system.base').packages) refused = A.intersection(systembase) if refused: ctx.ui.warning( _('Safety switch: cannot remove the following packages in system.base: ' ) + util.strlist(refused)) A = A - systembase else: ctx.ui.warning( _('Safety switch: the component system.base cannot be found')) Ap = [] for x in A: if ctx.installdb.is_installed(x): Ap.append(x) else: ctx.ui.info(_('Package %s does not exist. Cannot remove.') % x) A = set(Ap) if len(A) == 0: ctx.ui.info(_('No packages to remove.')) return False if not ctx.config.get_option('ignore_dependency') and not ignore_dep: G_f, order = plan_remove(A) else: G_f = None order = A ctx.ui.info( _("""The following minimal list of packages will be removed in the respective order to satisfy dependencies: """) + util.strlist(order)) if len(order) > len(A_0): if not ctx.ui.confirm(_('Do you want to continue?')): ctx.ui.warning(_('Package removal declined')) return False if ctx.get_option('dry_run'): return ctx.ui.notify(ui.packagestogo, order=order) for x in order: if ctx.installdb.is_installed(x): atomicoperations.remove_single(x) else: ctx.ui.info(_('Package %s is not installed. Cannot remove.') % x)
def run(self): self.init(database = True, write = False) orphaned = self.installdb.get_orphaned() if ctx.get_option('exclude'): orphaned = pisi.blacklist.exclude(orphaned, ctx.get_option('exclude')) pisi.api.remove(orphaned)
def remove(A): """remove set A of packages from system (A is a list of package names)""" # filter packages that are not installed A_0 = A = expand_components(set(A)) if not ctx.get_option("bypass_safety"): if ctx.componentdb.has_component("system.base"): refused = A.intersection(set(ctx.componentdb.get_component("system.base").packages)) if refused: ctx.ui.warning( _("Safety switch: cannot remove the following packages in system.base: ") + util.strlist(refused) ) A = A - set(ctx.componentdb.get_component("system.base").packages) else: ctx.ui.warning(_("Safety switch: the component system.base cannot be found")) Ap = [] for x in A: if ctx.installdb.is_installed(x): Ap.append(x) else: ctx.ui.info(_("Package %s does not exist. Cannot remove.") % x) A = set(Ap) if len(A) == 0: ctx.ui.info(_("No packages to remove.")) return False if not ctx.config.get_option("ignore_dependency"): G_f, order = plan_remove(A) else: G_f = None order = A ctx.ui.info( _( """The following minimal list of packages will be removed in the respective order to satisfy dependencies: """ ) + util.strlist(order) ) if len(order) > len(A_0): if not ctx.ui.confirm(_("Do you want to continue?")): ctx.ui.warning(_("Package removal declined")) return False if ctx.get_option("dry_run"): return ctx.ui.notify(ui.packagestogo, order=order) for x in order: if ctx.installdb.is_installed(x): atomicoperations.remove_single(x) else: ctx.ui.info(_("Package %s is not installed. Cannot remove.") % x)
def run(self): self.init(database=True, write=False) orphaned = self.installdb.get_orphaned() if ctx.get_option('exclude'): orphaned = pisi.blacklist.exclude(orphaned, ctx.get_option('exclude')) pisi.api.remove(orphaned)
def find_upgrades(packages, replaces): packagedb = pisi.db.packagedb.PackageDB() installdb = pisi.db.installdb.InstallDB() debug = ctx.config.get_option("debug") security_only = ctx.get_option('security_only') comparesha1sum = ctx.get_option('compare_sha1sum') Ap = [] ds = [] for i_pkg in packages: if i_pkg in replaces.keys(): # Replaced packages will be forced for upgrade, cause replaced packages are marked as obsoleted also. So we # pass them. continue if i_pkg.endswith(ctx.const.package_suffix): ctx.ui.debug(_("Warning: package *name* ends with '.pisi'")) if not installdb.has_package(i_pkg): ctx.ui.info(_('Package %s is not installed.') % i_pkg, True) continue if not packagedb.has_package(i_pkg): ctx.ui.info(_('Package %s is not available in repositories.') % i_pkg, True) continue pkg = packagedb.get_package(i_pkg) hash = installdb.get_install_tar_hash(i_pkg) (version, release, build, distro, distro_release) = installdb.get_version_and_distro_release(i_pkg) if security_only and not pkg.has_update_type("security", release): continue if pkg.distribution == distro and \ pisi.version.make_version(pkg.distributionRelease) > pisi.version.make_version(distro_release): Ap.append(i_pkg) else: if int(release) < int(pkg.release): Ap.append(i_pkg) elif comparesha1sum and \ int(release) == int(pkg.release) and \ not pkg.installTarHash == hash: Ap.append(i_pkg) ds.append(i_pkg) else: ctx.ui.info(_('Package %s is already at the latest release %s.') % (pkg.name, pkg.release), True) if debug and ds: ctx.ui.status(_('The following packages have different sha1sum:')) ctx.ui.info(util.format_by_columns(sorted(ds))) return Ap
def run(self): self.init() from pisi.api import index if len(self.args)>0: index(self.args, ctx.get_option('output')) elif len(self.args)==0: ctx.ui.info(_('Indexing current directory.')) index('.', ctx.get_option('output')) self.finalize()
def remove(A, ignore_dep = False, ignore_safety = False): """remove set A of packages from system (A is a list of package names)""" A = [str(x) for x in A] # filter packages that are not installed A_0 = A = expand_components(set(A)) if not ctx.get_option('ignore_safety') and not ignore_safety: if ctx.componentdb.has_component('system.base'): systembase = set(ctx.componentdb.get_union_comp('system.base').packages) refused = A.intersection(systembase) if refused: ctx.ui.warning(_('Safety switch: cannot remove the following packages in system.base: ') + util.strlist(refused)) A = A - systembase else: ctx.ui.warning(_('Safety switch: the component system.base cannot be found')) Ap = [] for x in A: if ctx.installdb.is_installed(x): Ap.append(x) else: ctx.ui.info(_('Package %s does not exist. Cannot remove.') % x) A = set(Ap) if len(A)==0: ctx.ui.info(_('No packages to remove.')) return False if not ctx.config.get_option('ignore_dependency') and not ignore_dep: G_f, order = plan_remove(A) else: G_f = None order = A ctx.ui.info(_("""The following minimal list of packages will be removed in the respective order to satisfy dependencies: """) + util.strlist(order)) if len(order) > len(A_0): if not ctx.ui.confirm(_('Do you want to continue?')): ctx.ui.warning(_('Package removal declined')) return False if ctx.get_option('dry_run'): return ctx.ui.notify(ui.packagestogo, order = order) for x in order: if ctx.installdb.is_installed(x): atomicoperations.remove_single(x) else: ctx.ui.info(_('Package %s is not installed. Cannot remove.') % x)
def run(self): if self.args: self.init(database=True) for package_fn in self.args: pisi.api.resurrect_package(package_fn, ctx.get_option('files`')) else: self.init(database=False) if ctx.ui.confirm(_('Rebuild PISI databases?')): pisi.api.rebuild_db(ctx.get_option('files')) self.finalize()
def run(self): self.init(database = False, write = False) if ctx.get_option('snapshot'): self.take_snapshot() return elif ctx.get_option('takeback'): opno = ctx.get_option('takeback') if opno != -1: self.takeback(opno) return self.redirect_output(self.print_history)
def run(self): self.init(database=False, write=False) if ctx.get_option('snapshot'): self.take_snapshot() return elif ctx.get_option('takeback'): opno = ctx.get_option('takeback') if opno != -1: self.takeback(opno) return self.redirect_output(self.print_history)
def run(self): self.init(database=False, write=False) ctx.set_option("ignore_build_no", True) if ctx.get_option("snapshot"): self.take_snapshot() return elif ctx.get_option("takeback"): opno = ctx.get_option("takeback") if opno != -1: self.takeback(opno) return self.redirect_output(self.print_history)
def emerge(A, rebuild_all=False): # A was a list, remove duplicates and expand components A = [str(x) for x in A] A_0 = A = expand_src_components(set(A)) ctx.ui.debug('A = %s' % str(A)) if len(A) == 0: ctx.ui.info(_('No packages to emerge.')) return #A |= upgrade_base(A) # FIXME: Errr... order_build changes type conditionally and this # is not good. - baris if not ctx.config.get_option('ignore_dependency'): G_f, order_inst, order_build = plan_emerge(A, rebuild_all) else: G_f = None order_inst = [] order_build = A if order_inst: ctx.ui.info( _("""The following minimal list of packages will be installed from repository in the respective order to satisfy dependencies: """) + util.strlist(order_inst)) ctx.ui.info( _("""The following minimal list of packages will be built and installed in the respective order to satisfy dependencies: """) + util.strlist(order_build)) if ctx.get_option('dry_run'): return if len(order_inst) + len(order_build) > len(A_0): if not ctx.ui.confirm( _('There are extra packages due to dependencies. Do you want to continue?' )): return False ctx.ui.notify(ui.packagestogo, order=order_inst) pisi_installed = ctx.installdb.is_installed('pisi') for x in order_inst: atomicoperations.install_single_name(x) #ctx.ui.notify(ui.packagestogo, order = order_build) for x in order_build: package_names = atomicoperations.build(x)[0] install_pkg_files(package_names) # handle inter-package deps here # FIXME: take a look at the fixme above :(, we have to be sure # that order_build is a known type... U = set(order_build) U.update(order_inst) if 'pisi' in order_build or (('pisi' in U) and pisi_installed): upgrade_pisi()
def run(self): self.init(database=True, write=False) from pisi.api import index from pisi.file import File ctypes = {"bz2": File.COMPRESSION_TYPE_BZ2, "xz": File.COMPRESSION_TYPE_XZ} compression = 0 for type_str in ctx.get_option("compression_types").split(","): compression |= ctypes.get(type_str, 0) index(self.args or ["."], ctx.get_option('output'), skip_sources=ctx.get_option('skip_sources'), skip_signing=ctx.get_option('skip_signing'), compression=compression)
def run(self): self.init(database = True, write = False) upgradable_pkgs = pisi.api.list_upgradable() component = ctx.get_option('component') if component: #FIXME: eopkg api is insufficient to do this component_pkgs = self.componentdb.get_union_packages(component, walk=True) upgradable_pkgs = list(set(upgradable_pkgs) & set(component_pkgs)) upgradable_pkgs = pisi.blacklist.exclude_from(upgradable_pkgs, ctx.const.blacklist) if not upgradable_pkgs: ctx.ui.info(_('No packages to upgrade.')) return upgradable_pkgs.sort() # Resize the first column according to the longest package name maxlen = max([len(_p) for _p in upgradable_pkgs]) if self.options.install_info: ctx.ui.info(_('Package Name |St| Version| Rel.| Distro| Date')) print '===========================================================================' for pkg in upgradable_pkgs: package = self.installdb.get_package(pkg) inst_info = self.installdb.get_info(pkg) if self.options.long: ctx.ui.info(package) print inst_info elif self.options.install_info: ctx.ui.info('%-20s |%s ' % (package.name, inst_info.one_liner())) else: package.name = package.name + ' ' * (maxlen - len(package.name)) ctx.ui.info('%s - %s' % (package.name, unicode(package.summary)))
def run_action_function(self, func, mandatory=False): """Calls the corresponding function in actions.py. If mandatory parameter is True, and function is not present in actionLocals pisi.build.Error will be raised.""" # we'll need our working directory after actionscript # finished its work in the archive source directory. curDir = os.getcwd() src_dir = self.pkg_src_dir() if os.path.exists(src_dir): os.chdir(src_dir) else: raise Error(_("ERROR: WorkDir (%s) does not exist\n") % src_dir) if func in self.actionLocals: if ctx.get_option('ignore_sandbox') or \ not ctx.config.values.build.enablesandbox: self.actionLocals[func]() else: import catbox ctx.ui.info(_("Sandbox enabled build...")) # Configure allowed paths from sandbox.conf valid_paths = [self.pkg_dir()] conf_file = ctx.const.sandbox_conf if os.path.exists(conf_file): for line in file(conf_file): line = line.strip() if len(line) > 0 and not line.startswith("#"): if line.startswith("~"): line = os.environ["HOME"] + line[1:] valid_paths.append(line) # Extra path for ccache when needed if ctx.config.values.build.buildhelper == "ccache": valid_paths.append( os.environ.get("CCACHE_DIR", "/root/.ccache")) ret = catbox.run(self.actionLocals[func], valid_paths, logger=self.log_sandbox_violation) # Retcode can be 0 while there is a sanbox violation, so only # look for violations to correctly handle it if ret.violations != []: ctx.ui.error(_("Sandbox violation result:")) for result in ret.violations: ctx.ui.error("%s (%s -> %s)" % (result[0], result[1], result[2])) raise Error(_("Sandbox violations!")) if ret.code == 1: raise ActionScriptException else: if mandatory: raise Error( _("unable to call function from actions: %s") % func) os.chdir(curDir) return True
def add_path(path): # add the files under material path for fpath, fhash in pisi.util.get_file_hashes( path, collisions, install_dir): if ctx.get_option('create_static') \ and fpath.endswith(ctx.const.ar_file_suffix) \ and not package.name.endswith(ctx.const.static_name_suffix) \ and pisi.util.is_ar_file(fpath): # if this is an ar file, and this package is not a static package, # don't include this file into the package. continue frpath = pisi.util.removepathprefix(install_dir, fpath) # relative path ftype, permanent = get_file_type(frpath, package.files, install_dir) fsize = pisi.util.dir_size(fpath) if not os.path.islink(fpath): st = os.stat(fpath) else: st = os.lstat(fpath) d[frpath] = pisi.files.FileInfo(path=frpath, type=ftype, permanent=permanent, size=fsize, hash=fhash, uid=str(st.st_uid), gid=str(st.st_gid), mode=oct( stat.S_IMODE(st.st_mode))) if stat.S_IMODE(st.st_mode) & stat.S_ISUID: ctx.ui.warning(_("/%s has suid bit set") % frpath)
def install_pkg_names(A, reinstall=False): """This is the real thing. It installs packages from the repository, trying to perform a minimum number of installs""" A = [str(x) for x in A] #FIXME: why do we still get unicode input here? :/ -- exa # A was a list, remove duplicates and expand components A_0 = A = expand_components(set(A)) ctx.ui.debug('A = %s' % str(A)) # filter packages that are already installed if not reinstall: Ap = set(filter(lambda x: not ctx.installdb.is_installed(x), A)) d = A - Ap if len(d) > 0: ctx.ui.warning( _('Not re-installing the following packages: ') + util.strlist(d)) A = Ap if len(A) == 0: ctx.ui.info(_('No packages to install.')) return A |= upgrade_base(A) if not ctx.config.get_option('ignore_dependency'): G_f, order = plan_install_pkg_names(A) else: G_f = None order = A ctx.ui.info( _("""Following packages will be installed in the respective order to satisfy dependencies: """) + util.strlist(order)) total_size = sum([ctx.packagedb.get_package(p).packageSize for p in order]) total_size, symbol = util.human_readable_size(total_size) ctx.ui.info(_('Total size of packages: %.2f %s') % (total_size, symbol)) if ctx.get_option('dry_run'): return if len(order) > len(A_0): if not ctx.ui.confirm( _('There are extra packages due to dependencies. Do you want to continue?' )): return False ctx.ui.notify(ui.packagestogo, order=order) pisi_installed = ctx.installdb.is_installed('pisi') for x in order: atomicoperations.install_single_name(x, True) # allow reinstalls here if 'pisi' in order and pisi_installed: upgrade_pisi()
def remove_file(fileinfo, package_name, remove_permanent=False, store_old_paths=None): if fileinfo.permanent and not remove_permanent: return fpath = pisi.util.join_path(ctx.config.dest_dir(), fileinfo.path) historydb = pisi.db.historydb.HistoryDB() filesdb = pisi.db.filesdb.FilesDB() # we should check if the file belongs to another # package (this can legitimately occur while upgrading # two packages such that a file has moved from one package to # another as in #2911) if filesdb.has_file(fileinfo.path): pkg, existing_file = filesdb.get_file(fileinfo.path) if pkg != package_name: ctx.ui.warning(_('Not removing conflicted file : %s') % fpath) return if fileinfo.type == ctx.const.conf: # config files are precious, leave them as they are # unless they are the same as provided by package. # remove symlinks as they are, cause if the hash of the # file it links has changed, it will be kept as is, # and when the package is reinstalled the symlink will # link to that changed file again. try: if os.path.islink(fpath) or pisi.util.sha1_file( fpath) == fileinfo.hash: os.unlink(fpath) else: # keep changed file in history historydb.save_config(package_name, fpath) # after saving to history db, remove the config file any way if ctx.get_option("purge"): os.unlink(fpath) except pisi.util.FileError: pass else: if os.path.isfile(fpath) or os.path.islink(fpath): os.unlink(fpath) if store_old_paths: open(store_old_paths, "a").write("%s\n" % fpath) elif os.path.isdir(fpath) and not os.listdir(fpath): os.rmdir(fpath) else: ctx.ui.warning( _('Installed file %s does not exist on system [Probably you manually deleted]' ) % fpath) return # remove emptied directories dpath = os.path.dirname(fpath) while dpath != '/' and not os.listdir(dpath): os.rmdir(dpath) dpath = os.path.dirname(dpath)
def generate_pending_order(A): # returns pending package list in reverse topological order of dependency installdb = pisi.db.installdb.InstallDB() G_f = pgraph.PGraph(installdb) # construct G_f for x in A: G_f.add_package(x) B = A while len(B) > 0: Bp = set() for x in B: pkg = installdb.get_package(x) for dep in pkg.runtimeDependencies(): if dep.package in G_f.vertices(): G_f.add_dep(x, dep) B = Bp if ctx.get_option('debug'): import sys G_f.write_graphviz(sys.stdout) order = G_f.topological_sort() order.reverse() componentdb = pisi.db.componentdb.ComponentDB() # Bug 4211 if componentdb.has_component('system.base'): order = reorder_base_packages(order) return order
def get_lang(self): lang = ctx.get_option('language') if not lang: lang = pisi.exml.autoxml.LocalText.get_lang() if not lang in ['en', 'tr']: lang = 'en' return lang
def gen_metadata_xml(self, package, build_no=None): """Generate the metadata.xml file for build source. metadata.xml is composed of the information from specfile plus some additional information.""" metadata = MetaData() metadata.from_spec(self.spec.source, package) metadata.package.distribution = ctx.config.values.general.distribution metadata.package.distributionRelease = ctx.config.values.general.distribution_release metadata.package.architecture = "Any" metadata.package.packageFormat = ctx.get_option('package_format') size = long(0) if package.debug_package: d = self.pkg_debug_dir() else: d = self.pkg_install_dir() for path in package.files: for p in glob.glob(util.join_path(d, path.path)): size += util.dir_size(p) metadata.package.installedSize = size metadata.package.build = build_no metadata_xml_path = util.join_path(self.pkg_dir(), ctx.const.metadata_xml) metadata.write(metadata_xml_path) self.metadata = metadata
def check_path_collision(package, pkgList): """This function will check for collision of paths in a package with the paths of packages in pkgList. The return value will be the list containing the paths that collide.""" collisions = [] for pinfo in package.files: for pkg in pkgList: if pkg is package: continue for path in pkg.files: # if pinfo.path is a subpath of path.path like # the example below. path.path is marked as a # collide. Exp: # pinfo.path: /usr/share # path.path: /usr/share/doc if (path.path.endswith(ctx.const.ar_file_suffix) and ctx.get_option('create_static')) or \ (path.path.endswith(ctx.const.debug_file_suffix) and ctx.config.values.build.generatedebug): # don't throw collision error for these files. # we'll handle this in gen_files_xml.. continue if util.subpath(pinfo.path, path.path): collisions.append(path.path) ctx.ui.debug( _('Path %s belongs in multiple packages') % path.path) return collisions
def run(self): self.init(database=True, write=False) upgradable_pkgs = pisi.api.list_upgradable() component = ctx.get_option('component') if component: #FIXME: PiSi api is insufficient to do this from sets import Set as set component_pkgs = self.componentdb.get_union_packages(component, walk=True) upgradable_pkgs = list(set(upgradable_pkgs) & set(component_pkgs)) upgradable_pkgs = pisi.blacklist.exclude_from(upgradable_pkgs, ctx.const.blacklist) if not upgradable_pkgs: ctx.ui.info(_('No packages to upgrade.')) upgradable_pkgs.sort() if self.options.install_info: ctx.ui.info( _('Package Name |St| Version| Rel.| Build| Distro| Date' )) print '========================================================================' for pkg in upgradable_pkgs: package = self.installdb.get_package(pkg) inst_info = self.installdb.get_info(pkg) if self.options.long: ctx.ui.info(package) print inst_info elif self.options.install_info: ctx.ui.info('%-15s | %s ' % (package.name, inst_info.one_liner())) else: ctx.ui.info('%15s - %s ' % (package.name, package.summary))
def print_pkginfo(self, metadata, files, repo=None): if ctx.get_option('short'): pkg = metadata.package ctx.ui.info('%15s - %s' % (pkg.name, unicode(pkg.summary))) else: ctx.ui.info(unicode(metadata.package)) if repo: revdeps = [ x[0] for x in ctx.packagedb.get_rev_deps( metadata.package.name, repo) ] print _('Reverse Dependencies:'), util.strlist(revdeps) if self.options.files or self.options.files_path: if files: print _('\nFiles:') files.list.sort(key=lambda x: x.path) for fileinfo in files.list: if self.options.files: print fileinfo else: print fileinfo.path else: ctx.ui.warning(_('File information not available')) if not self.options.short: print
def do_patch(sourceDir, patchFile, level = 0): """Apply given patch to the sourceDir.""" cwd = os.getcwd() os.chdir(sourceDir) if level == None: level = 0 check_file(patchFile) if ctx.get_option('use_quilt'): patchesDir = join_path(sourceDir, ctx.const.quilt_dir_suffix) # Make sure sourceDir/patches directory exists and if not create one! if not os.path.exists(patchesDir): os.makedirs(patchesDir) # Import original patch into quilt tree (ret, out, err) = run_batch('quilt import -p %d -P %s \"%s\"' % (level, os.path.basename(patchFile), patchFile)) # run quilt push to apply original patch into tree (ret, out, err) = run_batch('quilt push') else: # run GNU patch to apply original patch into tree (ret, out, err) = run_batch("patch --remove-empty-files --no-backup-if-mismatch -p%d < \"%s\"" % (level, patchFile)) if ret: if out is None and err is None: # Which means stderr and stdout directed so they are None raise Error(_("ERROR: patch (%s) failed") % (patchFile)) else: raise Error(_("ERROR: patch (%s) failed: %s") % (patchFile, out)) os.chdir(cwd)
def plan_install_pkg_names(A): # try to construct a pisi graph of packages to # install / reinstall G_f = pgraph.PGraph(ctx.packagedb) # construct G_f # find the "install closure" graph of G_f by package # set A using packagedb for x in A: G_f.add_package(x) B = A while len(B) > 0: Bp = set() for x in B: pkg = ctx.packagedb.get_package(x) for dep in pkg.runtimeDependencies(): ctx.ui.debug('checking %s' % str(dep)) # we don't deal with already *satisfied* dependencies if not dependency.installed_satisfies_dep(dep): if not dep.package in G_f.vertices(): Bp.add(str(dep.package)) G_f.add_dep(x, dep) B = Bp if ctx.config.get_option('debug'): G_f.write_graphviz(sys.stdout) order = G_f.topological_sort() order.reverse() if not ctx.get_option('ignore_file_conflicts'): check_conflicts(order, ctx.packagedb) return G_f, order
def run(self): self.init(database=True, write=False) component = ctx.get_option('component') if component: #FIXME: pisi api is insufficient to do this from sets import Set as set installed = pisi.api.list_installed() component_pkgs = self.componentdb.get_union_packages(component, walk=True) pkgs = list(set(installed) & set(component_pkgs)) elif self.args: pkgs = self.args else: ctx.ui.info(_('Checking all installed packages')) pkgs = pisi.api.list_installed() for pkg in pkgs: ctx.ui.info(_('* Checking %s... ') % pkg, noln=True) if self.installdb.has_package(pkg): corrupt = pisi.api.check(pkg) if corrupt: ctx.ui.info(_('\nPackage %s is corrupt.') % pkg) else: ctx.ui.info(_("OK"), verbose=False) else: ctx.ui.info(_('Package %s not installed') % pkg)