for x in crying_atoms[atom]: entropy_client.output(darkgreen(x), header=blue(" # ")) if self._ask: rc = entropy_client.ask_question( " %s" % (_("Would you like to install the packages ?"), )) if rc == _("No"): return 1 else: mytxt = "%s %s %s" % ( blue(_("Installing available packages in")), darkred(_("10 seconds")), blue("..."), ) entropy_client.output(mytxt, header=darkred(" @@ ")) time.sleep(10) exit_st, _show_cfgupd = self._install_action( entropy_client, True, True, self._pretend, self._ask, False, self._quiet, False, False, False, False, False, False, False, 1, sorted(found_deps)) return exit_st SoloCommandDescriptor.register( SoloCommandDescriptor(SoloDeptest, SoloDeptest.NAME, _("look for unsatisfied dependencies")))
ALLOW_UNPRIVILEGED = True INTRODUCTION = """\ Show Equo version. """ SEE_ALSO = "equo-help(1)" def man(self): """ Overridden from SoloCommand. """ return self._man() def parse(self): """ Parse command """ return self._show_version, [] def _show_version(self, *args): # do not use entropy_client here # it is slow and might interfere with # other Client inits. release = read_client_release() text = TextInterface() text.output(release, level="generic") return 0 SoloCommandDescriptor.register(SoloCommandDescriptor(SoloVersion, SoloVersion.NAME, _("show equo version")))
brown(_("Path")), darkgreen(repository_path),), header=" ") entropy_client.output( "%s: %s" % ( brown(_("Repository URL")), darkgreen(repo_data['plain_database']),), header=" ") if repo_data['packages']: entropy_client.output( "%s:" % ( blue(_("Package URLs")),), header=" ") urlcount = 0 for packages_url in repo_data['plain_packages']: urlcount += 1 entropy_client.output( "%s. %s" % ( purple(const_convert_to_unicode(urlcount)), brown(packages_url),), header=" ") SoloCommandDescriptor.register( SoloCommandDescriptor( SoloStatus, SoloStatus.NAME, _("show Repositories status")) )
pkg = action_factory.get( action_factory.SOURCE_ACTION, match, opts=metaopts) xterm_header = "equo (%s) :: %d of %d ::" % ( _("sources download"), count, total) pkg.set_xterm_header(xterm_header) entropy_client.output( darkgreen(atom), count=(count, total), header=darkred(" ::: ") + ">>> ") exit_st = pkg.start() if exit_st != 0: return 1 finally: if pkg is not None: pkg.finalize() return 0 SoloCommandDescriptor.register( SoloCommandDescriptor( SoloSource, SoloSource.NAME, _("download packages source code")) )
continue key_slot = inst_repo.retrieveKeySlotAggregated( inst_package_id) package_id, repository_id = entropy_client.atom_match(key_slot) if package_id != -1: valid_matches.add((package_id, repository_id)) if not valid_matches: entropy_client.output( "%s." % ( blue(_("All the available updates " "have been already installed")),), header=darkred(" @@ ")) return 0 exit_st, _show_cfgupd = self._install_action( entropy_client, True, True, pretend, ask, False, quiet, False, False, False, fetch, False, False, False, 1, [], package_matches=list(valid_matches)) return exit_st SoloCommandDescriptor.register( SoloCommandDescriptor( SoloSecurity, SoloSecurity.NAME, _("system security tools")) )
current_source_txt = reverse_install_sources.get( current_source, other_source) if current_source == source: txt = "%s: %s" % ( brown(pkg_atom), _("no change")) entropy_client.output( txt, header=blue(" @@ ")) else: txt = "%s: %s => %s" % ( brown(pkg_atom), current_source_txt, source_txt) entropy_client.output( txt, header=red(" !! ")) if not pretend: inst_repo.setInstalledPackageSource(pkg_id, source) return 0 SoloCommandDescriptor.register( SoloCommandDescriptor( SoloMark, SoloMark.NAME, _("set properties on installed packages")) )
def _show_notice_board_summary(self, entropy_client, repository): """ Show NoticeBoard information to user after repository update. """ mytxt = "%s %s: %s" % ( darkgreen(" @@ "), brown(_("Notice board")), bold(repository), ) entropy_client.output(mytxt) mydict = self._check_notice_board_availability(entropy_client, repository) if not mydict: return for key in sorted(mydict.keys()): mydata = mydict.get(key) mytxt = " [%s] [%s] %s: %s" % ( blue(str(key)), brown(mydata['pubDate']), _("Title"), darkred(mydata['title']), ) entropy_client.output(mytxt) SoloCommandDescriptor.register( SoloCommandDescriptor(SoloUpdate, SoloUpdate.NAME, _("update repositories")))
Respawn the upgrade activity if required. """ # It might be an Entropy bug and Entropy was proritized in the # install queue, ignoring the rest of available packages. # So, respawning myself again using execvp() should be a much # better idea. with inst_repo.shared(): outcome = entropy_client.calculate_updates() if outcome['update']: entropy_client.output("%s." % (purple( _("There are more updates to install, " "reloading Entropy")), ), header=teal(" @@ ")) # then spawn a new process entropy_client.shutdown() # hack to tell the resurrected equo to block on # locking acquisition os.environ['__EQUO_LOCKS_BLOCKING__'] = "1" # we will acquire them again in blocking mode, cross # fingers lock = EntropyResourcesLock(output=entropy_client) lock.release() os.execvp("equo", sys.argv) SoloCommandDescriptor.register( SoloCommandDescriptor(SoloUpgrade, SoloUpgrade.NAME, _("upgrade the system")))
try: nsargs = parser.parse_args(self._args) except IOError as err: sys.stderr.write("%s\n" % (err,)) return parser.print_help, [] return self._call_exclusive, [self._cleanup] def _cleanup(self, entropy_client): """ Solo Cleanup command. """ dirs = [etpConst['logdir'], etpConst['entropyunpackdir']] for rel in etpConst['packagesrelativepaths']: # backward compatibility, packages are moved to packages/ dir, # including nonfree, restricted etc. dirs.append(os.path.join(etpConst['entropyworkdir'], rel)) # new location dirs.append(os.path.join( etpConst['entropypackagesworkdir'], rel)) cleanup(entropy_client, dirs) return 0 SoloCommandDescriptor.register( SoloCommandDescriptor( SoloCleanup, SoloCleanup.NAME, _("remove downloaded packages and clean temp. directories")) )
ALLOW_UNPRIVILEGED = True HIDDEN = True INTRODUCTION = """\ Bow to the Highness. """ SEE_ALSO = "" def _get_message(self): """ Reimplemented from SoloFunny. """ t = """ ________________________ < Hail to the king, baby! > ------------------------ \ ^__^ \ (oo)\_______ (__)\ )\/\\ ||----w | || || """ return t SoloCommandDescriptor.register( SoloCommandDescriptor(SoloMoo, SoloMoo.NAME, _("moo at user"))) SoloCommandDescriptor.register( SoloCommandDescriptor(SoloLxnay, SoloLxnay.NAME, _("bow to lxnay")))
for pkg_name in non_rm_pkg_names: entropy_client.output(teal(pkg_name), header=purple(" # "), level="error") entropy_client.output("", level="error") return 1, False removal_queue += [x for x in package_ids if x not in removal_queue] self._show_removal_info(entropy_client, removal_queue) self._prompt_final_removal(entropy_client, inst_repo, removal_queue) if pretend: return 0, False if ask: question = " %s" % (_("Would you like to proceed ?"), ) rc = entropy_client.ask_question(question) if rc == _("No"): return 1, False exit_st = self._execute_action(entropy_client, inst_repo, removal_queue, remove_config_files) return exit_st, True SoloCommandDescriptor.register( SoloCommandDescriptor(SoloRemove, SoloRemove.NAME, _("remove packages from system")))
SEE_ALSO = "equo-unmask(1)" def __init__(self, args): SoloMaskUnmask.__init__(self, args, SoloMask.NAME) class SoloUnmask(SoloMaskUnmask): """ Main Solo Mask command. """ NAME = "unmask" ALIASES = [] INTRODUCTION = """\ Unmask packages so that installation and update will be allowed. """ SEE_ALSO = "equo-mask(1)" def __init__(self, args): SoloMaskUnmask.__init__(self, args, SoloUnmask.NAME) SoloCommandDescriptor.register( SoloCommandDescriptor(SoloMask, SoloMask.NAME, _("mask one or more packages"))) SoloCommandDescriptor.register( SoloCommandDescriptor(SoloUnmask, SoloUnmask.NAME, _("unmask one or more packages")))
back=True) file_name = os.path.basename(_file) package_path = os.path.join( savedir, file_name + ".db") ext_rc = entropy.tools.dump_entropy_metadata( _file, package_path) if not ext_rc: entropy_client.output( "%s: %s" % ( teal(_("error during metadata extraction")), purple(_file)), header=darkred(" @@ "), level="error", importance=1) return 1 entropy_client.output( "%s: %s" % ( teal(_("metadata file generated")), purple(package_path)), header=darkred(" @@ ")) return 0 SoloCommandDescriptor.register( SoloCommandDescriptor( SoloPkg, SoloPkg.NAME, _("execute advanced tasks on packages")) )
return 0 def _match(self, entropy_client, inst_repo, string): """ Solo Search string command. """ results = self._match_string(entropy_client, inst_repo, string) for pkg_id, pkg_repo in results: repo = entropy_client.open_repository(pkg_repo) print_package_info( pkg_id, entropy_client, repo, show_download_if_quiet = self._showdownload, show_repo_if_quiet = self._showrepo, show_desc_if_quiet = self._showdesc, show_slot_if_quiet = self._showslot, extended = self._verbose, installed_search = repo is inst_repo, quiet = self._quiet) return results SoloCommandDescriptor.register( SoloCommandDescriptor( SoloMatch, SoloMatch.NAME, _("match packages in repositories")) )
Parse command. """ parser = self._get_parser() try: nsargs = parser.parse_args(self._args) except IOError as err: sys.stderr.write("%s\n" % (err, )) return parser.print_help, [] return self._call_exclusive, [self._cleanup] def _cleanup(self, entropy_client): """ Solo Cleanup command. """ dirs = [etpConst['logdir'], etpConst['entropyunpackdir']] for rel in etpConst['packagesrelativepaths']: # backward compatibility, packages are moved to packages/ dir, # including nonfree, restricted etc. dirs.append(os.path.join(etpConst['entropyworkdir'], rel)) # new location dirs.append(os.path.join(etpConst['entropypackagesworkdir'], rel)) cleanup(entropy_client, dirs) return 0 SoloCommandDescriptor.register( SoloCommandDescriptor( SoloCleanup, SoloCleanup.NAME, _("remove downloaded packages and clean temp. directories")))
cacher = EntropyCacher() try: cacher.save(SoloYell._CACHE_KEY, 0) except IOError: pass def _show_yell(self, *args): yell_id = SoloYell.read() max_id = max(list(SoloYell._MESSAGES.keys())) yell_message = SoloYell._MESSAGES.get( yell_id, max_id) # do not use entropy_client here # it is slow and might interfere with # other Client inits. text = TextInterface() text.output( yell_message, importance=1, level="warning") new_yell_id = yell_id + 1 if new_yell_id <= max_id: SoloYell.write(new_yell_id) return 1 SoloCommandDescriptor.register( SoloCommandDescriptor( SoloYell, SoloYell.NAME, _("yell at user")) )
_("Title"), darkred(mydict['title']), ) entropy_client.output(mytxt) mytxt = "%s:\n\n%s\n" % ( darkgreen(_("Content")), mydict['description'], ) entropy_client.output(mytxt) mytxt = "%s: %s" % ( darkgreen(_("Link")), blue(mydict['link']), ) entropy_client.output(mytxt) def fake_callback(s): return True input_params = [ ('idx', _("Press Enter to continue"), fake_callback, False)] entropy_client.input_box('', input_params, cancel_button = True) SoloCommandDescriptor.register( SoloCommandDescriptor( SoloNotice, SoloNotice.NAME, _("repository notice board reader")) )
for library, elfclass, path in collectables: package_ids = inst_repo.isFileAvailable(path, get_id=True) entropy_client.output("%s [%s:%s]" % ( darkred(path), purple(library), teal(const_convert_to_unicode(elfclass)), )) for package_id in package_ids: atom = inst_repo.retrieveAtom(package_id) if atom is None: continue entropy_client.output("%s: %s, %s" % ( blue(_("but owned by")), darkgreen(atom), blue(_("then just unregister the library")), ), header=brown(" -> "), importance=0) return 0 SoloCommandDescriptor.register( SoloCommandDescriptor( SoloPreservedLibs, SoloPreservedLibs.NAME, _("Tools to manage the preserved libraries on the system")))
outcome += ["--verbose", "-v", "--quiet", "-q"] return self._bashcomp(sys.stdout, last_arg, outcome) @sharedlock # clear_cache uses inst_repo def _clean(self, entropy_client, _inst_repo): """ Solo Cache Clean command. """ entropy_client.output( blue(_("Cleaning Entropy cache, please wait ...")), level = "info", header = brown(" @@ "), back = True ) entropy_client.clear_cache() entropy_client.output( darkgreen(_("Entropy cache cleaned.")), level = "info", header = brown(" @@ ") ) return 0 SoloCommandDescriptor.register( SoloCommandDescriptor( SoloCache, SoloCache.NAME, _("manage Entropy Library Cache")) )
# filtered out in solo.main. Will never get here parser.add_argument( "--color", action="store_true", default=None, help=_("force colored output")) descriptors = SoloCommandDescriptor.obtain() descriptors.sort(key = lambda x: x.get_name()) group = parser.add_argument_group("command", "available commands") for descriptor in descriptors: if descriptor.get_class().HIDDEN: continue aliases = descriptor.get_class().ALIASES aliases_str = ", ".join([teal(x) for x in aliases]) if aliases_str: aliases_str = " [%s]" % (aliases_str,) name = "%s%s" % (purple(descriptor.get_name()), aliases_str) desc = descriptor.get_description() group.add_argument(name, help=darkgreen(desc), action="store_true") parser.print_help() if not self._args: return 1 return 0 SoloCommandDescriptor.register( SoloCommandDescriptor( SoloHelp, SoloHelp.NAME, _("this help")) )
exit_st = pkg.start() if exit_st != 0: if ugc_thread is not None: ugc_thread.join() return 1, True finally: if pkg is not None: pkg.finalize() finally: if notif_acquired: notification_lock.release() if ugc_thread is not None: ugc_thread.join() entropy_client.output( "%s." % ( blue(_("Installation complete")),), header=darkred(" @@ ")) return 0, True SoloCommandDescriptor.register( SoloCommandDescriptor( SoloInstall, SoloInstall.NAME, _("install or update packages or package files")) )
darkgreen(_("Succesfully switched to branch")), purple(self._branch), ) entropy_client.output(mytxt, header=red(" @@ ")) mytxt = "%s %s" % ( brown(" ?? "), darkgreen( _("Now run 'equo upgrade' to " "upgrade your distribution to")), ) entropy_client.output(mytxt) return 0 entropy_client.set_branch(old_branch) mytxt = "%s: %s" % ( darkred(_("Unable to switch to branch")), purple(self._branch), ) entropy_client.output(mytxt, level="error", importance=1, header=bold(" !!! ")) return 3 SoloCommandDescriptor.register( SoloCommandDescriptor(SoloHop, SoloHop.NAME, _("upgrade the System to a new branch")))
back=True) file_name = os.path.basename(_file) package_path = os.path.join( savedir, file_name + ".db") ext_rc = entropy.tools.dump_entropy_metadata( _file, package_path) if not ext_rc: entropy_client.output( "%s: %s" % ( teal(_("error during metadata extraction")), purple(_file)), header=darkred(" @@ "), level="error", importance=1) return 1 entropy_client.output( "%s: %s" % ( teal(_("metadata file generated")), purple(package_path)), header=darkred(" @@ ")) return 0 SoloCommandDescriptor.register( SoloCommandDescriptor( SoloPkg, SoloPkg.NAME, _("execute advanced tasks on packages")) )
return 1 run_queue, removal_queue = self._generate_install_queue( entropy_client, packages, deps, False, deep, relaxed, onlydeps, bdeps, recursive) if (run_queue is None) or (removal_queue is None): return 1 elif not (run_queue or removal_queue): entropy_client.output("%s." % (blue(_("Nothing to do")), ), level="warning", header=darkgreen(" @@ ")) return 0 if pretend: entropy_client.output("%s." % (blue(_("All done")), )) return 0 down_data = {} exit_st = self._download_packages(entropy_client, run_queue, down_data, multifetch) if exit_st == 0: self._signal_ugc(entropy_client, down_data) return exit_st SoloCommandDescriptor.register( SoloCommandDescriptor(SoloDownload, SoloDownload.NAME, _("download packages, essentially")))
self._get_dep_ids(inst_repo)) not_needed = all_ids - wanted_ids def _sort_key(x): sort_index = 1 if self._sortbysize else 0 return x[sort_index] not_needed_pkgs_data = sorted( [(inst_repo.retrieveAtom(x), inst_repo.retrieveOnDiskSize(x)) for x in not_needed], key=_sort_key) if self._quiet: entropy_client.output('\n'.join( [x[0] for x in not_needed_pkgs_data]), level="generic") else: for atom, disk_size in not_needed_pkgs_data: disk_size = entropy.tools.bytes_into_human(disk_size) entropy_client.output("# %s%s%s %s" % ( blue("["), brown(disk_size), blue("]"), darkgreen(atom), )) SoloCommandDescriptor.register( SoloCommandDescriptor(SoloUnused, SoloUnused.NAME, _("show unused packages (pay attention)")))
def _show_notice_board_summary(self, entropy_client, repository): """ Show NoticeBoard information to user after repository update. """ mytxt = "%s %s: %s" % (darkgreen(" @@ "), brown(_("Notice board")), bold(repository),) entropy_client.output(mytxt) mydict = self._check_notice_board_availability( entropy_client, repository) if not mydict: return for key in sorted(mydict.keys()): mydata = mydict.get(key) mytxt = " [%s] [%s] %s: %s" % ( blue(str(key)), brown(mydata['pubDate']), _("Title"), darkred(mydata['title']), ) entropy_client.output(mytxt) SoloCommandDescriptor.register( SoloCommandDescriptor( SoloUpdate, SoloUpdate.NAME, _("update repositories")) )
paths_map, scandata) if _continue: continue break elif action == 4: comeback, _continue = self._interactive_merge( idx, entropy_client, root, source, dest, paths_map, scandata) if _continue: continue break elif action == 5: # show diff again diff = self._showdiff( entropy_client, dest_path, source_path) continue if comeback: return True return False SoloCommandDescriptor.register( SoloCommandDescriptor( SoloConf, SoloConf.NAME, _("manage package file updates")) )
# filtered out in solo.main. Will never get here parser.add_argument( "--color", action="store_true", default=None, help=_("force colored output")) descriptors = SoloCommandDescriptor.obtain() descriptors.sort(key = lambda x: x.get_name()) group = parser.add_argument_group("command", "available commands") for descriptor in descriptors: if descriptor.get_class().HIDDEN: continue aliases = descriptor.get_class().ALIASES aliases_str = ", ".join([teal(x) for x in aliases]) if aliases_str: aliases_str = " [%s]" % (aliases_str,) name = "%s%s" % (purple(descriptor.get_name()), aliases_str) desc = descriptor.get_description() group.add_argument(name, help=darkgreen(desc), action="store_true") parser.print_help() if not self._args: return 1 return 0 SoloCommandDescriptor.register( SoloCommandDescriptor( SoloHelp, SoloHelp.NAME, _("this help")) )
try: pkg = entropy_client.Package() pkg.prepare((package_id,), "config") xterm_header = "equo (%s) :: %d of %d ::" % ( _("configure"), count, len(package_ids)) entropy_client.output( darkgreen(atom), count=(count, len(package_ids)), header=darkred(" ::: ") + ">>> ") exit_st = pkg.run(xterm_header=xterm_header) if exit_st not in (0, 3): return 1, True finally: if pkg is not None: pkg.kill() return 0, True SoloCommandDescriptor.register( SoloCommandDescriptor( SoloConfig, SoloConfig.NAME, _("configure installed packages")) )
" %s" % (_("Would you like to install them ?"),) ) if exit_st == _("No"): return 1 else: mytxt = "%s %s %s" % ( blue(_("Installing available packages in")), darkred(_("10 seconds")), blue("..."), ) entropy_client.output( mytxt, header=darkred(" @@ ")) time.sleep(10) exit_st, _show_cfgupd = self._install_action( entropy_client, True, True, pretend, ask, False, quiet, False, False, False, False, False, False, False, 1, [], package_matches=package_matches) return exit_st SoloCommandDescriptor.register( SoloCommandDescriptor( SoloLibtest, SoloLibtest.NAME, _("look for missing libraries")) )
repository_path = repo_data.get('dbpath', _("Not available")) entropy_client.output("%s: %s" % ( brown(_("Path")), darkgreen(repository_path), ), header=" ") entropy_client.output("%s: %s" % ( brown(_("Repository URL")), darkgreen(repo_data['plain_database']), ), header=" ") if repo_data['packages']: entropy_client.output("%s:" % (blue(_("Package URLs")), ), header=" ") urlcount = 0 for packages_url in repo_data['plain_packages']: urlcount += 1 entropy_client.output("%s. %s" % ( purple(const_convert_to_unicode(urlcount)), brown(packages_url), ), header=" ") SoloCommandDescriptor.register( SoloCommandDescriptor(SoloStatus, SoloStatus.NAME, _("show Repositories status")))
def _updates(self, entropy_client): """ Solo Query Updates command. """ quiet = self._nsargs.quiet verbose = self._nsargs.verbose if not quiet: entropy_client.output(brown(_("Available Updates")), header=darkred(" @@ ")) outcome = entropy_client.calculate_updates(quiet=True) update, remove = outcome["update"], outcome["remove"] fine, critical_f = outcome["fine"], outcome["critical_found"] if quiet: entropy_client.output("%d" % (len(update),), level="generic") return 0 toc = [] toc.append((darkgreen(_("Packages to update:")), bold(const_convert_to_unicode(len(update))))) toc.append((darkred(_("Packages to remove:")), bold(const_convert_to_unicode(len(remove))))) if verbose: toc.append((blue(_("Packages already up-to-date:")), bold(const_convert_to_unicode(len(fine))))) toc.append((purple(_("Critical updates found:")), teal(const_convert_to_unicode(str(critical_f))))) print_table(entropy_client, toc) return 0 SoloCommandDescriptor.register(SoloCommandDescriptor(SoloQuery, SoloQuery.NAME, _("repository query tools")))
target_pkg_ids = dest_db.getPackagesToRemove( pkg_meta['name'], pkg_meta['category'], pkg_meta['slot'], pkg_meta['injected']) if remove_conflicts: for conflict in pkg_meta['conflicts']: if conflict in conflict_cache: continue conflict_cache.add(conflict) matches, rc = dest_db.atomMatch(conflict, multiMatch=True) target_pkg_ids |= matches for target_pkg_id in target_pkg_ids: dest_db.removePackage(target_pkg_id) dest_pkg_id = dest_db.addPackage(pkg_meta, formatted_content=True) dest_db.commit() entropy_client.output("[%s] %s" % ( teal(source), blue(_("done merging packages")), )) dest_db.commit() dest_db.close() # close all repos again entropy_client.close_repositories() return 0 SoloCommandDescriptor.register( SoloCommandDescriptor(SoloRepo, SoloRepo.NAME, _("manage repositories")))
elif command not in self._commands: # return all the commands anyway # last_arg will filter them outcome += self._commands elif command == "enable": outcome += ["--verbose", "-v", "--quiet", "-q"] return self._bashcomp(sys.stdout, last_arg, outcome) @sharedlock # clear_cache uses inst_repo def _clean(self, entropy_client, _inst_repo): """ Solo Cache Clean command. """ entropy_client.output(blue( _("Cleaning Entropy cache, please wait ...")), level="info", header=brown(" @@ "), back=True) entropy_client.clear_cache() entropy_client.output(darkgreen(_("Entropy cache cleaned.")), level="info", header=brown(" @@ ")) return 0 SoloCommandDescriptor.register( SoloCommandDescriptor(SoloCache, SoloCache.NAME, _("manage Entropy Library Cache")))
def _get_message(self): """ Reimplemented from SoloFunny. """ t = """ ________________________ < Hail to the king, baby! > ------------------------ \ ^__^ \ (oo)\_______ (__)\ )\/\\ ||----w | || || """ return t SoloCommandDescriptor.register( SoloCommandDescriptor( SoloMoo, SoloMoo.NAME, _("moo at user")) ) SoloCommandDescriptor.register( SoloCommandDescriptor( SoloLxnay, SoloLxnay.NAME, _("bow to lxnay")) )
" %s" % (_("Would you like to install them ?"),) ) if exit_st == _("No"): return 1 else: mytxt = "%s %s %s" % ( blue(_("Installing available packages in")), darkred(_("10 seconds")), blue("..."), ) entropy_client.output( mytxt, header=darkred(" @@ ")) time.sleep(10) exit_st, _show_cfgupd = self._install_action( entropy_client, True, True, pretend, ask, False, quiet, False, False, False, False, False, False, False, 1, [], package_matches=package_matches) return exit_st SoloCommandDescriptor.register( SoloCommandDescriptor( SoloLibtest, SoloLibtest.NAME, _("look for missing libraries")) )
onlydeps, bdeps, recursive) if (run_queue is None) or (removal_queue is None): return 1 elif not (run_queue or removal_queue): entropy_client.output( "%s." % (blue(_("Nothing to do")),), level="warning", header=darkgreen(" @@ ")) return 0 if pretend: entropy_client.output( "%s." % (blue(_("All done")),)) return 0 down_data = {} exit_st = self._download_packages( entropy_client, run_queue, down_data, multifetch, True) if exit_st == 0: self._signal_ugc(entropy_client, down_data) return exit_st SoloCommandDescriptor.register( SoloCommandDescriptor( SoloDownload, SoloDownload.NAME, _("download packages, essentially")) )
else: mytxt = "%s %s %s" % ( blue(_("Installing available packages in")), darkred(_("10 seconds")), blue("..."), ) entropy_client.output(mytxt, header=darkred(" @@ ")) time.sleep(10) # avoid saving deps as installed by user matched_for_installation = self._match_packages_for_installation( entropy_client, False, sorted(found_deps)) if not matched_for_installation: return 1 exit_st, _show_cfgupd = self._install_action( entropy_client, True, True, self._pretend, self._ask, False, self._quiet, False, False, False, False, False, False, False, 1, [], package_matches=matched_for_installation) return exit_st SoloCommandDescriptor.register( SoloCommandDescriptor( SoloDeptest, SoloDeptest.NAME, _("look for unsatisfied dependencies")) )
obj = spm_wanted_map.setdefault(stripped, set()) obj.add(pkg) return spm_wanted_map def is_user_selected(self, pkg): """ Determines whether a package is selected by user in SPM "world" file. """ spm_package_key = entropy.dep.dep_getkey(pkg) spm_wanted_candidates = self._map.get(spm_package_key, set()) # Avoid calling spm.match_installed_package() which can be # a little slow. Now the list is reduced. spm_wanted_matches = (self._spm_match_installed(x) for x in spm_wanted_candidates if x is not None) return pkg in spm_wanted_matches def _spm_match_installed(self, pkg): try: return self._spm.match_installed_package(pkg) except KeyError: return None SoloCommandDescriptor.register( SoloCommandDescriptor( SoloRescue, SoloRescue.NAME, _("tools to rescue the running system")) )
return True # filter: --by-user not provided -> if package has been installed # by user, exclude from list. if not self._byuser: data = list(filter(_user_filter, data)) if self._sortbysize: data.sort(key = lambda x: x[0]) if self._quiet: entropy_client.output( '\n'.join([x[2] for x in data]), level="generic") else: for disk_size, idpackage, atom in data: disk_size = entropy.tools.bytes_into_human(disk_size) entropy_client.output( "# %s%s%s %s" % ( blue("["), brown(disk_size), blue("]"), darkgreen(atom),)) return 0 SoloCommandDescriptor.register( SoloCommandDescriptor( SoloUnused, SoloUnused.NAME, _("look for unused packages (pay attention)")) )
"%s [%s:%s]" % ( darkred(path), purple(library), teal(const_convert_to_unicode(elfclass)), )) for package_id in package_ids: atom = inst_repo.retrieveAtom(package_id) if atom is None: continue entropy_client.output( "%s: %s, %s" % ( blue(_("but owned by")), darkgreen(atom), blue(_("then just unregister the library")), ), header=brown(" -> "), importance=0 ) return 0 SoloCommandDescriptor.register( SoloCommandDescriptor( SoloPreservedLibs, SoloPreservedLibs.NAME, _("Tools to manage the preserved libraries on the system")) )
""" Solo Search string command. """ results = self._match_string( entropy_client, string) inst_repo = entropy_client.installed_repository() inst_repo_class = inst_repo.__class__ for pkg_id, pkg_repo in results: dbconn = entropy_client.open_repository(pkg_repo) from_client = isinstance(dbconn, inst_repo_class) print_package_info( pkg_id, entropy_client, dbconn, show_download_if_quiet = self._showdownload, show_repo_if_quiet = self._showrepo, show_desc_if_quiet = self._showdesc, show_slot_if_quiet = self._showslot, extended = self._verbose, installed_search = from_client, quiet = self._quiet) return results SoloCommandDescriptor.register( SoloCommandDescriptor( SoloMatch, SoloMatch.NAME, _("match packages in repositories")) )
level="error", importance=1 ) return 1 if not voted: entropy_client.output( "[%s] %s: %s" % ( darkred(pkgkey), blue(_("UGC error")), _("already voted"), ), level="error", importance=1 ) return 1 else: entropy_client.output("[%s] %s" % ( purple(pkgkey), blue(_("vote added, thank you!")), ) ) self._vote_get(entropy_client) return 0 SoloCommandDescriptor.register( SoloCommandDescriptor( SoloUgc, SoloUgc.NAME, _("manage User Generated Content")) )
continue conflict_cache.add(conflict) matches, rc = dest_db.atomMatch(conflict, multiMatch = True) target_pkg_ids |= matches for target_pkg_id in target_pkg_ids: dest_db.removePackage(target_pkg_id) dest_pkg_id = dest_db.addPackage(pkg_meta, formatted_content = True) dest_db.commit() entropy_client.output( "[%s] %s" % ( teal(source), blue(_("done merging packages")),)) dest_db.commit() dest_db.close() # close all repos again entropy_client.close_repositories() return 0 SoloCommandDescriptor.register( SoloCommandDescriptor( SoloRepo, SoloRepo.NAME, _("manage repositories")) )
""" # It might be an Entropy bug and Entropy was proritized in the # install queue, ignoring the rest of available packages. # So, respawning myself again using execvp() should be a much # better idea. outcome = entropy_client.calculate_updates() if outcome['update']: entropy_client.output( "%s." % ( purple(_("There are more updates to install, " "reloading Entropy")),), header=teal(" @@ ")) # then spawn a new process entropy_client.shutdown() # hack to tell the resurrected equo to block on # locking acquisition os.environ['__EQUO_LOCKS_BLOCKING__'] = "1" # we will acquire them again in blocking mode, cross # fingers entropy.tools.release_entropy_locks(entropy_client) os.execvp("equo", sys.argv) SoloCommandDescriptor.register( SoloCommandDescriptor( SoloUpgrade, SoloUpgrade.NAME, _("upgrade the system")) )
mytxt = "[%s] [%s] %s: %s" % ( blue(str(key)), brown(mydict['pubDate']), _("Title"), darkred(mydict['title']), ) entropy_client.output(mytxt) mytxt = "%s:\n\n%s\n" % ( darkgreen(_("Content")), mydict['description'], ) entropy_client.output(mytxt) mytxt = "%s: %s" % ( darkgreen(_("Link")), blue(mydict['link']), ) entropy_client.output(mytxt) def fake_callback(s): return True input_params = [('idx', _("Press Enter to continue"), fake_callback, False)] entropy_client.input_box('', input_params, cancel_button=True) SoloCommandDescriptor.register( SoloCommandDescriptor(SoloNotice, SoloNotice.NAME, _("repository notice board reader")))
return 1, False removal_queue += [x for x in plain_removal_queue if x \ not in removal_queue] self._show_removal_info(entropy_client, removal_queue) self._prompt_final_removal( entropy_client, inst_repo, removal_queue) if pretend: return 0, False if ask: question = " %s" % ( _("Would you like to proceed ?"),) rc = entropy_client.ask_question(question) if rc == _("No"): return 1, False exit_st = self._execute_action( entropy_client, inst_repo, removal_queue, remove_config_files) return exit_st, True SoloCommandDescriptor.register( SoloCommandDescriptor( SoloRemove, SoloRemove.NAME, _("remove packages from system")) )
pkg = action_factory.get( action_factory.CONFIG_ACTION, (package_id, inst_repo.repository_id())) xterm_header = "equo (%s) :: %d of %d ::" % ( _("configure"), count, len(package_ids)) pkg.set_xterm_header(xterm_header) entropy_client.output( darkgreen(atom), count=(count, len(package_ids)), header=darkred(" ::: ") + ">>> ") exit_st = pkg.start() if exit_st not in (0, 3): return 1, True finally: if pkg is not None: pkg.finalize() return 0, True SoloCommandDescriptor.register( SoloCommandDescriptor( SoloConfig, SoloConfig.NAME, _("configure installed packages")) )
class SoloUnmask(SoloMaskUnmask): """ Main Solo Mask command. """ NAME = "unmask" ALIASES = [] INTRODUCTION = """\ Unmask packages so that installation and update will be allowed. """ SEE_ALSO = "equo-mask(1)" def __init__(self, args): SoloMaskUnmask.__init__(self, args, SoloUnmask.NAME) SoloCommandDescriptor.register( SoloCommandDescriptor( SoloMask, SoloMask.NAME, _("mask one or more packages")) ) SoloCommandDescriptor.register( SoloCommandDescriptor( SoloUnmask, SoloUnmask.NAME, _("unmask one or more packages")) )
mytxt = "%s: %s" % ( darkgreen(_("Succesfully switched to branch")), purple(self._branch),) entropy_client.output( mytxt, header=red(" @@ ")) mytxt = "%s %s" % ( brown(" ?? "), darkgreen(_("Now run 'equo upgrade' to " "upgrade your distribution to")), ) entropy_client.output(mytxt) return 0 entropy_client.set_branch(old_branch) mytxt = "%s: %s" % ( darkred(_("Unable to switch to branch")), purple(self._branch),) entropy_client.output( mytxt, level="error", importance=1, header=bold(" !!! ")) return 3 SoloCommandDescriptor.register( SoloCommandDescriptor( SoloHop, SoloHop.NAME, _("upgrade the System to a new branch")) )
elif action == 3: comeback, _continue = self._edit_file(idx, entropy_client, root, source, dest, paths_map, scandata) if _continue: continue break elif action == 4: comeback, _continue = self._interactive_merge( idx, entropy_client, root, source, dest, paths_map, scandata) if _continue: continue break elif action == 5: # show diff again diff = self._showdiff(entropy_client, dest_path, source_path) continue if comeback: return True return False SoloCommandDescriptor.register( SoloCommandDescriptor(SoloConf, SoloConf.NAME, _("manage package file updates")))
INTRODUCTION = """\ Show Equo version. """ SEE_ALSO = "equo-help(1)" def man(self): """ Overridden from SoloCommand. """ return self._man() def parse(self): """ Parse command """ return self._show_version, [] def _show_version(self, *args): # do not use entropy_client here # it is slow and might interfere with # other Client inits. release = read_client_release() text = TextInterface() text.output(release, level="generic") return 0 SoloCommandDescriptor.register( SoloCommandDescriptor(SoloVersion, SoloVersion.NAME, _("show equo version")))