def checkPackages(self, all=False, uninstalled=False): cache = self._ctrl.getCache() if checkPackages(cache, cache.getPackages(), report=True, all=all, uninstalled=uninstalled): self.info(_("All checked packages have correct relations."))
def main(ctrl, opts): ctrl.reloadChannels() cache = ctrl.getCache() if opts.args: pkgs = {} for arg in opts.args: ratio, results, suggestions = ctrl.search(arg) if not results: if suggestions: dct = {} for r, obj in suggestions: if isinstance(obj, Package): dct[obj] = True else: dct.update(dict.fromkeys(obj.packages, True)) raise Error, _("'%s' matches no packages. " "Suggestions:\n%s") % \ (arg, "\n".join([" "+str(x) for x in dct])) else: raise Error, _("'%s' matches no packages") % arg dct = {} for obj in results: if isinstance(obj, Package): dct[obj] = True else: dct.update(dict.fromkeys(obj.packages, True)) pkgs.update(dct) pkgs = pkgs.keys() else: pkgs = cache.getPackages() return not checkPackages( cache, pkgs, report=True, all=opts.all, uninstalled=opts.uninstalled)
def main(ctrl, opts): ctrl.reloadChannels() cache = ctrl.getCache() if opts.args: pkgs = {} for arg in opts.args: ratio, results, suggestions = ctrl.search(arg) if not results: if suggestions: dct = {} for r, obj in suggestions: if isinstance(obj, Package): dct[obj] = True else: dct.update(dict.fromkeys(obj.packages, True)) raise Error, _("'%s' matches no packages. " "Suggestions:\n%s") % \ (arg, "\n".join([" "+str(x) for x in dct])) else: raise Error, _("'%s' matches no packages") % arg dct = {} for obj in results: if isinstance(obj, Package): dct[obj] = True else: dct.update(dict.fromkeys(obj.packages, True)) pkgs.update(dct) pkgs = pkgs.keys() else: pkgs = cache.getPackages() return not checkPackages(cache, pkgs, report=True, all=opts.all, uninstalled=opts.uninstalled)
def main(ctrl, opts, reloadchannels=True): # Argument check opts.check_args_of_option("channels", 1) if sysconf.get("auto-update"): from smart.commands import update updateopts = update.parse_options([]) update.main(ctrl, updateopts) else: if reloadchannels: ctrl.reloadChannels() cache = ctrl.getCache() if opts.all: relateset = dict.fromkeys(cache.getPackages(), True) else: relateset = {} if opts.available: for pkg in cache.getPackages(): if not pkg.installed: relateset[pkg] = True else: for loader in pkg.loaders: if not loader.getInstalled(): relateset[pkg] = True break if opts.channels: aliases = opts.channels.split(",") notfound = [] disabled = [] channels = sysconf.get("channels", ()) for alias in aliases: if alias not in channels: notfound.append(alias) elif channels[alias].get("disabled"): disabled.append(alias) if notfound: raise Error, _("Channels not found: %s") % ", ".join(notfound) elif disabled: iface.warning(_("Channels are disabled: %s") % \ ", ".join(disabled)) for pkg in cache.getPackages(): for loader in pkg.loaders: if loader.getChannel().getAlias() in opts.channels: relateset[pkg] = True break if opts.installed or not opts.channels and not opts.available: for pkg in cache.getPackages(): if pkg.installed: relateset[pkg] = True if opts.args: checkset = {} for arg in opts.args: ratio, results, suggestions = ctrl.search(arg) if not results: if suggestions: dct = {} for r, obj in suggestions: if isinstance(obj, Package): dct[obj] = True else: dct.update(dict.fromkeys(obj.packages, True)) raise Error, _("'%s' matches no packages. " "Suggestions:\n%s") % \ (arg, "\n".join([" "+str(x) for x in dct])) else: raise Error, _("'%s' matches no packages") % arg dct = {} for obj in results: if isinstance(obj, Package): dct[obj] = True else: dct.update(dict.fromkeys(obj.packages, True)) checkset.update(dct) else: checkset = relateset return not checkPackages(cache, checkset, relateset, report=True)
def main(ctrl, opts, reloadchannels=True): if sysconf.get("auto-update"): from smart.commands import update updateopts = update.parse_options([]) update.main(ctrl, updateopts) else: if reloadchannels: ctrl.reloadChannels() cache = ctrl.getCache() if opts.all: relateset = dict.fromkeys(cache.getPackages(), True) else: relateset = {} if opts.available: for pkg in cache.getPackages(): if not pkg.installed: relateset[pkg] = True else: for loader in pkg.loaders: if not loader.getInstalled(): relateset[pkg] = True break if opts.channels: aliases = opts.channels.split(",") notfound = [] disabled = [] channels = sysconf.get("channels", ()) for alias in aliases: if alias not in channels: notfound.append(alias) elif channels[alias].get("disabled"): disabled.append(alias) if notfound: raise Error, _("Channels not found: %s") % ", ".join(notfound) elif disabled: iface.warning(_("Channels are disabled: %s") % \ ", ".join(disabled)) for pkg in cache.getPackages(): for loader in pkg.loaders: if loader.getChannel().getAlias() in opts.channels: relateset[pkg] = True break if opts.installed or not opts.channels and not opts.available: for pkg in cache.getPackages(): if pkg.installed: relateset[pkg] = True if opts.args: checkset = {} for arg in opts.args: ratio, results, suggestions = ctrl.search(arg) if not results: if suggestions: dct = {} for r, obj in suggestions: if isinstance(obj, Package): dct[obj] = True else: dct.update(dict.fromkeys(obj.packages, True)) raise Error, _("'%s' matches no packages. " "Suggestions:\n%s") % \ (arg, "\n".join([" "+str(x) for x in dct])) else: raise Error, _("'%s' matches no packages") % arg dct = {} for obj in results: if isinstance(obj, Package): dct[obj] = True else: dct.update(dict.fromkeys(obj.packages, True)) checkset.update(dct) else: checkset = relateset return not checkPackages(cache, checkset, relateset, report=True)