[entropy.db] remove do_cleanup argument from removePackage()
This commit is contained in:
@@ -343,7 +343,7 @@ def _merge_repository(entropy_client, repo_ids, remove_conflicts = False):
|
||||
multiMatch = True)
|
||||
target_pkg_ids |= matches
|
||||
for target_pkg_id in target_pkg_ids:
|
||||
dest_db.removePackage(target_pkg_id, do_cleanup = False)
|
||||
dest_db.removePackage(target_pkg_id)
|
||||
dest_pkg_id = dest_db.addPackage(pkg_meta,
|
||||
formatted_content = True)
|
||||
dest_db.commit()
|
||||
|
||||
@@ -133,7 +133,7 @@ class InstalledPackagesRepository(CachedRepository):
|
||||
pkg_data['slot'], pkg_data['injected']
|
||||
)
|
||||
for r_package_id in removelist:
|
||||
self.removePackage(r_package_id, do_cleanup = False)
|
||||
self.removePackage(r_package_id)
|
||||
return self.addPackage(pkg_data, revision = forcedRevision,
|
||||
formatted_content = formattedContent)
|
||||
|
||||
@@ -1722,7 +1722,7 @@ class AvailablePackagesRepositoryUpdater(object):
|
||||
header = " ", back = (not etpUi['verbose'])
|
||||
)
|
||||
try:
|
||||
mydbconn.removePackage(idpackage, do_cleanup = False)
|
||||
mydbconn.removePackage(idpackage)
|
||||
except (Error,):
|
||||
self._entropy.output(
|
||||
blue(_("repository error while removing packages")),
|
||||
@@ -2526,8 +2526,7 @@ class AvailablePackagesRepository(CachedRepository, MaskableRepository):
|
||||
raise PermissionDenied(
|
||||
"cannot execute addPackage on this repository")
|
||||
|
||||
def removePackage(self, package_id, do_cleanup = True,
|
||||
from_add_package = False):
|
||||
def removePackage(self, package_id, from_add_package = False):
|
||||
"""
|
||||
Reimplemented from EntropyRepository
|
||||
"""
|
||||
|
||||
@@ -1785,8 +1785,7 @@ class Package:
|
||||
automerge_metadata = inst_repo.retrieveAutomergefiles(
|
||||
self.pkgmeta['removeidpackage'], get_dict = True)
|
||||
inst_repo.removePackage(
|
||||
self.pkgmeta['removeidpackage'],
|
||||
do_cleanup = False)
|
||||
self.pkgmeta['removeidpackage'])
|
||||
|
||||
# commit changes, to avoid users pressing CTRL+C and still having
|
||||
# all the db entries in, so we need to commit at every iteration
|
||||
|
||||
@@ -797,8 +797,7 @@ class EntropyMySQLRepository(EntropySQLRepository):
|
||||
"""
|
||||
raise NotImplementedError()
|
||||
|
||||
def _removePackage(self, package_id, do_cleanup = True,
|
||||
from_add_package = False):
|
||||
def _removePackage(self, package_id, from_add_package = False):
|
||||
"""
|
||||
Reimplemented from EntropyRepositoryBase.
|
||||
Needs to call superclass method.
|
||||
@@ -807,10 +806,6 @@ class EntropyMySQLRepository(EntropySQLRepository):
|
||||
self._cursor().execute(
|
||||
"DELETE FROM baseinfo WHERE idpackage = ?", (package_id,))
|
||||
|
||||
if do_cleanup:
|
||||
# Cleanups if at least one package has been removed
|
||||
self.clean()
|
||||
|
||||
def setSpmUid(self, package_id, spm_package_uid, branch = None):
|
||||
"""
|
||||
Reimplemented from EntropyRepositoryBase.
|
||||
|
||||
@@ -794,8 +794,7 @@ class EntropyRepositoryBase(TextInterface, EntropyRepositoryPluginStore):
|
||||
"[add_package_hook] %s: status: %s" % (
|
||||
plug_inst.get_id(), exec_rc,))
|
||||
|
||||
def removePackage(self, package_id, do_cleanup = True,
|
||||
from_add_package = False):
|
||||
def removePackage(self, package_id, from_add_package = False):
|
||||
"""
|
||||
Remove package from this Entropy repository using it's identifier
|
||||
(package_id).
|
||||
@@ -804,9 +803,6 @@ class EntropyRepositoryBase(TextInterface, EntropyRepositoryPluginStore):
|
||||
|
||||
@param package_id: Entropy repository package indentifier
|
||||
@type package_id: int
|
||||
@keyword do_cleanup: if True, executes repository metadata cleanup
|
||||
at the end
|
||||
@type do_cleanup: bool
|
||||
@keyword from_add_package: inform function that it's being called from
|
||||
inside addPackage().
|
||||
@type from_add_package: bool
|
||||
@@ -3819,9 +3815,7 @@ class EntropyRepositoryBase(TextInterface, EntropyRepositoryPluginStore):
|
||||
count = (mycount, maxcount)
|
||||
)
|
||||
|
||||
self.removePackage(
|
||||
package_id,
|
||||
do_cleanup = False)
|
||||
self.removePackage(package_id)
|
||||
|
||||
maxcount = len(added_ids)
|
||||
mycount = 0
|
||||
|
||||
@@ -858,8 +858,7 @@ class EntropySQLRepository(EntropyRepositoryBase):
|
||||
resolve_conditional_deps = False)
|
||||
|
||||
# does it exist?
|
||||
self.removePackage(package_id, do_cleanup = False,
|
||||
from_add_package = True)
|
||||
self.removePackage(package_id, from_add_package = True)
|
||||
mypackage_id_string = '?'
|
||||
mybaseinfo_data = (package_id,)+mybaseinfo_data
|
||||
|
||||
@@ -1008,8 +1007,7 @@ class EntropySQLRepository(EntropyRepositoryBase):
|
||||
self._connection().rollback()
|
||||
raise
|
||||
|
||||
def removePackage(self, package_id, do_cleanup = True,
|
||||
from_add_package = False):
|
||||
def removePackage(self, package_id, from_add_package = False):
|
||||
"""
|
||||
Reimplemented from EntropyRepositoryBase.
|
||||
Needs to call superclass method.
|
||||
@@ -1017,18 +1015,16 @@ class EntropySQLRepository(EntropyRepositoryBase):
|
||||
try:
|
||||
self.clearCache()
|
||||
super(EntropySQLRepository, self).removePackage(
|
||||
package_id, do_cleanup = do_cleanup,
|
||||
from_add_package = from_add_package)
|
||||
package_id, from_add_package = from_add_package)
|
||||
self.clearCache()
|
||||
|
||||
return self._removePackage(package_id, do_cleanup = do_cleanup,
|
||||
return self._removePackage(package_id,
|
||||
from_add_package = from_add_package)
|
||||
except:
|
||||
self._connection().rollback()
|
||||
raise
|
||||
|
||||
def _removePackage(self, package_id, do_cleanup = True,
|
||||
from_add_package = False):
|
||||
def _removePackage(self, package_id, from_add_package = False):
|
||||
"""
|
||||
Reimplement in subclasses.
|
||||
"""
|
||||
|
||||
@@ -622,8 +622,7 @@ class EntropySQLiteRepository(EntropySQLRepository):
|
||||
resolve_conditional_deps = False)
|
||||
|
||||
# does it exist?
|
||||
self.removePackage(package_id, do_cleanup = False,
|
||||
from_add_package = True)
|
||||
self.removePackage(package_id, from_add_package = True)
|
||||
mypackage_id_string = '?'
|
||||
mybaseinfo_data = (package_id,)+mybaseinfo_data
|
||||
|
||||
@@ -768,8 +767,7 @@ class EntropySQLiteRepository(EntropySQLRepository):
|
||||
|
||||
return package_id
|
||||
|
||||
def _removePackage(self, package_id, do_cleanup = True,
|
||||
from_add_package = False):
|
||||
def _removePackage(self, package_id, from_add_package = False):
|
||||
"""
|
||||
Reimplemented from EntropySQLRepository.
|
||||
We must handle on_delete_cascade.
|
||||
@@ -813,10 +811,6 @@ class EntropySQLiteRepository(EntropySQLRepository):
|
||||
DELETE FROM packagedownloads WHERE idpackage = (?)""",
|
||||
(package_id,))
|
||||
|
||||
if do_cleanup:
|
||||
# Cleanups if at least one package has been removed
|
||||
self.clean()
|
||||
|
||||
def __addCategory(self, category):
|
||||
"""
|
||||
NOTE: only working with _baseinfo_extrainfo_2010 disabled
|
||||
|
||||
@@ -258,7 +258,7 @@ class ServerPackagesRepository(CachedRepository):
|
||||
manual_deps |= self.retrieveManualDependencies(package_id,
|
||||
resolve_conditional_deps = False)
|
||||
# injected packages wouldn't be removed by addPackage
|
||||
self.removePackage(package_id, do_cleanup = False)
|
||||
self.removePackage(package_id)
|
||||
|
||||
if forcedRevision == -1:
|
||||
current_rev += 1
|
||||
@@ -272,7 +272,7 @@ class ServerPackagesRepository(CachedRepository):
|
||||
for r_package_id in removelist:
|
||||
manual_deps |= self.retrieveManualDependencies(r_package_id,
|
||||
resolve_conditional_deps = False)
|
||||
self.removePackage(r_package_id, do_cleanup = False)
|
||||
self.removePackage(r_package_id)
|
||||
|
||||
# inject old manual dependencies back to package metadata
|
||||
for manual_dep in manual_deps:
|
||||
|
||||
@@ -2767,6 +2767,7 @@ class Server(Client):
|
||||
|
||||
# remove package from old db
|
||||
dbconn.removePackage(idpackage)
|
||||
dbconn.clean()
|
||||
dbconn.commit()
|
||||
|
||||
self.output(
|
||||
@@ -2954,7 +2955,8 @@ class Server(Client):
|
||||
header = brown(" @@ ")
|
||||
)
|
||||
dbconn.removePackage(idpackage)
|
||||
dbconn.commit()
|
||||
dbconn.clean()
|
||||
dbconn.commit()
|
||||
self.close_repository(dbconn)
|
||||
self.output(
|
||||
"[%s] %s" % (
|
||||
|
||||
@@ -156,7 +156,7 @@ class EntropyPortageConverter(TextInterface):
|
||||
count = (count, max_count),
|
||||
importance = 0,
|
||||
back = True)
|
||||
self._repo.removePackage(package_id, do_cleanup = False)
|
||||
self._repo.removePackage(package_id)
|
||||
|
||||
self.output(purple("Done removing packages."),
|
||||
header = teal(" @@ "),
|
||||
@@ -261,7 +261,7 @@ class EntropyPortageConverter(TextInterface):
|
||||
count = (count, max_count),
|
||||
importance = 0, back = True)
|
||||
|
||||
self._repo.removePackage(package_id, do_cleanup = False)
|
||||
self._repo.removePackage(package_id)
|
||||
self.__add_package(pkg_atom, spm_repo, count, max_count)
|
||||
|
||||
self._repo.commit()
|
||||
|
||||
Reference in New Issue
Block a user