[entropy.client] more refactoring work in entropy.client.interfaces.methods
This commit is contained in:
@@ -836,7 +836,7 @@ def search_orphaned_files(Equo = None):
|
||||
filepath = entropy.tools.get_random_temp_file()
|
||||
if os.path.isfile(filepath):
|
||||
os.remove(filepath)
|
||||
tdbconn = Equo.open_generic_database(filepath)
|
||||
tdbconn = Equo.open_generic_repository(filepath)
|
||||
tdbconn.initializeDatabase()
|
||||
tdbconn.dropAllIndexes()
|
||||
|
||||
|
||||
+56
-6
@@ -110,7 +110,7 @@ def database(options):
|
||||
return _database_spmsync(etp_client)
|
||||
|
||||
elif options[0] == "backup":
|
||||
status, err_msg = etp_client.backup_database(
|
||||
status, err_msg = etp_client.backup_repository(
|
||||
etpConst['etpdatabaseclientfilepath'])
|
||||
if status:
|
||||
return 0
|
||||
@@ -143,7 +143,7 @@ def _database_vacuum(entropy_client):
|
||||
|
||||
def _database_restore(entropy_client):
|
||||
|
||||
dblist = entropy_client.list_backedup_client_databases()
|
||||
dblist = entropy_client.installed_repository_backups()
|
||||
if not dblist:
|
||||
print_info(brown(" @@ ")+blue("%s." % (
|
||||
_("No backed up databases found"),)))
|
||||
@@ -180,7 +180,7 @@ def _database_restore(entropy_client):
|
||||
continue
|
||||
break
|
||||
|
||||
status, err_msg = entropy_client.restore_database(dbpath,
|
||||
status, err_msg = entropy_client.restore_repository(dbpath,
|
||||
etpConst['etpdatabaseclientfilepath'])
|
||||
if status:
|
||||
return 0
|
||||
@@ -260,7 +260,7 @@ def _database_resurrect(entropy_client):
|
||||
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,
|
||||
dbc = entropy_client.open_generic_repository(dbpath,
|
||||
dbname = etpConst['clientdbid']) # don't do this at home
|
||||
dbc.initializeDatabase()
|
||||
dbc.commitChanges()
|
||||
@@ -656,7 +656,7 @@ def _database_generate(entropy_client):
|
||||
entropy_client.installed_repository().closeDB()
|
||||
if os.path.isfile(dbfile):
|
||||
os.remove(dbfile)
|
||||
entropy_client.open_installed_repository()
|
||||
entropy_client._open_installed_repository()
|
||||
entropy_client.installed_repository().initializeDatabase()
|
||||
mytxt = darkred(" %s %s") % (
|
||||
_("Database reinitialized correctly at"),
|
||||
@@ -728,13 +728,63 @@ def _database_generate(entropy_client):
|
||||
return 0
|
||||
|
||||
def _database_check(entropy_client):
|
||||
|
||||
def client_repository_sanity_check():
|
||||
entropy_client.output(
|
||||
darkred(_("Sanity Check") + ": " + _("system database")),
|
||||
importance = 2,
|
||||
type = "warning"
|
||||
)
|
||||
idpkgs = entropy_client.installed_repository().listAllIdpackages()
|
||||
length = len(idpkgs)
|
||||
count = 0
|
||||
errors = False
|
||||
scanning_txt = _("Scanning...")
|
||||
for x in idpkgs:
|
||||
count += 1
|
||||
entropy_client.output(
|
||||
darkgreen(scanning_txt),
|
||||
importance = 0,
|
||||
type = "info",
|
||||
back = True,
|
||||
count = (count, length),
|
||||
percent = True
|
||||
)
|
||||
try:
|
||||
entropy_client.installed_repository().getPackageData(x)
|
||||
except Exception as e:
|
||||
entropy.tools.print_traceback()
|
||||
errors = True
|
||||
entropy_client.output(
|
||||
darkred(_("Errors on idpackage %s, error: %s")) % (x, e),
|
||||
importance = 0,
|
||||
type = "warning"
|
||||
)
|
||||
|
||||
if not errors:
|
||||
t = _("Sanity Check") + ": %s" % (bold(_("PASSED")),)
|
||||
entropy_client.output(
|
||||
darkred(t),
|
||||
importance = 2,
|
||||
type = "warning"
|
||||
)
|
||||
return 0
|
||||
else:
|
||||
t = _("Sanity Check") + ": %s" % (bold(_("CORRUPTED")),)
|
||||
entropy_client.output(
|
||||
darkred(t),
|
||||
importance = 2,
|
||||
type = "warning"
|
||||
)
|
||||
return -1
|
||||
|
||||
try:
|
||||
valid = True
|
||||
entropy_client.installed_repository().validateDatabase()
|
||||
except SystemDatabaseError:
|
||||
valid = False
|
||||
if valid:
|
||||
entropy_client.client_repository_sanity_check()
|
||||
client_repository_sanity_check()
|
||||
else:
|
||||
mytxt = "# %s: %s" % (bold(_("ATTENTION")),
|
||||
red(_("database does not exist or is badly broken")),)
|
||||
|
||||
@@ -234,7 +234,7 @@ def inflate_handler(entropy_client, mytbz2s, savedir):
|
||||
while os.path.isfile(dbpath):
|
||||
dbpath = etpConst['packagestmpdir']+os.path.sep+str(entropy.tools.get_random_number())
|
||||
# create
|
||||
mydbconn = entropy_client.open_generic_database(dbpath)
|
||||
mydbconn = entropy_client.open_generic_repository(dbpath)
|
||||
mydbconn.initializeDatabase()
|
||||
idpackage, yyy, xxx = mydbconn.addPackage(mydata, revision = mydata['revision'])
|
||||
del yyy, xxx
|
||||
@@ -357,7 +357,7 @@ def smartpackagegenerator(entropy_client, matched_pkgs):
|
||||
os.mkdir(unpackdir+"/db")
|
||||
# create master database
|
||||
dbfile = unpackdir+"/db/merged.db"
|
||||
mergeDbconn = entropy_client.open_generic_database(dbfile, dbname = "client")
|
||||
mergeDbconn = entropy_client.open_generic_repository(dbfile, dbname = "client")
|
||||
mergeDbconn.initializeDatabase()
|
||||
tmpdbfile = dbfile+"--readingdata"
|
||||
for package in matched_pkgs:
|
||||
@@ -366,7 +366,7 @@ def smartpackagegenerator(entropy_client, matched_pkgs):
|
||||
etpConst['entropyworkdir'] + os.path.sep + \
|
||||
matchedAtoms[package]['download'], tmpdbfile)
|
||||
# read db and add data to mergeDbconn
|
||||
mydbconn = entropy_client.open_generic_database(tmpdbfile)
|
||||
mydbconn = entropy_client.open_generic_repository(tmpdbfile)
|
||||
idpackages = mydbconn.listAllIdpackages()
|
||||
|
||||
for myidpackage in idpackages:
|
||||
|
||||
+1
-1
@@ -666,7 +666,7 @@ def _scan_packages(entropy_client, packages, etp_pkg_files):
|
||||
|
||||
if etp_pkg_files:
|
||||
for pkg in etp_pkg_files:
|
||||
status, atomsfound = entropy_client.add_package_to_repos(pkg)
|
||||
status, atomsfound = entropy_client.add_package_to_repositories(pkg)
|
||||
if status == 0:
|
||||
found_pkg_atoms += atomsfound[:]
|
||||
del atomsfound
|
||||
|
||||
@@ -185,7 +185,7 @@ class ClientSystemSettingsPlugin(SystemSettingsPlugin):
|
||||
if old_branch == current_branch: # all fine, no need to run
|
||||
return
|
||||
|
||||
repos, err = self._helper.run_repositories_post_branch_switch_hooks(
|
||||
repos, err = self._helper._run_repositories_post_branch_switch_hooks(
|
||||
old_branch, current_branch)
|
||||
if not err:
|
||||
write_in_branch_upgrade(current_branch)
|
||||
@@ -197,7 +197,7 @@ class ClientSystemSettingsPlugin(SystemSettingsPlugin):
|
||||
if os.getuid() != 0:
|
||||
return
|
||||
|
||||
repos, errors = self._helper.run_repository_post_branch_upgrade_hooks(
|
||||
repos, errors = self._helper._run_repository_post_branch_upgrade_hooks(
|
||||
pretend = True)
|
||||
if not repos:
|
||||
# no scripts to run
|
||||
@@ -224,7 +224,7 @@ class ClientSystemSettingsPlugin(SystemSettingsPlugin):
|
||||
# actually execute this only if
|
||||
# there are no updates left
|
||||
if not update:
|
||||
self._helper.run_repository_post_branch_upgrade_hooks()
|
||||
self._helper._run_repository_post_branch_upgrade_hooks()
|
||||
delete_in_branch_upgrade()
|
||||
|
||||
def system_mask_parser(self, system_settings_instance):
|
||||
@@ -668,7 +668,7 @@ class Client(Singleton, TextInterface, LoadersMixin, CacheMixin, CalculatorsMixi
|
||||
self.clear_cache()
|
||||
|
||||
if self.openclientdb:
|
||||
self.open_installed_repository()
|
||||
self._open_installed_repository()
|
||||
|
||||
# create our SystemSettings plugin
|
||||
self.sys_settings_client_plugin = ClientSystemSettingsPlugin(
|
||||
@@ -683,7 +683,7 @@ class Client(Singleton, TextInterface, LoadersMixin, CacheMixin, CalculatorsMixi
|
||||
self._validate_repositories_cache()
|
||||
|
||||
if self.repo_validation:
|
||||
self.validate_repositories()
|
||||
self._validate_repositories()
|
||||
else:
|
||||
self._enabled_repos.extend(
|
||||
self.SystemSettings['repositories']['order'])
|
||||
|
||||
@@ -41,7 +41,8 @@ import entropy.tools
|
||||
|
||||
class RepositoryMixin:
|
||||
|
||||
def validate_repositories(self, quiet = False):
|
||||
def _validate_repositories(self, quiet = False):
|
||||
|
||||
StatusInterface().clear()
|
||||
self._repo_error_messages_cache.clear()
|
||||
|
||||
@@ -145,12 +146,6 @@ class RepositoryMixin:
|
||||
self.SystemSettings.clear()
|
||||
self._can_run_sys_set_hooks = old_value
|
||||
|
||||
|
||||
def is_repository_connection_cached(self, repoid):
|
||||
if (repoid, etpConst['systemroot'],) in self._repodb_cache:
|
||||
return True
|
||||
return False
|
||||
|
||||
def open_repository(self, repoid):
|
||||
|
||||
# support for installed pkgs repository, got by issuing
|
||||
@@ -160,7 +155,7 @@ class RepositoryMixin:
|
||||
|
||||
key = self.__get_repository_cache_key(repoid)
|
||||
if key not in self._repodb_cache:
|
||||
dbconn = self.load_repository_database(repoid,
|
||||
dbconn = self._load_repository_database(repoid,
|
||||
xcache = self.xcache, indexing = self.indexing)
|
||||
try:
|
||||
dbconn.checkDatabaseApi()
|
||||
@@ -172,7 +167,7 @@ class RepositoryMixin:
|
||||
|
||||
return self._repodb_cache.get(key)
|
||||
|
||||
def load_repository_database(self, repoid, xcache = True, indexing = True):
|
||||
def _load_repository_database(self, repoid, xcache = True, indexing = True):
|
||||
|
||||
if const_isstring(repoid):
|
||||
if repoid.endswith(etpConst['packagesext']):
|
||||
@@ -233,23 +228,20 @@ class RepositoryMixin:
|
||||
return conn
|
||||
|
||||
def get_repository_revision(self, reponame):
|
||||
|
||||
db_data = self.SystemSettings['repositories']['available'][reponame]
|
||||
fname = db_data['dbpath']+"/"+etpConst['etpdatabaserevisionfile']
|
||||
fname = os.path.join(db_data['dbpath'],
|
||||
etpConst['etpdatabaserevisionfile'])
|
||||
revision = -1
|
||||
|
||||
if os.path.isfile(fname) and os.access(fname, os.R_OK):
|
||||
with open(fname, "r") as f:
|
||||
try:
|
||||
revision = int(f.readline().strip())
|
||||
except (OSError, IOError, ValueError,):
|
||||
pass
|
||||
return revision
|
||||
|
||||
def update_repository_revision(self, reponame):
|
||||
r = self.get_repository_revision(reponame)
|
||||
db_data = self.SystemSettings['repositories']['available'][reponame]
|
||||
db_data['dbrevision'] = "0"
|
||||
if r != -1:
|
||||
db_data['dbrevision'] = str(r)
|
||||
return revision
|
||||
|
||||
def add_repository(self, repodata):
|
||||
|
||||
@@ -286,7 +278,7 @@ class RepositoryMixin:
|
||||
self.clear_cache()
|
||||
self.SystemSettings.clear()
|
||||
|
||||
self.validate_repositories()
|
||||
self._validate_repositories()
|
||||
|
||||
def remove_repository(self, repoid, disable = False):
|
||||
|
||||
@@ -303,7 +295,7 @@ class RepositoryMixin:
|
||||
# issues when reloading SystemSettings which is bound to Entropy Client
|
||||
# SystemSettings plugin, which triggers calculate_world_updates, which
|
||||
# triggers _all_repositories_checksum, which triggers open_repository,
|
||||
# which triggers load_repository_database, which triggers an unwanted
|
||||
# which triggers _load_repository_database, which triggers an unwanted
|
||||
# output message => "bad repository id specified"
|
||||
if repoid in self._enabled_repos:
|
||||
self._enabled_repos.remove(repoid)
|
||||
@@ -333,7 +325,7 @@ class RepositoryMixin:
|
||||
|
||||
# reset db cache
|
||||
self.close_repositories()
|
||||
self.validate_repositories()
|
||||
self._validate_repositories()
|
||||
|
||||
def __save_repository_settings(self, repodata, remove = False,
|
||||
disable = False, enable = False):
|
||||
@@ -461,7 +453,7 @@ class RepositoryMixin:
|
||||
self.SystemSettings.clear()
|
||||
self.close_repositories()
|
||||
self.SystemSettings._clear_repository_cache(repoid = repoid)
|
||||
self.validate_repositories()
|
||||
self._validate_repositories()
|
||||
|
||||
def enable_repository(self, repoid):
|
||||
self.SystemSettings._clear_repository_cache(repoid = repoid)
|
||||
@@ -471,7 +463,7 @@ class RepositoryMixin:
|
||||
self.__save_repository_settings(repodata, enable = True)
|
||||
self.SystemSettings.clear()
|
||||
self.close_repositories()
|
||||
self.validate_repositories()
|
||||
self._validate_repositories()
|
||||
|
||||
def disable_repository(self, repoid):
|
||||
# update self.SystemSettings['repositories']['available']
|
||||
@@ -498,19 +490,11 @@ class RepositoryMixin:
|
||||
self.SystemSettings.clear()
|
||||
|
||||
self.close_repositories()
|
||||
self.validate_repositories()
|
||||
|
||||
def get_repository_settings(self, repoid):
|
||||
try:
|
||||
repodata = self.SystemSettings['repositories']['available'][repoid].copy()
|
||||
except KeyError:
|
||||
if repoid not in self.SystemSettings['repositories']['excluded']:
|
||||
raise
|
||||
repodata = self.SystemSettings['repositories']['excluded'][repoid].copy()
|
||||
return repodata
|
||||
self._validate_repositories()
|
||||
|
||||
# every tbz2 file that would be installed must pass from here
|
||||
def add_package_to_repos(self, pkg_file):
|
||||
def add_package_to_repositories(self, pkg_file):
|
||||
|
||||
atoms_contained = []
|
||||
basefile = os.path.basename(pkg_file)
|
||||
db_dir = tempfile.mkdtemp()
|
||||
@@ -527,7 +511,7 @@ class RepositoryMixin:
|
||||
repodata['pkgpath'] = os.path.realpath(pkg_file) # extra info added
|
||||
repodata['smartpackage'] = False # extra info added
|
||||
|
||||
mydbconn = self.open_generic_database(dbfile)
|
||||
mydbconn = self.open_generic_repository(dbfile)
|
||||
# read all idpackages
|
||||
try:
|
||||
# all branches admitted from external files
|
||||
@@ -545,7 +529,7 @@ class RepositoryMixin:
|
||||
atoms_contained.append((int(myidpackage), basefile))
|
||||
|
||||
self.add_repository(repodata)
|
||||
self.validate_repositories()
|
||||
self._validate_repositories()
|
||||
if basefile not in self._enabled_repos:
|
||||
self.remove_repository(basefile)
|
||||
return -4, atoms_contained
|
||||
@@ -588,7 +572,7 @@ class RepositoryMixin:
|
||||
"""
|
||||
return self._installed_repository
|
||||
|
||||
def open_installed_repository(self):
|
||||
def _open_installed_repository(self):
|
||||
|
||||
def load_db_from_ram():
|
||||
self.safe_mode = etpConst['safemodeerrors']['clientdb']
|
||||
@@ -643,60 +627,11 @@ class RepositoryMixin:
|
||||
|
||||
def reopen_installed_repository(self):
|
||||
self._installed_repository.closeDB()
|
||||
self.open_installed_repository()
|
||||
self._open_installed_repository()
|
||||
# make sure settings are in sync
|
||||
self.SystemSettings.clear()
|
||||
|
||||
def client_repository_sanity_check(self):
|
||||
self.output(
|
||||
darkred(_("Sanity Check") + ": " + _("system database")),
|
||||
importance = 2,
|
||||
type = "warning"
|
||||
)
|
||||
idpkgs = self._installed_repository.listAllIdpackages()
|
||||
length = len(idpkgs)
|
||||
count = 0
|
||||
errors = False
|
||||
scanning_txt = _("Scanning...")
|
||||
for x in idpkgs:
|
||||
count += 1
|
||||
self.output(
|
||||
darkgreen(scanning_txt),
|
||||
importance = 0,
|
||||
type = "info",
|
||||
back = True,
|
||||
count = (count, length),
|
||||
percent = True
|
||||
)
|
||||
try:
|
||||
self._installed_repository.getPackageData(x)
|
||||
except Exception as e:
|
||||
entropy.tools.print_traceback()
|
||||
errors = True
|
||||
self.output(
|
||||
darkred(_("Errors on idpackage %s, error: %s")) % (x, e),
|
||||
importance = 0,
|
||||
type = "warning"
|
||||
)
|
||||
|
||||
if not errors:
|
||||
t = _("Sanity Check") + ": %s" % (bold(_("PASSED")),)
|
||||
self.output(
|
||||
darkred(t),
|
||||
importance = 2,
|
||||
type = "warning"
|
||||
)
|
||||
return 0
|
||||
else:
|
||||
t = _("Sanity Check") + ": %s" % (bold(_("CORRUPTED")),)
|
||||
self.output(
|
||||
darkred(t),
|
||||
importance = 2,
|
||||
type = "warning"
|
||||
)
|
||||
return -1
|
||||
|
||||
def open_generic_database(self, dbfile, dbname = None, xcache = None,
|
||||
def open_generic_repository(self, dbfile, dbname = None, xcache = None,
|
||||
readOnly = False, indexing_override = None, skipChecks = False):
|
||||
if xcache is None:
|
||||
xcache = self.xcache
|
||||
@@ -736,7 +671,7 @@ class RepositoryMixin:
|
||||
dbc.initializeDatabase()
|
||||
return dbc
|
||||
|
||||
def backup_database(self, dbpath, backup_dir = None, silent = False,
|
||||
def backup_repository(self, dbpath, backup_dir = None, silent = False,
|
||||
compress_level = 9):
|
||||
|
||||
if compress_level not in list(range(1, 10)):
|
||||
@@ -804,7 +739,7 @@ class RepositoryMixin:
|
||||
)
|
||||
return True, _("All fine")
|
||||
|
||||
def restore_database(self, backup_path, db_destination, silent = False):
|
||||
def restore_repository(self, backup_path, db_destination, silent = False):
|
||||
|
||||
bytes_required = 1024000*200
|
||||
db_dir = os.path.dirname(db_destination)
|
||||
@@ -840,7 +775,6 @@ class RepositoryMixin:
|
||||
back = True
|
||||
)
|
||||
|
||||
import bz2
|
||||
try:
|
||||
entropy.tools.uncompress_file(backup_path, db_destination,
|
||||
bz2.BZ2File)
|
||||
@@ -863,7 +797,7 @@ class RepositoryMixin:
|
||||
self.clear_cache()
|
||||
return True, _("All fine")
|
||||
|
||||
def list_backedup_client_databases(self, client_dbdir = None):
|
||||
def installed_repository_backups(self, client_dbdir = None):
|
||||
if not client_dbdir:
|
||||
client_dbdir = os.path.dirname(etpConst['etpdatabaseclientfilepath'])
|
||||
return [os.path.join(client_dbdir, x) for x in os.listdir(client_dbdir) \
|
||||
@@ -871,7 +805,7 @@ class RepositoryMixin:
|
||||
os.access(os.path.join(client_dbdir, x), os.R_OK)
|
||||
]
|
||||
|
||||
def run_repositories_post_branch_switch_hooks(self, old_branch, new_branch):
|
||||
def _run_repositories_post_branch_switch_hooks(self, old_branch, new_branch):
|
||||
"""
|
||||
This method is called whenever branch is successfully switched by user.
|
||||
Branch is switched when user wants to upgrade the OS to a new
|
||||
@@ -988,7 +922,7 @@ class RepositoryMixin:
|
||||
|
||||
return hooks_ran, errors
|
||||
|
||||
def run_repository_post_branch_upgrade_hooks(self, pretend = False):
|
||||
def _run_repository_post_branch_upgrade_hooks(self, pretend = False):
|
||||
"""
|
||||
This method is called whenever branch is successfully switched by user
|
||||
and all the updates have been installed (also look at:
|
||||
@@ -1314,7 +1248,7 @@ class MiscMixin:
|
||||
chroot = chroot[:-1]
|
||||
etpSys['rootdir'] = chroot
|
||||
self.reload_constants()
|
||||
self.validate_repositories()
|
||||
self._validate_repositories()
|
||||
self.reopen_installed_repository()
|
||||
# keep them closed, since SystemSettings.clear() is called
|
||||
# above on reopen_installed_repository()
|
||||
@@ -1422,7 +1356,7 @@ class MiscMixin:
|
||||
# reset treeupdatesactions
|
||||
self.reopen_installed_repository()
|
||||
self._installed_repository.resetTreeupdatesDigests()
|
||||
self.validate_repositories(quiet = True)
|
||||
self._validate_repositories(quiet = True)
|
||||
self.close_repositories()
|
||||
if self.xcache:
|
||||
self._cacher.start()
|
||||
@@ -1571,7 +1505,7 @@ class MiscMixin:
|
||||
treeupdates_actions = None):
|
||||
tmp_fd, tmp_path = tempfile.mkstemp()
|
||||
os.close(tmp_fd)
|
||||
dbconn = self.open_generic_database(tmp_path)
|
||||
dbconn = self.open_generic_repository(tmp_path)
|
||||
dbconn.initializeDatabase()
|
||||
dbconn.addPackage(data, revision = data['revision'])
|
||||
if treeupdates_actions != None:
|
||||
|
||||
@@ -1493,7 +1493,7 @@ class Package:
|
||||
# skipChecks = False : creating missing tables is unwanted,
|
||||
# and also no foreign keys update
|
||||
# readOnly = True: no need to open in write mode
|
||||
pkg_dbconn = self._entropy.open_generic_database(
|
||||
pkg_dbconn = self._entropy.open_generic_repository(
|
||||
self.pkgmeta['pkgdbpath'], skipChecks = True,
|
||||
indexing_override = False, readOnly = True,
|
||||
xcache = False)
|
||||
|
||||
@@ -31,6 +31,7 @@ from entropy.dump import dumpobj
|
||||
from entropy.security import Repository as RepositorySecurity
|
||||
from entropy.db.exceptions import IntegrityError, OperationalError, Error, \
|
||||
DatabaseError
|
||||
from entropy.core.settings.base import SystemSettings
|
||||
|
||||
import entropy.tools
|
||||
|
||||
@@ -57,8 +58,9 @@ class Repository:
|
||||
"meta_file", "meta_file_gpg", "notice_board"
|
||||
)
|
||||
self.__big_sock_timeout = 10
|
||||
self.Entropy = entropy_client_instance
|
||||
self._entropy = entropy_client_instance
|
||||
self._cacher = EntropyCacher()
|
||||
self._settings = SystemSettings()
|
||||
self.repo_ids = repo_identifiers
|
||||
self.force = force
|
||||
self.sync_errors = False
|
||||
@@ -77,13 +79,13 @@ class Repository:
|
||||
if env_gpg is not None:
|
||||
self._gpg_feature = False
|
||||
# Developer Repository mode enabled?
|
||||
sys_set = self.Entropy.SystemSettings
|
||||
sys_set = self._settings
|
||||
self._developer_repo = sys_set['repositories']['developer_repo']
|
||||
if self._developer_repo:
|
||||
const_debug_write(__name__, "__init__: developer repo mode enabled")
|
||||
|
||||
avail_data = sys_set['repositories']['available']
|
||||
# check self.Entropy.SystemSettings['repositories']['available']
|
||||
# check self._settings['repositories']['available']
|
||||
if not avail_data:
|
||||
mytxt = "No repositories specified in %s" % (
|
||||
etpConst['repositoriesconf'],)
|
||||
@@ -99,7 +101,7 @@ class Repository:
|
||||
|
||||
def __get_eapi3_connection(self, repoid):
|
||||
# get database url
|
||||
avail_data = self.Entropy.SystemSettings['repositories']['available']
|
||||
avail_data = self._settings['repositories']['available']
|
||||
dburl = avail_data[repoid].get('service_uri')
|
||||
if dburl is None:
|
||||
return None
|
||||
@@ -109,7 +111,7 @@ class Repository:
|
||||
from entropy.services.ugc.interfaces import Client
|
||||
from entropy.client.services.ugc.commands import Client as \
|
||||
CommandsClient
|
||||
eapi3_socket = Client(self.Entropy, CommandsClient,
|
||||
eapi3_socket = Client(self._entropy, CommandsClient,
|
||||
output_header = "\t", socket_timeout = self.__big_sock_timeout)
|
||||
eapi3_socket.connect(dburl, port)
|
||||
return eapi3_socket
|
||||
@@ -174,7 +176,7 @@ class Repository:
|
||||
|
||||
self.__validate_repository_id(repo)
|
||||
|
||||
repo_settings = self.Entropy.SystemSettings['repositories']
|
||||
repo_settings = self._settings['repositories']
|
||||
dbc_format = repo_settings['available'][repo]['dbcformat']
|
||||
cmethod = etpConst['etpdatabasecompressclasses'].get(dbc_format)
|
||||
if cmethod is None:
|
||||
@@ -187,7 +189,7 @@ class Repository:
|
||||
|
||||
self.__validate_repository_id(repo)
|
||||
|
||||
avail_data = self.Entropy.SystemSettings['repositories']['available']
|
||||
avail_data = self._settings['repositories']['available']
|
||||
repo_data = avail_data[repo]
|
||||
|
||||
# create dir if it doesn't exist
|
||||
@@ -211,7 +213,7 @@ class Repository:
|
||||
mytxt = "For %s, cmethod can't be None" % (item,)
|
||||
raise AttributeError(mytxt)
|
||||
|
||||
avail_data = self.Entropy.SystemSettings['repositories']['available']
|
||||
avail_data = self._settings['repositories']['available']
|
||||
repo_data = avail_data[repo]
|
||||
|
||||
repo_db = repo_data['database']
|
||||
@@ -308,7 +310,7 @@ class Repository:
|
||||
return url, path
|
||||
|
||||
def __remove_repository_files(self, repo):
|
||||
sys_set = self.Entropy.SystemSettings
|
||||
sys_set = self._settings
|
||||
repo_dbpath = sys_set['repositories']['available'][repo]['dbpath']
|
||||
shutil.rmtree(repo_dbpath, True)
|
||||
|
||||
@@ -317,7 +319,7 @@ class Repository:
|
||||
self.__validate_repository_id(repo)
|
||||
rc = 0
|
||||
path = None
|
||||
sys_set_repos = self.Entropy.SystemSettings['repositories']['available']
|
||||
sys_set_repos = self._settings['repositories']['available']
|
||||
repo_data = sys_set_repos[repo]
|
||||
|
||||
garbage, myfile = self._construct_paths(down_item, repo, cmethod)
|
||||
@@ -342,7 +344,7 @@ class Repository:
|
||||
raise AttributeError(mytxt)
|
||||
|
||||
if rc == 0:
|
||||
self.Entropy.setup_default_file_perms(path)
|
||||
self._entropy.setup_default_file_perms(path)
|
||||
|
||||
return rc
|
||||
|
||||
@@ -355,7 +357,7 @@ class Repository:
|
||||
def __verify_database_checksum(self, repo, cmethod = None):
|
||||
|
||||
self.__validate_repository_id(repo)
|
||||
sys_settings_repos = self.Entropy.SystemSettings['repositories']
|
||||
sys_settings_repos = self._settings['repositories']
|
||||
avail_config = sys_settings_repos['available'][repo]
|
||||
|
||||
sep = os.path.sep
|
||||
@@ -405,7 +407,7 @@ class Repository:
|
||||
else:
|
||||
return repo_rev
|
||||
|
||||
avail_data = self.Entropy.SystemSettings['repositories']['available']
|
||||
avail_data = self._settings['repositories']['available']
|
||||
repo_data = avail_data[repo]
|
||||
|
||||
url = repo_data['database'] + "/" + etpConst['etpdatabaserevisionfile']
|
||||
@@ -427,7 +429,7 @@ class Repository:
|
||||
|
||||
onlinestatus = self.get_online_repository_revision(repo)
|
||||
if onlinestatus != -1:
|
||||
localstatus = self.Entropy.get_repository_revision(repo)
|
||||
localstatus = self._entropy.get_repository_revision(repo)
|
||||
if (localstatus == onlinestatus) and (not self.force):
|
||||
return False
|
||||
return True
|
||||
@@ -468,7 +470,7 @@ class Repository:
|
||||
os.makedirs(filepath_dir, 0o775)
|
||||
const_setup_perms(filepath_dir, etpConst['entropygid'])
|
||||
|
||||
fetchConn = self.Entropy.urlFetcher(
|
||||
fetchConn = self._entropy.urlFetcher(
|
||||
url,
|
||||
filepath,
|
||||
resume = False,
|
||||
@@ -480,7 +482,7 @@ class Repository:
|
||||
del fetchConn
|
||||
if rc in ("-1", "-2", "-3", "-4"):
|
||||
return False
|
||||
self.Entropy.setup_default_file_perms(filepath)
|
||||
self._entropy.setup_default_file_perms(filepath)
|
||||
return True
|
||||
|
||||
def _check_downloaded_database(self, repo, cmethod):
|
||||
@@ -498,7 +500,7 @@ class Repository:
|
||||
darkgreen(os.path.basename(dbfilename)),
|
||||
red("..."),
|
||||
)
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
mytxt,
|
||||
importance = 0,
|
||||
back = True,
|
||||
@@ -511,7 +513,7 @@ class Repository:
|
||||
red(_("Cannot open digest")),
|
||||
red(_("Cannot verify database integrity")),
|
||||
)
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
mytxt,
|
||||
importance = 1,
|
||||
type = "warning",
|
||||
@@ -522,7 +524,7 @@ class Repository:
|
||||
red(_("Downloaded database status")),
|
||||
bold(_("OK")),
|
||||
)
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
mytxt,
|
||||
importance = 1,
|
||||
type = "info",
|
||||
@@ -533,7 +535,7 @@ class Repository:
|
||||
red(_("Downloaded database status")),
|
||||
darkred(_("ERROR")),
|
||||
)
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
mytxt,
|
||||
importance = 1,
|
||||
type = "error",
|
||||
@@ -543,7 +545,7 @@ class Repository:
|
||||
red(_("An error occured while checking database integrity")),
|
||||
red(_("Giving up")),
|
||||
)
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
mytxt,
|
||||
importance = 1,
|
||||
type = "error",
|
||||
@@ -552,13 +554,19 @@ class Repository:
|
||||
return 1
|
||||
return 0
|
||||
|
||||
def _update_repository_revision(self, repo):
|
||||
cur_rev = self._entropy.get_repository_revision(repo)
|
||||
db_data = self._settings['repositories']['available'][repo]
|
||||
db_data['dbrevision'] = "0"
|
||||
if cur_rev != -1:
|
||||
db_data['dbrevision'] = str(cur_rev)
|
||||
|
||||
def _show_repository_information(self, repo, count_info):
|
||||
|
||||
avail_data = self.Entropy.SystemSettings['repositories']['available']
|
||||
avail_data = self._settings['repositories']['available']
|
||||
repo_data = avail_data[repo]
|
||||
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
bold("%s") % ( repo_data['description'] ),
|
||||
importance = 2,
|
||||
type = "info",
|
||||
@@ -567,7 +575,7 @@ class Repository:
|
||||
)
|
||||
mytxt = "%s: %s" % (red(_("Database URL")),
|
||||
darkgreen(repo_data['database']),)
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
mytxt,
|
||||
importance = 1,
|
||||
type = "info",
|
||||
@@ -575,7 +583,7 @@ class Repository:
|
||||
)
|
||||
mytxt = "%s: %s" % (red(_("Database local path")),
|
||||
darkgreen(repo_data['dbpath']),)
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
mytxt,
|
||||
importance = 0,
|
||||
type = "info",
|
||||
@@ -583,7 +591,7 @@ class Repository:
|
||||
)
|
||||
mytxt = "%s: %s" % (red(_("Database EAPI")),
|
||||
darkgreen(str(self._repo_eapi[repo])),)
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
mytxt,
|
||||
importance = 0,
|
||||
type = "info",
|
||||
@@ -592,13 +600,13 @@ class Repository:
|
||||
|
||||
def __get_eapi3_local_database(self, repo):
|
||||
|
||||
avail_data = self.Entropy.SystemSettings['repositories']['available']
|
||||
avail_data = self._settings['repositories']['available']
|
||||
repo_data = avail_data[repo]
|
||||
|
||||
dbfile = os.path.join(repo_data['dbpath'], etpConst['etpdatabasefile'])
|
||||
mydbconn = None
|
||||
try:
|
||||
mydbconn = self.Entropy.open_generic_database(dbfile,
|
||||
mydbconn = self._entropy.open_generic_repository(dbfile,
|
||||
xcache = False, indexing_override = False)
|
||||
mydbconn.validateDatabase()
|
||||
except (OperationalError, IntegrityError, SystemDatabaseError,
|
||||
@@ -609,7 +617,7 @@ class Repository:
|
||||
def __get_eapi3_database_differences(self, eapi3_interface, repo, idpackages,
|
||||
session):
|
||||
|
||||
product = self.Entropy.SystemSettings['repositories']['product']
|
||||
product = self._settings['repositories']['product']
|
||||
data = eapi3_interface.CmdInterface.differential_packages_comparison(
|
||||
session, idpackages, repo, etpConst['currentarch'], product
|
||||
)
|
||||
@@ -624,7 +632,7 @@ class Repository:
|
||||
return data['added'], data['removed'], data['secure_checksum']
|
||||
|
||||
def __get_eapi3_repository_metadata(self, eapi3_interface, repo, session):
|
||||
product = self.Entropy.SystemSettings['repositories']['product']
|
||||
product = self._settings['repositories']['product']
|
||||
data = eapi3_interface.CmdInterface.get_repository_metadata(
|
||||
session, repo, etpConst['currentarch'], product
|
||||
)
|
||||
@@ -679,7 +687,7 @@ class Repository:
|
||||
self.__eapi3_close(eapi3_interface, session)
|
||||
mytxt = "%s: %s" % ( blue(_("EAPI3 Service status")),
|
||||
darkred(_("remote database suddenly locked")),)
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
mytxt,
|
||||
importance = 0,
|
||||
type = "info",
|
||||
@@ -696,7 +704,7 @@ class Repository:
|
||||
blue(str(len(added_ids))),
|
||||
darkred(str(threshold)),
|
||||
)
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
mytxt,
|
||||
importance = 0,
|
||||
type = "info",
|
||||
@@ -722,12 +730,12 @@ class Repository:
|
||||
# fetch and store
|
||||
count = 0
|
||||
maxcount = len(added_segments)
|
||||
product = self.Entropy.SystemSettings['repositories']['product']
|
||||
product = self._settings['repositories']['product']
|
||||
for segment in added_segments:
|
||||
|
||||
count += 1
|
||||
mytxt = "%s %s" % (blue(_("Fetching segments")), "...",)
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
mytxt, importance = 0, type = "info",
|
||||
header = "\t", back = True, count = (count, maxcount,)
|
||||
)
|
||||
@@ -750,7 +758,7 @@ class Repository:
|
||||
if pkgdata is None:
|
||||
mytxt = "%s: %s" % ( blue(_("Fetch error on segment")),
|
||||
darkred(str(segment)),)
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
mytxt, importance = 1, type = "warning",
|
||||
header = "\t", count = (count, maxcount,)
|
||||
)
|
||||
@@ -760,7 +768,7 @@ class Repository:
|
||||
blue(_("Service status")),
|
||||
darkred("remote database suddenly locked"),
|
||||
)
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
mytxt, importance = 1, type = "info",
|
||||
header = "\t", count = (count, maxcount,)
|
||||
)
|
||||
@@ -773,7 +781,7 @@ class Repository:
|
||||
pkgdata[0], pkgdata[1],
|
||||
darkred("Error processing the command"),
|
||||
)
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
mytxt, importance = 1, type = "info",
|
||||
header = "\t", count = (count, maxcount,)
|
||||
)
|
||||
@@ -794,7 +802,7 @@ class Repository:
|
||||
darkred("Error storing data"),
|
||||
e,
|
||||
)
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
mytxt, importance = 1, type = "info",
|
||||
header = "\t", count = (count, maxcount,)
|
||||
)
|
||||
@@ -818,7 +826,7 @@ class Repository:
|
||||
blue(_("EAPI3 Service status")),
|
||||
darkred(_("cannot fetch repository metadata")),
|
||||
)
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
mytxt,
|
||||
importance = 0,
|
||||
type = "info",
|
||||
@@ -839,7 +847,7 @@ class Repository:
|
||||
blue(_("EAPI3 Service status")),
|
||||
darkred(_("cannot update treeupdates data")),
|
||||
)
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
mytxt,
|
||||
importance = 0,
|
||||
type = "info",
|
||||
@@ -858,7 +866,7 @@ class Repository:
|
||||
blue(_("EAPI3 Service status")),
|
||||
darkred(_("cannot update package sets data")),
|
||||
)
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
mytxt,
|
||||
importance = 0,
|
||||
type = "info",
|
||||
@@ -882,7 +890,7 @@ class Repository:
|
||||
blue(_("Fetch error on segment while adding")),
|
||||
darkred(str(segment)),
|
||||
)
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
mytxt, importance = 1, type = "warning",
|
||||
header = "\t", count = (count, maxcount,)
|
||||
)
|
||||
@@ -893,7 +901,7 @@ class Repository:
|
||||
blue(_("Injecting package")),
|
||||
darkgreen(mydata['atom']),
|
||||
)
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
mytxt, importance = 0, type = "info",
|
||||
header = "\t", back = True, count = (count, maxcount,)
|
||||
)
|
||||
@@ -906,7 +914,7 @@ class Repository:
|
||||
except (Error,) as err:
|
||||
if etpUi['debug']:
|
||||
entropy.tools.print_traceback()
|
||||
self.Entropy.output("%s: %s" % (
|
||||
self._entropy.output("%s: %s" % (
|
||||
blue(_("repository error while adding packages")),
|
||||
err,),
|
||||
importance = 1, type = "warning",
|
||||
@@ -915,7 +923,7 @@ class Repository:
|
||||
mydbconn.closeDB()
|
||||
return False
|
||||
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
blue(_("Packages injection complete")), importance = 0,
|
||||
type = "info", header = "\t",
|
||||
)
|
||||
@@ -931,7 +939,7 @@ class Repository:
|
||||
mytxt = "%s: %s" % (
|
||||
blue(_("Removing package")),
|
||||
darkred(str(myatom)),)
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
mytxt, importance = 0, type = "info",
|
||||
header = "\t", back = True, count = (count, maxcount,)
|
||||
)
|
||||
@@ -939,7 +947,7 @@ class Repository:
|
||||
mydbconn.removePackage(idpackage, do_cleanup = False,
|
||||
do_commit = False)
|
||||
except (Error,):
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
blue(_("repository error while removing packages")),
|
||||
importance = 1, type = "warning",
|
||||
header = "\t", count = (count, maxcount,)
|
||||
@@ -947,7 +955,7 @@ class Repository:
|
||||
mydbconn.closeDB()
|
||||
return False
|
||||
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
blue(_("Packages removal complete")),
|
||||
importance = 0, type = "info",
|
||||
header = "\t",
|
||||
@@ -962,17 +970,17 @@ class Repository:
|
||||
if secure_checksum == mychecksum:
|
||||
result = True
|
||||
else:
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
blue(_("Database checksum doesn't match remote.")),
|
||||
importance = 0, type = "info", header = "\t",
|
||||
)
|
||||
mytxt = "%s: %s" % (_('local'), mychecksum,)
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
mytxt, importance = 0,
|
||||
type = "info", header = "\t",
|
||||
)
|
||||
mytxt = "%s: %s" % (_('remote'), secure_checksum,)
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
mytxt, importance = 0,
|
||||
type = "info", header = "\t",
|
||||
)
|
||||
@@ -981,7 +989,7 @@ class Repository:
|
||||
return result
|
||||
|
||||
def _run_post_update_repository_hook(self, repoid):
|
||||
my_repos = self.Entropy.SystemSettings['repositories']
|
||||
my_repos = self._settings['repositories']
|
||||
branch = my_repos['branch']
|
||||
avail_data = my_repos['available']
|
||||
repo_data = avail_data[repoid]
|
||||
@@ -1011,7 +1019,7 @@ class Repository:
|
||||
|
||||
def _install_gpg_key_if_available(self, repoid):
|
||||
|
||||
my_repos = self.Entropy.SystemSettings['repositories']
|
||||
my_repos = self._settings['repositories']
|
||||
avail_data = my_repos['available']
|
||||
repo_data = avail_data[repoid]
|
||||
gpg_path = repo_data['gpg_pubkey']
|
||||
@@ -1021,7 +1029,7 @@ class Repository:
|
||||
|
||||
def do_warn_user(fingerprint):
|
||||
mytxt = purple(_("Make sure to verify the imported key and set an appropriate trust level"))
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
mytxt + ":",
|
||||
type = "warning",
|
||||
header = "\t"
|
||||
@@ -1029,25 +1037,25 @@ class Repository:
|
||||
mytxt = brown("gpg --homedir '%s' --edit-key '%s'" % (
|
||||
etpConst['etpclientgpgdir'], fingerprint,)
|
||||
)
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
"$ " + mytxt,
|
||||
type = "warning",
|
||||
header = "\t"
|
||||
)
|
||||
|
||||
try:
|
||||
repo_sec = self.Entropy.RepositorySecurity()
|
||||
repo_sec = self._entropy.RepositorySecurity()
|
||||
except RepositorySecurity.GPGError:
|
||||
mytxt = "%s," % (
|
||||
purple(_("This repository suports GPG-signed packages")),
|
||||
)
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
mytxt,
|
||||
type = "warning",
|
||||
header = "\t"
|
||||
)
|
||||
mytxt = purple(_("you may want to install GnuPG to take advantage of this feature"))
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
mytxt,
|
||||
type = "warning",
|
||||
header = "\t"
|
||||
@@ -1064,7 +1072,7 @@ class Repository:
|
||||
if pk_avail:
|
||||
|
||||
tmp_dir = tempfile.mkdtemp()
|
||||
repo_tmp_sec = self.Entropy.RepositorySecurity(
|
||||
repo_tmp_sec = self._entropy.RepositorySecurity(
|
||||
keystore_dir = tmp_dir)
|
||||
# try to install and get fingerprint
|
||||
try:
|
||||
@@ -1081,7 +1089,7 @@ class Repository:
|
||||
purple(_("GPG key changed for")),
|
||||
bold(repoid),
|
||||
)
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
mytxt,
|
||||
type = "warning",
|
||||
header = "\t"
|
||||
@@ -1090,7 +1098,7 @@ class Repository:
|
||||
darkgreen(fingerprint),
|
||||
purple(downloaded_key_fp),
|
||||
)
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
mytxt,
|
||||
type = "warning",
|
||||
header = "\t"
|
||||
@@ -1101,7 +1109,7 @@ class Repository:
|
||||
purple(_("GPG key already installed for")),
|
||||
bold(repoid),
|
||||
)
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
mytxt,
|
||||
type = "info",
|
||||
header = "\t"
|
||||
@@ -1114,7 +1122,7 @@ class Repository:
|
||||
purple(_("GPG key EXPIRED for repository")),
|
||||
bold(repoid),
|
||||
)
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
mytxt,
|
||||
type = "warning",
|
||||
header = "\t"
|
||||
@@ -1126,7 +1134,7 @@ class Repository:
|
||||
purple(_("Installing GPG key for repository")),
|
||||
brown(repoid),
|
||||
)
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
mytxt,
|
||||
type = "info",
|
||||
header = "\t",
|
||||
@@ -1139,7 +1147,7 @@ class Repository:
|
||||
darkred(_("Error during GPG key installation")),
|
||||
err,
|
||||
)
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
mytxt,
|
||||
type = "error",
|
||||
header = "\t"
|
||||
@@ -1150,7 +1158,7 @@ class Repository:
|
||||
purple(_("Successfully installed GPG key for repository")),
|
||||
brown(repoid),
|
||||
)
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
mytxt,
|
||||
type = "info",
|
||||
header = "\t"
|
||||
@@ -1159,7 +1167,7 @@ class Repository:
|
||||
darkgreen(_("Fingerprint")),
|
||||
bold(fingerprint),
|
||||
)
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
mytxt,
|
||||
type = "info",
|
||||
header = "\t"
|
||||
@@ -1170,7 +1178,7 @@ class Repository:
|
||||
def _gpg_verify_downloaded_files(self, repo, downloaded_files):
|
||||
|
||||
try:
|
||||
repo_sec = self.Entropy.RepositorySecurity()
|
||||
repo_sec = self._entropy.RepositorySecurity()
|
||||
except RepositorySecurity.GPGServiceNotAvailable:
|
||||
# wtf! it was available a while ago!
|
||||
return 0 # GPG not available
|
||||
@@ -1197,7 +1205,7 @@ class Repository:
|
||||
darkgreen(_("Verifying GPG signature of")),
|
||||
brown(file_name),
|
||||
)
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
mytxt,
|
||||
type = "info",
|
||||
header = blue("\t@@ "),
|
||||
@@ -1211,7 +1219,7 @@ class Repository:
|
||||
darkgreen(_("Verified GPG signature of")),
|
||||
brown(file_name),
|
||||
)
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
mytxt,
|
||||
type = "info",
|
||||
header = blue("\t@@ ")
|
||||
@@ -1221,7 +1229,7 @@ class Repository:
|
||||
darkred(_("Error during GPG verification of")),
|
||||
file_name,
|
||||
)
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
mytxt,
|
||||
type = "error",
|
||||
header = "\t%s " % (bold("!!!"),)
|
||||
@@ -1230,7 +1238,7 @@ class Repository:
|
||||
purple(_("It could mean a potential security risk")),
|
||||
err_msg,
|
||||
)
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
mytxt,
|
||||
type = "error",
|
||||
header = "\t%s " % (bold("!!!"),)
|
||||
@@ -1271,7 +1279,7 @@ class Repository:
|
||||
do_db_update_transfer = False
|
||||
rc = 0
|
||||
|
||||
my_repos = self.Entropy.SystemSettings['repositories']
|
||||
my_repos = self._settings['repositories']
|
||||
avail_data = my_repos['available']
|
||||
repo_data = avail_data[repo]
|
||||
|
||||
@@ -1321,7 +1329,7 @@ class Repository:
|
||||
blue(_("EAPI3 Service error")),
|
||||
darkred(repr(err)),
|
||||
)
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
mytxt,
|
||||
importance = 0,
|
||||
type = "info",
|
||||
@@ -1450,7 +1458,7 @@ class Repository:
|
||||
continue
|
||||
|
||||
if os.path.isfile(dbfile) and os.access(dbfile, os.W_OK):
|
||||
self.Entropy.setup_default_file_perms(dbfile)
|
||||
self._entropy.setup_default_file_perms(dbfile)
|
||||
|
||||
# database has been updated
|
||||
self.updated = True
|
||||
@@ -1462,22 +1470,22 @@ class Repository:
|
||||
except OSError:
|
||||
continue
|
||||
|
||||
self.Entropy.update_repository_revision(repo)
|
||||
self._update_repository_revision(repo)
|
||||
self._database_revdeps_setup(repo)
|
||||
if self.Entropy.indexing:
|
||||
if self._entropy.indexing:
|
||||
self._database_indexing(repo)
|
||||
|
||||
try:
|
||||
spm_class = self.Entropy.Spm_class()
|
||||
spm_class = self._entropy.Spm_class()
|
||||
spm_class.entropy_client_post_repository_update_hook(
|
||||
self.Entropy, repo)
|
||||
self._entropy, repo)
|
||||
except Exception as err:
|
||||
entropy.tools.print_traceback()
|
||||
mytxt = "%s: %s" % (
|
||||
blue(_("Configuration files update error, not critical, continuing")),
|
||||
err,
|
||||
)
|
||||
self.Entropy.output(mytxt, importance = 0,
|
||||
self._entropy.output(mytxt, importance = 0,
|
||||
type = "info", header = blue(" # "),)
|
||||
|
||||
# execute post update repo hook
|
||||
@@ -1490,40 +1498,40 @@ class Repository:
|
||||
os.remove(dbfile_old)
|
||||
|
||||
# keep them closed
|
||||
self.Entropy.close_repositories()
|
||||
self.Entropy.validate_repositories()
|
||||
self.Entropy.close_repositories()
|
||||
self._entropy.close_repositories()
|
||||
self._entropy._validate_repositories()
|
||||
self._entropy.close_repositories()
|
||||
|
||||
# clean caches, fetch security
|
||||
if self.updated:
|
||||
self.Entropy.clear_cache()
|
||||
self._entropy.clear_cache()
|
||||
if self.fetch_security:
|
||||
self._update_security_advisories()
|
||||
# do treeupdates
|
||||
if isinstance(self.Entropy.installed_repository(), EntropyRepository) and \
|
||||
if isinstance(self._entropy.installed_repository(), EntropyRepository) and \
|
||||
entropy.tools.is_root(): # only as root due to Portage
|
||||
for repo in self.repo_ids:
|
||||
try:
|
||||
dbc = self.Entropy.open_repository(repo)
|
||||
dbc = self._entropy.open_repository(repo)
|
||||
except RepositoryError:
|
||||
# download failed and repo is not available, skip!
|
||||
continue
|
||||
try:
|
||||
self.Entropy.repository_packages_spm_sync(repo, dbc)
|
||||
self._entropy.repository_packages_spm_sync(repo, dbc)
|
||||
except Error:
|
||||
# EntropyRepository error, missing table?
|
||||
continue
|
||||
self.Entropy.close_repositories()
|
||||
self._entropy.close_repositories()
|
||||
|
||||
if self.sync_errors:
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
red(_("Something bad happened. Please have a look.")),
|
||||
importance = 1,
|
||||
type = "warning",
|
||||
header = darkred(" @@ ")
|
||||
)
|
||||
self.sync_errors = True
|
||||
self.Entropy.resources_remove_lock()
|
||||
self._entropy.resources_remove_lock()
|
||||
return 128
|
||||
|
||||
if self.entropy_updates_alert:
|
||||
@@ -1535,7 +1543,7 @@ class Repository:
|
||||
rc = False
|
||||
if self.entropy_updates_alert:
|
||||
try:
|
||||
rc, pkg_match = self.Entropy.check_package_update(
|
||||
rc, pkg_match = self._entropy.check_package_update(
|
||||
"sys-apps/entropy", deep = True)
|
||||
except:
|
||||
pass
|
||||
@@ -1546,7 +1554,7 @@ class Repository:
|
||||
blue(_("a new release is available")),
|
||||
darkred(_("Mind to install it before any other package")),
|
||||
)
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
mytxt,
|
||||
importance = 1,
|
||||
type = "info",
|
||||
@@ -1563,7 +1571,7 @@ class Repository:
|
||||
|
||||
mytxt = "%s %s %s" % (red(_("Unpacking database to")),
|
||||
darkgreen(file_to_unpack), red("..."),)
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
mytxt,
|
||||
importance = 0,
|
||||
type = "info",
|
||||
@@ -1580,7 +1588,7 @@ class Repository:
|
||||
if myrc != 0:
|
||||
mytxt = "%s %s !" % (red(_("Cannot unpack compressed package")),
|
||||
red(_("Skipping repository")),)
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
mytxt,
|
||||
importance = 1,
|
||||
type = "warning",
|
||||
@@ -1605,7 +1613,7 @@ class Repository:
|
||||
red("..."),
|
||||
)
|
||||
# download checksum
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
mytxt,
|
||||
importance = 0,
|
||||
type = "info",
|
||||
@@ -1628,7 +1636,7 @@ class Repository:
|
||||
red(_("Cannot fetch checksum")),
|
||||
red(_("Cannot verify database integrity")),
|
||||
)
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
mytxt,
|
||||
importance = 1,
|
||||
type = "warning",
|
||||
@@ -1666,7 +1674,7 @@ class Repository:
|
||||
bold(_("Attention")),
|
||||
red(_("remote database got suddenly locked")),
|
||||
)
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
mytxt,
|
||||
importance = 1,
|
||||
type = "warning",
|
||||
@@ -1675,7 +1683,7 @@ class Repository:
|
||||
|
||||
# starting to download
|
||||
mytxt = "%s ..." % (red(_("Downloading repository database")),)
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
mytxt,
|
||||
importance = 1,
|
||||
type = "info",
|
||||
@@ -1735,7 +1743,7 @@ class Repository:
|
||||
if not down_status:
|
||||
mytxt = "%s: %s." % (bold(_("Attention")),
|
||||
red(_("database does not exist online")),)
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
mytxt,
|
||||
importance = 1,
|
||||
type = "warning",
|
||||
@@ -1751,7 +1759,7 @@ class Repository:
|
||||
if not update:
|
||||
mytxt = "%s: %s." % (bold(_("Attention")),
|
||||
red(_("database is already up to date")),)
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
mytxt,
|
||||
importance = 1,
|
||||
type = "info",
|
||||
@@ -1769,7 +1777,7 @@ class Repository:
|
||||
red(_("Repository is being updated")),
|
||||
red(_("Try again in a few minutes")),
|
||||
)
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
mytxt,
|
||||
importance = 1,
|
||||
type = "warning",
|
||||
@@ -1780,9 +1788,9 @@ class Repository:
|
||||
|
||||
def __eapi1_eapi2_databases_alignment(self, dbfile, dbfile_old):
|
||||
|
||||
dbconn = self.Entropy.open_generic_database(dbfile, xcache = False,
|
||||
dbconn = self._entropy.open_generic_repository(dbfile, xcache = False,
|
||||
indexing_override = False)
|
||||
old_dbconn = self.Entropy.open_generic_database(dbfile_old,
|
||||
old_dbconn = self._entropy.open_generic_repository(dbfile_old,
|
||||
xcache = False, indexing_override = False)
|
||||
upd_rc = 0
|
||||
try:
|
||||
@@ -1806,13 +1814,13 @@ class Repository:
|
||||
red(_("please wait")),
|
||||
red("..."),
|
||||
)
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
mytxt,
|
||||
importance = 0,
|
||||
type = "info",
|
||||
header = "\t"
|
||||
)
|
||||
dbconn = self.Entropy.open_generic_database(dbfile,
|
||||
dbconn = self._entropy.open_generic_repository(dbfile,
|
||||
xcache = False, indexing_override = False)
|
||||
rc = dbconn.doDatabaseImport(dumpfile, dbfile)
|
||||
dbconn.closeDB()
|
||||
@@ -1821,12 +1829,12 @@ class Repository:
|
||||
def _update_security_advisories(self):
|
||||
# update Security Advisories
|
||||
try:
|
||||
security_intf = self.Entropy.Security()
|
||||
security_intf = self._entropy.Security()
|
||||
security_intf.sync()
|
||||
except Exception as e:
|
||||
entropy.tools.print_traceback(f = self.Entropy.clientLog)
|
||||
entropy.tools.print_traceback(f = self._entropy.clientLog)
|
||||
mytxt = "%s: %s" % (red(_("Advisories fetch error")), e,)
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
mytxt,
|
||||
importance = 1,
|
||||
type = "warning",
|
||||
@@ -1835,7 +1843,7 @@ class Repository:
|
||||
|
||||
def _standard_items_download(self, repo):
|
||||
|
||||
repos_data = self.Entropy.SystemSettings['repositories']
|
||||
repos_data = self._settings['repositories']
|
||||
repo_data = repos_data['available'][repo]
|
||||
notice_board = os.path.basename(repo_data['local_notice_board'])
|
||||
db_meta_file = etpConst['etpdatabasemetafilesfile']
|
||||
@@ -1878,7 +1886,7 @@ class Repository:
|
||||
]
|
||||
|
||||
def my_show_info(txt):
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
txt,
|
||||
importance = 0,
|
||||
type = "info",
|
||||
@@ -1887,7 +1895,7 @@ class Repository:
|
||||
)
|
||||
|
||||
def my_show_down_status(message, mytype):
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
message,
|
||||
importance = 0,
|
||||
type = mytype,
|
||||
@@ -1895,13 +1903,13 @@ class Repository:
|
||||
)
|
||||
|
||||
def my_show_file_unpack(fp):
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
"%s: %s" % (darkgreen(_("unpacked meta file")), brown(fp),),
|
||||
header = blue("\t << ")
|
||||
)
|
||||
|
||||
def my_show_file_rm(fp):
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
"%s: %s" % (darkgreen(_("removed meta file")), purple(fp),),
|
||||
header = blue("\t << ")
|
||||
)
|
||||
@@ -2002,9 +2010,9 @@ class Repository:
|
||||
|
||||
mytxt = "%s: %s" % (
|
||||
red(_("Repository revision")),
|
||||
bold(str(self.Entropy.get_repository_revision(repo))),
|
||||
bold(str(self._entropy.get_repository_revision(repo))),
|
||||
)
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
mytxt,
|
||||
importance = 1,
|
||||
type = "info",
|
||||
@@ -2014,70 +2022,70 @@ class Repository:
|
||||
return downloaded_files
|
||||
|
||||
def _database_revdeps_setup(self, repo):
|
||||
dbconn = self.Entropy.open_repository(repo)
|
||||
dbconn = self._entropy.open_repository(repo)
|
||||
dbconn.generateReverseDependenciesMetadata(verbose = False)
|
||||
dbconn.commitChanges(force = True)
|
||||
|
||||
def _database_indexing(self, repo):
|
||||
|
||||
# renice a bit, to avoid eating resources
|
||||
old_prio = self.Entropy.set_priority(15)
|
||||
old_prio = self._entropy.set_priority(15)
|
||||
mytxt = red("%s ...") % (_("Indexing Repository metadata"),)
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
mytxt,
|
||||
importance = 1,
|
||||
type = "info",
|
||||
header = "\t"
|
||||
)
|
||||
dbconn = self.Entropy.open_repository(repo)
|
||||
dbconn = self._entropy.open_repository(repo)
|
||||
dbconn.createAllIndexes()
|
||||
dbconn.commitChanges(force = True)
|
||||
# get list of indexes
|
||||
repo_indexes = dbconn.listAllIndexes()
|
||||
if self.Entropy.installed_repository() is not None:
|
||||
if self._entropy.installed_repository() is not None:
|
||||
try: # client db can be absent
|
||||
client_indexes = self.Entropy.installed_repository().listAllIndexes()
|
||||
client_indexes = self._entropy.installed_repository().listAllIndexes()
|
||||
if repo_indexes != client_indexes:
|
||||
self.Entropy.installed_repository().createAllIndexes()
|
||||
self._entropy.installed_repository().createAllIndexes()
|
||||
except:
|
||||
pass
|
||||
self.Entropy.set_priority(old_prio)
|
||||
self._entropy.set_priority(old_prio)
|
||||
|
||||
def sync(self):
|
||||
|
||||
# close them
|
||||
self.Entropy.close_repositories()
|
||||
self._entropy.close_repositories()
|
||||
|
||||
# let's dance!
|
||||
mytxt = darkgreen("%s ...") % (_("Repositories synchronization"),)
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
mytxt,
|
||||
importance = 2,
|
||||
type = "info",
|
||||
header = darkred(" @@ ")
|
||||
)
|
||||
|
||||
gave_up = self.Entropy.lock_check(self.Entropy.resources_check_lock)
|
||||
gave_up = self._entropy.lock_check(self._entropy.resources_check_lock)
|
||||
if gave_up:
|
||||
return 3
|
||||
|
||||
locked = self.Entropy.application_lock_check()
|
||||
locked = self._entropy.application_lock_check()
|
||||
if locked:
|
||||
return 4
|
||||
|
||||
# lock
|
||||
acquired = self.Entropy.resources_create_lock()
|
||||
acquired = self._entropy.resources_create_lock()
|
||||
if not acquired:
|
||||
return 4 # app locked during lock acquire
|
||||
try:
|
||||
rc = self._run_sync()
|
||||
finally:
|
||||
self.Entropy.resources_remove_lock()
|
||||
self._entropy.resources_remove_lock()
|
||||
if rc:
|
||||
return rc
|
||||
|
||||
# remove lock
|
||||
self.Entropy.resources_remove_lock()
|
||||
self._entropy.resources_remove_lock()
|
||||
|
||||
if (self.not_available >= len(self.repo_ids)):
|
||||
return 2
|
||||
|
||||
@@ -3782,7 +3782,7 @@ class ServerRepositoryMixin:
|
||||
header = darkgreen(" * "),
|
||||
back = True
|
||||
)
|
||||
dbconn = self.open_generic_database(dbpath)
|
||||
dbconn = self.open_generic_repository(dbpath)
|
||||
dbconn.initializeDatabase()
|
||||
dbconn.commitChanges()
|
||||
dbconn.closeDB()
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -263,7 +263,7 @@ class Server(SocketHost):
|
||||
cached = self.syscache['db'].get(dbpath)
|
||||
if cached != None:
|
||||
return cached
|
||||
dbc = self.Entropy.open_generic_database(
|
||||
dbc = self.Entropy.open_generic_repository(
|
||||
dbpath,
|
||||
xcache = False,
|
||||
readOnly = True,
|
||||
|
||||
@@ -112,7 +112,7 @@ class EntropyRepositoryTest(unittest.TestCase):
|
||||
|
||||
def test_package_repository(self):
|
||||
test_pkg = _misc.get_test_entropy_package()
|
||||
rc, atoms_contained = self.Client.add_package_to_repos(test_pkg)
|
||||
rc, atoms_contained = self.Client.add_package_to_repositories(test_pkg)
|
||||
self.assertEqual(0, rc)
|
||||
self.assertNotEqual([], atoms_contained)
|
||||
for idpackage, repoid in atoms_contained:
|
||||
@@ -147,7 +147,7 @@ class EntropyRepositoryTest(unittest.TestCase):
|
||||
etp_pkg = os.path.join(pkg_dir, os.listdir(pkg_dir)[0])
|
||||
self.assert_(os.path.isfile(etp_pkg))
|
||||
|
||||
status, matches = self.Client.add_package_to_repos(etp_pkg)
|
||||
status, matches = self.Client.add_package_to_repositories(etp_pkg)
|
||||
self.assert_(status == 0)
|
||||
self.assert_(matches)
|
||||
for match in matches:
|
||||
|
||||
@@ -411,7 +411,7 @@ class EntropyRepositoryTest(unittest.TestCase):
|
||||
fd, new_db_path = tempfile.mkstemp()
|
||||
os.close(fd)
|
||||
self.test_db.doDatabaseImport(buf_file, new_db_path)
|
||||
new_db = self.Client.open_generic_database(new_db_path)
|
||||
new_db = self.Client.open_generic_repository(new_db_path)
|
||||
new_db_data = new_db.getPackageData(idpackage)
|
||||
new_db.closeDB()
|
||||
etpUi['mute'] = False
|
||||
|
||||
@@ -41,7 +41,7 @@ class ToolsTest(unittest.TestCase):
|
||||
for test_pkg in self.test_pkgs:
|
||||
et.dump_entropy_metadata(test_pkg, tmp_path)
|
||||
self.assertNotEqual(tmp_path, None)
|
||||
dbconn = client.open_generic_database(tmp_path)
|
||||
dbconn = client.open_generic_repository(tmp_path)
|
||||
dbconn.validateDatabase()
|
||||
dbconn.listAllIdpackages()
|
||||
dbconn.closeDB()
|
||||
|
||||
@@ -520,7 +520,7 @@ def repositories(options):
|
||||
elif cmd == "backup":
|
||||
|
||||
db_path = Entropy._get_local_database_file()
|
||||
rc, err_msg = Entropy.backup_database(db_path,
|
||||
rc, err_msg = Entropy.backup_repository(db_path,
|
||||
backup_dir = os.path.dirname(db_path))
|
||||
if not rc:
|
||||
print_info(darkred(" ** ")+red("%s: %s" % (_("Error"), err_msg,) ))
|
||||
@@ -532,7 +532,7 @@ def repositories(options):
|
||||
|
||||
db_file = Entropy._get_local_database_file()
|
||||
db_dir = os.path.dirname(db_file)
|
||||
dblist = Entropy.list_backedup_client_databases(
|
||||
dblist = Entropy.installed_repository_backups(
|
||||
client_dbdir = db_dir)
|
||||
if not dblist:
|
||||
print_info(brown(" @@ ")+blue("%s." % (_("No backed up databases found"),)))
|
||||
@@ -570,7 +570,7 @@ def repositories(options):
|
||||
continue
|
||||
break
|
||||
|
||||
status, err_msg = Entropy.restore_database(dbpath, db_file)
|
||||
status, err_msg = Entropy.restore_repository(dbpath, db_file)
|
||||
if status:
|
||||
return 0
|
||||
return 1
|
||||
|
||||
@@ -99,7 +99,7 @@ class Entropy(Client):
|
||||
url_fetcher = DaemonUrlFetcher, repo_validation = False)
|
||||
# validate currently available repos
|
||||
# manually, to not taint logs
|
||||
self.validate_repositories(quiet = True)
|
||||
self._validate_repositories(quiet = True)
|
||||
self.output(
|
||||
"Loading Entropy Client Tracker miner: logfile: %s" % (
|
||||
DAEMON_LOGFILE,)
|
||||
|
||||
@@ -126,7 +126,7 @@ class Entropy(Client):
|
||||
url_fetcher = DaemonUrlFetcher, repo_validation = False)
|
||||
# validate currently available repos
|
||||
# manually, to not taint logs
|
||||
self.validate_repositories(quiet = True)
|
||||
self._validate_repositories(quiet = True)
|
||||
self.output(
|
||||
"Loading Entropy Updates daemon: check every %ss, logfile: %s" % (
|
||||
CHECK_DELAY_SECS, DAEMON_LOGFILE,)
|
||||
|
||||
@@ -41,8 +41,8 @@ from entropy.i18n import _
|
||||
from entropy.misc import ParallelTask
|
||||
from entropy.cache import EntropyCacher, MtimePingus
|
||||
from entropy.output import print_generic
|
||||
|
||||
from entropy.db.exceptions import ProgrammingError
|
||||
from entropy.core.settings.base import SystemSettings
|
||||
|
||||
# Sulfur Imports
|
||||
import gtk, gobject
|
||||
@@ -66,7 +66,8 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin):
|
||||
def __init__(self):
|
||||
|
||||
self.Equo = Equo()
|
||||
self.Cacher = EntropyCacher()
|
||||
self._cacher = EntropyCacher()
|
||||
self._settings = SystemSettings()
|
||||
|
||||
self.do_debug = False
|
||||
self._ugc_status = "--nougc" not in sys.argv
|
||||
@@ -349,7 +350,7 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin):
|
||||
# configuration files update cache generation
|
||||
def file_updates_cache_gen():
|
||||
self.Equo.FileUpdates.scan(quiet = True)
|
||||
self.Cacher.sync()
|
||||
self._cacher.sync()
|
||||
return False
|
||||
|
||||
def file_updates_fill_view():
|
||||
@@ -584,7 +585,7 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin):
|
||||
first = False
|
||||
|
||||
def warn_repositories(self):
|
||||
all_repos = self.Equo.SystemSettings['repositories']['order']
|
||||
all_repos = self._settings['repositories']['order']
|
||||
valid_repos = self.Equo.repositories()
|
||||
invalid_repos = [x for x in all_repos if x not in valid_repos]
|
||||
invalid_repos = [x for x in invalid_repos if \
|
||||
@@ -832,7 +833,7 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin):
|
||||
|
||||
def do_ugc_sync():
|
||||
self._ugc_update()
|
||||
self.Cacher.sync()
|
||||
self._cacher.sync()
|
||||
print_generic("UGC child process done")
|
||||
|
||||
self._spawning_ugc = True
|
||||
@@ -857,7 +858,7 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin):
|
||||
|
||||
def fill_pref_db_backup_page(self):
|
||||
self.dbBackupStore.clear()
|
||||
backed_up_dbs = self.Equo.list_backedup_client_databases()
|
||||
backed_up_dbs = self.Equo.installed_repository_backups()
|
||||
for mypath in backed_up_dbs:
|
||||
mymtime = os.path.getmtime(mypath)
|
||||
mytime = entropy.tools.convert_unix_time_to_human_time(mymtime)
|
||||
@@ -1053,7 +1054,7 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin):
|
||||
etpConst['entropyconf']: [
|
||||
(
|
||||
'ftp-proxy',
|
||||
self.Equo.SystemSettings['system']['proxy']['ftp'],
|
||||
self._settings['system']['proxy']['ftp'],
|
||||
const_get_stringtype(),
|
||||
fill_setting,
|
||||
saveSetting,
|
||||
@@ -1062,7 +1063,7 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin):
|
||||
),
|
||||
(
|
||||
'http-proxy',
|
||||
self.Equo.SystemSettings['system']['proxy']['http'],
|
||||
self._settings['system']['proxy']['http'],
|
||||
const_get_stringtype(),
|
||||
fill_setting,
|
||||
saveSetting,
|
||||
@@ -1071,7 +1072,7 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin):
|
||||
),
|
||||
(
|
||||
'proxy-username',
|
||||
self.Equo.SystemSettings['system']['proxy']['username'],
|
||||
self._settings['system']['proxy']['username'],
|
||||
const_get_stringtype(),
|
||||
fill_setting,
|
||||
saveSetting,
|
||||
@@ -1080,7 +1081,7 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin):
|
||||
),
|
||||
(
|
||||
'proxy-password',
|
||||
self.Equo.SystemSettings['system']['proxy']['password'],
|
||||
self._settings['system']['proxy']['password'],
|
||||
const_get_stringtype(),
|
||||
fill_setting,
|
||||
saveSetting,
|
||||
@@ -1100,7 +1101,7 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin):
|
||||
etpConst['clientconf']: [
|
||||
(
|
||||
'collisionprotect',
|
||||
self.Equo.SystemSettings[sys_settings_plg_id]['misc']['collisionprotect'],
|
||||
self._settings[sys_settings_plg_id]['misc']['collisionprotect'],
|
||||
int,
|
||||
fill_setting,
|
||||
saveSetting,
|
||||
@@ -1109,7 +1110,7 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin):
|
||||
),
|
||||
(
|
||||
'configprotect',
|
||||
self.Equo.SystemSettings[sys_settings_plg_id]['misc']['configprotect'],
|
||||
self._settings[sys_settings_plg_id]['misc']['configprotect'],
|
||||
list,
|
||||
fill_setting_view,
|
||||
save_setting_view,
|
||||
@@ -1118,7 +1119,7 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin):
|
||||
),
|
||||
(
|
||||
'configprotectmask',
|
||||
self.Equo.SystemSettings[sys_settings_plg_id]['misc']['configprotectmask'],
|
||||
self._settings[sys_settings_plg_id]['misc']['configprotectmask'],
|
||||
list,
|
||||
fill_setting_view,
|
||||
save_setting_view,
|
||||
@@ -1127,7 +1128,7 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin):
|
||||
),
|
||||
(
|
||||
'configprotectskip',
|
||||
self.Equo.SystemSettings[sys_settings_plg_id]['misc']['configprotectskip'],
|
||||
self._settings[sys_settings_plg_id]['misc']['configprotectskip'],
|
||||
list,
|
||||
fill_setting_view,
|
||||
save_setting_view,
|
||||
@@ -1136,7 +1137,7 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin):
|
||||
),
|
||||
(
|
||||
'filesbackup',
|
||||
self.Equo.SystemSettings[sys_settings_plg_id]['misc']['filesbackup'],
|
||||
self._settings[sys_settings_plg_id]['misc']['filesbackup'],
|
||||
bool,
|
||||
fill_setting,
|
||||
saveSetting,
|
||||
@@ -1156,7 +1157,7 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin):
|
||||
etpConst['repositoriesconf']: [
|
||||
(
|
||||
'downloadspeedlimit',
|
||||
self.Equo.SystemSettings['repositories']['transfer_limit'],
|
||||
self._settings['repositories']['transfer_limit'],
|
||||
int,
|
||||
fill_setting,
|
||||
saveSetting,
|
||||
@@ -1306,7 +1307,7 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin):
|
||||
for repoid in self.Equo.repositories():
|
||||
if self.Equo.is_noticeboard_marked_as_read(repoid) and not force:
|
||||
continue
|
||||
avail_repos = self.Equo.SystemSettings['repositories']['available']
|
||||
avail_repos = self._settings['repositories']['available']
|
||||
board_file = avail_repos[repoid]['local_notice_board']
|
||||
if not (os.path.isfile(board_file) and \
|
||||
os.access(board_file, os.R_OK)):
|
||||
@@ -1829,7 +1830,7 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin):
|
||||
# live masked, and anyway, better wasting
|
||||
# 2-3 more cycles than having unattended
|
||||
# behaviours
|
||||
self.Equo.SystemSettings.clear()
|
||||
self._settings.clear()
|
||||
self.Equo.close_repositories()
|
||||
|
||||
def hide_notebook_tabs_for_install(self):
|
||||
@@ -1929,7 +1930,7 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin):
|
||||
def critical_updates_warning(self):
|
||||
sys_set_client_plg_id = \
|
||||
etpConst['system_settings_plugins_ids']['client_plugin']
|
||||
misc_set = self.Equo.SystemSettings[sys_set_client_plg_id]['misc']
|
||||
misc_set = self._settings[sys_set_client_plg_id]['misc']
|
||||
if misc_set.get('forcedupdates'):
|
||||
crit_atoms, crit_mtchs = self.Equo.calculate_critical_updates()
|
||||
if crit_atoms:
|
||||
@@ -2118,7 +2119,7 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin):
|
||||
if (err == 0) and ((not fetch_only) and (not download_sources)):
|
||||
# this triggers post-branch upgrade function inside
|
||||
# Entropy Client SystemSettings plugin
|
||||
self.Equo.SystemSettings.clear()
|
||||
self._settings.clear()
|
||||
|
||||
if self.my_inst_abort:
|
||||
okDialog(self.ui.main,
|
||||
@@ -2227,7 +2228,7 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin):
|
||||
if repodata[1] != None:
|
||||
repoid = self.repoView.get_repoid(repodata)
|
||||
# do it if it's enabled
|
||||
repo_order = self.Equo.SystemSettings['repositories']['order']
|
||||
repo_order = self._settings['repositories']['order']
|
||||
if repoid in repo_order:
|
||||
idx = repo_order.index(repoid)
|
||||
return idx, repoid, repodata
|
||||
@@ -2302,9 +2303,9 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin):
|
||||
|
||||
def load_ugc_repositories(self):
|
||||
self.ugcRepositoriesModel.clear()
|
||||
repo_order = self.Equo.SystemSettings['repositories']['order']
|
||||
repo_excluded = self.Equo.SystemSettings['repositories']['excluded']
|
||||
avail_repos = self.Equo.SystemSettings['repositories']['available']
|
||||
repo_order = self._settings['repositories']['order']
|
||||
repo_excluded = self._settings['repositories']['excluded']
|
||||
avail_repos = self._settings['repositories']['available']
|
||||
for repoid in repo_order+sorted(repo_excluded.keys()):
|
||||
repodata = avail_repos.get(repoid)
|
||||
if repodata == None:
|
||||
|
||||
@@ -40,7 +40,7 @@ class QueueExecutor:
|
||||
|
||||
def __init__(self, SulfurApplication):
|
||||
self.Sulfur = SulfurApplication
|
||||
self.Entropy = SulfurApplication.Equo
|
||||
self._entropy = SulfurApplication.Equo
|
||||
self.__on_lic_request = False
|
||||
self.__on_lic_rc = None
|
||||
# clear download mirrors status
|
||||
@@ -50,12 +50,12 @@ class QueueExecutor:
|
||||
|
||||
### Before even starting the fetch, make sure
|
||||
### that the user accepts their licenses
|
||||
licenses = self.Entropy.get_licenses_to_accept(queue)
|
||||
licenses = self._entropy.get_licenses_to_accept(queue)
|
||||
if licenses:
|
||||
|
||||
self.__on_lic_request = True
|
||||
def do_handle():
|
||||
dialog = LicenseDialog(self.Sulfur, self.Entropy, licenses)
|
||||
dialog = LicenseDialog(self.Sulfur, self._entropy, licenses)
|
||||
accept = dialog.run()
|
||||
dialog.destroy()
|
||||
self.__on_lic_rc = accept, licenses
|
||||
@@ -91,9 +91,9 @@ class QueueExecutor:
|
||||
# unmask packages
|
||||
if (not fetch_only) and (not download_sources):
|
||||
for match in self.Sulfur.etpbase.unmaskingPackages:
|
||||
result = self.Entropy.unmask_match(match)
|
||||
if not result or self.Entropy.is_match_masked(match):
|
||||
dbconn = self.Entropy.open_repository(match[1])
|
||||
result = self._entropy.unmask_match(match)
|
||||
if not result or self._entropy.is_match_masked(match):
|
||||
dbconn = self._entropy.open_repository(match[1])
|
||||
atom = dbconn.retrieveAtom(match[0])
|
||||
self.ok_dialog("%s: %s" % (
|
||||
_("Error enabling masked package"), atom))
|
||||
@@ -103,7 +103,7 @@ class QueueExecutor:
|
||||
runQueue = install_queue
|
||||
conflicts_queue = []
|
||||
if (not fetch_only) and (not download_sources):
|
||||
runQueue, conflicts_queue, status = self.Entropy.get_install_queue(
|
||||
runQueue, conflicts_queue, status = self._entropy.get_install_queue(
|
||||
install_queue, False, False,
|
||||
relaxed = (SulfurConf.relaxed_deps == 1)
|
||||
)
|
||||
@@ -116,7 +116,7 @@ class QueueExecutor:
|
||||
return 3
|
||||
|
||||
for lic in licenses:
|
||||
self.Entropy.installed_repository().acceptLicense(lic)
|
||||
self._entropy.installed_repository().acceptLicense(lic)
|
||||
|
||||
def do_skip_show():
|
||||
self.Sulfur.skipMirrorNow = False
|
||||
@@ -151,9 +151,9 @@ class QueueExecutor:
|
||||
self.Sulfur.queue_bombing()
|
||||
|
||||
progress_step_count += 1
|
||||
self.Entropy.set_progress(float(progress_step_count)/total_steps)
|
||||
self._entropy.set_progress(float(progress_step_count)/total_steps)
|
||||
|
||||
pkg = self.Entropy.Package()
|
||||
pkg = self._entropy.Package()
|
||||
metaopts = {}
|
||||
metaopts['fetch_abort_function'] = self.Sulfur.mirror_bombing
|
||||
pkg.prepare(pkg_info, fetch_action, metaopts)
|
||||
@@ -164,7 +164,7 @@ class QueueExecutor:
|
||||
mykeys[myrepo].add(
|
||||
entropy.tools.dep_getkey(pkg.pkgmeta['atom']))
|
||||
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
fetch_string+pkg.pkgmeta['atom'],
|
||||
importance = 2,
|
||||
count = (progress_step_count, total_steps)
|
||||
@@ -178,10 +178,10 @@ class QueueExecutor:
|
||||
if not download_sources:
|
||||
def spawn_ugc():
|
||||
try:
|
||||
if self.Entropy.UGC != None:
|
||||
if self._entropy.UGC != None:
|
||||
for myrepo in mykeys:
|
||||
mypkgkeys = sorted(mykeys[myrepo])
|
||||
self.Entropy.UGC.add_download_stats(myrepo,
|
||||
self._entropy.UGC.add_download_stats(myrepo,
|
||||
mypkgkeys)
|
||||
except:
|
||||
pass
|
||||
@@ -203,16 +203,16 @@ class QueueExecutor:
|
||||
|
||||
idpackage = rem_data[0]
|
||||
progress_step_count += 1
|
||||
self.Entropy.set_progress(float(progress_step_count)/total_steps)
|
||||
self._entropy.set_progress(float(progress_step_count)/total_steps)
|
||||
|
||||
metaopts = {}
|
||||
metaopts['removeconfig'] = rem_data[1]
|
||||
if idpackage in do_purge_cache:
|
||||
metaopts['removeconfig'] = True
|
||||
pkg = self.Entropy.Package()
|
||||
pkg = self._entropy.Package()
|
||||
pkg.prepare((idpackage,), "remove", metaopts)
|
||||
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
"%s: %s" % (
|
||||
_("Removing package"),
|
||||
pkg.pkgmeta['removeatom'],
|
||||
@@ -222,7 +222,7 @@ class QueueExecutor:
|
||||
)
|
||||
|
||||
if 'remove_installed_vanished' not in pkg.pkgmeta:
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
"%s: " % (_("Removing"),) + pkg.pkgmeta['removeatom'],
|
||||
importance = 2,
|
||||
count = (progress_step_count, total_steps)
|
||||
@@ -247,7 +247,7 @@ class QueueExecutor:
|
||||
for pkg_info in runQueue:
|
||||
|
||||
progress_step_count += 1
|
||||
self.Entropy.set_progress(float(progress_step_count)/total_steps)
|
||||
self._entropy.set_progress(float(progress_step_count)/total_steps)
|
||||
self.Sulfur.queue_bombing()
|
||||
|
||||
metaopts = {}
|
||||
@@ -261,10 +261,10 @@ class QueueExecutor:
|
||||
metaopts['install_source'] = \
|
||||
etpConst['install_sources']['automatic_dependency']
|
||||
|
||||
pkg = self.Entropy.Package()
|
||||
pkg = self._entropy.Package()
|
||||
pkg.prepare(pkg_info, "install", metaopts)
|
||||
|
||||
self.Entropy.output(
|
||||
self._entropy.output(
|
||||
"%s: %s" % (_("Installing"), pkg.pkgmeta['atom'],),
|
||||
importance = 2,
|
||||
count = (progress_step_count, total_steps)
|
||||
|
||||
+20
-10
@@ -52,7 +52,7 @@ class SulfurApplicationEventsMixin:
|
||||
|
||||
def on_dbBackupButton_clicked(self, widget):
|
||||
self.start_working()
|
||||
status, err_msg = self.Equo.backup_database(
|
||||
status, err_msg = self.Equo.backup_repository(
|
||||
etpConst['etpdatabaseclientfilepath'])
|
||||
self.end_working()
|
||||
if not status:
|
||||
@@ -68,7 +68,7 @@ class SulfurApplicationEventsMixin:
|
||||
if myiter == None: return
|
||||
dbpath = model.get_value(myiter, 0)
|
||||
self.start_working()
|
||||
status, err_msg = self.Equo.restore_database(dbpath,
|
||||
status, err_msg = self.Equo.restore_repository(dbpath,
|
||||
etpConst['etpdatabaseclientfilepath'])
|
||||
self.end_working()
|
||||
self.Equo.reopen_installed_repository()
|
||||
@@ -242,7 +242,7 @@ class SulfurApplicationEventsMixin:
|
||||
# get text
|
||||
if repodata[1] != None:
|
||||
repoid = self.repoView.get_repoid(repodata)
|
||||
if repoid == self.Equo.SystemSettings['repositories']['default_repository']:
|
||||
if repoid == self._settings['repositories']['default_repository']:
|
||||
okDialog( self.ui.main,
|
||||
_("You! Why do you want to remove the main repository ?"))
|
||||
return True
|
||||
@@ -250,7 +250,17 @@ class SulfurApplicationEventsMixin:
|
||||
self.reset_cache_status()
|
||||
self.setup_repoView()
|
||||
|
||||
def on_repoEdit_clicked( self, widget ):
|
||||
def on_repoEdit_clicked(self, widget):
|
||||
|
||||
def get_repository_settings(repoid):
|
||||
try:
|
||||
repodata = self._settings['repositories']['available'][repoid]
|
||||
except KeyError:
|
||||
if repoid not in self._settings['repositories']['excluded']:
|
||||
raise
|
||||
repodata = self._settings['repositories']['excluded'][repoid]
|
||||
return repodata.copy()
|
||||
|
||||
my = AddRepositoryWindow(self, self.ui.main, self.Equo)
|
||||
my.addrepo_ui.repoSubmit.hide()
|
||||
my.addrepo_ui.repoSubmitEdit.show()
|
||||
@@ -261,7 +271,7 @@ class SulfurApplicationEventsMixin:
|
||||
repostuff = selection.get_selected()
|
||||
if repostuff[1] != None:
|
||||
repoid = self.repoView.get_repoid(repostuff)
|
||||
repodata = self.Equo.get_repository_settings(repoid)
|
||||
repodata = get_repository_settings(repoid)
|
||||
my._load_repo_data(repodata)
|
||||
my.load()
|
||||
|
||||
@@ -397,7 +407,7 @@ class SulfurApplicationEventsMixin:
|
||||
|
||||
newrepo = os.path.basename(fn)
|
||||
# we have it !
|
||||
status, atomsfound = self.Equo.add_package_to_repos(fn)
|
||||
status, atomsfound = self.Equo.add_package_to_repositories(fn)
|
||||
if status != 0:
|
||||
errtxt = _("is not a valid Entropy package")
|
||||
if status == -3:
|
||||
@@ -781,8 +791,8 @@ class SulfurApplicationEventsMixin:
|
||||
|
||||
def on_ugcClearCacheButton_clicked(self, widget):
|
||||
if self.Equo.UGC == None: return
|
||||
repo_excluded = self.Equo.SystemSettings['repositories']['excluded']
|
||||
avail_repos = self.Equo.SystemSettings['repositories']['available']
|
||||
repo_excluded = self._settings['repositories']['excluded']
|
||||
avail_repos = self._settings['repositories']['available']
|
||||
for repoid in list(set(list(avail_repos.keys())+list(repo_excluded.keys()))):
|
||||
self.Equo.UGC.UGCCache.clear_cache(repoid)
|
||||
self.set_status_ticker("%s: %s ..." % (_("Cleaning UGC cache of"), repoid,))
|
||||
@@ -791,8 +801,8 @@ class SulfurApplicationEventsMixin:
|
||||
def on_ugcClearCredentialsButton_clicked(self, widget):
|
||||
if self.Equo.UGC == None:
|
||||
return
|
||||
repo_excluded = self.Equo.SystemSettings['repositories']['excluded']
|
||||
avail_repos = self.Equo.SystemSettings['repositories']['available']
|
||||
repo_excluded = self._settings['repositories']['excluded']
|
||||
avail_repos = self._settings['repositories']['available']
|
||||
for repoid in list(set(list(avail_repos.keys())+list(repo_excluded.keys()))):
|
||||
if not self.Equo.UGC.is_repository_eapi3_aware(repoid):
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user