[matter] add new drop-old-injected argument support.

This will make possible to fully support automated injected packages
bump.
This commit is contained in:
Fabio Erculiani
2013-02-19 17:57:18 +00:00
parent 7c810b6e91
commit c01a66c5ee
6 changed files with 80 additions and 10 deletions

View File

@@ -218,6 +218,7 @@ class EntropyBinaryPMS(BaseBinaryPMS):
settings, _trees, _db = self.load_emerge_config()
pkgdir = settings["PKGDIR"]
repository = spec["repository"]
drop_old_injected = spec["drop-old-injected"] == "yes"
print_info("committing build-only packages: %s, to repository: %s" % (
", ".join(sorted(packages)), repository,))
@@ -237,11 +238,40 @@ class EntropyBinaryPMS(BaseBinaryPMS):
pkg_files = [([x], True) for x in package_files]
package_ids = self._entropy.add_packages_to_repository(
repository, pkg_files, ask=False)
if package_ids:
# checking dependencies and print issues
self._entropy.dependencies_test(repository)
self._entropy.commit_repositories()
if package_ids:
# drop old injected packages if they are in the
# same key + slot of the newly added ones.
# This is not atomic, but we don't actually care.
if drop_old_injected:
repo = self._entropy.open_repository(repository)
key_slots = set()
for package_id in package_ids:
key, slot = repo.retrieveKeySlot(package_id)
key_slots.add((key, slot))
key_slot_package_ids = set()
for key, slot in key_slots:
ks_package_ids = [x for x in repo.searchKeySlot(key, slot) \
if repo.isInjected(x)]
key_slot_package_ids.update(ks_package_ids)
# remove the newly added packages, of course
key_slot_package_ids -= package_ids
key_slot_package_ids = sorted(key_slot_package_ids)
if key_slot_package_ids:
print_info("removing old injected packages, "
"as per drop-old-injected:")
for package_id in key_slot_package_ids:
atom = repo.retrieveAtom(package_id)
print_info(" %s" % (atom,))
self._entropy.remove_packages(
repository, key_slot_package_ids)
self._entropy.dependencies_test(repository)
return exit_st
def _commit(self, spec, packages):
@@ -340,11 +370,11 @@ class EntropyBinaryPMS(BaseBinaryPMS):
# (beside those blacklisted), since this execution is not interactive
package_ids = self._entropy.add_packages_to_repository(
repository, etp_pkg_files, ask=False)
if package_ids:
# checking dependencies and print issues
self._entropy.dependencies_test(repository)
self._entropy.commit_repositories()
if package_ids:
self._entropy.dependencies_test(repository)
return exit_st
def push(self, repository):
@@ -386,7 +416,16 @@ class EntropySpecParser(MatterSpecParser):
"""
Overridden from MatterSpecParser.
"""
return {}
return {
"drop-old-injected": {
"cb": self._funcs.valid_yes_no,
"ve": self._funcs.ve_string_stripper,
"default": "no",
"desc": "Drop older packages in the same slot when\n "
"adding an injected package. Injected packages come\n "
"into play when 'build-only: yes'",
},
}
MatterSpec.register_parser(EntropySpecParser())

View File

@@ -39,6 +39,11 @@ stable: inherit
# Default is: no
# build-only: no
# Drop older packages in the same slot when adding an injected package.
# Injected packages come into play when 'build-only: yes'
# Default is: no
# drop-old-injected: no
# Allow Source Package Manager (Portage) repository change?
# Valid values are either "yes" or "no"
# Default is: no

View File

@@ -27,6 +27,11 @@ repository: community0
# Default is: no
# build-only: no
# Drop older packages in the same slot when adding an injected package.
# Injected packages come into play when 'build-only: yes'
# Default is: no
# drop-old-injected: no
# Allow Source Package Manager (Portage) repository change?
# Valid values are either "yes" or "no"
# Default is: no

View File

@@ -27,6 +27,11 @@ repository: community0
# Default is: no
# build-only: no
# Drop older packages in the same slot when adding an injected package.
# Injected packages come into play when 'build-only: yes'
# Default is: no
# drop-old-injected: no
# Allow Source Package Manager (Portage) repository change?
# Valid values are either "yes" or "no"
# Default is: no

View File

@@ -3,7 +3,7 @@
# List of packages required to be built.
# Comma separated, example: app-foo/bar, bar-baz/foo
# Mandatory, cannot be empty
packages: sys-libs/zlib, asd-foo/foo
packages: sys-libs/zlib
# Enforce stable or unstable packages on emerge.
# yes = only stable packages are accepted
@@ -27,6 +27,11 @@ repository: community0
# Default is: no
build-only: yes
# Drop older packages in the same slot when adding an injected package.
# Injected packages come into play when 'build-only: yes'
# Default is: no
drop-old-injected: yes
# Allow Source Package Manager (Portage) repository change?
# Valid values are either "yes" or "no"
# Default is: no
@@ -42,7 +47,7 @@ spm-repository-change-if-upstreamed: yes
# Allow compiling package even if it's not actually installed on system?
# Valid values are either "yes" or "no"
# Default is: no
not-installed: no
not-installed: yes
# Allow soft-blockers in the merge queue? Packages will be unmerged if yes.
# Valid values are either "yes" or "no"
@@ -62,7 +67,7 @@ dependencies: yes
# Allow package downgrade?
# Valid values are either "yes" or "no"
# Default is: no
downgrade: no
downgrade: yes
# Allow package rebuild?
# Valid values are either "yes" or "no"

View File

@@ -18,9 +18,20 @@ stable: inherit
repository: community0
# Provide custom build arguments to Portage.
# --ask and --buildpkgonly are not allowed and automatically filtered.
# Default is: --verbose --nospinner
build-args: --verbose --nospinner
# Only build the packages without merging them into the system.
# Valid values are either "yes" or "no"
# Default is: no
# build-only: no
# Drop older packages in the same slot when adding an injected package.
# Injected packages come into play when 'build-only: yes'
# Default is: no
# drop-old-injected: no
# Allow Source Package Manager (Portage) repository change?
# Valid values are either "yes" or "no"
# Default is: no