[gentoo-commits] proj/portage:master commit in: lib/portage/dep/
commit: ee127db438307c133fcf650c148ed594ceb68591 Author: Sam James gentoo org> AuthorDate: Mon Sep 4 17:40:06 2023 + Commit: Sam James gentoo org> CommitDate: Sun Dec 10 22:01:48 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=ee127db4 dep: add comment to _eval_deps wrt binding slot deps in any-of || ( ... ) Bug: https://bugs.gentoo.org/455904 Bug: https://bugs.gentoo.org/489458 Bug: https://bugs.gentoo.org/586238 Signed-off-by: Sam James gentoo.org> lib/portage/dep/_slot_operator.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/portage/dep/_slot_operator.py b/lib/portage/dep/_slot_operator.py index 82dd7d66c9..d3f506450f 100644 --- a/lib/portage/dep/_slot_operator.py +++ b/lib/portage/dep/_slot_operator.py @@ -91,6 +91,7 @@ def _eval_deps(dep_struct, vardbs): # and B installed should record subslot on A only since the package is # supposed to link against that anyway, and we have no guarantee that B # has matching ABI. +# See bug #455904, bug #489458, bug #586238. for i, x in enumerate(dep_struct): if isinstance(x, list):
[gentoo-commits] proj/portage:master commit in: lib/portage/dep/soname/
commit: 334946eadc7efb457062c7aba9d3b51085e463c3 Author: Zac Medico gentoo org> AuthorDate: Tue Oct 24 22:33:20 2023 + Commit: Zac Medico gentoo org> CommitDate: Tue Oct 24 22:34:25 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=334946ea SonameAtom: multiprocessing spawn compat Do not pickle the SonameAtom _hash_value attribute, since hash() results are not meaningfully picklable. Bug: https://bugs.gentoo.org/916248 Signed-off-by: Zac Medico gentoo.org> lib/portage/dep/soname/SonameAtom.py | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/portage/dep/soname/SonameAtom.py b/lib/portage/dep/soname/SonameAtom.py index 78129f3262..421ab3f5a2 100644 --- a/lib/portage/dep/soname/SonameAtom.py +++ b/lib/portage/dep/soname/SonameAtom.py @@ -20,11 +20,15 @@ class SonameAtom: ) def __getstate__(self): -return {k: getattr(self, k) for k in self.__slots__} +state = {k: getattr(self, k) for k in self.__slots__} +# hash() results are not meaningfully picklable. +state["_hash_value"] = None +return state def __setstate__(self, state): for k, v in state.items(): object.__setattr__(self, k, v) +object.__setattr__(self, "_hash_value", hash(self._hash_key)) def __hash__(self): return self._hash_value
[gentoo-commits] proj/portage:master commit in: lib/portage/dep/, lib/_emerge/
commit: 5fa94917c22de6208b8b7f2a51f0d1e59b9b6244 Author: Berin Aniesh gmail com> AuthorDate: Sun Jun 18 03:46:32 2023 + Commit: Sam James gentoo org> CommitDate: Thu Jun 29 08:19:28 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=5fa94917 actions.py: getportageversion() change .format to f string portage.dep.py: run black Signed-off-by: Berin Aniesh gmail.com> Signed-off-by: Sam James gentoo.org> lib/_emerge/actions.py | 14 +- lib/portage/dep/__init__.py | 2 +- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/lib/_emerge/actions.py b/lib/_emerge/actions.py index dae6b6b7b..01bf82fcb 100644 --- a/lib/_emerge/actions.py +++ b/lib/_emerge/actions.py @@ -2789,6 +2789,7 @@ def relative_profile_path(portdir, abs_profile): profilever = None return profilever + def get_libc_version(vardb): libcver = [] libclist = set() @@ -2805,6 +2806,7 @@ def get_libc_version(vardb): libcver = ["unavailable"] return libcver + def get_profile_version(portdir, profile, vardb): profilever = None repositories = vardb.settings.repositories @@ -2845,9 +2847,10 @@ def get_profile_version(portdir, profile, vardb): if profilever is None: profilever = "unavailable" - + return profilever + def getportageversion(portdir, _unused, profile, chost, vardb): pythonver = ( "python" @@ -2863,14 +2866,7 @@ def getportageversion(portdir, _unused, profile, chost, vardb): gccver = getgccversion(chost) unameout = platform.release() + " " + platform.machine() -return "Portage {} ({}, {}, {}, {}, {})".format( -portage.VERSION, -pythonver, -profilever, -gccver, -",".join(libcver), -unameout, -) +return f"Portage {portage.VERSION} ({pythonver}, {profilever}, {gccver}, {','.join(libcver)}, {unameout})" class _emerge_config(SlotObject): diff --git a/lib/portage/dep/__init__.py b/lib/portage/dep/__init__.py index b196dd340..7bdb8da76 100644 --- a/lib/portage/dep/__init__.py +++ b/lib/portage/dep/__init__.py @@ -100,7 +100,7 @@ def _get_slot_dep_re(eapi_attrs: portage.eapi._eapi_attrs) -> re.Pattern: def _match_slot(atom, pkg) -> bool: """ @type atom: portage.dep.Atom -@type pkg: _emerge.Package.Package +@type pkg: _emerge.Package.Package """ if pkg.slot == atom.slot: if not atom.sub_slot:
[gentoo-commits] proj/portage:master commit in: lib/portage/dep/
commit: ca68d224094a6227b27ca90a0827d2abe4ca6177 Author: Berin Aniesh gmail com> AuthorDate: Fri Jun 16 10:41:38 2023 + Commit: Sam James gentoo org> CommitDate: Thu Jun 29 08:19:27 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=ca68d224 portage: dep: A few type annotations Signed-off-by: Berin Aniesh gmail.com> Signed-off-by: Sam James gentoo.org> lib/portage/dep/__init__.py | 15 ++- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/portage/dep/__init__.py b/lib/portage/dep/__init__.py index d0c5a45cc..b196dd340 100644 --- a/lib/portage/dep/__init__.py +++ b/lib/portage/dep/__init__.py @@ -1,7 +1,8 @@ -# deps.py -- Portage dependency resolution functions -# Copyright 2003-2021 Gentoo Authors +# Copyright 2003-2023 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 +"""deps.py -- Portage dependency resolution functions""" + __all__ = [ "Atom", "best_match_to_list", @@ -79,7 +80,7 @@ _extended_cat = r"[\w+*][\w+.*-]*" _slot_dep_re_cache = {} -def _get_slot_dep_re(eapi_attrs): +def _get_slot_dep_re(eapi_attrs: portage.eapi._eapi_attrs) -> re.Pattern: cache_key = eapi_attrs.slot_operator slot_re = _slot_dep_re_cache.get(cache_key) if slot_re is not None: @@ -96,7 +97,11 @@ def _get_slot_dep_re(eapi_attrs): return slot_re -def _match_slot(atom, pkg): +def _match_slot(atom, pkg) -> bool: +""" +@type atom: portage.dep.Atom +@type pkg: _emerge.Package.Package +""" if pkg.slot == atom.slot: if not atom.sub_slot: return True @@ -108,7 +113,7 @@ def _match_slot(atom, pkg): _atom_re = None -def _get_atom_re(eapi_attrs): +def _get_atom_re(eapi_attrs: portage.eapi._eapi_attrs) -> re.Pattern: global _atom_re if _atom_re is not None: return _atom_re
[gentoo-commits] proj/portage:master commit in: /, lib/portage/dep/soname/, lib/portage/util/elf/
commit: bde2a895cf520687dce7a8e92601041a37529ba0 Author: Yiyang Wu gmail com> AuthorDate: Thu Feb 2 14:53:44 2023 + Commit: Sam James gentoo org> CommitDate: Wed Feb 15 08:38:53 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=bde2a895 ELF: add EM_AMDGPU entry With this, portage is able to detect AMDGPU machine code elf object. Bug: https://bugs.gentoo.org/795825 Signed-off-by: Yiyang Wu gmail.com> Closes: https://github.com/gentoo/portage/pull/983 Signed-off-by: Sam James gentoo.org> NEWS| 3 +++ lib/portage/dep/soname/multilib_category.py | 2 ++ lib/portage/util/elf/constants.py | 1 + 3 files changed, 6 insertions(+) diff --git a/NEWS b/NEWS index 881565634..646073421 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,9 @@ portage-3.0.45 (UNRELEASED) -- +Features: +* Support new ELF machine code: AMDGPU + Bug fixes: * gpkg: Handle out-of-space errors (bug #891391). diff --git a/lib/portage/dep/soname/multilib_category.py b/lib/portage/dep/soname/multilib_category.py index d195116fe..14a9eea77 100644 --- a/lib/portage/dep/soname/multilib_category.py +++ b/lib/portage/dep/soname/multilib_category.py @@ -51,6 +51,7 @@ from portage.util.elf.constants import ( EM_68K, EM_AARCH64, EM_ALPHA, +EM_AMDGPU, EM_ARM, EM_ALTERA_NIOS2, EM_IA_64, @@ -77,6 +78,7 @@ _machine_prefix_map = { EM_68K: "m68k", EM_AARCH64: "arm", EM_ALPHA: "alpha", +EM_AMDGPU: "amdgpu", EM_ALTERA_NIOS2: "nios2", EM_ARM: "arm", EM_IA_64: "ia64", diff --git a/lib/portage/util/elf/constants.py b/lib/portage/util/elf/constants.py index 19b72cfa1..022e78d77 100644 --- a/lib/portage/util/elf/constants.py +++ b/lib/portage/util/elf/constants.py @@ -35,6 +35,7 @@ EM_IA_64 = 50 EM_X86_64 = 62 EM_ALTERA_NIOS2 = 113 EM_AARCH64 = 183 +EM_AMDGPU = 224 EM_RISCV = 243 EM_LOONGARCH = 258 EM_ALPHA = 0x9026
[gentoo-commits] proj/portage:master commit in: lib/portage/dep/, lib/portage/package/ebuild/, lib/portage/, lib/portage/cache/, ...
commit: 9e288a776d9668a2f71a83610217edd517fa7079 Author: Thomas Bracht Laumann Jespersen laumann xyz> AuthorDate: Tue Apr 12 12:39:51 2022 + Commit: Sam James gentoo org> CommitDate: Wed Apr 13 03:26:37 2022 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=9e288a77 cleanup: replace '!= None' with 'is not None' Result from running this: find -name '*.py' |xargs sed -i -e 's/!= None/is not None/g' Same as the previous commit, just figured I'd keep the results in separate commits. Signed-off-by: Thomas Bracht Laumann Jespersen laumann.xyz> Closes: https://github.com/gentoo/portage/pull/812 Signed-off-by: Sam James gentoo.org> lib/_emerge/is_valid_package_atom.py | 2 +- lib/portage/_sets/base.py| 2 +- lib/portage/_sets/files.py | 6 +++--- lib/portage/cache/anydbm.py | 2 +- lib/portage/cache/mappings.py| 4 ++-- lib/portage/cache/sql_template.py| 6 +++--- lib/portage/dbapi/vartree.py | 8 lib/portage/dep/__init__.py | 2 +- lib/portage/dep/dep_check.py | 2 +- lib/portage/mail.py | 2 +- lib/portage/package/ebuild/fetch.py | 2 +- 11 files changed, 19 insertions(+), 19 deletions(-) diff --git a/lib/_emerge/is_valid_package_atom.py b/lib/_emerge/is_valid_package_atom.py index 004337e25..d05d35e17 100644 --- a/lib/_emerge/is_valid_package_atom.py +++ b/lib/_emerge/is_valid_package_atom.py @@ -18,7 +18,7 @@ def insert_category_into_atom(atom, category): def is_valid_package_atom(x, allow_repo=False, allow_build_id=True): if "/" not in x.split(":")[0]: x2 = insert_category_into_atom(x, "cat") -if x2 != None: +if x2 is not None: x = x2 return isvalidatom( x, allow_blockers=False, allow_repo=allow_repo, allow_build_id=allow_build_id diff --git a/lib/portage/_sets/base.py b/lib/portage/_sets/base.py index 8e540f3c8..23e8e795e 100644 --- a/lib/portage/_sets/base.py +++ b/lib/portage/_sets/base.py @@ -226,7 +226,7 @@ class InternalPackageSet(EditablePackageSet): super(InternalPackageSet, self).__init__( allow_wildcard=allow_wildcard, allow_repo=allow_repo ) -if initial_atoms != None: +if initial_atoms is not None: self.update(initial_atoms) def clear(self): diff --git a/lib/portage/_sets/files.py b/lib/portage/_sets/files.py index 4d7f6f1ab..21e6933fa 100644 --- a/lib/portage/_sets/files.py +++ b/lib/portage/_sets/files.py @@ -56,18 +56,18 @@ class StaticFileSet(EditablePackageSet): value = [] for line in metadata: line = line.strip() -if len(line) == 0 and key != None: +if len(line) == 0 and key is not None: setattr(self, key, " ".join(value)) key = None elif line[-1] == ":" and key is None: key = line[:-1].lower() value = [] -elif key != None: +elif key is not None: value.append(line) else: pass else: -if key != None: +if key is not None: setattr(self, key, " ".join(value)) def _validate(self, atom): diff --git a/lib/portage/cache/anydbm.py b/lib/portage/cache/anydbm.py index 2ab82a9f8..cf5f3fa4b 100644 --- a/lib/portage/cache/anydbm.py +++ b/lib/portage/cache/anydbm.py @@ -90,7 +90,7 @@ class database(fs_template.FsBased): return cpv in self.__db def __del__(self): -if "__db" in self.__dict__ and self.__db != None: +if "__db" in self.__dict__ and self.__db is not None: self.__db.sync() self.__db.close() diff --git a/lib/portage/cache/mappings.py b/lib/portage/cache/mappings.py index c0f2147a9..00126cf44 100644 --- a/lib/portage/cache/mappings.py +++ b/lib/portage/cache/mappings.py @@ -250,7 +250,7 @@ class LazyLoad(Mapping): def __getitem__(self, key): if key in self.d: return self.d[key] -if self.pull != None: +if self.pull is not None: self.d.update(self.pull()) self.pull = None return self.d[key] @@ -264,7 +264,7 @@ class LazyLoad(Mapping): def __contains__(self, key): if key in self.d: return True -if self.pull != None: +if self.pull is not None: self.d.update(self.pull()) self.pull = None return key in self.d diff --git a/lib/portage/cache/sql_template.py b/lib/portage/cache/sql_template.py index 99cd41a34..f8ce72d5b 100644 --- a/lib/portage/cache/sql_template.py +++ b/lib/portage/cache/sql_template.py @@ -152,7 +152,7 @@ class SQLDatabase(template.database): def __del__(self): # just to be safe. -if "db" in self.__dict__ and self.db != None: +if "db" in self.__dict__ and self.db is not None: self.commit()
[gentoo-commits] proj/portage:master commit in: lib/portage/dep/
commit: afcdeffeb038523df511ee4efc3a98cc602499ed Author: Wolfgang E. Sanyer gmail com> AuthorDate: Thu Sep 23 15:36:10 2021 + Commit: Matt Turner gentoo org> CommitDate: Tue Mar 15 02:52:03 2022 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=afcdeffe portage.dep.Atom: Clean up __new__ parameters Reviewed-by: Matt Turner gentoo.org> Signed-off-by: Wolfgang E. Sanyer gmail.com> Signed-off-by: Matt Turner gentoo.org> lib/portage/dep/__init__.py | 12 +--- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/lib/portage/dep/__init__.py b/lib/portage/dep/__init__.py index 3b3577025..13c0f4ef7 100644 --- a/lib/portage/dep/__init__.py +++ b/lib/portage/dep/__init__.py @@ -1489,17 +1489,7 @@ class Atom(str): def __init__(self, forbid_overlap=False): self.overlap = self._overlap(forbid=forbid_overlap) -def __new__( -cls, -s, -unevaluated_atom=None, -allow_wildcard=False, -allow_repo=None, -_use=None, -eapi=None, -is_valid_flag=None, -allow_build_id=None, -): +def __new__(cls, s, *args, **kwargs): return str.__new__(cls, s) def __init__(
[gentoo-commits] proj/portage:master commit in: lib/portage/dep/, lib/portage/tests/resolver/
commit: 17d64dba6363c15069f49bfe3dc2060a9811e288 Author: Zac Medico gentoo org> AuthorDate: Sat Mar 5 19:22:08 2022 + Commit: Zac Medico gentoo org> CommitDate: Sat Mar 5 19:23:39 2022 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=17d64dba Revert "dep_zapdeps: avoid new slots when appropriate (bug 828136)" Revert the change from bug 828136, since it prevents solving of some blockers unless --update and --deep are specified as reported in bug 833014. Bug: https://bugs.gentoo.org/833014 Reverts: a7289ac0eaaa0d435bf6d9bfb2724a6b39adcbee Signed-off-by: Zac Medico gentoo.org> lib/portage/dep/dep_check.py | 6 +- lib/portage/tests/resolver/test_installkernel.py | 20 +--- .../tests/resolver/test_unecessary_slot_upgrade.py | 11 --- 3 files changed, 2 insertions(+), 35 deletions(-) diff --git a/lib/portage/dep/dep_check.py b/lib/portage/dep/dep_check.py index 8ca4c0b9d..9fccda08b 100644 --- a/lib/portage/dep/dep_check.py +++ b/lib/portage/dep/dep_check.py @@ -376,7 +376,6 @@ def dep_zapdeps( # c) contains masked installed packages # d) is the first item -no_new_slots = [] preferred_in_graph = [] preferred_installed = preferred_in_graph preferred_any_slot = preferred_in_graph @@ -392,7 +391,6 @@ def dep_zapdeps( # unsat_use_* must come after preferred_non_installed # for correct ordering in cases like || ( foo[a] foo[b] ). choice_bins = ( -no_new_slots, preferred_in_graph, preferred_non_installed, unsat_use_in_graph, @@ -691,9 +689,7 @@ def dep_zapdeps( other.append(this_choice) else: if all_use_satisfied: -if new_slot_count == 0 and not want_update: -no_new_slots.append(this_choice) -elif all_in_graph: +if all_in_graph: preferred_in_graph.append(this_choice) elif all_installed: if all_installed_slots: diff --git a/lib/portage/tests/resolver/test_installkernel.py b/lib/portage/tests/resolver/test_installkernel.py index b73bbe5bb..5909b53aa 100644 --- a/lib/portage/tests/resolver/test_installkernel.py +++ b/lib/portage/tests/resolver/test_installkernel.py @@ -58,25 +58,8 @@ class InstallKernelTestCase(TestCase): ), ], ), -# Demonstrate bug 833014, where the calculation fails unless +# Test bug 833014, where the calculation failed unless # --update and --deep are specified. -ResolverPlaygroundTestCase( -[ -"sys-kernel/installkernel-systemd-boot", -"sys-kernel/gentoo-kernel-bin", -], -ambiguous_merge_order=True, -success=False, -mergelist=[ -"sys-kernel/installkernel-systemd-boot-1", -"sys-kernel/gentoo-kernel-bin-5.15.23", -"virtual/dist-kernel-5.15.23", -( -"!sys-kernel/installkernel-gentoo", -"!sys-kernel/installkernel-systemd-boot", -), -], -), ResolverPlaygroundTestCase( [ "sys-kernel/installkernel-systemd-boot", @@ -84,7 +67,6 @@ class InstallKernelTestCase(TestCase): ], ambiguous_merge_order=True, success=True, -options={"--deep": True, "--update": True}, mergelist=[ "virtual/dist-kernel-5.15.23", "sys-kernel/installkernel-systemd-boot-1", diff --git a/lib/portage/tests/resolver/test_unecessary_slot_upgrade.py b/lib/portage/tests/resolver/test_unecessary_slot_upgrade.py index f8b8b346a..a89ebdb67 100644 --- a/lib/portage/tests/resolver/test_unecessary_slot_upgrade.py +++ b/lib/portage/tests/resolver/test_unecessary_slot_upgrade.py @@ -26,13 +26,6 @@ class UnnecessarySlotrUpgradeTestCase(TestCase): test_cases = ( # Test bug 828136, where an unnecessary python slot upgrade # was triggered. -ResolverPlaygroundTestCase( -[ -"app-misc/a", -], -success=True, -mergelist=("app-misc/a-1",), -), ResolverPlaygroundTestCase( [ "app-misc/a", @@ -42,10 +35,6 @@ class UnnecessarySlotrUpgradeTestCase(TestCase): "dev-lang/python-3.10", "app-misc/a-1", ), -options={ -"--deep": True, -"--update": True, -},
[gentoo-commits] proj/portage:master commit in: lib/portage/dep/soname/, lib/portage/util/elf/
commit: f6cdba7689ea423245a232cc13103dd988363845 Author: WANG Xuerui xen0n name> AuthorDate: Mon Aug 9 07:31:25 2021 + Commit: Sam James gentoo org> CommitDate: Tue Dec 14 03:37:13 2021 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=f6cdba76 multilib_category.py: recognize LoongArch ABIs Add its ELF machine number constant as well. The Gentoo ARCH is "loong"; all six ABIs defined in the LoongArch ELF psABI spec [1] are supported. The upstream binutils port currently implements an earlier version of the spec [2]; the ILP32 ABIs are never fully implemented so far, and the value for LP64D is coincidentally the same, so the code here stays compatible. This is preparatory work towards a port to the LoongArch architecture, which is the new RISC architecture from Loongson Corporation after switching away from MIPS. [1]: https://github.com/loongson/LoongArch-Documentation/blob/23d53fe146a4/docs/LoongArch-ELF-ABI-EN.adoc [2]: https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=include/elf/loongarch.h;h=b4d801ae9bd5a6c4562ca6b1cbae6e6d45d6c704;hb=HEAD Signed-off-by: WANG Xuerui xen0n.name> Closes: https://github.com/gentoo/portage/pull/740 Signed-off-by: Sam James gentoo.org> lib/portage/dep/soname/multilib_category.py | 26 ++ lib/portage/util/elf/constants.py | 9 + 2 files changed, 35 insertions(+) diff --git a/lib/portage/dep/soname/multilib_category.py b/lib/portage/dep/soname/multilib_category.py index ab855d339..567b1d32e 100644 --- a/lib/portage/dep/soname/multilib_category.py +++ b/lib/portage/dep/soname/multilib_category.py @@ -11,6 +11,7 @@ # arm_{32,64} # hppa_{32,64} # ia_{32,64} +# loong_{ilp32s,ilp32f,ilp32d,lp64s,lp64f,lp64d} # m68k_{32,64} # mips_{eabi32,eabi64,n32,n64,o32,o64} # ppc_{32,64} @@ -37,6 +38,13 @@ from portage.util.elf.constants import ( EF_MIPS_ABI2, EF_RISCV_FLOAT_ABI_DOUBLE, EF_RISCV_RVC, +EF_LOONGARCH_ABI_LP64_SOFT_FLOAT, +EF_LOONGARCH_ABI_LP64_SINGLE_FLOAT, +EF_LOONGARCH_ABI_LP64_DOUBLE_FLOAT, +EF_LOONGARCH_ABI_ILP32_SOFT_FLOAT, +EF_LOONGARCH_ABI_ILP32_SINGLE_FLOAT, +EF_LOONGARCH_ABI_ILP32_DOUBLE_FLOAT, +EF_LOONGARCH_ABI_MASK, ELFCLASS32, ELFCLASS64, EM_386, @@ -46,6 +54,7 @@ from portage.util.elf.constants import ( EM_ARM, EM_ALTERA_NIOS2, EM_IA_64, +EM_LOONGARCH, EM_MIPS, EM_PARISC, EM_PPC, @@ -71,6 +80,7 @@ _machine_prefix_map = { EM_ALTERA_NIOS2: "nios2", EM_ARM: "arm", EM_IA_64: "ia64", +EM_LOONGARCH: "loong", EM_MIPS: "mips", EM_PARISC: "hppa", EM_PPC: "ppc", @@ -84,6 +94,15 @@ _machine_prefix_map = { EM_X86_64: "x86", } +_loong_abi_map = { +EF_LOONGARCH_ABI_LP64_SOFT_FLOAT: "lp64s", +EF_LOONGARCH_ABI_LP64_SINGLE_FLOAT: "lp64f", +EF_LOONGARCH_ABI_LP64_DOUBLE_FLOAT: "lp64d", +EF_LOONGARCH_ABI_ILP32_SOFT_FLOAT: "ilp32s", +EF_LOONGARCH_ABI_ILP32_SINGLE_FLOAT: "ilp32f", +EF_LOONGARCH_ABI_ILP32_DOUBLE_FLOAT: "ilp32d", +} + _mips_abi_map = { E_MIPS_ABI_EABI32: "eabi32", E_MIPS_ABI_EABI64: "eabi64", @@ -92,6 +111,12 @@ _mips_abi_map = { } +def _compute_suffix_loong(elf_header): + +loong_abi = elf_header.e_flags & EF_LOONGARCH_ABI_MASK +return _loong_abi_map.get(loong_abi) + + def _compute_suffix_mips(elf_header): name = None @@ -136,6 +161,7 @@ def _compute_suffix_riscv(elf_header): _specialized_funcs = { +"loong": _compute_suffix_loong, "mips": _compute_suffix_mips, "riscv": _compute_suffix_riscv, } diff --git a/lib/portage/util/elf/constants.py b/lib/portage/util/elf/constants.py index d86b39483..19b72cfa1 100644 --- a/lib/portage/util/elf/constants.py +++ b/lib/portage/util/elf/constants.py @@ -36,6 +36,7 @@ EM_X86_64 = 62 EM_ALTERA_NIOS2 = 113 EM_AARCH64 = 183 EM_RISCV = 243 +EM_LOONGARCH = 258 EM_ALPHA = 0x9026 E_ENTRY = 24 @@ -52,3 +53,11 @@ EF_RISCV_FLOAT_ABI_SOFT = 0x EF_RISCV_FLOAT_ABI_SINGLE = 0x0002 EF_RISCV_FLOAT_ABI_DOUBLE = 0x0004 EF_RISCV_FLOAT_ABI_QUAD = 0x0006 + +EF_LOONGARCH_ABI_LP64_SOFT_FLOAT = 0b001 +EF_LOONGARCH_ABI_LP64_SINGLE_FLOAT = 0b010 +EF_LOONGARCH_ABI_LP64_DOUBLE_FLOAT = 0b011 +EF_LOONGARCH_ABI_ILP32_SOFT_FLOAT = 0b101 +EF_LOONGARCH_ABI_ILP32_SINGLE_FLOAT = 0b110 +EF_LOONGARCH_ABI_ILP32_DOUBLE_FLOAT = 0b111 +EF_LOONGARCH_ABI_MASK = 0x07
[gentoo-commits] proj/portage:master commit in: lib/portage/dep/, lib/portage/tests/resolver/
commit: a7289ac0eaaa0d435bf6d9bfb2724a6b39adcbee Author: Zac Medico gentoo org> AuthorDate: Sat Dec 4 23:54:47 2021 + Commit: Zac Medico gentoo org> CommitDate: Sun Dec 5 18:40:44 2021 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=a7289ac0 dep_zapdeps: avoid new slots when appropriate (bug 828136) Place choices that do not pull in new slots into a preferred choice bin, so that they will not be mixed with choices that contain unnecessary upgrades. This fixes the included test case so that an unnecessary new python slot is not pulled in. Bug: https://bugs.gentoo.org/828136 Signed-off-by: Zac Medico gentoo.org> lib/portage/dep/dep_check.py | 6 ++- .../tests/resolver/test_unecessary_slot_upgrade.py | 62 ++ 2 files changed, 67 insertions(+), 1 deletion(-) diff --git a/lib/portage/dep/dep_check.py b/lib/portage/dep/dep_check.py index 9fccda08b..8ca4c0b9d 100644 --- a/lib/portage/dep/dep_check.py +++ b/lib/portage/dep/dep_check.py @@ -376,6 +376,7 @@ def dep_zapdeps( # c) contains masked installed packages # d) is the first item +no_new_slots = [] preferred_in_graph = [] preferred_installed = preferred_in_graph preferred_any_slot = preferred_in_graph @@ -391,6 +392,7 @@ def dep_zapdeps( # unsat_use_* must come after preferred_non_installed # for correct ordering in cases like || ( foo[a] foo[b] ). choice_bins = ( +no_new_slots, preferred_in_graph, preferred_non_installed, unsat_use_in_graph, @@ -689,7 +691,9 @@ def dep_zapdeps( other.append(this_choice) else: if all_use_satisfied: -if all_in_graph: +if new_slot_count == 0 and not want_update: +no_new_slots.append(this_choice) +elif all_in_graph: preferred_in_graph.append(this_choice) elif all_installed: if all_installed_slots: diff --git a/lib/portage/tests/resolver/test_unecessary_slot_upgrade.py b/lib/portage/tests/resolver/test_unecessary_slot_upgrade.py new file mode 100644 index 0..f8b8b346a --- /dev/null +++ b/lib/portage/tests/resolver/test_unecessary_slot_upgrade.py @@ -0,0 +1,62 @@ +# Copyright 2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +from portage.tests import TestCase +from portage.tests.resolver.ResolverPlayground import ( +ResolverPlayground, +ResolverPlaygroundTestCase, +) + + +class UnnecessarySlotrUpgradeTestCase(TestCase): +def testUnnecessarySlotUpgrade(self): +ebuilds = { +"app-misc/a-1": { +"EAPI": "8", +"RDEPEND": "|| ( dev-lang/python:3.10 dev-lang/python:3.9 ) || ( dev-lang/python:3.10 dev-lang/python:3.9 )", +}, +"dev-lang/python-3.9": {"SLOT": "3.9"}, +"dev-lang/python-3.10": {"SLOT": "3.10"}, +} + +installed = { +"dev-lang/python-3.9": {"SLOT": "3.9"}, +} + +test_cases = ( +# Test bug 828136, where an unnecessary python slot upgrade +# was triggered. +ResolverPlaygroundTestCase( +[ +"app-misc/a", +], +success=True, +mergelist=("app-misc/a-1",), +), +ResolverPlaygroundTestCase( +[ +"app-misc/a", +], +success=True, +mergelist=( +"dev-lang/python-3.10", +"app-misc/a-1", +), +options={ +"--deep": True, +"--update": True, +}, +), +) + +playground = ResolverPlayground( +debug=False, ebuilds=ebuilds, installed=installed +) + +try: +for test_case in test_cases: +playground.run_TestCase(test_case) +self.assertEqual(test_case.test_success, True, test_case.fail_msg) +finally: +playground.debug = False +playground.cleanup()
[gentoo-commits] proj/portage:master commit in: lib/portage/dep/
commit: b59e2545a88dccf70e546d49e08a5a99110dd628 Author: Zac Medico gentoo org> AuthorDate: Sat Nov 28 01:04:07 2020 + Commit: Zac Medico gentoo org> CommitDate: Sat Nov 28 03:13:02 2020 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=b59e2545 backtracking: fix virtual choices for circular deps (bug 757306) Fix virtual choices to be consistent with circular dependency backtracking choices. Fixes: f78a91e44e3e ("backtracking: adjust || preference to break dependency cycles") Bug: https://bugs.gentoo.org/757306 Signed-off-by: Zac Medico gentoo.org> lib/portage/dep/dep_check.py | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/portage/dep/dep_check.py b/lib/portage/dep/dep_check.py index 60c8ec6d0..b89d5d651 100644 --- a/lib/portage/dep/dep_check.py +++ b/lib/portage/dep/dep_check.py @@ -356,6 +356,7 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None, # Alias the trees we'll be checking availability against parent = trees[myroot].get("parent") + virt_parent = trees[myroot].get("virt_parent") priority = trees[myroot].get("priority") graph_db = trees[myroot].get("graph_db") graph= trees[myroot].get("graph") @@ -596,8 +597,10 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None, if match_from_list(atom, cpv_slot_list): circular_atom = atom break - else: - for circular_child in circular_dependency.get(parent, []): + if circular_atom is None and circular_dependency is not None: + for circular_child in itertools.chain( + circular_dependency.get(parent, []), + circular_dependency.get(virt_parent, [])): for atom in atoms: if not atom.blocker and atom.match(circular_child): circular_atom = atom
[gentoo-commits] proj/portage:master commit in: lib/portage/dep/soname/
commit: 4c3b7adb63d3fef8963877291a490600a1a55443 Author: Andreas K. Hüttel gentoo org> AuthorDate: Fri Sep 11 21:42:14 2020 + Commit: Zac Medico gentoo org> CommitDate: Mon Sep 14 06:52:39 2020 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=4c3b7adb Recognize riscv_{ilp32,ilp32d} ABIs Bug: https://bugs.gentoo.org/742446 Signed-off-by: Zac Medico gentoo.org> lib/portage/dep/soname/multilib_category.py | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/portage/dep/soname/multilib_category.py b/lib/portage/dep/soname/multilib_category.py index 301c62a35..fb2839e01 100644 --- a/lib/portage/dep/soname/multilib_category.py +++ b/lib/portage/dep/soname/multilib_category.py @@ -14,7 +14,7 @@ # m68k_{32,64} # mips_{eabi32,eabi64,n32,n64,o32,o64} # ppc_{32,64} -# riscv_{lp64,lp64d} +# riscv_{ilp32,ilp32d,lp64,lp64d} # s390_{32,64} # sh_{32,64} # sparc_{32,64} @@ -99,6 +99,8 @@ def _compute_suffix_riscv(elf_header): Compute riscv multilib suffix. In order to avoid possible misidentification, only the following ABIs are recognized: + * ilp32 + * ilp32d * lp64 * lp64d """ @@ -111,8 +113,13 @@ def _compute_suffix_riscv(elf_header): elif elf_header.e_flags == EF_RISCV_RVC | EF_RISCV_FLOAT_ABI_DOUBLE: name = "lp64d" - return name + elif elf_header.ei_class == ELFCLASS32: + if elf_header.e_flags == EF_RISCV_RVC: + name = "ilp32" + elif elf_header.e_flags == EF_RISCV_RVC | EF_RISCV_FLOAT_ABI_DOUBLE: + name = "ilp32d" + return name _specialized_funcs = { "mips": _compute_suffix_mips,
[gentoo-commits] proj/portage:master commit in: lib/portage/dep/
commit: 766683ccfee145b356928eb11cd6969c7928d369 Author: Aaron Bauman gentoo org> AuthorDate: Wed Aug 5 23:51:57 2020 + Commit: Zac Medico gentoo org> CommitDate: Thu Aug 6 05:57:53 2020 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=766683cc lib/portage/dep/__init__.py: fix multiple-imports Signed-off-by: Aaron Bauman gentoo.org> Signed-off-by: Zac Medico gentoo.org> lib/portage/dep/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/portage/dep/__init__.py b/lib/portage/dep/__init__.py index 50266a21b..c0ed2dd3c 100644 --- a/lib/portage/dep/__init__.py +++ b/lib/portage/dep/__init__.py @@ -13,8 +13,10 @@ __all__ = [ '_repo_separator', '_slot_separator', ] -import re, sys +import re +import sys import warnings + from functools import lru_cache import portage
[gentoo-commits] proj/portage:master commit in: lib/portage/dep/soname/
commit: b90802486aa4a48bca5cdf10eb59a7eb2beb1a42 Author: Aaron Bauman gentoo org> AuthorDate: Mon Aug 3 20:20:21 2020 + Commit: Zac Medico gentoo org> CommitDate: Mon Aug 3 21:15:51 2020 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=b9080248 lib/portage/dep/soname/SonameAtom.py: drop unused-import Signed-off-by: Aaron Bauman gentoo.org> Signed-off-by: Zac Medico gentoo.org> lib/portage/dep/soname/SonameAtom.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/portage/dep/soname/SonameAtom.py b/lib/portage/dep/soname/SonameAtom.py index 62b2ee5e1..9abdf6906 100644 --- a/lib/portage/dep/soname/SonameAtom.py +++ b/lib/portage/dep/soname/SonameAtom.py @@ -1,9 +1,6 @@ # Copyright 2015-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 - -from portage import _encodings, _unicode_encode - class SonameAtom: __slots__ = ("multilib_category", "soname", "_hash_key",
[gentoo-commits] proj/portage:master commit in: lib/portage/dep/
commit: 8296e641d825d90b3140599e30701ca625edb6e7 Author: Aaron Bauman gentoo org> AuthorDate: Mon Aug 3 19:05:52 2020 + Commit: Zac Medico gentoo org> CommitDate: Mon Aug 3 19:22:00 2020 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=8296e641 lib/portage/dep/dep_check.py: drop unused-import Signed-off-by: Aaron Bauman gentoo.org> Signed-off-by: Zac Medico gentoo.org> lib/portage/dep/dep_check.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/portage/dep/dep_check.py b/lib/portage/dep/dep_check.py index 625599725..b6491a430 100644 --- a/lib/portage/dep/dep_check.py +++ b/lib/portage/dep/dep_check.py @@ -19,7 +19,7 @@ from portage.localization import _ from portage.util import writemsg, writemsg_level from portage.util.digraph import digraph from portage.util.SlotObject import SlotObject -from portage.versions import vercmp, _pkg_str +from portage.versions import vercmp def _expand_new_virtuals(mysplit, edebug, mydbapi, mysettings, myroot="/", trees=None, use_mask=None, use_force=None, **kwargs):
[gentoo-commits] proj/portage:master commit in: lib/portage/dep/, lib/portage/
commit: d9ee5b09664ab2255b62c1d52d554721ef8b716a Author: Chun-Yu Shei google com> AuthorDate: Mon Jul 13 06:30:20 2020 + Commit: Zac Medico gentoo org> CommitDate: Mon Jul 13 07:14:29 2020 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=d9ee5b09 Add caching to use_reduce, vercmp, and catpkgsplit Each of these functions is called repeatedly with the same arguments many times. Cache sizes were selected to minimize memory use increase, while still providing about the same speedup compared to a cache with unbounded size. "emerge -uDvpU --with-bdeps=y @world" runtime decreases from 44.32s -> 29.94s -- a 48% speedup, while the maximum value of the RES column in htop increases from 280 MB -> 290 MB. "emerge -ep @world" time slightly decreases from 18.77s -> 17.93, while max observed RES value actually decreases from 228 MB -> 214 MB (similar values observed across a few before/after runs). Bug: https://bugs.gentoo.org/732378 Signed-off-by: Zac Medico gentoo.org> lib/portage/dep/__init__.py | 107 ++-- lib/portage/versions.py | 3 ++ 2 files changed, 67 insertions(+), 43 deletions(-) diff --git a/lib/portage/dep/__init__.py b/lib/portage/dep/__init__.py index 72988357a..314338f7c 100644 --- a/lib/portage/dep/__init__.py +++ b/lib/portage/dep/__init__.py @@ -17,6 +17,7 @@ __all__ = [ import re, sys import warnings +from functools import lru_cache import portage portage.proxy.lazyimport.lazyimport(globals(), @@ -404,49 +405,10 @@ def paren_enclose(mylist, unevaluated_atom=False, opconvert=False): mystrparts.append(x) return " ".join(mystrparts) -def use_reduce(depstr, uselist=(), masklist=(), matchall=False, excludeall=(), is_src_uri=False, \ - eapi=None, opconvert=False, flat=False, is_valid_flag=None, token_class=None, matchnone=False, - subset=None): - """ - Takes a dep string and reduces the use? conditionals out, leaving an array - with subarrays. All redundant brackets are removed. - - @param depstr: depstring - @type depstr: String - @param uselist: Sequence of use enabled flags - @type uselist: Sequence - @param masklist: Sequence of masked flags (always treated as disabled) - @type masklist: Sequence - @param matchall: Treat all conditionals as active. Used by repoman. - @type matchall: Bool - @param excludeall: Sequence of flags for which negated conditionals are always treated as inactive. - @type excludeall: Sequence - @param is_src_uri: Indicates if depstr represents a SRC_URI - @type is_src_uri: Bool - @param eapi: Indicates the EAPI the dep string has to comply to - @type eapi: String - @param opconvert: Put every operator as first element into it's argument list - @type opconvert: Bool - @param flat: Create a flat list of all tokens - @type flat: Bool - @param is_valid_flag: Function that decides if a given use flag might be used in use conditionals - @type is_valid_flag: Function - @param token_class: Convert all non operator tokens into this class - @type token_class: Class - @param matchnone: Treat all conditionals as inactive. Used by digestgen(). - @type matchnone: Bool - @param subset: Select a subset of dependencies conditional on the given flags - @type subset: Sequence - @rtype: List - @return: The use reduced depend array - """ - if isinstance(depstr, list): - if portage._internal_caller: - warnings.warn(_("Passing paren_reduced dep arrays to %s is deprecated. " + \ - "Pass the original dep string instead.") % \ - ('portage.dep.use_reduce',), DeprecationWarning, stacklevel=2) - depstr = paren_enclose(depstr) - +@lru_cache(1024) +def _use_reduce_cached(depstr, uselist, masklist, matchall, excludeall, \ + is_src_uri, eapi, opconvert, flat, is_valid_flag, token_class, \ + matchnone,subset): if opconvert and flat: raise ValueError("portage.dep.use_reduce: 'opconvert' and 'flat' are mutually exclusive") @@ -769,6 +731,65 @@ def use_reduce(depstr, uselist=(), masklist=(), matchall=False, excludeall=(), i return stack[0] +def use_reduce(depstr, uselist=(), masklist=(), matchall=False, excludeall=(), is_src_uri=False, \ + eapi=None, opconvert=False, flat=False, is_valid_flag=None, token_class=None, matchnone=False, + subset=None): + """ + Takes a dep string and reduces the use? conditionals out, leaving an array + with subarrays. All redundant brackets are removed. + + @param depstr: depstring + @type depstr: String + @param uselist: Sequence of use enabled flags + @type uselist: Sequence + @param masklist: Sequence of
[gentoo-commits] proj/portage:master commit in: lib/portage/dep/
commit: e762752a8bf5c19e0d6d7b22de86306bfa4270ba Author: Zac Medico gentoo org> AuthorDate: Tue Mar 3 06:25:45 2020 + Commit: Zac Medico gentoo org> CommitDate: Tue Mar 3 06:27:12 2020 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=e762752a dep_zapdeps: skip want_update_pkg if parent is None (bug 711400) Skip the want_update_pkg call when parent is None, since passing a None parent to want_update_pkg results in an error like this: File "libdep/dep_check.py", line 513, in dep_zapdeps if graph_interface.want_update_pkg(parent, avail_pkg): File "lib/_emerge/depgraph.py", line 5850, in _want_update_pkg depth = parent.depth or 0 AttributeError: 'NoneType' object has no attribute 'depth' Fixes: f7d83d75c6b0 ("dep_zapdeps: adjust || preference for slot upgrades (bug 706278)") Bug: https://bugs.gentoo.org/711400 Signed-off-by: Zac Medico gentoo.org> lib/portage/dep/dep_check.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/portage/dep/dep_check.py b/lib/portage/dep/dep_check.py index 1dd289eec..9534590bf 100644 --- a/lib/portage/dep/dep_check.py +++ b/lib/portage/dep/dep_check.py @@ -510,7 +510,7 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None, else: new_slot_count = 0 for slot_atom, avail_pkg in slot_map.items(): - if graph_interface.want_update_pkg(parent, avail_pkg): + if parent is not None and graph_interface.want_update_pkg(parent, avail_pkg): want_update = True if (not slot_atom.cp.startswith("virtual/") and not graph_db.match_pkgs(slot_atom)):
[gentoo-commits] proj/portage:master commit in: lib/portage/dep/, lib/portage/tests/resolver/
commit: 216c52d1ea447fbf06f6ac00e5d771780508601d Author: Zac Medico gentoo org> AuthorDate: Sat Feb 8 18:41:56 2020 + Commit: Zac Medico gentoo org> CommitDate: Sat Feb 8 18:48:45 2020 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=216c52d1 dep_zapdeps: prefer choices with all in graph (bug 649622) Prefer choices where all packages have been pulled into the graph (except for choices that eliminate upgrades). This logic must be consistent between both update and removal (depclean) actions in order to avoid pulling in packages only to have them removed by depclean, as reported in bug 649622 for virtual/w3m. Bug: https://bugs.gentoo.org/649622 Signed-off-by: Zac Medico gentoo.org> lib/portage/dep/dep_check.py | 8 +++- lib/portage/tests/resolver/test_or_choices.py | 9 ++--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/portage/dep/dep_check.py b/lib/portage/dep/dep_check.py index 8adb92da2..1dd289eec 100644 --- a/lib/portage/dep/dep_check.py +++ b/lib/portage/dep/dep_check.py @@ -722,11 +722,9 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None, # Prefer upgrades. (has_upgrade and not has_downgrade) - # For removal actions, prefer choices where all packages - # have been pulled into the graph, except for choices that - # eliminate upgrades. - or (graph_interface and graph_interface.removal_action and - choice_1.all_in_graph and not choice_2.all_in_graph and + # Prefer choices where all packages have been pulled into + # the graph, except for choices that eliminate upgrades. + or (choice_1.all_in_graph and not choice_2.all_in_graph and not (has_downgrade and not has_upgrade)) ): # promote choice_1 in front of choice_2 diff --git a/lib/portage/tests/resolver/test_or_choices.py b/lib/portage/tests/resolver/test_or_choices.py index f1cc75499..5679d0b5b 100644 --- a/lib/portage/tests/resolver/test_or_choices.py +++ b/lib/portage/tests/resolver/test_or_choices.py @@ -465,13 +465,13 @@ class OrChoicesTestCase(TestCase): test_cases = ( - # Test for bug 649622, where virtual/w3m is installed only + # Test for bug 649622, where virtual/w3m was pulled in only # to be removed by the next emerge --depclean. ResolverPlaygroundTestCase( ['@world'], options = {'--update': True, '--deep': True}, success = True, - mergelist = ['virtual/w3m-0'] + mergelist = [] ), ) @@ -499,7 +499,10 @@ class OrChoicesTestCase(TestCase): # Test for bug 649622, where virtual/w3m is removed by # emerge --depclean immediately after it's installed - # by a world update. + # by a world update. Note that removal of virtual/w3m here + # is essentially indistinguishable from removal of + # dev-util/cmake-bootstrap in the depclean test case for + # bug 703440. ResolverPlaygroundTestCase( [], options={'--depclean': True},
[gentoo-commits] proj/portage:master commit in: lib/portage/dep/, lib/portage/tests/resolver/
commit: d77d933b4a9cb2b830e661806a2a8689ffbac0ef Author: Zac Medico gentoo org> AuthorDate: Sat Feb 1 04:53:45 2020 + Commit: Zac Medico gentoo org> CommitDate: Sat Feb 1 20:54:11 2020 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=d77d933b depclean: do not eliminate upgrades (bug 707108) For depclean actions, prefer choices where all packages have been pulled into the graph, except for choices that eliminate upgrades. This solves the test case for bug 707108, where depclean eliminated a new slot of python that had been pulled in by a world update. This should also prevent non-deterministic elimination of the latest vala slot that was reported in bug 693790. NOTE: There's a common perception (expressed in bug 705700) that emerge is pulling in an "unecessary" python slot in cases when that python slot is not enabled in PYTHON_TARGETS. However, the so-called "unnecessary" slot is practically indistinguishable from a desirable upgrade such as the missed llvm slot upgrade that was reported in bug 706278. Therefore, be advised that emerge must pull in the highest visible slot (regardless of PYTHON_TARGETS) in order to ensure that a desirable upgrade is not missed. Fixes: f7d83d75c6b0 ("dep_zapdeps: adjust || preference for slot upgrades (bug 706278)") Bug: https://bugs.gentoo.org/707108 Bug: https://bugs.gentoo.org/706278 Bug: https://bugs.gentoo.org/705700 Bug: https://bugs.gentoo.org/693790 Signed-off-by: Zac Medico gentoo.org> lib/portage/dep/dep_check.py | 23 +-- lib/portage/tests/resolver/test_or_choices.py | 4 ++-- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/lib/portage/dep/dep_check.py b/lib/portage/dep/dep_check.py index a7ae2cfa4..8adb92da2 100644 --- a/lib/portage/dep/dep_check.py +++ b/lib/portage/dep/dep_check.py @@ -690,17 +690,12 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None, # choice_1 will not be promoted, so move on break if ( - # For removal actions, prefer choices where all packages - # have been pulled into the graph. - (graph_interface and graph_interface.removal_action and - choice_1.all_in_graph and not choice_2.all_in_graph) - # Prefer choices where all_installed_slots is True, except # in cases where we want to upgrade to a new slot as in # bug 706278. Don't compare new_slot_count here since that # would aggressively override the preference order defined # in the ebuild, breaking the test case for bug 645002. - or (choice_1.all_installed_slots and + (choice_1.all_installed_slots and not choice_2.all_installed_slots and not choice_2.want_update) ): @@ -711,8 +706,6 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None, break intersecting_cps = cps.intersection(choice_2.cp_map) - if not intersecting_cps: - continue has_upgrade = False has_downgrade = False for cp in intersecting_cps: @@ -724,8 +717,18 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None, has_upgrade = True else: has_downgrade = True - break - if has_upgrade and not has_downgrade: + + if ( + # Prefer upgrades. + (has_upgrade and not has_downgrade) + + # For removal actions, prefer choices where all packages + # have been pulled into the graph, except for choices that + # eliminate upgrades. + or (graph_interface and graph_interface.removal_action and + choice_1.all_in_graph and not choice_2.all_in_graph and + not (has_downgrade and not has_upgrade)) + ):
[gentoo-commits] proj/portage:master commit in: lib/portage/dep/, lib/portage/tests/resolver/
commit: ef66aab178180288132177011ad0e910fb2cd55e Author: Zac Medico gentoo org> AuthorDate: Tue Jan 21 03:19:01 2020 + Commit: Zac Medico gentoo org> CommitDate: Thu Jan 23 05:52:43 2020 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=ef66aab1 dep_zapdeps: break more buildtime cycles (bug 705986) Buildtime cycle breaking was not enabled in cases where the all_in_graph variable was False, and this prevented the pypy / pypy-exe dependency cycle from being broken as shown in the test case for bug 705986. In order to break more buildtime cycles, enable cycle breaking regardless of the state of the all_in_graph variable. Bug: https://bugs.gentoo.org/705986 Signed-off-by: Zac Medico gentoo.org> lib/portage/dep/dep_check.py| 5 ++--- lib/portage/tests/resolver/test_circular_choices.py | 14 -- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/lib/portage/dep/dep_check.py b/lib/portage/dep/dep_check.py index 3a0c7bbe9..321d961dd 100644 --- a/lib/portage/dep/dep_check.py +++ b/lib/portage/dep/dep_check.py @@ -1,4 +1,4 @@ -# Copyright 2010-2018 Gentoo Foundation +# Copyright 2010-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 from __future__ import unicode_literals @@ -570,8 +570,7 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None, circular_atom = None if not (parent is None or priority is None) and \ (parent.onlydeps or - (all_in_graph and priority.buildtime and - not (priority.satisfied or priority.optional))): + (priority.buildtime and not priority.satisfied and not priority.optional)): # Check if the atom would result in a direct circular # dependency and try to avoid that if it seems likely # to be unresolvable. This is only relevant for diff --git a/lib/portage/tests/resolver/test_circular_choices.py b/lib/portage/tests/resolver/test_circular_choices.py index 968677a46..a383519fc 100644 --- a/lib/portage/tests/resolver/test_circular_choices.py +++ b/lib/portage/tests/resolver/test_circular_choices.py @@ -1,4 +1,4 @@ -# Copyright 2011-2019 Gentoo Authors +# Copyright 2011-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 from portage.tests import TestCase @@ -184,17 +184,11 @@ class CircularPypyExeTestCase(TestCase): } test_cases = ( - # Demonstrate bug 705986, where a USE change suggestion is given - # even though an || preference adjustment is available. + # Demonstrate bug 705986, where a USE change suggestion was given + # even though an || preference adjustment would solve the problem + # by pulling in pypy-exe-bin instead of pypy-exe. ResolverPlaygroundTestCase( ['dev-python/pypy'], - circular_dependency_solutions = {'dev-python/pypy-7.3.0': {frozenset({('low-memory', True)})}}, - success = False, - ), - # Demonstrate explicit pypy-exe-bin argument used as a workaround - # for bug 705986. - ResolverPlaygroundTestCase( - ['dev-python/pypy', 'dev-python/pypy-exe-bin'], mergelist=['dev-python/pypy-exe-bin-7.3.0', 'dev-python/pypy-7.3.0'], success = True, ),
[gentoo-commits] proj/portage:master commit in: lib/portage/dep/
commit: 8663207ddef5124466ac8943f6b61789d8ab54a4 Author: Justin Turner Arthur gmail com> AuthorDate: Tue Oct 22 02:59:34 2019 + Commit: Zac Medico gentoo org> CommitDate: Wed Oct 23 17:01:39 2019 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=8663207d Improve runtime performance of portage.dep module functions. Use tuple vs list, reduce dot-refs, remove unused, use operators instead of function calls where possible. Signed-off-by: Justin Turner Arthur gmail.com> Signed-off-by: Zac Medico gentoo.org> lib/portage/dep/__init__.py | 108 ++-- 1 file changed, 55 insertions(+), 53 deletions(-) diff --git a/lib/portage/dep/__init__.py b/lib/portage/dep/__init__.py index 285e0c2ec..f08f6ba4c 100644 --- a/lib/portage/dep/__init__.py +++ b/lib/portage/dep/__init__.py @@ -17,7 +17,6 @@ __all__ = [ import re, sys import warnings -from itertools import chain import portage portage.proxy.lazyimport.lazyimport(globals(), @@ -28,8 +27,8 @@ from portage import _encodings, _unicode_decode, _unicode_encode from portage.eapi import _get_eapi_attrs from portage.exception import InvalidAtom, InvalidData, InvalidDependString from portage.localization import _ -from portage.versions import catpkgsplit, catsplit, \ - vercmp, ververify, _cp, _cpv, _pkg_str, _slot, _unknown_repo, _vr +from portage.versions import _cp, _cpv, _pkg_str, _slot, _unknown_repo, _vr, \ + catpkgsplit, vercmp, ververify import portage.cache.mappings if sys.hexversion >= 0x300: @@ -405,7 +404,7 @@ def paren_enclose(mylist, unevaluated_atom=False, opconvert=False): mystrparts.append(x) return " ".join(mystrparts) -def use_reduce(depstr, uselist=[], masklist=[], matchall=False, excludeall=[], is_src_uri=False, \ +def use_reduce(depstr, uselist=(), masklist=(), matchall=False, excludeall=(), is_src_uri=False, \ eapi=None, opconvert=False, flat=False, is_valid_flag=None, token_class=None, matchnone=False): """ Takes a dep string and reduces the use? conditionals out, leaving an array @@ -413,14 +412,14 @@ def use_reduce(depstr, uselist=[], masklist=[], matchall=False, excludeall=[], i @param depstr: depstring @type depstr: String - @param uselist: List of use enabled flags - @type uselist: List - @param masklist: List of masked flags (always treated as disabled) - @type masklist: List + @param uselist: Sequence of use enabled flags + @type uselist: Sequence + @param masklist: Sequence of masked flags (always treated as disabled) + @type masklist: Sequence @param matchall: Treat all conditionals as active. Used by repoman. @type matchall: Bool - @param excludeall: List of flags for which negated conditionals are always treated as inactive. - @type excludeall: List + @param excludeall: Sequence of flags for which negated conditionals are always treated as inactive. + @type excludeall: Sequence @param is_src_uri: Indicates if depstr represents a SRC_URI @type is_src_uri: Bool @param eapi: Indicates the EAPI the dep string has to comply to @@ -903,7 +902,7 @@ class _use_dep(object): if conditional: self.conditional = self._conditionals_class() for k in "enabled", "disabled", "equal", "not_equal": - setattr(self.conditional, k, frozenset(conditional.get(k, []))) + setattr(self.conditional, k, frozenset(conditional.get(k, ( def __bool__(self): return bool(self.tokens) @@ -1012,7 +1011,7 @@ class _use_dep(object): conditional = {} tokens = [] - all_defaults = frozenset(chain(self.missing_enabled, self.missing_disabled)) + all_defaults = self.missing_enabled | self.missing_disabled def validate_flag(flag): return is_valid_flag(flag) or flag in all_defaults @@ -1249,35 +1248,36 @@ class Atom(_unicode): m = atom_re.match(s) if m is None: raise InvalidAtom(self) - gdict = m.groupdict() - if m.group('star') is not None: + m_group = m.group + if m_group('star') is not None: op = '=*' base = atom_re.groupindex['star'] - cp = m.group(base + 1) - cpv = m.group('star')[1:] - extended_version = m.group(base + 4) + cp = m_group(base + 1) +
[gentoo-commits] proj/portage:master commit in: lib/portage/dep/
commit: 75dfea84dea28ca2e14b6f1cb7bc3ca1c2f87a0c Author: Rolf Eike Beer sf-mail de> AuthorDate: Thu May 9 18:12:14 2019 + Commit: Zac Medico gentoo org> CommitDate: Sat May 11 20:45:26 2019 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=75dfea84 really fix some dep API documentation -interface description needs to be last for epydoc, even if it works at some places when it is not -fix some other minor things like wrong parameter names and missing types Closes: https://github.com/gentoo/portage/pull/426 Signed-off-by: Rolf Eike Beer sf-mail.de> Signed-off-by: Zac Medico gentoo.org> lib/portage/dep/__init__.py | 112 +++- 1 file changed, 58 insertions(+), 54 deletions(-) diff --git a/lib/portage/dep/__init__.py b/lib/portage/dep/__init__.py index 418bfa011..285e0c2ec 100644 --- a/lib/portage/dep/__init__.py +++ b/lib/portage/dep/__init__.py @@ -186,20 +186,20 @@ def _get_useflag_re(eapi): def cpvequal(cpv1, cpv2): """ + Example Usage: + >>> from portage.dep import cpvequal + >>> cpvequal("sys-apps/portage-2.1","sys-apps/portage-2.1") + >>> True + @param cpv1: CategoryPackageVersion (no operators) Example: "sys-apps/portage-2.1" @type cpv1: String @param cpv2: CategoryPackageVersion (no operators) Example: "sys-apps/portage-2.1" @type cpv2: String @rtype: Boolean @return: - 1. True if cpv1 = cpv2 - 2. False Otherwise - 3. Throws PortageException if cpv1 or cpv2 is not a CPV - - Example Usage: - >>> from portage.dep import cpvequal - >>> cpvequal("sys-apps/portage-2.1","sys-apps/portage-2.1") - >>> True + 1. True if cpv1 = cpv2 + 2. False Otherwise + 3. Throws PortageException if cpv1 or cpv2 is not a CPV """ try: @@ -411,8 +411,8 @@ def use_reduce(depstr, uselist=[], masklist=[], matchall=False, excludeall=[], i Takes a dep string and reduces the use? conditionals out, leaving an array with subarrays. All redundant brackets are removed. - @param deparray: depstring - @type deparray: String + @param depstr: depstring + @type depstr: String @param uselist: List of use enabled flags @type uselist: List @param masklist: List of masked flags (always treated as disabled) @@ -734,16 +734,16 @@ def dep_opconvert(deplist): dep is a '||' or '&&' operator, combine it with the list of deps that follows.. + Example usage: + >>> test = ["blah", "||", ["foo", "bar", "baz"]] + >>> dep_opconvert(test) + ['blah', ['||', 'foo', 'bar', 'baz']] + @param deplist: A list of deps to format @type deplist: List @rtype: List @return: The new list with the new ordering - - Example usage: - >>> test = ["blah", "||", ["foo", "bar", "baz"]] - >>> dep_opconvert(test) - ['blah', ['||', 'foo', 'bar', 'baz']] """ if portage._internal_caller: warnings.warn(_("%s is deprecated. Use %s with the opconvert parameter set to True instead.") % \ @@ -1434,7 +1434,7 @@ class Atom(_unicode): """ Returns True if slot_operator == "=" and sub_slot is not None. NOTE: foo/bar:2= is unbuilt and returns False, whereas foo/bar:2/2= - is built and returns True. + is built and returns True. """ return self.slot_operator == "=" and self.sub_slot is not None @@ -1729,16 +1729,16 @@ def get_operator(mydep): """ Return the operator used in a depstring. + Example usage: + >>> from portage.dep import * + >>> get_operator(">=test-1.0") + '>=' + @param mydep: The dep string to check @type mydep: String @rtype: String @return: The operator. One of: '~', '=', '>', '<', '=*', '>=', or '<=' - - Example usage: - >>> from portage.dep import * - >>> get_operator(">=test-1.0") - '>=' """ if not isinstance(mydep, Atom): mydep = Atom(mydep) @@ -1749,14 +1749,14 @@ def dep_getcpv(mydep): """ Return the category-package-version with any operators/slot specifications stripped off + Example usage: + >>> dep_getcpv('>=media-libs/test-3.0') + 'media-libs/test-3.0' + @param mydep: The depstring @type mydep: String @rtype: String @return: The depstring with the operator removed - - Example usage: - >>> dep_getcpv('>=media-libs/test-3.0') - 'media-libs/test-3.0' """ if not
[gentoo-commits] proj/portage:master commit in: lib/portage/dep/
commit: 7f2c4b0d402be190a9575346a76e3ee9361179ac Author: Rolf Eike Beer sf-mail de> AuthorDate: Sat May 4 17:54:22 2019 + Commit: Zac Medico gentoo org> CommitDate: Sat May 4 21:08:03 2019 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=7f2c4b0d fix some documentation in the dep API -fix bad parameter names -fix duplicate @param that should be @type -move "Example usage:" below the parameter list Closes: https://github.com/gentoo/portage/pull/424 Signed-off-by: Rolf Eike Beer sf-mail.de> Signed-off-by: Zac Medico gentoo.org> lib/portage/dep/__init__.py | 140 ++-- 1 file changed, 69 insertions(+), 71 deletions(-) diff --git a/lib/portage/dep/__init__.py b/lib/portage/dep/__init__.py index 26595da47..418bfa011 100644 --- a/lib/portage/dep/__init__.py +++ b/lib/portage/dep/__init__.py @@ -186,7 +186,6 @@ def _get_useflag_re(eapi): def cpvequal(cpv1, cpv2): """ - @param cpv1: CategoryPackageVersion (no operators) Example: "sys-apps/portage-2.1" @type cpv1: String @param cpv2: CategoryPackageVersion (no operators) Example: "sys-apps/portage-2.1" @@ -201,7 +200,6 @@ def cpvequal(cpv1, cpv2): >>> from portage.dep import cpvequal >>> cpvequal("sys-apps/portage-2.1","sys-apps/portage-2.1") >>> True - """ try: @@ -384,15 +382,15 @@ def paren_enclose(mylist, unevaluated_atom=False, opconvert=False): """ Convert a list to a string with sublists enclosed with parens. - Example usage: - >>> test = ['foobar','foo',['bar','baz']] - >>> paren_enclose(test) - 'foobar foo ( bar baz )' - @param mylist: The list @type mylist: List @rtype: String @return: The paren enclosed string + + Example usage: + >>> test = ['foobar','foo',['bar','baz']] + >>> paren_enclose(test) + 'foobar foo ( bar baz )' """ mystrparts = [] for x in mylist: @@ -736,16 +734,16 @@ def dep_opconvert(deplist): dep is a '||' or '&&' operator, combine it with the list of deps that follows.. - Example usage: - >>> test = ["blah", "||", ["foo", "bar", "baz"]] - >>> dep_opconvert(test) - ['blah', ['||', 'foo', 'bar', 'baz']] - @param deplist: A list of deps to format - @type mydep: List + @type deplist: List @rtype: List @return: The new list with the new ordering + + Example usage: + >>> test = ["blah", "||", ["foo", "bar", "baz"]] + >>> dep_opconvert(test) + ['blah', ['||', 'foo', 'bar', 'baz']] """ if portage._internal_caller: warnings.warn(_("%s is deprecated. Use %s with the opconvert parameter set to True instead.") % \ @@ -769,14 +767,14 @@ def flatten(mylist): Recursively traverse nested lists and return a single list containing all non-list elements that are found. - Example usage: - >>> flatten([1, [2, 3, [4]]]) - [1, 2, 3, 4] - @param mylist: A list containing nested lists and non-list elements. @type mylist: List @rtype: List @return: A single list containing only non-list elements. + + Example usage: + >>> flatten([1, [2, 3, [4]]]) + [1, 2, 3, 4] """ if portage._internal_caller: warnings.warn(_("%s is deprecated and will be removed without replacement.") % \ @@ -1731,16 +1729,16 @@ def get_operator(mydep): """ Return the operator used in a depstring. - Example usage: - >>> from portage.dep import * - >>> get_operator(">=test-1.0") - '>=' - @param mydep: The dep string to check @type mydep: String @rtype: String @return: The operator. One of: '~', '=', '>', '<', '=*', '>=', or '<=' + + Example usage: + >>> from portage.dep import * + >>> get_operator(">=test-1.0") + '>=' """ if not isinstance(mydep, Atom): mydep = Atom(mydep) @@ -1751,14 +1749,14 @@ def dep_getcpv(mydep): """ Return the category-package-version with any operators/slot specifications stripped off - Example usage: - >>> dep_getcpv('>=media-libs/test-3.0') - 'media-libs/test-3.0' - @param mydep: The depstring @type mydep: String @rtype: String @return: The depstring with the operator removed + + Example usage: + >>> dep_getcpv('>=media-libs/test-3.0') + 'media-libs/test-3.0' """ if not isinstance(mydep, Atom): mydep = Atom(mydep) @@ -1769,14 +1767,14 @@ def