def vcs_upgrade(): ''' Upgrades all VCS packages from the AUR ''' Msg.process(_('Updating all VCS packages')) Log.log(_('Starting a VCS upgrade')) vcs = [pkg for pkg in LocalRepo._repo if LocalRepo._repo[pkg].is_vcs] if not vcs: Msg.info(_('No VCS packages found')) return Msg.process(_('Retrieving package info from the AUR')) updates, errors = Aur.packages(vcs) for e in errors: Msg.error(e) if not updates: Msg.info(_('No updates found')) return Msg.result('\n'.join(updates)) if not Msg.ask(_('Upgrade?')): Msg.info(_('Bye')) return LocalRepo.add([pkg['uri'] for pkg in updates.values()], force=True)
def info(names): ''' Prints all available info of specified packages ''' for name in names: if name not in LocalRepo._repo: Msg.error(_('Package does not exist: {0}').format(name)) LocalRepo.shutdown(1) Msg.process(_('Package information: {0}').format(name)) Msg.info(LocalRepo._repo[name])
def info(names): ''' Prints all available info of specified packages ''' for name in names: if not LocalRepo._repo.has(name): Msg.error(_('Package does not exist: {0}').format(name)) LocalRepo.shutdown(1) Msg.process(_('Package information: {0}').format(name)) Msg.info(LocalRepo._repo.package(name))
def find(q): ''' Searches the repo for packages ''' res = sorted((name for name in LocalRepo._repo if q in name)) if not res: Msg.error(_('No package found')) return for name in res: Msg.info(name, LocalRepo._repo[name].version)
def find(q): ''' Searches the repo for packages ''' res = LocalRepo._repo.find(q) if not res: Msg.error(_('No package found')) return for r in res: Msg.info(r, LocalRepo._repo.package(r).version)
def aur_add(names, force=False): ''' Downloads, makes and adds packages from the AUR ''' Msg.process(_('Retrieving package info from the AUR')) pkgs, errors = Aur.packages(names) for e in errors: Msg.error(e) for pkg in pkgs.values(): if not force and pkg['name'] in LocalRepo._repo: Msg.error(_('Package is already in the repo: {0}').format(pkg['name'])) LocalRepo.shutdown(1) LocalRepo.add([pkg['uri']], force=force)
def remove(names): ''' Removes packages from the repo ''' missing = [name for name in names if not LocalRepo._repo.has(name)] if missing: Msg.error(_('Packages do not exist: {0}').format(', '.join(missing))) LocalRepo.shutdown(1) Msg.process(_('Removing packages: {0}').format(', '.join(names))) try: LocalRepo._repo.remove(names) Log.log(_('Removed packages: {0}').format(', '.join(names))) except LocalRepoError as e: LocalRepo.error(e)
def remove(names): ''' Removes packages from the repo ''' missing = [name for name in names if name not in LocalRepo._repo] if missing: Msg.error( _('Packages do not exist: {0}').format(', '.join(missing))) LocalRepo.shutdown(1) Msg.process(_('Removing packages: {0}').format(', '.join(names))) try: LocalRepo._repo.remove(names) Log.log(_('Removed packages: {0}').format(', '.join(names))) except LocalRepoError as e: LocalRepo.error(e)
def aur_add(names, force=False): ''' Downloads, makes and adds packages from the AUR ''' Msg.process(_('Retrieving package info from the AUR')) pkgs, errors = Aur.packages(names) for e in errors: Msg.error(e) pkgs_uri = [] for pkg in pkgs.values(): if not force and pkg['name'] in LocalRepo._repo: Msg.error( _('Package is already in the repo: {0}').format( pkg['name'])) else: pkgs_uri.append(pkg['uri']) if pkgs_uri: LocalRepo.add(pkgs_uri, force=force)
def aur_upgrade(): ''' Upgrades all packages from the AUR ''' pkgs = [ pkg for pkg in LocalRepo._repo if pkg not in Config.get('no-aur-upgrade', []) ] Msg.info(_('{0} packages found').format(len(pkgs))) Log.log(_('Starting an AUR upgrade')) if len(pkgs) is 0: Msg.info(_('Nothing to do')) return Msg.process(_('Retrieving package info from the AUR')) pkgs, errors = Aur.packages(pkgs) for e in errors: Msg.error(e) Msg.info(_('{0} packages found').format(len(pkgs))) Msg.process(_('Checking for updates')) updates = [] for name, pkg in ((name, pkg) for name, pkg in pkgs.items() if name in LocalRepo._repo): oldpkg = LocalRepo._repo[name] if oldpkg.has_smaller_version_than(pkg['version']): updates.append(pkg) Msg.result('{0} ({1} -> {2})'.format(name, oldpkg.version, pkg['version'])) if not updates: Msg.info(_('All packages are up to date')) return if not Msg.ask(_('Upgrade?')): Msg.info(_('Bye')) LocalRepo.shutdown(1) LocalRepo.add([pkg['uri'] for pkg in updates], force=True)
def aur_upgrade(): ''' Upgrades all packages from the AUR ''' pkgs = [pkg for pkg in LocalRepo._repo if pkg not in Config.get('no-aur-upgrade', [])] Msg.info(_('{0} packages found').format(len(pkgs))) Log.log(_('Starting an AUR upgrade')) if len(pkgs) is 0: Msg.info(_('Nothing to do')) return Msg.process(_('Retrieving package info from the AUR')) pkgs, errors = Aur.packages(pkgs) for e in errors: Msg.error(e) Msg.info(_('{0} packages found').format(len(pkgs))) Msg.process(_('Checking for updates')) updates = [] for name, pkg in ((name, pkg) for name, pkg in pkgs.items() if name in LocalRepo._repo): oldpkg = LocalRepo._repo[name] if oldpkg.has_smaller_version_than(pkg['version']): updates.append(pkg) Msg.result('{0} ({1} -> {2})'.format(name, oldpkg.version, pkg['version'])) if not updates: Msg.info(_('All packages are up to date')) return if not Msg.ask(_('Upgrade?')): Msg.info(_('Bye')) LocalRepo.shutdown(1) LocalRepo.add([pkg['uri'] for pkg in updates], force=True)
def abort(): ''' This called by KeyboardInterrupt ''' Msg.error(_('Execution cancelled by user')) LocalRepo.shutdown(1)
def error(error): ''' Prints the error message and shuts down ''' Msg.error(error.message) Log.error(error.message) LocalRepo.shutdown(1)