diff options
-rw-r--r-- | .github/workflows/ci.yml | 2 | ||||
-rw-r--r-- | NEWS | 58 | ||||
-rwxr-xr-x | bin/emerge-webrsync | 9 | ||||
-rw-r--r-- | bin/install-qa-check.d/90config-impl-decl | 4 | ||||
-rw-r--r-- | bin/install-qa-check.d/90gcc-warnings | 2 | ||||
-rw-r--r-- | bin/phase-helpers.sh | 148 | ||||
-rw-r--r-- | lib/_emerge/JobStatusDisplay.py | 9 | ||||
-rw-r--r-- | lib/_emerge/SpawnProcess.py | 4 | ||||
-rw-r--r-- | lib/_emerge/depgraph.py | 2 | ||||
-rw-r--r-- | lib/portage/eapi.py | 34 | ||||
-rw-r--r-- | lib/portage/process.py | 7 | ||||
-rw-r--r-- | lib/portage/tests/resolver/test_virtual_slot.py | 8 | ||||
-rw-r--r-- | lib/portage/util/futures/_asyncio/__init__.py | 37 | ||||
-rw-r--r-- | lib/portage/util/whirlpool.py | 2 | ||||
-rw-r--r-- | man/emerge.1 | 2 | ||||
-rw-r--r-- | meson.build | 2 | ||||
-rwxr-xr-x | misc/emerge-delta-webrsync | 9 | ||||
-rw-r--r-- | pylintrc | 7 |
18 files changed, 178 insertions, 168 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2ac66970e..1ec1e8381 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,7 +28,7 @@ jobs: start-method: 'spawn' - python-version: '3.11' start-method: 'spawn' - - python-version: '3.13-dev' + - python-version: '3.12' start-method: 'spawn' - python-version: 'pypy-3.10' start-method: 'spawn' @@ -6,14 +6,39 @@ Release notes take the form of the following optional categories: * Bug fixes * Cleanups -portage-3.0.66 (UNRELEASED) +Bug fixes: +* depgraph: Ignore blockers when computing virtual deps visibility (PR #1387). + +portage-3.0.66.1 (2024-09-18) +-------------- + +Bug fixes: +* JobStatusDisplay: Fix width of display. Notable with the new 'merge wait' + metric. + +* install-qa-check.d: 90config-impl-decl: Skip various false positives. + +portage-3.0.66 (2024-09-11) -------------- Features: +* binrepos.conf: Support custom download location (bug #934784). + + In binrepos.conf, 'location' can now be set to choose the location + for fetched binpkgs from a particular remote repository. + * emerge: Make bare --root-deps option install build-time dependencies to ROOT as well as / for all EAPIs rather than instead of / for EAPI 6 and below (bug #435066). -* Show length of merge-wait queue as part of the status display + +* Show length of merge-wait queue as part of the status display. + +* src: Allow GIL to be disabled for Whirlpool C extension (bug #934220). + +* ELF: Recognise BPF (bug #937485). + +* portage.util.compression_probe: Handle lack of ctypes (libffi) for + bootstrapping purposes. Bug fixes: * ebuild: Handle Bash 5.2's change in behavior which enables the shopt @@ -21,6 +46,9 @@ Bug fixes: working ebuilds. Future EAPIs will need to adjust the logic added by this change. See bug #907061. +* doebuild.spawn: Fix hang with FEATURES="network-sandbox-proxy" in consumers + like gentoolkit (bug #937384). + * make.globals: add bcachefs_effective.* and bcachefs.* to PORTAGE_XATTR_EXCLUDE * vartree, movefile: Warn when rewriting a symlink (bug #934514). @@ -31,6 +59,32 @@ Bug fixes: * emerge: Fix parallel-fetch to properly terminate FETCHCOMMAND processes when needed, using a SIGTERM handler (bug #936273). +* unpack: Don't display "Unpacking ..." message for skipped files. + Match file extensions case-sensitively in old EAPIs, fixes PMS compliance. + +* sync: zipfile: Fix installing module. + +* ebuild: Improve 'maintainer mode' QA check. + +* emerge-webrsync: Honour sync-webrsync-verify-signature attribute. + +* dispatch-conf: Don't use SHELL (bug #910560). + +* phase-functions: Fix QA_SONAME_NO_SYMLINK so it accepts regex (bug #924953). + +* ebuild.5: Improve QA_PREBUILT docs. + +* install-qa-check.d: 90gcc-warnings: Handle color in logs for build.log too. + +Cleanups: +* tar_safe_extract: Port to Python 3.14 (bug #933433). + +* Drop unnecessary f-string use. + +* Improve detection of xtrace (debugging). + +* eapi.py: Use attrs rather than hardcoding / repeating EAPI properties. + portage-3.0.65 (2024-06-04) -------------- diff --git a/bin/emerge-webrsync b/bin/emerge-webrsync index 124bcaddc..caa4986da 100755 --- a/bin/emerge-webrsync +++ b/bin/emerge-webrsync @@ -105,17 +105,16 @@ do_debug=0 keep=false handle_pgp_setup() { - local attr repo_has_webrsync_verify webrsync_gpg - # WEBRSYNC_VERIFY_SIGNATURE=0: disable PGP verification # WEBRSYNC_VERIFY_SIGNATURE=1: use gemato for verification, fallback to regular gpg # WEBRSYNC_VERIFY_SIGNATURE=2: use legacy FEATURES="webrsync-gpg" WEBRSYNC_VERIFY_SIGNATURE=1 - has webrsync-gpg ${FEATURES} && webrsync_gpg=1 + has webrsync-gpg ${FEATURES} && webrsync_gpg=1 || webrsync_gpg=0 - attr=$(__repo_attr "${repo_name}" sync-webrsync-verify-signature) - [[ ${attr,,} == @(true|yes) ]] && repo_has_webrsync_verify=1 + repo_has_webrsync_verify=$( + has $(__repo_attr "${repo_name}" sync-webrsync-verify-signature | LC_ALL=C tr '[:upper:]' '[:lower:]') true yes + ) if [[ -n ${PORTAGE_TEMP_GPG_DIR} ]] || [[ ${repo_has_webrsync_verify} -eq 1 ]]; then # If FEATURES=webrsync-gpg is enabled then allow direct emerge-webrsync diff --git a/bin/install-qa-check.d/90config-impl-decl b/bin/install-qa-check.d/90config-impl-decl index 8768c99c6..06bb7195f 100644 --- a/bin/install-qa-check.d/90config-impl-decl +++ b/bin/install-qa-check.d/90config-impl-decl @@ -45,6 +45,10 @@ add_default_skips() { [[ ${CHOST} == *linux* ]] && QA_CONFIG_IMPL_DECL_SKIP+=( acl acl_get_perm_np + pthread_cond_timedwait_monotonic_np + pthread_get_name_np + pthread_set_name_np + pthread_threadid_np res_getservers res_ndestroy statacl diff --git a/bin/install-qa-check.d/90gcc-warnings b/bin/install-qa-check.d/90gcc-warnings index 2e728268e..c7e3d6a8a 100644 --- a/bin/install-qa-check.d/90gcc-warnings +++ b/bin/install-qa-check.d/90gcc-warnings @@ -162,7 +162,7 @@ gcc_warn_check() { # Force C locale to work around slow multibyte locales, bug #160234 # Force text mode as newer grep will treat non-ASCII (e.g. UTF-8) as # binary when we run in the C locale. - f=$(LC_CTYPE=C LC_COLLATE=C "${grep_cmd}" -E -a "${joined_msgs}" "${PORTAGE_LOG_FILE}" | uniq) + f=$(LC_ALL='C' sed -E -e $'s/\033\[[0-9;]*[A-Za-z]//g' < "${PORTAGE_LOG_FILE}" | LC_CTYPE=C LC_COLLATE=C "${grep_cmd}" -E -a "${joined_msgs}" | uniq) if [[ -n ${f} ]] ; then abort="yes" diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh index 77132eb06..5a3513019 100644 --- a/bin/phase-helpers.sh +++ b/bin/phase-helpers.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# Copyright 1999-2023 Gentoo Authors +# Copyright 1999-2024 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 if ___eapi_has_DESTTREE_INSDESTTREE; then @@ -321,20 +321,20 @@ unpack() { local x local y y_insensitive local suffix suffix_insensitive + local suffix_known local myfail local eapi=${EAPI:-0} [[ -z "$*" ]] && die "Nothing passed to the 'unpack' command" for x in "$@"; do - __vecho ">>> Unpacking ${x} to ${PWD}" suffix=${x##*.} suffix_insensitive=$(LC_ALL=C tr "[:upper:]" "[:lower:]" <<< "${suffix}") y=${x%.*} y=${y##*.} y_insensitive=$(LC_ALL=C tr "[:upper:]" "[:lower:]" <<< "${y}") - # wrt PMS 11.3.3.13 Misc Commands + # wrt PMS 12.3.15 Misc Commands if [[ ${x} != */* ]]; then # filename without path of any kind srcdir=${DISTDIR}/ @@ -360,14 +360,33 @@ unpack() { fi [[ ! -s ${srcdir}${x} ]] && die "unpack: ${x} does not exist" + suffix_known="" + case ${suffix_insensitive} in + tar|tgz|tbz2|tbz|zip|jar|gz|z|bz2|bz|a|deb|lzma) suffix_known=1 ;; + 7z) ___eapi_unpack_supports_7z && suffix_known=1 ;; + rar) ___eapi_unpack_supports_rar && suffix_known=1 ;; + lha|lzh) ___eapi_unpack_supports_lha && suffix_known=1 ;; + xz) ___eapi_unpack_supports_xz && suffix_known=1 ;; + txz) ___eapi_unpack_supports_txz && suffix_known=1 ;; + esac + + if ___eapi_unpack_is_case_sensitive \ + && ! has "${suffix}" "${suffix_insensitive}" \ + ZIP Z 7Z RAR LHA LHa; then + suffix_known="" + fi + + if [[ -n ${suffix_known} ]]; then + __vecho ">>> Unpacking ${x} to ${PWD}" + else + __vecho "=== Skipping unpack of ${x}" + continue + fi + __unpack_tar() { - if [[ ${y_insensitive} == tar ]] ; then - if ___eapi_unpack_is_case_sensitive && \ - [[ tar != ${y} ]] ; then - eqawarn "QA Notice: unpack called with" \ - "secondary suffix '${y}' which is unofficially" \ - "supported with EAPI '${EAPI}'. Instead use 'tar'." - fi + if [[ ${y_insensitive} == tar ]] \ + && ! ___eapi_unpack_is_case_sensitive \ + || [[ ${y} == tar ]]; then $1 -c -- "${srcdir}${x}" | tar xof - __assert_sigpipe_ok "${myfail}" else @@ -380,114 +399,45 @@ unpack() { myfail="unpack: failure unpacking ${x}" case "${suffix_insensitive}" in tar) - if ___eapi_unpack_is_case_sensitive && \ - [[ tar != ${suffix} ]] ; then - eqawarn "QA Notice: unpack called with" \ - "suffix '${suffix}' which is unofficially supported" \ - "with EAPI '${EAPI}'. Instead use 'tar'." - fi tar xof "${srcdir}${x}" || die "${myfail}" ;; tgz) - if ___eapi_unpack_is_case_sensitive && \ - [[ tgz != ${suffix} ]] ; then - eqawarn "QA Notice: unpack called with" \ - "suffix '${suffix}' which is unofficially supported" \ - "with EAPI '${EAPI}'. Instead use 'tgz'." - fi tar xozf "${srcdir}${x}" || die "${myfail}" ;; tbz|tbz2) - if ___eapi_unpack_is_case_sensitive && \ - [[ " tbz tbz2 " != *" ${suffix} "* ]] ; then - eqawarn "QA Notice: unpack called with" \ - "suffix '${suffix}' which is unofficially supported" \ - "with EAPI '${EAPI}'. Instead use 'tbz' or 'tbz2'." - fi ${PORTAGE_BUNZIP2_COMMAND:-${PORTAGE_BZIP2_COMMAND} -d} -c -- "${srcdir}${x}" | tar xof - __assert_sigpipe_ok "${myfail}" ;; zip|jar) - if ___eapi_unpack_is_case_sensitive && \ - [[ " ZIP zip jar " != *" ${suffix} "* ]] ; then - eqawarn "QA Notice: unpack called with" \ - "suffix '${suffix}' which is unofficially supported" \ - "with EAPI '${EAPI}'." \ - "Instead use 'ZIP', 'zip', or 'jar'." - fi # unzip will interactively prompt under some error conditions, # as reported in bug #336285 ( set +x ; while true ; do echo n || break ; done ) | \ unzip -qo "${srcdir}${x}" || die "${myfail}" ;; gz|z) - if ___eapi_unpack_is_case_sensitive && \ - [[ " gz z Z " != *" ${suffix} "* ]] ; then - eqawarn "QA Notice: unpack called with" \ - "suffix '${suffix}' which is unofficially supported" \ - "with EAPI '${EAPI}'. Instead use 'gz', 'z', or 'Z'." - fi __unpack_tar "gzip -d" ;; bz2|bz) - if ___eapi_unpack_is_case_sensitive && \ - [[ " bz bz2 " != *" ${suffix} "* ]] ; then - eqawarn "QA Notice: unpack called with" \ - "suffix '${suffix}' which is unofficially supported" \ - "with EAPI '${EAPI}'. Instead use 'bz' or 'bz2'." - fi __unpack_tar "${PORTAGE_BUNZIP2_COMMAND:-${PORTAGE_BZIP2_COMMAND} -d}" ;; 7z) - if ___eapi_unpack_supports_7z; then - local my_output - my_output="$(7z x -y "${srcdir}${x}")" - if [[ $? -ne 0 ]]; then - echo "${my_output}" >&2 - die "${myfail}" - fi + local my_output + my_output="$(7z x -y "${srcdir}${x}")" + if [[ $? -ne 0 ]]; then + echo "${my_output}" >&2 + die "${myfail}" fi ;; rar) - if ___eapi_unpack_is_case_sensitive && \ - [[ " rar RAR " != *" ${suffix} "* ]] ; then - eqawarn "QA Notice: unpack called with" \ - "suffix '${suffix}' which is unofficially supported" \ - "with EAPI '${EAPI}'. Instead use 'rar' or 'RAR'." - fi - if ___eapi_unpack_supports_rar; then - unrar x -idq -o+ "${srcdir}${x}" || die "${myfail}" - fi + unrar x -idq -o+ "${srcdir}${x}" || die "${myfail}" ;; lha|lzh) - if ___eapi_unpack_is_case_sensitive && \ - [[ " LHA LHa lha lzh " != *" ${suffix} "* ]] ; then - eqawarn "QA Notice: unpack called with" \ - "suffix '${suffix}' which is unofficially supported" \ - "with EAPI '${EAPI}'." \ - "Instead use 'LHA', 'LHa', 'lha', or 'lzh'." - fi - if ___eapi_unpack_supports_lha; then - lha xfq "${srcdir}${x}" || die "${myfail}" - fi + lha xfq "${srcdir}${x}" || die "${myfail}" ;; a) - if ___eapi_unpack_is_case_sensitive && \ - [[ " a " != *" ${suffix} "* ]] ; then - eqawarn "QA Notice: unpack called with" \ - "suffix '${suffix}' which is unofficially supported" \ - "with EAPI '${EAPI}'. Instead use 'a'." - fi ar x "${srcdir}${x}" || die "${myfail}" ;; deb) - if ___eapi_unpack_is_case_sensitive && \ - [[ " deb " != *" ${suffix} "* ]] ; then - eqawarn "QA Notice: unpack called with" \ - "suffix '${suffix}' which is unofficially supported" \ - "with EAPI '${EAPI}'. Instead use 'deb'." - fi - # Unpacking .deb archives can not always be done with # `ar`. For instance on AIX this doesn't work out. # If `ar` is not the GNU binutils version and we have @@ -522,35 +472,13 @@ unpack() { fi ;; lzma) - if ___eapi_unpack_is_case_sensitive && \ - [[ " lzma " != *" ${suffix} "* ]] ; then - eqawarn "QA Notice: unpack called with" \ - "suffix '${suffix}' which is unofficially supported" \ - "with EAPI '${EAPI}'. Instead use 'lzma'." - fi __unpack_tar "lzma -d" ;; xz) - if ___eapi_unpack_is_case_sensitive && \ - [[ " xz " != *" ${suffix} "* ]] ; then - eqawarn "QA Notice: unpack called with" \ - "suffix '${suffix}' which is unofficially supported" \ - "with EAPI '${EAPI}'. Instead use 'xz'." - fi - if ___eapi_unpack_supports_xz; then - __unpack_tar "xz -T$(___makeopts_jobs) -d" - fi + __unpack_tar "xz -T$(___makeopts_jobs) -d" ;; txz) - if ___eapi_unpack_is_case_sensitive && \ - [[ " txz " != *" ${suffix} "* ]] ; then - eqawarn "QA Notice: unpack called with" \ - "suffix '${suffix}' which is unofficially supported" \ - "with EAPI '${EAPI}'. Instead use 'txz'." - fi - if ___eapi_unpack_supports_txz; then - XZ_OPT="-T$(___makeopts_jobs)" tar xof "${srcdir}${x}" || die "${myfail}" - fi + XZ_OPT="-T$(___makeopts_jobs)" tar xof "${srcdir}${x}" || die "${myfail}" ;; esac done diff --git a/lib/_emerge/JobStatusDisplay.py b/lib/_emerge/JobStatusDisplay.py index 78fd8f761..57495c5ae 100644 --- a/lib/_emerge/JobStatusDisplay.py +++ b/lib/_emerge/JobStatusDisplay.py @@ -16,6 +16,9 @@ from _emerge.getloadavg import getloadavg class JobStatusDisplay: + # Used as maximum display width and default fallback value. + max_display_width = 100 + _bound_properties = ("curval", "failed", "running") # Don't update the display unless at least this much @@ -65,14 +68,14 @@ class JobStatusDisplay: if self._isatty: width = portage.output.get_term_size()[1] else: - width = 100 + width = self.max_display_width self._set_width(width) def _set_width(self, width): if width == getattr(self, "width", None): return - if width <= 0 or width > 80: - width = 80 + if width <= 0 or width > self.max_display_width: + width = self.max_display_width object.__setattr__(self, "width", width) object.__setattr__(self, "_jobs_column_width", width - 32) diff --git a/lib/_emerge/SpawnProcess.py b/lib/_emerge/SpawnProcess.py index 513a7b2fe..5d8b3929e 100644 --- a/lib/_emerge/SpawnProcess.py +++ b/lib/_emerge/SpawnProcess.py @@ -51,10 +51,6 @@ class SpawnProcess(SubProcess): ) ) - # Max number of attempts to kill the processes listed in cgroup.procs, - # given that processes may fork before they can be killed. - _CGROUP_CLEANUP_RETRY_MAX = 8 - def _start(self): if self.fd_pipes is None: self.fd_pipes = {} diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py index 2acd8f2e1..ddef7bb0a 100644 --- a/lib/_emerge/depgraph.py +++ b/lib/_emerge/depgraph.py @@ -6022,6 +6022,8 @@ class depgraph: for atoms in rdepend.values(): for atom in atoms: + if atom.blocker: + continue if ignore_use: atom = atom.without_use pkg, existing = self._select_package(pkg.root, atom) diff --git a/lib/portage/eapi.py b/lib/portage/eapi.py index 2c1701870..86b27bdbc 100644 --- a/lib/portage/eapi.py +++ b/lib/portage/eapi.py @@ -41,7 +41,7 @@ def eapi_has_strong_blocks(eapi: str) -> bool: def eapi_has_src_prepare_and_src_configure(eapi: str) -> bool: - return eapi not in ("0", "1") + return _get_eapi_attrs(eapi).src_prepare_src_configure def eapi_supports_prefix(eapi: str) -> bool: @@ -77,15 +77,15 @@ def eapi_exports_ECLASSDIR(eapi: str) -> bool: def eapi_has_pkg_pretend(eapi: str) -> bool: - return eapi not in ("0", "1", "2", "3") + return _get_eapi_attrs(eapi).pkg_pretend def eapi_has_implicit_rdepend(eapi: str) -> bool: - return eapi in ("0", "1", "2", "3") + return _get_eapi_attrs(eapi).rdepend_depend def eapi_has_dosed_dohard(eapi: str) -> bool: - return eapi in ("0", "1", "2", "3") + return _get_eapi_attrs(eapi).dosed_dohard def eapi_has_required_use(eapi: str) -> bool: @@ -109,11 +109,11 @@ def eapi_has_repo_deps(eapi: str) -> bool: def eapi_supports_stable_use_forcing_and_masking(eapi: str) -> bool: - return eapi not in ("0", "1", "2", "3", "4", "4-slot-abi") + return _get_eapi_attrs(eapi).stablemask def eapi_allows_directories_on_profile_level_and_repository_level(eapi: str) -> bool: - return eapi not in ("0", "1", "2", "3", "4", "4-slot-abi", "5", "6") + return _get_eapi_attrs(eapi).profile_file_dirs def eapi_allows_package_provided(eapi: str) -> bool: @@ -150,6 +150,8 @@ _eapi_attrs = collections.namedtuple( "allows_package_provided", "bdepend", "broot", + "dosed_dohard", + "empty_groups_always_true", "exports_AA", "exports_EBUILD_PHASE_FUNC", "exports_ECLASSDIR", @@ -163,19 +165,23 @@ _eapi_attrs = collections.namedtuple( "iuse_effective", "posixish_locale", "path_variables_end_with_trailing_slash", + "pkg_pretend", "prefix", + "profile_file_dirs", + "rdepend_depend", "repo_deps", "required_use", "required_use_at_most_one_of", "selective_src_uri_restriction", "slot_operator", "slot_deps", + "src_prepare_src_configure", "src_uri_arrows", + "stablemask", "strong_blocks", + "sysroot", "use_deps", "use_dep_defaults", - "empty_groups_always_true", - "sysroot", ), ) @@ -223,6 +229,7 @@ def _get_eapi_attrs(eapi_str: Optional[str]) -> _eapi_attrs: allows_package_provided=True, bdepend=False, broot=True, + dosed_dohard=False, empty_groups_always_true=False, exports_AA=False, exports_EBUILD_PHASE_FUNC=True, @@ -236,15 +243,20 @@ def _get_eapi_attrs(eapi_str: Optional[str]) -> _eapi_attrs: iuse_defaults=True, iuse_effective=False, path_variables_end_with_trailing_slash=False, + pkg_pretend=True, posixish_locale=False, prefix=True, + profile_file_dirs=False, + rdepend_depend=False, repo_deps=True, required_use=True, required_use_at_most_one_of=True, selective_src_uri_restriction=True, slot_deps=True, slot_operator=True, + src_prepare_src_configure=True, src_uri_arrows=True, + stablemask=True, strong_blocks=True, sysroot=True, use_deps=True, @@ -256,6 +268,7 @@ def _get_eapi_attrs(eapi_str: Optional[str]) -> _eapi_attrs: allows_package_provided=eapi <= Eapi("6"), bdepend=eapi >= Eapi("7"), broot=eapi >= Eapi("7"), + dosed_dohard=eapi <= Eapi("3"), empty_groups_always_true=eapi <= Eapi("6"), exports_AA=eapi <= Eapi("3"), exports_EBUILD_PHASE_FUNC=eapi >= Eapi("5"), @@ -269,15 +282,20 @@ def _get_eapi_attrs(eapi_str: Optional[str]) -> _eapi_attrs: iuse_defaults=eapi >= Eapi("1"), iuse_effective=eapi >= Eapi("5"), path_variables_end_with_trailing_slash=eapi <= Eapi("6"), + pkg_pretend=eapi >= Eapi("4"), posixish_locale=eapi >= Eapi("6"), prefix=eapi >= Eapi("3"), + profile_file_dirs=eapi >= Eapi("7"), + rdepend_depend=eapi <= Eapi("3"), repo_deps=False, required_use=eapi >= Eapi("4"), required_use_at_most_one_of=eapi >= Eapi("5"), selective_src_uri_restriction=eapi >= Eapi("8"), slot_deps=eapi >= Eapi("1"), slot_operator=eapi >= Eapi("5"), + src_prepare_src_configure=eapi >= Eapi("2"), src_uri_arrows=eapi >= Eapi("2"), + stablemask=eapi >= Eapi("5"), strong_blocks=eapi >= Eapi("2"), sysroot=eapi >= Eapi("7"), use_deps=eapi >= Eapi("2"), diff --git a/lib/portage/process.py b/lib/portage/process.py index e6f6feb35..a66b6a541 100644 --- a/lib/portage/process.py +++ b/lib/portage/process.py @@ -23,6 +23,11 @@ from dataclasses import dataclass from functools import lru_cache, partial from typing import Any, Optional, Callable, Union +try: + from inspect import iscoroutinefunction +except ImportError: + iscoroutinefunction = _asyncio.iscoroutinefunction + from portage import os from portage import _encodings from portage import _unicode_encode @@ -203,7 +208,7 @@ def atexit_register(func, *args, **kargs): manually by calling the run_exitfuncs() function in this module.""" # The internal asyncio wrapper module would trigger a circular import # if used here. - if _asyncio.iscoroutinefunction(func): + if iscoroutinefunction(func): # Add this coroutine function to the exit handlers for the loop # which is associated with the current thread. global_event_loop()._coroutine_exithandlers.append((func, args, kargs)) diff --git a/lib/portage/tests/resolver/test_virtual_slot.py b/lib/portage/tests/resolver/test_virtual_slot.py index 19dc254dd..b032fca8c 100644 --- a/lib/portage/tests/resolver/test_virtual_slot.py +++ b/lib/portage/tests/resolver/test_virtual_slot.py @@ -71,7 +71,13 @@ class VirtualSlotResolverTestCase(TestCase): }, "virtual/jdk-1.7.0": { "SLOT": "1.7", - "RDEPEND": "|| ( =dev-java/icedtea-7* =dev-java/oracle-jdk-bin-1.7.0* )", + "RDEPEND": """ + || ( + =dev-java/icedtea-7* + =dev-java/oracle-jdk-bin-1.7.0* + ) + !virtual/jdk-does-not-exist + """, }, } diff --git a/lib/portage/util/futures/_asyncio/__init__.py b/lib/portage/util/futures/_asyncio/__init__.py index c960d0363..ea67adcae 100644 --- a/lib/portage/util/futures/_asyncio/__init__.py +++ b/lib/portage/util/futures/_asyncio/__init__.py @@ -19,7 +19,6 @@ __all__ = ( "run", "shield", "sleep", - "Task", "wait", "wait_for", ) @@ -39,13 +38,17 @@ from asyncio import ( FIRST_EXCEPTION, Future, InvalidStateError, - iscoroutinefunction, Lock as _Lock, shield, TimeoutError, wait_for, ) +try: + from inspect import iscoroutinefunction +except ImportError: + iscoroutinefunction = _asyncio.iscoroutinefunction + import threading from typing import Optional @@ -120,7 +123,7 @@ def run(coro): run.__doc__ = _real_asyncio.run.__doc__ -def create_subprocess_exec(*args, **kwargs): +def create_subprocess_exec(*args, loop=None, **kwargs): """ Create a subprocess. @@ -141,7 +144,6 @@ def create_subprocess_exec(*args, **kwargs): @rtype: asyncio.subprocess.Process (or compatible) @return: asyncio.subprocess.Process interface """ - loop = _wrap_loop(kwargs.pop("loop", None)) # Python 3.4 and later implement PEP 446, which makes newly # created file descriptors non-inheritable by default. kwargs.setdefault("close_fds", False) @@ -174,16 +176,6 @@ class Lock(_Lock): super().__init__(**kwargs) -class Task(Future): - """ - Schedule the execution of a coroutine: wrap it in a future. A task - is a subclass of Future. - """ - - def __init__(self, coro, loop=None): - raise NotImplementedError - - def ensure_future(coro_or_future, loop=None): """ Wrap a coroutine or an awaitable in a future. @@ -197,6 +189,9 @@ def ensure_future(coro_or_future, loop=None): @rtype: asyncio.Future (or compatible) @return: an instance of Future """ + if loop is None: + return _real_asyncio.ensure_future(coro_or_future) + loop = _wrap_loop(loop) if isinstance(loop._asyncio_wrapper, _AsyncioEventLoop): # Use the real asyncio loop and ensure_future. @@ -221,9 +216,12 @@ def sleep(delay, result=None, loop=None): @param result: result of the future @type loop: asyncio.AbstractEventLoop (or compatible) @param loop: event loop - @rtype: asyncio.Future (or compatible) - @return: an instance of Future + @rtype: collections.abc.Coroutine or asyncio.Future + @return: an instance of Coroutine or Future """ + if loop is None: + return _real_asyncio.sleep(delay, result=result) + loop = _wrap_loop(loop) future = loop.create_future() handle = loop.call_later(delay, future.set_result, result) @@ -322,6 +320,13 @@ def _safe_loop(create: Optional[bool] = True) -> Optional[_AsyncioEventLoop]: _thread_weakrefs.loops = weakref.WeakValueDictionary() try: loop = _thread_weakrefs.loops[thread_key] + if loop.is_closed(): + # Discard wrapped asyncio.run loop that was closed. + del _thread_weakrefs.loops[thread_key] + if loop is _thread_weakrefs.mainloop: + _thread_weakrefs.mainloop = None + loop = None + raise KeyError(thread_key) except KeyError: if not create: return None diff --git a/lib/portage/util/whirlpool.py b/lib/portage/util/whirlpool.py index 62fcfda53..4726846ff 100644 --- a/lib/portage/util/whirlpool.py +++ b/lib/portage/util/whirlpool.py @@ -28,8 +28,6 @@ ## # This Python implementation is therefore also placed in the public domain. -# pylint: disable=mixed-indentation - import warnings from portage.localization import _ diff --git a/man/emerge.1 b/man/emerge.1 index e30f5f813..c629c6826 100644 --- a/man/emerge.1 +++ b/man/emerge.1 @@ -30,7 +30,7 @@ distribution. .SH "EBUILDS, TBZ2S, SETS AND ATOMS" \fBemerge\fR primarily installs packages. You can specify packages to install in five possible ways: an \fIatom\fR, -a \fIset\fR, an installed \fIfile\fR, an \fIebuild\fR, a +a \fIset\fR, an installed \fIfile\fR, an \fIebuild\fR, a \fItbz2\fR file, or a \fIgpkg\fR file. .LP .TP diff --git a/meson.build b/meson.build index 673c1e631..42ec97310 100644 --- a/meson.build +++ b/meson.build @@ -1,7 +1,7 @@ project( 'portage', 'c', - version : '3.0.65', + version : '3.0.66.1', license : 'GPL-2.0-or-later', meson_version : '>=0.58.0' ) diff --git a/misc/emerge-delta-webrsync b/misc/emerge-delta-webrsync index 8550c15fe..a788cdb0e 100755 --- a/misc/emerge-delta-webrsync +++ b/misc/emerge-delta-webrsync @@ -165,17 +165,16 @@ if [[ ! -d $STATE_DIR ]]; then fi handle_pgp_setup() { - local attr repo_has_webrsync_verify webrsync_gpg - # WEBRSYNC_VERIFY_SIGNATURE=0: disable PGP verification # WEBRSYNC_VERIFY_SIGNATURE=1: use gemato for verification, fallback to regular gpg # WEBRSYNC_VERIFY_SIGNATURE=2: use legacy FEATURES="webrsync-gpg" WEBRSYNC_VERIFY_SIGNATURE=1 - has webrsync-gpg ${FEATURES} && webrsync_gpg=1 + has webrsync-gpg ${FEATURES} && webrsync_gpg=1 || webrsync_gpg=0 - attr=$(__repo_attr "${repo_name}" sync-webrsync-verify-signature) - [[ ${attr,,} == @(true|yes) ]] && repo_has_webrsync_verify=1 + repo_has_webrsync_verify=$( + has $(__repo_attr "${repo_name}" sync-webrsync-verify-signature | LC_ALL=C tr '[:upper:]' '[:lower:]') true yes + ) if [[ -n ${PORTAGE_TEMP_GPG_DIR} ]] || [[ ${repo_has_webrsync_verify} -eq 1 ]]; then # If FEATURES=webrsync-gpg is enabled then allow direct emerge-webrsync @@ -219,13 +219,6 @@ max-line-length=100 # Maximum number of lines in a module. max-module-lines=10000 -# List of optional constructs for which whitespace checking is disabled. `dict- -# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}. -# `trailing-comma` allows a space between comma and closing bracket: (a, ). -# `empty-line` allows space-only lines. -no-space-check=trailing-comma, - dict-separator - # Allow the body of a class to be on the same line as the declaration if body # contains single statement. single-line-class-stmt=no |