From fb9f180f8ce65c8bbf97e5aa267a93c1078f59e4 Mon Sep 17 00:00:00 2001 From: Fabio Erculiani Date: Wed, 23 Dec 2009 21:51:47 +0100 Subject: [PATCH] [equo] some more code cleanup and polishing --- client/equo.py | 16 +- client/text_rescue.py | 1218 +++++++++++++++++++++-------------------- docs/man/equo.pod | 12 +- docs/man/man1/equo.1 | 33 +- 4 files changed, 648 insertions(+), 631 deletions(-) diff --git a/client/equo.py b/client/equo.py index 7c8849af9..64b096796 100644 --- a/client/equo.py +++ b/client/equo.py @@ -233,10 +233,10 @@ help_opts_extended = [ (1, 'database', 1, _('handles installed packages database')), (2, 'check', 2, _('check System Database for errors')), (2, 'vacuum', 2, _('remove System Database internal indexes to save space')), - (2, 'generate', 1, 'generate installed packages database using Portage database (Portage needed)'), + (2, 'generate', 1, _('generate installed packages database using Source Package Manager repositories')), (2, 'resurrect', 1, _('generate installed packages database using files on the system [last hope]')), (2, 'revdeps', 1, _('regenerate reverse dependencies metadata')), - (2, 'counters', 1, _('update/generate counters table (Portage <-> Entropy packages table)')), + (2, 'spmuids', 1, _('regenerate SPM UIDs map (SPM <-> Entropy packages)')), (2, 'spmsync', 1, _('makes Entropy aware of your Source Package Manager updated packages')), (2, 'backup', 2, _('backup the current Entropy installed packages database')), (2, 'restore', 1, _('restore a previously backed up Entropy installed packages database')), @@ -285,7 +285,7 @@ help_opts_extended = [ (3, 'md5remote', 2, _('verify remote integrity of the provided atoms (or world)')), (3, 'backup', 3, _('backup current repository database')), (3, 'restore', 3, _('restore a previously backed-up repository database')), - (3, 'counters', 2, _('resync counters table (Portage <-> Entropy matching scheme)'),), + (3, 'spmuids', 2, _('regenerate SPM UIDs map (SPM <-> Entropy packages)'),), None, @@ -426,7 +426,7 @@ if (options[0] == "--version"): raise SystemExit(0) elif (options[0] == "--info"): import text_rescue - text_rescue.getinfo() + text_rescue.database(["info"]) raise SystemExit(0) def do_moo(): @@ -524,8 +524,6 @@ def main(): elif (options[0] == "database"): import text_rescue rc = text_rescue.database(options[1:]) - # FIXME: refactor text_rescue - text_rescue.Equo.destroy() elif (options[0] == "ugc"): import text_ugc @@ -575,16 +573,14 @@ def main(): elif myopts[0] == "database": do = True - # hook to support counters command, which is just + # hook to support spmuids command, which is just # a duplicate of 'equo database counters' # put here for completeness if len(myopts) > 1: - if myopts[1] == "counters": + if myopts[1] == "spmuids": do = False import text_rescue rc = text_rescue.database(myopts[1:]) - # FIXME: refactor text_rescue - text_rescue.Equo.destroy() if do: try: diff --git a/client/text_rescue.py b/client/text_rescue.py index 1930bf8ac..0ab1325b5 100644 --- a/client/text_rescue.py +++ b/client/text_rescue.py @@ -9,13 +9,11 @@ B{Entropy Package Manager Client}. """ - -######################################################## -#### -## Repositories Tools -# import os import sys +import shutil +import tempfile + from entropy.const import etpConst, ETP_LOGPRI_INFO, ETP_LOGLEVEL_NORMAL, \ etpSys, etpUi from entropy.output import red, bold, brown, blue, darkred, darkgreen, purple, \ @@ -24,25 +22,23 @@ from entropy.exceptions import SystemDatabaseError import entropy.tools from entropy.client.interfaces import Client from entropy.i18n import _ + # strictly depending on Portage atm from entropy.spm.plugins.interfaces.portage_plugin import xpaktools -Equo = Client(noclientdb = True) - -def test_spm(): +def test_spm(entropy_client): # test if portage is available try: - Spm = Equo.Spm() - return Spm - except Exception as e: + return entropy_client.Spm() + except Exception as err: entropy.tools.print_traceback() mytxt = _("Source Package Manager backend not available") - print_error(darkred(" * ")+red("%s: %s" % (mytxt, e,))) + print_error(darkred(" * ")+red("%s: %s" % (mytxt, err,))) return None -def test_clientdb(): +def test_clientdb(entropy_client): try: - Equo.clientDbconn.validateDatabase() + entropy_client.clientDbconn.validateDatabase() except SystemDatabaseError: mytxt = _("Installed packages database not available") print_error(darkred(" * ")+red("%s !" % (mytxt,))) @@ -54,656 +50,676 @@ def database(options): return -10 # check if I am root - if (not entropy.tools.is_root()): + if not entropy.tools.is_root(): mytxt = _("You are not root") print_error(red(mytxt+".")) return 1 - if (options[0] == "generate"): + etp_client = Client(noclientdb = True) + try: - Spm = test_spm() - if Spm == None: + if options[0] == "generate": + return _database_generate(etp_client) + + elif options[0] == "check": + return _database_check(etp_client) + + elif options[0] == "resurrect": + return _database_resurrect(etp_client) + + elif options[0] == "revdeps": + return _database_revdeps(etp_client) + + elif options[0] in ("counters", "spmuids",): + if options[0] == "counters": + print_warning("") + print_warning("'%s' %s: '%s'" % ( + purple("equo database counters"), + blue(_("is deprecated, please use")), + darkgreen("equo database spmuids"),)) + print_warning("") + return _database_counters(etp_client) + + elif options[0] in ("gentoosync", "spmsync",): + if options[0] == "gentoosync": + print_warning("") + print_warning("'%s' %s: '%s'" % ( + purple("equo database gentoosync"), + blue(_("is deprecated, please use")), + darkgreen("equo database spmsync"),)) + print_warning("") + return _database_spmsync(etp_client) + + elif options[0] == "backup": + status, err_msg = etp_client.backup_database( + etpConst['etpdatabaseclientfilepath']) + if status: + return 0 return 1 - mytxt = "%s: %s." % ( - bold(_("ATTENTION")), - red(_("The installed package database will be generated again using Source Package Manager one")), - ) - print_warning(mytxt) - print_warning(red(_("If you dont know what you're doing just, don't do this. Really. I'm not joking."))) - rc = Equo.askQuestion(" %s" % (_("Understood ?"),)) - if rc == _("No"): - return 0 - rc = Equo.askQuestion(" %s" % (_("Really ?"),) ) - if rc == _("No"): - return 0 - rc = Equo.askQuestion(" %s. %s" % (_("This is your last chance"), _("Ok?"),) ) - if rc == _("No"): - return 0 + elif options[0] == "restore": + return _database_restore(etp_client) - # clean caches - Equo.purge_cache() - import shutil + elif options[0] == "vacuum": + return _database_vacuum(etp_client) - # try to collect current installed revisions if possible - revisions_match = {} - try: - myids = Equo.clientDbconn.listAllIdpackages() - for myid in myids: - myatom = Equo.clientDbconn.retrieveAtom(myid) - myrevision = Equo.clientDbconn.retrieveRevision(myid) - revisions_match[myatom] = myrevision - except: - pass + elif options[0] == "info": + return _getinfo(etp_client) - # ok, he/she knows it... hopefully - # if exist, copy old database - print_info(red(" @@ ")+blue(_("Creating backup of the previous database, if exists."))+red(" @@")) - newfile = entropy.tools.backup_client_repository() - if (newfile): - print_info(red(" @@ ")+blue(_("Previous database copied to file"))+" "+newfile+red(" @@")) + finally: + etp_client.destroy() - # Now reinitialize it - mytxt = darkred(" %s %s") % (_("Initializing the new database at"), bold(etpConst['etpdatabaseclientfilepath']),) - print_info(mytxt, back = True) - Equo.reopen_client_repository() - dbfile = Equo.clientDbconn.dbFile - Equo.clientDbconn.closeDB() - if os.path.isfile(dbfile): - os.remove(dbfile) - Equo.open_client_repository() - Equo.clientDbconn.initializeDatabase() - mytxt = darkred(" %s %s") % (_("Database reinitialized correctly at"), bold(etpConst['etpdatabaseclientfilepath']),) - print_info(mytxt) + return -10 - # now collect packages in the system - print_info(red(" %s..." % (_("Transductingactioningintactering databases"),) )) - - spm_packages = Spm.get_installed_packages() - - # do for each database - maxcount = str(len(spm_packages)) - count = 0 - for portagePackage in spm_packages: - count += 1 - print_info(blue("(")+darkgreen(str(count))+"/"+darkred(maxcount)+blue(")")+red(" atom: ")+brown(portagePackage), back = True) - temptbz2 = etpConst['entropyunpackdir']+"/"+portagePackage.split("/")[1]+".tbz2" - if not os.path.isdir(etpConst['entropyunpackdir']): - os.makedirs(etpConst['entropyunpackdir']) - if os.path.isfile(temptbz2): - os.remove(temptbz2) - elif os.path.isdir(temptbz2): - shutil.rmtree(temptbz2) - f = open(temptbz2, "wb") - f.flush() - f.close() - xpaktools.append_xpak(temptbz2, portagePackage) - # now extract info - try: - mydata = Spm.extract_package_metadata(temptbz2) - except Exception as e: - entropy.tools.print_traceback() - Equo.clientLog.log( - ETP_LOGPRI_INFO, - ETP_LOGLEVEL_NORMAL, - "Database generation: Exception caught: %s: %s" % (str(Exception), str(e),) - ) - print_warning( red("!!! %s: %s") % (_("An error occured while analyzing"), blue(portagePackage),) ) - print_warning("%s: %s: %s" % (_("Exception"), str(Exception), e,)) - continue - - # Try to see if it's possible to use the revision of a possible old db - mydata['revision'] = 9999 - # create atom string - myatom = mydata['category']+"/"+mydata['name']+"-"+mydata['version'] - if mydata['versiontag']: - myatom += "#"+mydata['versiontag'] - # now see if a revision is available - savedRevision = revisions_match.get(myatom) - if savedRevision != None: - try: - savedRevision = int(savedRevision) # cast to int for security - mydata['revision'] = savedRevision - except: - pass - - idpk, rev, xx = Equo.clientDbconn.addPackage(mydata, revision = mydata['revision']) - Equo.clientDbconn.storeInstalledPackage(idpk, "spm-db") - os.remove(temptbz2) - - print_info(red(" %s." % (_("All the Source Package Manager packages have been injected into Entropy database"),) )) - print_info(red(" %s..." % (_("Now checking dependency atoms validity"),) )) - mydeps = Equo.clientDbconn.listAllDependencies() - maxcount = str(len(mydeps)) - count = 0 - for depdata in mydeps: - count += 1 - atom = depdata[1] - iddependency = depdata[0] - print_info(blue("(")+darkgreen(str(count))+"/"+darkred(maxcount)+blue(")")+red(" %s: " % (_("atom"),) )+brown(atom), back = True) - try: - Equo.clientDbconn.atomMatch(atom) - except Exception as e: - entropy.tools.print_traceback() - Equo.clientLog.log( - ETP_LOGPRI_INFO, - ETP_LOGLEVEL_NORMAL, - "Database dependency atoms check: Exception caught: %s: %s" % ( - str(Exception), - str(e), - ) - ) - print_warning(red("!!! %s: " % (_("An error occured while analyzing"),) )+blue(atom)+" - "+red(_("entry can be invalid!"))) - print_warning("%s: %s: %s" % (_("Exception"), str(Exception), str(e),)) - found_idpackages = Equo.clientDbconn.searchIdpackageFromIddependency(iddependency) - if found_idpackages: - print_warning(red("%s:" % (_("These are the invalid entries"),) )) - for myidpackage in found_idpackages: - myatom = Equo.clientDbconn.retrieveAtom(myidpackage) - print_warning(darkred(" # ")+blue(myatom)) - print_warning(red("%s..." % (_("Removing database information"),) )) - for myidpackage in found_idpackages: - Equo.clientDbconn.removePackage(myidpackage) - - print_info(red(" %s..." % (_("Now generating reverse dependencies metadata"),) )) - Equo.clientDbconn.generateReverseDependenciesMetadata() - print_info(red(" %s...") % (_("Now indexing tables"),) ) - Equo.clientDbconn.indexing = True - Equo.clientDbconn.createAllIndexes() - print_info(red(" %s." % (_("Database reinitialized successfully"),) )) +def _database_vacuum(entropy_client): + if entropy_client.clientDbconn is not None: + print_info(red(" @@ ")+"%s..." % (blue(_("Vacuum cleaning System Database")),), back = True) + entropy_client.clientDbconn.dropAllIndexes() + entropy_client.clientDbconn.vacuum() + entropy_client.clientDbconn.commitChanges() + print_info(red(" @@ ")+"%s." % (brown(_("Vacuum cleaned System Database")),)) return 0 + print_warning(darkred(" !!! ")+blue("%s." % (_("No System Databases found"),))) + return 1 - elif (options[0] == "check"): - try: - valid = True - Equo.clientDbconn.validateDatabase() - except SystemDatabaseError: - valid = False - if valid: - Equo.client_repository_sanity_check() - else: - mytxt = "# %s: %s" % (bold(_("ATTENTION")), red(_("database does not exist or is badly broken")),) - print_warning(mytxt) +def _database_restore(entropy_client): + + dblist = entropy_client.list_backedup_client_databases() + if not dblist: + print_info(brown(" @@ ")+blue("%s." % ( + _("No backed up databases found"),))) + return 1 + + mydblist = [] + db_data = [] + for mydb in dblist: + ts = entropy.tools.get_file_unix_mtime(mydb) + mytime = entropy.tools.convert_unix_time_to_human_time(ts) + mydblist.append("[%s] %s" % (mytime, mydb,)) + db_data.append(mydb) + + def fake_cb(s): + return s + + input_params = [ + ('db', ('combo', (_('Select the database you want to restore'), + mydblist),), fake_cb, True) + ] + + while True: + data = entropy_client.inputBox( + red(_("Entropy installed packages database restore tool")), + input_params, cancel_button = True) + if data is None: return 1 + myid, dbx = data['db'] + try: + dbpath = db_data.pop(myid) + except IndexError: + continue + if not os.path.isfile(dbpath): continue + break + + status, err_msg = entropy_client.restore_database(dbpath, + etpConst['etpdatabaseclientfilepath']) + if status: + return 0 + return 1 + + +def _database_counters(entropy_client): + Spm = test_spm(entropy_client) + if Spm is None: + return 1 + + rc = test_clientdb(entropy_client) + if rc is not None: + return rc + + print_info(red(" %s..." % (_("Regenerating counters table"),) )) + entropy_client.clientDbconn.regenerateSpmUidTable(verbose = True) + print_info(red(" %s" % ( + _("Counters table regenerated. Look above for errors."),) )) + return 0 + +def _database_revdeps(entropy_client): + rc = test_clientdb(entropy_client) + if rc is not None: + return rc + + print_info(red(" %s..." % ( + _("Regenerating reverse dependencies metadata"),) )) + entropy_client.clientDbconn.generateReverseDependenciesMetadata() + print_info(red(" %s." % ( + _("Reverse dependencies metadata regenerated successfully"),) )) + return 0 + +def _database_resurrect(entropy_client): + + mytxt = "####### %s: %s" % ( + bold(_("ATTENTION")), + red(_("The installed package database will be resurrected, this will take a LOT of time.")), + ) + print_warning(mytxt) + mytxt = "####### %s: %s" % ( + bold(_("ATTENTION")), + red(_("Please use this function ONLY if you are using an Entropy-aware distribution.")), + ) + print_warning(mytxt) + rc = entropy_client.askQuestion(" %s" % ( + _("Can I continue ?"),) ) + if rc == _("No"): + return 0 + rc = entropy_client.askQuestion(" %s" % ( + _("Are you REALLY sure ?"),) ) + if rc == _("No"): + return 0 + rc = entropy_client.askQuestion(" %s" % ( + _("Do you even know what you're doing ?"),) ) + if rc == _("No"): return 0 - elif (options[0] == "resurrect"): + # clean caches + entropy_client.purge_cache() - mytxt = "####### %s: %s" % ( - bold(_("ATTENTION")), - red(_("The installed package database will be resurrected, this will take a LOT of time.")), + # ok, he/she knows it... hopefully + # if exist, copy old database + print_info(red(" @@ ") + \ + blue(_("Creating backup of the previous database, if exists."))) + newfile = entropy.tools.backup_client_repository() + if (newfile): + print_info(red(" @@ ") + \ + blue(_("Previous database copied to file"))+" "+newfile) + + # Now reinitialize it + mytxt = " %s %s" % ( + darkred(_("Initializing the new database at")), + bold(etpConst['etpdatabaseclientfilepath']), + ) + print_info(mytxt, back = True) + dbpath = etpConst['etpdatabaseclientfilepath'] + if os.path.isfile(dbpath) and os.access(dbpath, os.W_OK): + os.remove(dbpath) + dbc = entropy_client.open_generic_database(dbpath, + dbname = etpConst['clientdbid']) # don't do this at home + dbc.initializeDatabase() + dbc.commitChanges() + entropy_client.clientDbconn = dbc + mytxt = " %s %s" % ( + darkgreen(_("Database reinitialized correctly at")), + bold(etpConst['etpdatabaseclientfilepath']), + ) + print_info(mytxt) + + mytxt = red(" %s. %s. %s ...") % ( + _("Collecting installed files"), + _("Writing to temporary file"), + _("Please wait"), + ) + print_info(mytxt, back = True) + + # since we use find, see if it's installed + find = os.system("which find &> /dev/null") + if find != 0: + mytxt = "%s: %s!" % ( + darkred(_("Attention")), + red(_("You must have 'find' installed")), ) - print_warning(mytxt) - mytxt = "####### %s: %s" % ( - bold(_("ATTENTION")), - red(_("Please use this function ONLY if you are using an Entropy-aware distribution.")), - ) - print_warning(mytxt) - rc = Equo.askQuestion(" %s" % (_("Can I continue ?"),) ) - if rc == _("No"): - return 0 - rc = Equo.askQuestion(" %s" % (_("Are you REALLY sure ?"),) ) - if rc == _("No"): - return 0 - rc = Equo.askQuestion(" %s" % (_("Do you even know what you're doing ?"),) ) - if rc == _("No"): - return 0 - - # clean caches - Equo.purge_cache() - - # ok, he/she knows it... hopefully - # if exist, copy old database - print_info(red(" @@ ")+blue(_("Creating backup of the previous database, if exists."))) - newfile = entropy.tools.backup_client_repository() - if (newfile): - print_info(red(" @@ ")+blue(_("Previous database copied to file"))+" "+newfile) - - # Now reinitialize it - mytxt = " %s %s" % ( - darkred(_("Initializing the new database at")), - bold(etpConst['etpdatabaseclientfilepath']), - ) - print_info(mytxt, back = True) - dbpath = etpConst['etpdatabaseclientfilepath'] - if os.path.isfile(dbpath) and os.access(dbpath, os.W_OK): - os.remove(dbpath) - dbc = Equo.open_generic_database(dbpath, dbname = etpConst['clientdbid']) # don't do this at home - dbc.initializeDatabase() - dbc.commitChanges() - Equo.clientDbconn = dbc - mytxt = " %s %s" % ( - darkgreen(_("Database reinitialized correctly at")), - bold(etpConst['etpdatabaseclientfilepath']), - ) - print_info(mytxt) - - mytxt = red(" %s. %s. %s ...") % ( - _("Collecting installed files"), - _("Writing to temporary file"), - _("Please wait"), - ) - print_info(mytxt, back = True) - - # since we use find, see if it's installed - find = os.system("which find &> /dev/null") - if find != 0: - mytxt = "%s: %s!" % ( - darkred(_("Attention")), - red(_("You must have 'find' installed")), - ) - print_error(mytxt) - return - # spawn process - rnd_num = entropy.tools.get_random_number() - tmpfile = os.path.join(etpConst['packagestmpdir'], "%s" % (rnd_num,)) - if os.path.isfile(tmpfile): - os.remove(tmpfile) - os.system("find "+etpConst['systemroot']+"/ -mount 1> "+tmpfile) - if not os.path.isfile(tmpfile): - mytxt = "%s: %s!" % ( - darkred(_("Attention")), - red(_("'find' couldn't generate an output file")), - ) - print_error(mytxt) - return - - f = open(tmpfile, "r") - # creating list of files - filelist = set() - item = f.readline().strip() - while item: - filelist.add(item) - item = f.readline().strip() - f.close() - entries = len(filelist) - - mytxt = red(" %s...") % (_("Found %s files on the system. Assigning packages" % (entries,) ),) - print_info(mytxt) - atoms = {} - pkgsfound = set() - - for repo in Equo.SystemSettings['repositories']['order']: - mytxt = red(" %s: %s") % (_("Matching in repository"), Equo.SystemSettings['repositories']['available'][repo]['description'],) - print_info(mytxt) - # get all idpackages - dbconn = Equo.open_repository(repo) - idpackages = dbconn.listAllIdpackages() - count = str(len(idpackages)) - cnt = 0 - for idpackage in idpackages: - cnt += 1 - idpackageatom = dbconn.retrieveAtom(idpackage) - mytxt = " (%s/%s) %s ..." % ( - cnt, - count, - red(_("Matching files from packages")), - ) - print_info(mytxt, back = True) - # content - content = dbconn.retrieveContent(idpackage) - for item in content: - if etpConst['systemroot']+item in filelist: - pkgsfound.add((idpackage, repo)) - atoms[(idpackage, repo)] = idpackageatom - filelist.difference_update(set([etpConst['systemroot']+x for x in content])) - break - - mytxt = red(" %s. %s...") % ( - _("Found %s packages") % (bold(str(len(pkgsfound))),), - _("Filling database"), - ) - print_info(mytxt) - count = str(len(pkgsfound)) - cnt = 0 + print_error(mytxt) + return + # spawn process + rnd_num = entropy.tools.get_random_number() + tmpfile = os.path.join(etpConst['packagestmpdir'], "%s" % (rnd_num,)) + if os.path.isfile(tmpfile): os.remove(tmpfile) + os.system("find "+etpConst['systemroot']+"/ -mount 1> "+tmpfile) + if not os.path.isfile(tmpfile): + mytxt = "%s: %s!" % ( + darkred(_("Attention")), + red(_("'find' couldn't generate an output file")), + ) + print_error(mytxt) + return - for pkgfound in pkgsfound: + f = open(tmpfile, "r") + # creating list of files + filelist = set() + item = f.readline().strip() + while item: + filelist.add(item) + item = f.readline().strip() + f.close() + entries = len(filelist) + + mytxt = red(" %s...") % ( + _("Found %s files on the system. Assigning packages" % (entries,) ),) + print_info(mytxt) + atoms = {} + pkgsfound = set() + + repos_data = entropy_client.SystemSettings['repositories'] + + for repo in repos_data['order']: + mytxt = red(" %s: %s") % (_("Matching in repository"), + repos_data['available'][repo]['description'],) + print_info(mytxt) + # get all idpackages + dbconn = entropy_client.open_repository(repo) + idpackages = dbconn.listAllIdpackages() + count = str(len(idpackages)) + cnt = 0 + for idpackage in idpackages: cnt += 1 - print_info(" ("+str(cnt)+"/"+count+") "+red("%s: " % (_("Adding"),))+atoms[pkgfound], back = True) - Package = Equo.Package() - Package.prepare(tuple(pkgfound), "install", {}) - Package.add_installed_package() - Package.kill() - del Package + idpackageatom = dbconn.retrieveAtom(idpackage) + mytxt = " (%s/%s) %s ..." % ( + cnt, + count, + red(_("Matching files from packages")), + ) + print_info(mytxt, back = True) + # content + content = dbconn.retrieveContent(idpackage) + for item in content: + if etpConst['systemroot']+item in filelist: + pkgsfound.add((idpackage, repo)) + atoms[(idpackage, repo)] = idpackageatom + filelist.difference_update( + set([etpConst['systemroot']+x for x in content])) + break + + mytxt = red(" %s. %s...") % ( + _("Found %s packages") % (bold(str(len(pkgsfound))),), + _("Filling database"), + ) + print_info(mytxt) + count = str(len(pkgsfound)) + cnt = 0 + os.remove(tmpfile) + + for pkgfound in pkgsfound: + cnt += 1 + print_info(" ("+str(cnt)+"/"+count+") "+red( + "%s: " % (_("Adding"),))+atoms[pkgfound], back = True) + etp_pkg = entropy_client.Package() + etp_pkg.prepare(tuple(pkgfound), "install", {}) + etp_pkg.add_installed_package() + etp_pkg.kill() + del etp_pkg - print_info(red(" %s." % (_("Database resurrected successfully"),))) + print_info(red(" %s." % (_("Database resurrected successfully"),))) - print_info(red(" %s..." % (_("Now generating reverse dependencies metadata"),))) - Equo.clientDbconn.generateReverseDependenciesMetadata() - print_info(red(" %s..." % (_("Now indexing tables"),))) - Equo.clientDbconn.indexing = True - Equo.clientDbconn.createAllIndexes() - print_info(red(" %s." % (_("Database reinitialized successfully"),))) + print_info(red(" %s..." % (_("Now generating reverse dependencies metadata"),))) + entropy_client.clientDbconn.generateReverseDependenciesMetadata() + print_info(red(" %s..." % (_("Now indexing tables"),))) + entropy_client.clientDbconn.indexing = True + entropy_client.clientDbconn.createAllIndexes() + print_info(red(" %s." % (_("Database reinitialized successfully"),))) - print_warning(red(" %s" % (_("Keep in mind that virtual/meta packages couldn't be matched. They don't own any files."),) )) - return 0 + print_warning(red(" %s" % (_("Keep in mind that virtual packages couldn't be matched. They don't own any files."),) )) + return 0 - elif (options[0] == "revdeps"): +def _database_spmsync(entropy_client): - rc = test_clientdb() - if rc != None: - return rc + Spm = test_spm(entropy_client) + if Spm is None: + return 1 - print_info(red(" %s..." % (_("Regenerating reverse dependencies metadata"),) )) - Equo.clientDbconn.generateReverseDependenciesMetadata() - print_info(red(" %s." % (_("Reverse dependencies metadata regenerated successfully"),) )) - return 0 + rc = test_clientdb(entropy_client) + if rc is not None: + return rc - elif (options[0] == "counters"): + print_info(red(" %s..." % ( + _("Scanning Source Package Manager and Entropy databases for differences"),))) - Spm = test_spm() - if Spm == None: - return 1 + # make it crash + entropy_client.noclientdb = False + entropy_client.reopen_client_repository() + entropy_client.close_all_repositories() - rc = test_clientdb() - if rc != None: - return rc - - print_info(red(" %s..." % (_("Regenerating counters table"),) )) - Equo.clientDbconn.regenerateSpmUidTable(verbose = True) - print_info(red(" %s" % (_("Counters table regenerated. Look above for errors."),) )) - return 0 - - elif (options[0] in ("gentoosync", "spmsync",)): - - if options[0] == "gentoosync": - print_warning("") - print_warning("'%s' %s: '%s'" % ( - purple("equo database gentoosync"), - blue(_("is deprecated, please use")), - darkgreen("equo database spmsync"),)) - print_warning("") - - Spm = test_spm() - if Spm == None: - return 1 - - rc = test_clientdb() - if rc != None: - return rc - - print_info(red(" %s..." % (_("Scanning Source Package Manager and Entropy databases for differences"),))) - - # make it crash - Equo.noclientdb = False - Equo.reopen_client_repository() - Equo.close_all_repositories() - - # test if counters table exists, because if not, it's useless to run the diff scan + print_info(red(" %s..." % ( + _("Collecting Source Package Manager metadata"),) ), back = True) + spm_packages = Spm.get_installed_packages() + installed_packages = [] + for spm_package in spm_packages: + pkg_counter = Spm.get_installed_package_metadata(spm_package, + "COUNTER") try: - Equo.clientDbconn.isSpmUidAvailable(1) - except: - mytxt = "%s %s: %s %s." % ( - bold(_("Entropy database")), - red(_("has never been in sync with Source Package Manager. So, you can't run this unless you run first")), - bold("equo database generate"), - red(_("Sorry")), - ) - print_error(darkred(" * ")+mytxt) - return 1 + pkg_counter = int(pkg_counter) + except ValueError: + continue + installed_packages.append((spm_package, pkg_counter,)) - import shutil - print_info(red(" %s..." % (_("Collecting Source Package Manager metadata"),) ), back = True) - spm_packages = Spm.get_installed_packages() - installed_packages = [] - for spm_package in spm_packages: - pkg_counter = Spm.get_installed_package_metadata(spm_package, - "COUNTER") - try: - pkg_counter = int(pkg_counter) - except ValueError: - continue - installed_packages.append((spm_package, pkg_counter,)) + print_info(red(" %s..." % ( + _("Collecting Entropy packages"),) ), back = True) + installed_spm_uids = set() + to_be_added = set() + to_be_removed = set() - print_info(red(" %s..." % (_("Collecting Entropy packages"),) ), back = True) - installedCounters = set() - toBeAdded = set() - toBeRemoved = set() + print_info(red(" %s..." % (_("Differential Scan"),)), back = True) + # packages to be added/updated (handle add/update later) + for x in installed_packages: + installed_spm_uids.add(x[1]) + counter = entropy_client.clientDbconn.isSpmUidAvailable(x[1]) + if (not counter): + to_be_added.add(tuple(x)) - print_info(red(" %s..." % (_("Differential Scan"),)), back = True) - # packages to be added/updated (handle add/update later) - for x in installed_packages: - installedCounters.add(x[1]) - counter = Equo.clientDbconn.isSpmUidAvailable(x[1]) - if (not counter): - toBeAdded.add(tuple(x)) - - # packages to be removed from the database - databaseCounters = Equo.clientDbconn.listAllSpmUids() - for x in databaseCounters: - if x[0] < 0: # skip packages without valid counter - continue - if x[0] not in installedCounters: - # check if the package is in toBeAdded - if (toBeAdded): - atom = Equo.clientDbconn.retrieveAtom(x[1]) + # packages to be removed from the database + repo_spm_uids = entropy_client.clientDbconn.listAllSpmUids() + for x in repo_spm_uids: + if x[0] < 0: # skip packages without valid counter + continue + if x[0] not in installed_spm_uids: + # check if the package is in to_be_added + if (to_be_added): + atom = entropy_client.clientDbconn.retrieveAtom(x[1]) + add = True + if atom: + atomkey = entropy.tools.dep_getkey(atom) + atomslot = entropy_client.clientDbconn.retrieveSlot(x[1]) add = True - if atom: - atomkey = entropy.tools.dep_getkey(atom) - atomslot = Equo.clientDbconn.retrieveSlot(x[1]) - add = True - for pkgdata in toBeAdded: - try: - addslot = Spm.get_installed_package_metadata(pkgdata[0], "SLOT") - except KeyError: - continue - addkey = entropy.tools.dep_getkey(pkgdata[0]) - # workaround for ebuilds not having slot - if addslot == None: - addslot = '0' - if (atomkey == addkey) and (str(atomslot) == str(addslot)): - # do not add to toBeRemoved - add = False - break - if add: - toBeRemoved.add(x[1]) - else: - toBeRemoved.add(x[1]) + for pkgdata in to_be_added: + try: + addslot = Spm.get_installed_package_metadata( + pkgdata[0], "SLOT") + except KeyError: + continue + addkey = entropy.tools.dep_getkey(pkgdata[0]) + # workaround for ebuilds not having slot + if addslot is None: + addslot = '0' + if (atomkey == addkey) and (str(atomslot) == str(addslot)): + # do not add to to_be_removed + add = False + break + if add: + to_be_removed.add(x[1]) + else: + to_be_removed.add(x[1]) - if (not toBeRemoved) and (not toBeAdded): - print_info(red(" %s." % (_("Databases already synced"),))) - # then exit gracefully - return 0 + if (not to_be_removed) and (not to_be_added): + print_info(red(" %s." % (_("Databases already synced"),))) + # then exit gracefully + return 0 - # check lock file - gave_up = Equo.lock_check(Equo.resources_check_lock) - if gave_up: - print_info(red(" %s." % (_("Entropy locked, giving up"),))) - return 2 + # check lock file + gave_up = entropy_client.lock_check(entropy_client.resources_check_lock) + if gave_up: + print_info(red(" %s." % (_("Entropy locked, giving up"),))) + return 2 - rc = Equo.askQuestion(_("Are you ready ?")) - if rc == _("No"): - return 0 + rc = entropy_client.askQuestion(_("Are you ready ?")) + if rc == _("No"): + return 0 - acquired = Equo.resources_create_lock() - if not acquired: - print_info(red(" %s." % (_("Entropy locked during lock acquire"),))) - return 2 + acquired = entropy_client.resources_create_lock() + if not acquired: + print_info(red(" %s." % (_("Entropy locked during lock acquire"),))) + return 2 - if toBeRemoved: - mytxt = blue("%s. %s:") % ( - _("Someone removed these packages"), - _("They would be removed from the system database"), - ) - print_info(brown(" @@ ")+mytxt) + if to_be_removed: + mytxt = blue("%s. %s:") % ( + _("Someone removed these packages"), + _("They would be removed from the system database"), + ) + print_info(brown(" @@ ")+mytxt) - broken = set() - for x in toBeRemoved: - atom = Equo.clientDbconn.retrieveAtom(x) - if not atom: - broken.add(x) - continue - print_info(brown(" # ")+red(atom)) - toBeRemoved -= broken - if toBeRemoved: - rc = _("Yes") - if etpUi['ask']: - rc = Equo.askQuestion(">> %s" % ( - _("Continue with removal ?"),)) - if rc == _("Yes"): - queue = 0 - totalqueue = str(len(toBeRemoved)) - for x in toBeRemoved: - queue += 1 - atom = Equo.clientDbconn.retrieveAtom(x) - mytxt = " %s (%s/%s) %s %s %s" % ( - red("--"), - blue(str(queue)), - red(totalqueue), - brown(">>>"), - _("Removing"), - darkgreen(atom), - ) - print_info(mytxt) - Equo.clientDbconn.removePackage(x) - print_info(brown(" @@ ")+blue("%s." % (_("Database removal complete"),) )) - - if toBeAdded: - mytxt = blue("%s. %s:") % ( - _("Someone added these packages"), - _("They would be added to the system database"), - ) - print_info(brown(" @@ ")+mytxt) - for x in toBeAdded: - print_info(darkgreen(" # ")+red(x[0])) + broken = set() + for x in to_be_removed: + atom = entropy_client.clientDbconn.retrieveAtom(x) + if not atom: + broken.add(x) + continue + print_info(brown(" # ")+red(atom)) + to_be_removed -= broken + if to_be_removed: rc = _("Yes") if etpUi['ask']: - rc = Equo.askQuestion(">> %s" % ( - _("Continue with adding ?"),) ) - if rc == _("No"): - Equo.resources_remove_lock() - return 0 - # now analyze - - totalqueue = str(len(toBeAdded)) - queue = 0 - for atom, counter in toBeAdded: - queue += 1 - mytxt = " %s (%s/%s) %s %s %s" % ( - red("++"), - blue(str(queue)), - red(totalqueue), - brown(">>>"), - _("Adding"), - darkgreen(atom), - ) - print_info(mytxt) - if not os.path.isdir(etpConst['entropyunpackdir']): - os.makedirs(etpConst['entropyunpackdir']) - temptbz2 = etpConst['entropyunpackdir']+"/"+atom.split("/")[1]+etpConst['packagesext'] - if os.path.isfile(temptbz2): - os.remove(temptbz2) - elif os.path.isdir(temptbz2): - shutil.rmtree(temptbz2) - f = open(temptbz2, "wb") - f.flush() - f.close() - xpaktools.append_xpak(temptbz2, atom) - # now extract info - try: - mydata = Spm.extract_package_metadata(temptbz2) - except Exception as e: - Equo.clientLog.log( - ETP_LOGPRI_INFO, - ETP_LOGLEVEL_NORMAL, - "Database spmsync: Exception caught: %s: %s" % ( - str(Exception), - str(e), - ) + rc = entropy_client.askQuestion(">> %s" % ( + _("Continue with removal ?"),)) + if rc == _("Yes"): + queue = 0 + totalqueue = str(len(to_be_removed)) + for x in to_be_removed: + queue += 1 + atom = entropy_client.clientDbconn.retrieveAtom(x) + mytxt = " %s (%s/%s) %s %s %s" % ( + red("--"), + blue(str(queue)), + red(totalqueue), + brown(">>>"), + _("Removing"), + darkgreen(atom), ) - print_warning(red("!!! %s: " % (_("An error occured while analyzing")) )+blue(atom)) - print_warning("%s: %s: %s" % (_("Exception"), str(Exception), str(e),)) - continue + print_info(mytxt) + entropy_client.clientDbconn.removePackage(x) + print_info(brown(" @@ ") + \ + blue("%s." % (_("Database removal complete"),) )) - # create atom string - myatom = mydata['category']+"/"+mydata['name']+"-"+mydata['version'] - if mydata['versiontag']: - myatom += "#"+mydata['versiontag'] + if to_be_added: + mytxt = blue("%s. %s:") % ( + _("Someone added these packages"), + _("They would be added to the system database"), + ) + print_info(brown(" @@ ")+mytxt) + for x in to_be_added: + print_info(darkgreen(" # ")+red(x[0])) + rc = _("Yes") + if etpUi['ask']: + rc = entropy_client.askQuestion(">> %s" % ( + _("Continue with adding ?"),) ) + if rc == _("No"): + entropy_client.resources_remove_lock() + return 0 + # now analyze - # look for atom in client database - oldidpackages = sorted(Equo.clientDbconn.getIDPackages(myatom)) - oldidpackage = None - if oldidpackages: - oldidpackage = oldidpackages[-1] + totalqueue = str(len(to_be_added)) + queue = 0 + for atom, counter in to_be_added: + queue += 1 + mytxt = " %s (%s/%s) %s %s %s" % ( + red("++"), + blue(str(queue)), + red(totalqueue), + brown(">>>"), + _("Adding"), + darkgreen(atom), + ) + print_info(mytxt) - mydata['revision'] = 9999 # can't do much more - if oldidpackage: - mydata['revision'] = Equo.clientDbconn.retrieveRevision(oldidpackage) + tmp_fd, temp_pkg_path = tempfile.mkstemp() + os.close(tmp_fd) + xpaktools.append_xpak(temp_pkg_path, atom) + # now extract info + try: + mydata = Spm.extract_package_metadata(temp_pkg_path) + except Exception as err: + entropy.tools.print_traceback() + entropy_client.clientLog.log( + ETP_LOGPRI_INFO, + ETP_LOGLEVEL_NORMAL, + "Database spmsync: Exception caught: %s" % ( + str(err), + ) + ) + print_warning(red("!!! %s: " % ( + _("An error occured while analyzing")) ) + blue(atom)) + print_warning("%s: %s" % (_("Exception"), str(err),)) + continue - idpk, rev, xx = Equo.clientDbconn.handlePackage(mydata, forcedRevision = mydata['revision']) - Equo.clientDbconn.dropInstalledPackageFromStore(idpk) - Equo.clientDbconn.storeInstalledPackage(idpk, "spm-db") - os.remove(temptbz2) + # create atom string + myatom = entropy.tools.create_package_atom_string(mydata['category'], + mydata['name'], mydata['version'], mydata['versiontag']) - print_info(brown(" @@ ")+blue("%s." % (_("Database update completed"),))) + # look for atom in client database + idpkgs = entropy_client.clientDbconn.getIDPackages(myatom) + oldidpackages = sorted(idpkgs) + oldidpackage = None + if oldidpackages: + oldidpackage = oldidpackages[-1] - Equo.resources_remove_lock() + mydata['revision'] = 9999 # can't do much more + if oldidpackage: + mydata['revision'] = \ + entropy_client.clientDbconn.retrieveRevision(oldidpackage) + + idpk, rev, xx = entropy_client.clientDbconn.handlePackage(mydata, + forcedRevision = mydata['revision']) + entropy_client.clientDbconn.dropInstalledPackageFromStore(idpk) + entropy_client.clientDbconn.storeInstalledPackage(idpk, "spm-db") + os.remove(temp_pkg_path) + + print_info(brown(" @@ ") + \ + blue("%s." % (_("Database update completed"),))) + + entropy_client.resources_remove_lock() + return 0 + +def _database_generate(entropy_client): + + Spm = test_spm(entropy_client) + if Spm is None: + return 1 + + mytxt = "%s: %s." % ( + bold(_("ATTENTION")), + red(_("The installed package repository will be regenerated using Source Package Manager")), + ) + print_warning(mytxt) + print_warning(red(_("If you dont know what you're doing just, don't do this. Really. I'm not joking."))) + rc = entropy_client.askQuestion(" %s" % (_("Understood ?"),)) + if rc == _("No"): + return 0 + rc = entropy_client.askQuestion(" %s" % (_("Really ?"),) ) + if rc == _("No"): + return 0 + rc = entropy_client.askQuestion(" %s. %s" % ( + _("This is your last chance"), _("Ok?"),) ) + if rc == _("No"): return 0 - elif (options[0] == "backup"): + # clean caches + entropy_client.purge_cache() - status, err_msg = Equo.backup_database(etpConst['etpdatabaseclientfilepath']) - if status: - return 0 - return 1 + # try to collect current installed revisions if possible + revisions_match = {} + try: + myids = entropy_client.clientDbconn.listAllIdpackages() + for myid in myids: + myatom = entropy_client.clientDbconn.retrieveAtom(myid) + myrevision = entropy_client.clientDbconn.retrieveRevision(myid) + revisions_match[myatom] = myrevision + except: + pass - elif (options[0] == "restore"): + # ok, he/she knows it... hopefully + # if exist, copy old database + print_info(red(" @@ ") + \ + blue(_("Creating backup of the previous database, if exists.")) + \ + red(" @@")) + newfile = entropy.tools.backup_client_repository() + if newfile: + print_info(red(" @@ ") + blue(_("Previous database copied to file")) + \ + " " + newfile+red(" @@")) - dblist = Equo.list_backedup_client_databases() - if not dblist: - print_info(brown(" @@ ")+blue("%s." % (_("No backed up databases found"),))) - return 1 + # Now reinitialize it + mytxt = darkred(" %s %s") % ( + _("Initializing the new database at"), + bold(etpConst['etpdatabaseclientfilepath']), + ) + print_info(mytxt, back = True) + entropy_client.reopen_client_repository() + dbfile = entropy_client.clientDbconn.dbFile + entropy_client.clientDbconn.closeDB() + if os.path.isfile(dbfile): + os.remove(dbfile) + entropy_client.open_client_repository() + entropy_client.clientDbconn.initializeDatabase() + mytxt = darkred(" %s %s") % ( + _("Database reinitialized correctly at"), + bold(etpConst['etpdatabaseclientfilepath']), + ) + print_info(mytxt) - mydblist = [] - db_data = [] - for mydb in dblist: - ts = entropy.tools.get_file_unix_mtime(mydb) - mytime = entropy.tools.convert_unix_time_to_human_time(ts) - mydblist.append("[%s] %s" % (mytime, mydb,)) - db_data.append(mydb) + # now collect packages in the system + print_info(red(" %s..." % ( + _("Transductingactioningintactering databases"),) )) - def fake_cb(s): - return s + spm_packages = Spm.get_installed_packages() - input_params = [ - ('db', ('combo', (_('Select the database you want to restore'), mydblist),), fake_cb, True) - ] + # do for each database + maxcount = str(len(spm_packages)) + count = 0 + for spm_package in spm_packages: + count += 1 + print_info(blue("(") + darkgreen(str(count)) + "/" + \ + darkred(maxcount) + blue(")") + red(" :: ") + brown(spm_package), + back = True) - while True: - data = Equo.inputBox(red(_("Entropy installed packages database restore tool")), input_params, cancel_button = True) - if data == None: - return 1 - myid, dbx = data['db'] - try: - dbpath = db_data.pop(myid) - except IndexError: - continue - if not os.path.isfile(dbpath): continue - break + tmp_fd, temp_pkg_path = tempfile.mkstemp() + os.close(tmp_fd) - status, err_msg = Equo.restore_database(dbpath, etpConst['etpdatabaseclientfilepath']) - if status: - return 0 - return 1 + xpaktools.append_xpak(temp_pkg_path, spm_package) + # now extract info + try: + mydata = Spm.extract_package_metadata(temp_pkg_path) + except Exception as err: + entropy.tools.print_traceback() + entropy_client.clientLog.log( + ETP_LOGPRI_INFO, + ETP_LOGLEVEL_NORMAL, + "Database generation: Exception caught: %s" % (str(err),) + ) + print_warning( red("!!! %s: %s") % ( + _("An error occured while analyzing"), blue(spm_package),) ) + print_warning("%s: %s: %s" % ( + _("Exception"), str(Exception), err,)) + continue - elif (options[0] == "vacuum"): + # Try to see if it's possible to use the revision of a possible old db + mydata['revision'] = 9999 + # create atom string + myatom = entropy.tools.create_package_atom_string(mydata['category'], + mydata['name'], mydata['version'], mydata['versiontag']) - if Equo.clientDbconn != None: - print_info(red(" @@ ")+"%s..." % (blue(_("Vacuum cleaning System Database")),), back = True) - Equo.clientDbconn.dropAllIndexes() - Equo.clientDbconn.vacuum() - Equo.clientDbconn.commitChanges() - print_info(red(" @@ ")+"%s." % (brown(_("Vacuum cleaned System Database")),)) - return 0 - print_warning(darkred(" !!! ")+blue("%s." % (_("No System Databases found"),))) - return 1 + # now see if a revision is available + saved_rev = revisions_match.get(myatom) + if saved_rev is not None: + saved_rev = saved_rev + mydata['revision'] = saved_rev + idpk, rev, xx = entropy_client.clientDbconn.addPackage(mydata, + revision = mydata['revision'], do_commit = False) + entropy_client.clientDbconn.storeInstalledPackage(idpk, "spm-db") + os.remove(temp_pkg_path) + + print_info(red(" %s." % (_("All the Source Package Manager packages have been injected into Entropy database"),) )) + + print_info(red(" %s..." % ( + _("Now generating reverse dependencies metadata"),) )) + entropy_client.clientDbconn.generateReverseDependenciesMetadata() + print_info(red(" %s...") % (_("Now indexing tables"),) ) + entropy_client.clientDbconn.indexing = True + entropy_client.clientDbconn.createAllIndexes() + print_info(red(" %s." % (_("Database reinitialized successfully"),) )) + return 0 + +def _database_check(entropy_client): + try: + valid = True + entropy_client.clientDbconn.validateDatabase() + except SystemDatabaseError: + valid = False + if valid: + entropy_client.client_repository_sanity_check() else: - return -10 + mytxt = "# %s: %s" % (bold(_("ATTENTION")), + red(_("database does not exist or is badly broken")),) + print_warning(mytxt) + return 1 + return 0 -def getinfo(): +def _getinfo(entropy_client): # sysinfo info = {} @@ -729,14 +745,14 @@ def getinfo(): info['Entropy logging directory'] = etpConst['logdir'] info['Entropy Official Repository identifier'] = SysSettings['repositories']['default_repository'] info['Entropy API'] = etpConst['etpapi'] - info['Equo pidfile'] = etpConst['pidfile'] + info['Entropy pidfile'] = etpConst['pidfile'] info['Entropy database tag'] = etpConst['databasestarttag'] info['Repositories'] = SysSettings['repositories']['available'] info['System Config'] = etpSys info['UI Config'] = etpUi # client database info - cdbconn = Equo.clientDbconn + cdbconn = entropy_client.clientDbconn info['Installed database'] = cdbconn if cdbconn is not None: # print db info @@ -750,12 +766,12 @@ def getinfo(): dbfile = SysSettings['repositories']['available'][x]['dbpath']+"/"+etpConst['etpdatabasefile'] if os.path.isfile(dbfile): # print info about this database - dbconn = Equo.open_repository(x) + dbconn = entropy_client.open_repository(x) info['Repository databases'][x] = {} info['Repository databases'][x]['Installation internal protected directories'] = dbconn.listConfigProtectEntries() info['Repository databases'][x]['Installation internal protected directory masks'] = dbconn.listConfigProtectEntries(mask = True) info['Repository databases'][x]['Total available packages'] = len(dbconn.listAllIdpackages()) - info['Repository databases'][x]['Database revision'] = Equo.get_repository_revision(x) + info['Repository databases'][x]['Database revision'] = entropy_client.get_repository_revision(x) keys = sorted(info) for x in keys: diff --git a/docs/man/equo.pod b/docs/man/equo.pod index 97509f78f..732099187 100644 --- a/docs/man/equo.pod +++ b/docs/man/equo.pod @@ -694,7 +694,7 @@ remove System Database internal indexes to save space =item B -generate installed packages database using Portage database (Portage needed) +generate installed packages database using Source Package Manager repositories =item B @@ -704,9 +704,9 @@ generate installed packages database using files on the system [last hope] regenerate reverse dependencies metadata -=item B +=item B -update/generate counters table (Portage <-> Entropy packages table) +regenerate SPM UIDs map (SPM <-> Entropy packages) =item B @@ -946,6 +946,12 @@ restore a previously backed-up repository database =back +=item B + +regenerate SPM UIDs map (SPM <-> Entropy packages) + +=back + =item B diff --git a/docs/man/man1/equo.1 b/docs/man/man1/equo.1 index 2407435bd..99876dcc5 100644 --- a/docs/man/man1/equo.1 +++ b/docs/man/man1/equo.1 @@ -129,7 +129,7 @@ .\" ======================================================================== .\" .IX Title "EQUO 1" -.TH EQUO 1 "2009-12-22" "perl v5.8.8" "Entropy" +.TH EQUO 1 "2009-12-23" "perl v5.8.8" "Entropy" .SH "NAME" \&\fBequo\fR \- Official Sabayon Linux Package Manager Client .SH "SYNOPSIS" @@ -663,16 +663,16 @@ check System Database for errors remove System Database internal indexes to save space .IP "\fBgenerate\fR" 4 .IX Item "generate" -generate installed packages database using Portage database (Portage needed) +generate installed packages database using Source Package Manager repositories .IP "\fBresurrect\fR" 4 .IX Item "resurrect" generate installed packages database using files on the system [last hope] .IP "\fBrevdeps\fR" 4 .IX Item "revdeps" regenerate reverse dependencies metadata -.IP "\fBcounters\fR" 4 -.IX Item "counters" -update/generate counters table (Portage <\-> Entropy packages table) +.IP "\fBspmuids\fR" 4 +.IX Item "spmuids" +regenerate \s-1SPM\s0 UIDs map (\s-1SPM\s0 <\-> Entropy packages) .IP "\fBspmsync\fR" 4 .IX Item "spmsync" makes Entropy aware of your Source Package Manager updated packages @@ -846,6 +846,12 @@ restore a previously backed-up repository database .RE .RS 4 .RE +.IP "\fBspmuids\fR" 4 +.IX Item "spmuids" +regenerate \s-1SPM\s0 UIDs map (\s-1SPM\s0 <\-> Entropy packages) +.RE +.RS 4 +.RE .IP "\fBrepo\fR" 4 .IX Item "repo" manage a repository @@ -995,12 +1001,9 @@ verify the integrity of local package files .IX Item "revdeps" regenerate reverse dependencies metadata .RE -.RS 4 -.RE -.IP "\fBugc\fR" 4 +.IP "\fBugc\fR" .IX Item "ugc" handles User Generated Content features -.RS 4 .IP "\fBlogin " 4 .IX Item "login " login against a specified repository @@ -1044,12 +1047,9 @@ add vote for the specified package key (example: x11\-libs/qt) .RS 4 .RE .RE -.RS 4 -.RE -.IP "\fBcache\fR" 4 +.IP "\fBcache\fR" .IX Item "cache" handles Entropy cache -.RS 4 .IP "\fBclean\fR" 4 .IX Item "clean" clean Entropy cache @@ -1063,12 +1063,11 @@ show more details .IX Item "--quiet" print results in a scriptable way .RE -.RS 4 -.RE -.IP "\fBcleanup\fR" 4 +.IP "\fBcleanup\fR" .IX Item "cleanup" remove downloaded packages and clean temp. directories -.IP "\fB\-\-info\fR" 4 +.RE +.IP "\fB\-\-info\fR" .IX Item "--info" show system information .SH "ENVIRONMENT"