[entropy.db] API change, handlePackage(forcedRevision -> revision)
This commit is contained in:
@@ -783,7 +783,7 @@ Tools to rescue the running system.
|
||||
del data['original_repository']
|
||||
|
||||
new_package_id = inst_repo.handlePackage(
|
||||
data, forcedRevision = data['revision'])
|
||||
data, revision = data['revision'])
|
||||
inst_repo.storeInstalledPackage(new_package_id,
|
||||
etpConst['spmdbid'])
|
||||
|
||||
|
||||
@@ -134,8 +134,8 @@ class InstalledPackagesRepository(CachedRepository):
|
||||
const_setup_file(self._db, etpConst['entropygid'], 0o644,
|
||||
uid = etpConst['uid'])
|
||||
|
||||
def handlePackage(self, pkg_data, forcedRevision = -1,
|
||||
formattedContent = False):
|
||||
def handlePackage(self, pkg_data, revision = None,
|
||||
formattedContent = False):
|
||||
"""
|
||||
Reimplemented from EntropyRepository.
|
||||
"""
|
||||
@@ -145,7 +145,7 @@ class InstalledPackagesRepository(CachedRepository):
|
||||
)
|
||||
for r_package_id in removelist:
|
||||
self.removePackage(r_package_id)
|
||||
return self.addPackage(pkg_data, revision = forcedRevision,
|
||||
return self.addPackage(pkg_data, revision = revision,
|
||||
formatted_content = formattedContent)
|
||||
|
||||
|
||||
@@ -2712,8 +2712,8 @@ class AvailablePackagesRepository(CachedRepository, MaskableRepository):
|
||||
return AvailablePackagesRepositoryUpdater(TextInterface(),
|
||||
repository_id, False, False).remote_revision()
|
||||
|
||||
def handlePackage(self, pkg_data, forcedRevision = -1,
|
||||
formattedContent = False):
|
||||
def handlePackage(self, pkg_data, revision = None,
|
||||
formattedContent = False):
|
||||
"""
|
||||
Reimplemented from EntropyRepository
|
||||
"""
|
||||
@@ -2752,8 +2752,8 @@ class GenericRepository(CachedRepository, MaskableRepository):
|
||||
in fail-safe mode.
|
||||
"""
|
||||
|
||||
def handlePackage(self, pkg_data, forcedRevision = -1,
|
||||
formattedContent = False):
|
||||
def handlePackage(self, pkg_data, revision = None,
|
||||
formattedContent = False):
|
||||
"""
|
||||
Reimplemented from EntropyRepository.
|
||||
It is supposed that a generic repository should not support
|
||||
@@ -2766,8 +2766,8 @@ class GenericRepository(CachedRepository, MaskableRepository):
|
||||
raise PermissionDenied(
|
||||
"cannot execute handlePackage on this repository")
|
||||
|
||||
return self.addPackage(pkg_data, revision = forcedRevision,
|
||||
formatted_content = formattedContent)
|
||||
return self.addPackage(pkg_data, revision = revision,
|
||||
formatted_content = formattedContent)
|
||||
|
||||
def maskFilter(self, package_id, live = True):
|
||||
"""
|
||||
|
||||
@@ -2570,7 +2570,7 @@ class Package:
|
||||
data['content_safety'] = Package.FileContentSafetyReader(
|
||||
content_safety_file)
|
||||
idpackage = inst_repo.handlePackage(
|
||||
data, forcedRevision = data['revision'],
|
||||
data, revision = data['revision'],
|
||||
formattedContent = True)
|
||||
finally:
|
||||
if data['content'] is not None:
|
||||
|
||||
@@ -831,8 +831,8 @@ class EntropyMySQLRepository(EntropySQLRepository):
|
||||
REPLACE INTO counters SET counter = ? %s
|
||||
WHERE idpackage = ?""" % (branchstring,), insertdata)
|
||||
|
||||
def handlePackage(self, pkg_data, forcedRevision = -1,
|
||||
formattedContent = False):
|
||||
def handlePackage(self, pkg_data, revision = None,
|
||||
formattedContent = False):
|
||||
"""
|
||||
Reimplemented from EntropySQLRepository.
|
||||
"""
|
||||
|
||||
@@ -668,8 +668,8 @@ class EntropyRepositoryBase(TextInterface, EntropyRepositoryPluginStore):
|
||||
|
||||
return new_actions
|
||||
|
||||
def handlePackage(self, pkg_data, forcedRevision = -1,
|
||||
formattedContent = False):
|
||||
def handlePackage(self, pkg_data, revision = None,
|
||||
formattedContent = False):
|
||||
"""
|
||||
Update or add a package to repository automatically handling
|
||||
its scope and thus removal of previous versions if requested by
|
||||
@@ -725,8 +725,8 @@ class EntropyRepositoryBase(TextInterface, EntropyRepositoryPluginStore):
|
||||
|
||||
@param pkg_data: Entropy package metadata dict
|
||||
@type pkg_data: dict
|
||||
@keyword forcedRevision: force a specific package revision
|
||||
@type forcedRevision: int
|
||||
@keyword revision: force a specific package revision
|
||||
@type revision: int
|
||||
@keyword formattedContent: tells whether content metadata is already
|
||||
formatted for insertion
|
||||
@type formattedContent: bool
|
||||
|
||||
@@ -1026,8 +1026,8 @@ class EntropySQLRepository(EntropyRepositoryBase):
|
||||
"""
|
||||
super(EntropySQLRepository, self).initializeRepository()
|
||||
|
||||
def handlePackage(self, pkg_data, forcedRevision = -1,
|
||||
formattedContent = False):
|
||||
def handlePackage(self, pkg_data, revision = None,
|
||||
formattedContent = False):
|
||||
"""
|
||||
Reimplemented from EntropyRepositoryBase. Raises NotImplementedError.
|
||||
Subclasses have to reimplement this.
|
||||
|
||||
@@ -518,7 +518,7 @@ class EntropySQLiteRepository(EntropySQLRepository):
|
||||
self._clearLiveCache("_doesColumnInTableExist")
|
||||
super(EntropySQLiteRepository, self).initializeRepository()
|
||||
|
||||
def handlePackage(self, pkg_data, forcedRevision = -1,
|
||||
def handlePackage(self, pkg_data, revision = None,
|
||||
formattedContent = False):
|
||||
"""
|
||||
Reimplemented from EntropySQLRepository.
|
||||
|
||||
@@ -241,8 +241,8 @@ class ServerPackagesRepository(CachedRepository):
|
||||
return super(ServerPackagesRepository, self)._runConfigurationFilesUpdate(
|
||||
actions, files, protect_overwrite = False)
|
||||
|
||||
def handlePackage(self, pkg_data, forcedRevision = -1,
|
||||
formattedContent = False):
|
||||
def handlePackage(self, pkg_data, revision = None,
|
||||
formattedContent = False):
|
||||
"""
|
||||
Reimplemented from EntropyRepository.
|
||||
"""
|
||||
@@ -252,24 +252,25 @@ class ServerPackagesRepository(CachedRepository):
|
||||
pkg_data['category'], pkg_data['name'], pkg_data['version'],
|
||||
pkg_data['versiontag'])
|
||||
|
||||
current_rev = forcedRevision
|
||||
if revision is None:
|
||||
current_rev = -1
|
||||
else:
|
||||
current_rev = revision
|
||||
|
||||
manual_deps = set()
|
||||
# Remove entries in the same scope.
|
||||
for package_id in self.getPackageIds(pkgatom):
|
||||
|
||||
if forcedRevision == -1:
|
||||
myrev = self.retrieveRevision(package_id)
|
||||
if myrev > current_rev:
|
||||
current_rev = myrev
|
||||
if revision is None:
|
||||
pkg_revision = self.retrieveRevision(package_id)
|
||||
current_rev = max(pkg_revision, current_rev)
|
||||
|
||||
#
|
||||
manual_deps |= self.retrieveManualDependencies(package_id,
|
||||
resolve_conditional_deps = False)
|
||||
# injected packages wouldn't be removed by addPackage
|
||||
self.removePackage(package_id)
|
||||
|
||||
if forcedRevision == -1:
|
||||
if revision is None:
|
||||
current_rev += 1
|
||||
|
||||
# manual dependencies handling
|
||||
|
||||
Reference in New Issue
Block a user