[gentoo-commits] proj/portage:master commit in: /
commit: ca2728e9bc57b749408cf6c2a2766dab93595ca0 Author: Sam James gentoo org> AuthorDate: Thu Sep 21 15:47:04 2023 + Commit: Sam James gentoo org> CommitDate: Thu Sep 21 15:47:04 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=ca2728e9 NEWS: update Bug: https://bugs.gentoo.org/883071 Signed-off-by: Sam James gentoo.org> NEWS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS b/NEWS index 2e88b894b8..340516a9b4 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,8 @@ Breaking changes: manually add or remove binpkgs from their PKGDIR (bug #889300). Features: +* Refine _slot_operator_check_reverse_dependencies caching (bug #883071). + * bintree: Add new API member (invalid_paths) to allow gentoolkit to later clean up invalid binpkgs (bug #900224).
[gentoo-commits] proj/portage:master commit in: lib/portage/dbapi/
commit: 03489ca1880d4429c18cf7da2ed27ae65a21510b Author: Andreas K. Hüttel gentoo org> AuthorDate: Tue Sep 19 18:15:30 2023 + Commit: Mike Gilbert gentoo org> CommitDate: Wed Sep 20 18:02:20 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=03489ca1 Catch error when trust helper is not found Closes: https://github.com/gentoo/portage/pull/1097 Signed-off-by: Andreas K. Hüttel gentoo.org> Signed-off-by: Mike Gilbert gentoo.org> lib/portage/dbapi/bintree.py | 12 +++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/portage/dbapi/bintree.py b/lib/portage/dbapi/bintree.py index 9d7c45577b..42912b2eb5 100644 --- a/lib/portage/dbapi/bintree.py +++ b/lib/portage/dbapi/bintree.py @@ -1245,7 +1245,17 @@ class binarytree: portage_trust_helper = self.settings.get("PORTAGE_TRUST_HELPER", "") if portage_trust_helper == "": return -ret = subprocess.run(portage_trust_helper) +try: +ret = subprocess.run(portage_trust_helper) +except FileNotFoundError: +writemsg( +_( +"\n!!! Portage trust helper %s for binary packages not found\n!!! Continuing, but did you install app-portage/getuto?\n" +) +% portage_trust_helper, +noiselevel=-1, +) +return ret.check_returncode() def _populate_remote(self, getbinpkg_refresh=True):
[gentoo-commits] proj/portage:master commit in: cnf/, /
commit: 3bc7bfef51d88fd716e882d3931f2873e3493e01 Author: John Helmert III gentoo org> AuthorDate: Sun Jan 1 18:14:57 2023 + Commit: Sam James gentoo org> CommitDate: Tue Sep 19 07:18:44 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=3bc7bfef make.globals: default-on FEATURES=pkgdir-index-trusted Commit fbbe0cfe29020313ae44fb2a6afa87c2951ae028 indicates that the rationale for having this disabled is to tolerate manual additions/removals of binpkgs in the PKGDIR. I don't think there are many people doing this, so it should be safe to enable this by default for quicker operations with PKGDIR. [sam: This is only used for local operations, we don't reindex remote indexes, so there's no issue with not having indexes be signed (although we do plan on doing that at some point).] Bug: https://bugs.gentoo.org/889300 Signed-off-by: John Helmert III gentoo.org> Closes: https://github.com/gentoo/portage/pull/970 Signed-off-by: Sam James gentoo.org> NEWS | 5 + cnf/make.globals | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 2e2246a611..2e88b894b8 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,11 @@ portage-3.0.52 (UNRELEASED) -- +Breaking changes: +* FEATURES=pkgdir-index-trusted is now on by default. This improves performance + with binpkgs, but does require that users run `emaint binhost --fix` if they + manually add or remove binpkgs from their PKGDIR (bug #889300). + Features: * bintree: Add new API member (invalid_paths) to allow gentoolkit to later clean up invalid binpkgs (bug #900224). diff --git a/cnf/make.globals b/cnf/make.globals index bfefcc5235..86e9b5b744 100644 --- a/cnf/make.globals +++ b/cnf/make.globals @@ -78,7 +78,7 @@ FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg-live config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict - network-sandbox news parallel-fetch pid-sandbox + network-sandbox news parallel-fetch pkgdir-index-trusted pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/, lib/portage/dbapi/
commit: c9fb98b4913b286ed404d1df408e51d4f17b1dfb Author: John Helmert III gentoo org> AuthorDate: Tue Jan 17 03:16:17 2023 + Commit: Sam James gentoo org> CommitDate: Tue Sep 19 07:15:59 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=c9fb98b4 ResolverPlayground: produce pkgdir indexes Tests expect the index to be generated anyway, so let's not rely on implicit FEATURES=-pkgdir-index-trusted. Signed-off-by: John Helmert III gentoo.org> Signed-off-by: Sam James gentoo.org> lib/portage/dbapi/bintree.py | 9 - lib/portage/tests/resolver/ResolverPlayground.py | 4 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/portage/dbapi/bintree.py b/lib/portage/dbapi/bintree.py index ec31b52d00..9d7c45577b 100644 --- a/lib/portage/dbapi/bintree.py +++ b/lib/portage/dbapi/bintree.py @@ -803,7 +803,13 @@ class binarytree: except PortageException: pass -def populate(self, getbinpkgs=False, getbinpkg_refresh=False, add_repos=()): +def populate( +self, +getbinpkgs=False, +getbinpkg_refresh=False, +add_repos=(), +force_reindex=False, +): """ Populates the binarytree with package metadata. @@ -833,6 +839,7 @@ class binarytree: try: update_pkgindex = self._populate_local( reindex="pkgdir-index-trusted" not in self.settings.features +or force_reindex ) if update_pkgindex and self.dbapi.writable: diff --git a/lib/portage/tests/resolver/ResolverPlayground.py b/lib/portage/tests/resolver/ResolverPlayground.py index 7f97d3100c..f1cd844708 100644 --- a/lib/portage/tests/resolver/ResolverPlayground.py +++ b/lib/portage/tests/resolver/ResolverPlayground.py @@ -17,6 +17,7 @@ from portage.const import ( ) from portage.process import find_binary from portage.dep import Atom, _repo_separator +from portage.dbapi.bintree import binarytree from portage.package.ebuild.config import config from portage.package.ebuild.digestgen import digestgen from portage._sets import load_default_config @@ -397,6 +398,9 @@ class ResolverPlayground: else: raise InvalidBinaryPackageFormat(binpkg_format) +bintree = binarytree(pkgdir=self.pkgdir, settings=self.settings) +bintree.populate(force_reindex=True) + def _create_installed(self, installed): for cpv in installed: a = Atom("=" + cpv, allow_repo=True)
[gentoo-commits] proj/portage:master commit in: /
commit: 6c059c5a06716d963a59af90448c1a83eb9e16b7 Author: Sam James gentoo org> AuthorDate: Mon Sep 18 00:39:20 2023 + Commit: Sam James gentoo org> CommitDate: Mon Sep 18 00:39:40 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=6c059c5a NEWS: update Signed-off-by: Sam James gentoo.org> NEWS | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 63e365e683..2e2246a611 100644 --- a/NEWS +++ b/NEWS @@ -5,7 +5,10 @@ Features: * bintree: Add new API member (invalid_paths) to allow gentoolkit to later clean up invalid binpkgs (bug #900224). -* Run PORTAGE_TRUST_HELPER before remote binary package operations. +* gpkg: Run PORTAGE_TRUST_HELPER before remote binary package operations (bug #913070). + +* emerge: Use appropriate colors if binpkgs are used in e.g. pkg_pretend + messages as well as elog's mod_echo module (bug #914159). Bug fixes: * Prevent gpg from removing /dev/null when unlocking signing key (bug #912808).
[gentoo-commits] proj/portage:master commit in: lib/portage/package/ebuild/, /
commit: 54ac998b655bcea7e491465e7df7f5e74591 Author: Mike Gilbert gentoo org> AuthorDate: Sat Sep 16 16:43:33 2023 + Commit: Mike Gilbert gentoo org> CommitDate: Sat Sep 16 17:05:51 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=54ac fetch: ignore force-mirror feature when try_mirrors is false When fetching layout.conf, we call fetch(try_mirrors=False) to force direct use of the primary URI being passed and ignore mirrors. The force-mirror feature causes fetch to ignore the primary URI. Ignoring both the primary URI and mirrors leads to an unfetchable file. Give precedence to the try_mirrors parameter since we really only set it to False when fetching layout.conf from a mirror. Bug: https://bugs.gentoo.org/877793 Signed-off-by: Mike Gilbert gentoo.org> NEWS| 2 ++ lib/portage/package/ebuild/fetch.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 023bea3f85..63e365e683 100644 --- a/NEWS +++ b/NEWS @@ -14,6 +14,8 @@ Bug fixes: * vartree: keep build dir if postinst fails (bug #704866). +* fetch: fix fetching of layout.conf when FEATURES=force-mirror (bug #877793). + portage-3.0.51 (2023-08-20) -- diff --git a/lib/portage/package/ebuild/fetch.py b/lib/portage/package/ebuild/fetch.py index 0ecad162e5..59a0afcf63 100644 --- a/lib/portage/package/ebuild/fetch.py +++ b/lib/portage/package/ebuild/fetch.py @@ -980,7 +980,7 @@ def fetch( ] restrict_fetch = "fetch" in restrict -force_mirror = "force-mirror" in features and not restrict_mirror +force_mirror = "force-mirror" in features and not restrict_mirror and try_mirrors file_uri_tuples = [] # Check for 'items' attribute since OrderedDict is not a dict.
[gentoo-commits] proj/portage:master commit in: lib/portage/elog/
commit: 7fe73e2e2d72192afe63668d60d2a0945ee3fd67 Author: Sam James gentoo org> AuthorDate: Sat Sep 16 09:47:32 2023 + Commit: Sam James gentoo org> CommitDate: Sat Sep 16 09:47:44 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=7fe73e2e elog: mod_echo: handle unmerging for binary coloring Fixes: 2e572b9edc48a6d4623df1c2c46ba34316f7e72a Signed-off-by: Sam James gentoo.org> lib/portage/elog/mod_echo.py | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/portage/elog/mod_echo.py b/lib/portage/elog/mod_echo.py index e8a0d49fc4..1043edf201 100644 --- a/lib/portage/elog/mod_echo.py +++ b/lib/portage/elog/mod_echo.py @@ -23,7 +23,10 @@ def process(mysettings, key, logentries, fulltext): ): logfile = mysettings["PORTAGE_LOG_FILE"] -binary = mysettings.configdict["pkg"]["MERGE_TYPE"] == "binary" +try: +binary = mysettings.configdict["pkg"]["MERGE_TYPE"] == "binary" +except KeyError: +binary = False _items.append((mysettings["ROOT"], key, logentries, logfile, binary))
[gentoo-commits] proj/portage:master commit in: man/
commit: 102c79b20729ed95b8759c612eee0f4404decc8d Author: Sam James gentoo org> AuthorDate: Sat Sep 16 05:50:05 2023 + Commit: Sam James gentoo org> CommitDate: Sat Sep 16 05:50:05 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=102c79b2 man: ebuild(5): fix has_version argument It takes a dependency specification, not just a package name and version. (e.g. it accepts USE flags, like app-misc/foo[x]). Signed-off-by: Sam James gentoo.org> man/ebuild.5 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/man/ebuild.5 b/man/ebuild.5 index 9dd14d8afb..cce5451755 100644 --- a/man/ebuild.5 +++ b/man/ebuild.5 @@ -1177,10 +1177,10 @@ has a default value of ' ', or a space. It is a \fBbash\fR(1) setting. Like \fBhas\fR, but also echoes \fIitem\fR when \fBhas\fR returns true. Banned in \fBEAPI 8\fR. .TP -.B has_version\fR \fI[\-b]\fR \fI[\-d]\fR \fI[\-r]\fR \fI[\-\-host\-root]\fR \fI -Check to see if \fIcategory/package\-version\fR is installed. The +.B has_version\fR \fI[\-b]\fR \fI[\-d]\fR \fI[\-r]\fR \fI[\-\-host\-root]\fR \fI +Check to see if \fI\fR is installed. The parameter accepts all values that are acceptable in the \fBDEPEND\fR -variable. The function returns 0 if \fIcategory/package\-version\fR +variable. The function returns 0 if \fI\fR is installed, 1 otherwise. The package is searched for in \fBROOT\fR by default.
[gentoo-commits] proj/portage:master commit in: man/
commit: 3b1e0733abf2fdc634a64f4e118b987aec33c6fc Author: Mike Gilbert gentoo org> AuthorDate: Fri Sep 15 17:41:16 2023 + Commit: Sam James gentoo org> CommitDate: Sat Sep 16 05:47:57 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=3b1e0733 man: use groff escape sequence for tilde characters groff replaces normal tilde (~) with a weird "modifier" on output. Use the escape sequence from groff_char(7) to avoid this. Signed-off-by: Mike Gilbert gentoo.org> Closes: https://github.com/gentoo/portage/pull/1094 Signed-off-by: Sam James gentoo.org> man/ebuild.5| 18 +- man/emerge.1| 6 +++--- man/make.conf.5 | 6 +++--- man/portage.5 | 10 +- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/man/ebuild.5 b/man/ebuild.5 index d4187a8a47..9dd14d8afb 100644 --- a/man/ebuild.5 +++ b/man/ebuild.5 @@ -62,20 +62,20 @@ operators: \fI<\fRmedia\-libs/libgd\-1.6 .fi .TP -.B Extended Atom Prefixes [!~] and Postfixes [*] +.B Extended Atom Prefixes [!\(ti] and Postfixes [*] Now to get even fancier, we provide the ability to define blocking packages and version range matching. Also note that these extended prefixes/postfixes may be combined in any way with the atom classes defined above. .RS .TP -.I ~ +.I \(ti means match any revision of the base version specified. So in the example below, we would match versions '1.0.2a', '1.0.2a\-r1', '1.0.2a\-r2', etc... \fBExample\fR: .nf - \fI~\fRnet\-libs/libnet\-1.0.2a + \fI\(ti\fRnet\-libs/libnet\-1.0.2a .fi .TP .I ! @@ -120,7 +120,7 @@ Beginning with \fBEAPI 1\fR, any atom can be constrained to match a specific \fBExamples\fR: .nf x11\-libs/qt:3 - \fI~\fRx11\-libs/qt-3.3.8:3 + \fI\(ti\fRx11\-libs/qt-3.3.8:3 \fI>=\fRx11\-libs/qt-3.3.8:3 \fI=\fRx11\-libs/qt-3.3*:3 .fi @@ -572,7 +572,7 @@ file name, should be separated by whitespace. Should contain a list of URIs for the sources main sites and other further package dependent information. .TP -.B KEYWORDS\fR = \fI[\-~][x86,ppc,sparc,mips,alpha,arm,hppa,...] +.B KEYWORDS\fR = \fI[\-\(ti][x86,ppc,sparc,mips,alpha,arm,hppa,...] .P KEYWORDS works in conjunction with ACCEPT_KEYWORDS (see \fBmake.conf\fR(5)) @@ -590,9 +590,9 @@ Any ebuild that then has "amd64" in KEYWORDS will be unmasked by default. On an "unstable" -amd64 system, ACCEPT_KEYWORDS will be set to "amd64 ~amd64", with the +amd64 system, ACCEPT_KEYWORDS will be set to "amd64 \(tiamd64", with the tilde denoting "unstable." Then, if an ebuild has \fIeither\fR -"amd64" or "~amd64" in KEYWORDS, it will be keyword unmasked by default on +"amd64" or "\(tiamd64" in KEYWORDS, it will be keyword unmasked by default on that system. Similarly, if an ebuild is known to not be compatible with a particular architecture, the "\-" prefix ( i.e. "\-amd64") setting can be specified to mask it only on that arch. @@ -612,7 +612,7 @@ This would be done by specifying "\-ppc", for example. This will ensure that it is explicitly keyword\-masked for that architecture. .IP \(bu When submitting an ebuild to Gentoo Linux, it is the project policy to only -have "~arch" set in KEYWORDS +have "\(tiarch" set in KEYWORDS for the architecture for which it has been successfully tested, and no more. As the ebuild receives more testing, Gentoo arch teams will gradually expand the KEYWORDS settings to "bump" the package to unstable, and possibly stable. @@ -1605,7 +1605,7 @@ SRC_URI="ftp://alpha.gnu.org/pub/gnu/${PN}/${P}.tar.gz; LICENSE="GPL\-2" SLOT="0" -KEYWORDS="~amd64" +KEYWORDS="\(tiamd64" BDEPEND="nls? ( sys-devel/gettext )" diff --git a/man/emerge.1 b/man/emerge.1 index c9f4e45421..ed3cf929fe 100644 --- a/man/emerge.1 +++ b/man/emerge.1 @@ -1290,10 +1290,10 @@ Symbol Mask Type # package.mask * missing keyword -~ unstable keyword +\(ti unstable keyword .TE -\fBNOTE:\fR The unstable keyword symbol (~) will not be shown in cases +\fBNOTE:\fR The unstable keyword symbol (\(ti) will not be shown in cases in which the corresponding unstable keywords have been accepted globally via \fBACCEPT_KEYWORDS\fR. .TP @@ -1370,7 +1370,7 @@ The \fBKEYWORDS\fR variable in an \fBebuild\fR file is also used for masking a package still in testing. There are architecture\-specific keywords for each package that let \fBportage\fR know which systems are compatible with the package. Packages which compile on an architecture, but have not been -proven to be "stable", are masked with a tilde (\fB~\fR) in front of the +proven to be "stable", are masked with a tilde (\fB\(ti\fR) in front of the architecture name. \fBemerge\fR examines the \fBACCEPT_KEYWORDS\fR environment variable to allow or disallow the emerging of a package masked by \fBKEYWORDS\fR. To inform \fBemerge\fR that it should build these 'testing' diff --git a/man/make.conf.5 b/man/make.conf.5 index 2a28d2b6f7..8f6c444ba1
[gentoo-commits] proj/portage:master commit in: lib/_emerge/
commit: 7280f1b3dc19ae1be1cc7a930346127b1b7e7686 Author: Sam James gentoo org> AuthorDate: Fri Sep 15 03:38:13 2023 + Commit: Sam James gentoo org> CommitDate: Fri Sep 15 10:36:47 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=7280f1b3 _emerge: use binpkg coloring for pkg_pretend For the 'Running pre-merge checks' message, we write: ``` >>> Running pre-merge checks for X ``` X is currently always in green, while the emerge list above might have the atom X listed in purple if it's a binpkg. Change X to be colored based on if it's a binpkg or not. Bug: https://bugs.gentoo.org/914159 Signed-off-by: Sam James gentoo.org> lib/_emerge/Scheduler.py | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/_emerge/Scheduler.py b/lib/_emerge/Scheduler.py index ece3f27f7c..db9615d406 100644 --- a/lib/_emerge/Scheduler.py +++ b/lib/_emerge/Scheduler.py @@ -865,12 +865,13 @@ class Scheduler(PollScheduler): if self._terminated_tasks: raise asyncio.CancelledError -out_str = "Running pre-merge checks for " + colorize("INFORM", x.cpv) -self._status_msg(out_str) - root_config = x.root_config settings = self._allocate_config(root_config.root) settings.setcpv(x) + +color = "PKG_BINARY_MERGE" if x.built else "INFORM" +self._status_msg(f"Running pre-merge checks for {colorize(color, x.cpv)}") + if not x.built: # Get required SRC_URI metadata (it's not cached in x.metadata # because some packages have an extremely large SRC_URI value).
[gentoo-commits] proj/portage:master commit in: lib/portage/elog/
commit: 2e572b9edc48a6d4623df1c2c46ba34316f7e72a Author: Sam James gentoo org> AuthorDate: Fri Sep 15 03:55:10 2023 + Commit: Sam James gentoo org> CommitDate: Fri Sep 15 10:36:47 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=2e572b9e elog: mod_echo: use binpkg coloring With the 'echo' elog module, we get messages like: ``` * Messages for package X * Log file: /var/log/portage/build/[...] ``` Colorize 'X' based on whether it's a binpkg or not, rather than always using green as if it was built from source. Bug: https://bugs.gentoo.org/914159 Signed-off-by: Sam James gentoo.org> lib/portage/elog/mod_echo.py | 13 + 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/portage/elog/mod_echo.py b/lib/portage/elog/mod_echo.py index a63939988a..e8a0d49fc4 100644 --- a/lib/portage/elog/mod_echo.py +++ b/lib/portage/elog/mod_echo.py @@ -22,7 +22,9 @@ def process(mysettings, key, logentries, fulltext): and "PORTAGE_LOG_FILE" in mysettings ): logfile = mysettings["PORTAGE_LOG_FILE"] -_items.append((mysettings["ROOT"], key, logentries, logfile)) + +binary = mysettings.configdict["pkg"]["MERGE_TYPE"] == "binary" +_items.append((mysettings["ROOT"], key, logentries, logfile, binary)) def finalize(): @@ -42,14 +44,17 @@ def finalize(): def _finalize(): global _items printer = EOutput() -for root, key, logentries, logfile in _items: +for root, key, logentries, logfile, binary in _items: +color = "PKG_BINARY_MERGE" if binary else "INFORM" + print() + if root == "/": -printer.einfo(_("Messages for package %s:") % colorize("INFORM", key)) +printer.einfo(_("Messages for package %s:") % colorize(color, key)) else: printer.einfo( _("Messages for package %(pkg)s merged to %(root)s:") -% {"pkg": colorize("INFORM", key), "root": root} +% {"pkg": colorize(color, key), "root": root} ) if logfile is not None: printer.einfo(_("Log file: %s") % colorize("INFORM", logfile))
[gentoo-commits] proj/portage:master commit in: lib/_emerge/
commit: f5081b7def54bc9e49aac117ce2b1ebc89379c79 Author: Sam James gentoo org> AuthorDate: Fri Sep 15 04:00:32 2023 + Commit: Sam James gentoo org> CommitDate: Fri Sep 15 10:36:47 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=f5081b7d _emerge: use binpkg coloring for failures too Bug: https://bugs.gentoo.org/914159 Signed-off-by: Sam James gentoo.org> lib/_emerge/Scheduler.py | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/_emerge/Scheduler.py b/lib/_emerge/Scheduler.py index db9615d406..2d1872feba 100644 --- a/lib/_emerge/Scheduler.py +++ b/lib/_emerge/Scheduler.py @@ -1260,12 +1260,14 @@ class Scheduler(PollScheduler): and not mod_echo_output ): for mysettings, key, logentries in self._failed_pkgs_die_msgs: +color = "PKG_BINARY_MERGE" if pkg.built else "INFORM" + root_msg = "" if mysettings["ROOT"] != "/": root_msg = f" merged to {mysettings['ROOT']}" print() printer.einfo( -f"Error messages for package {colorize('INFORM', key)}{root_msg}:" +f"Error messages for package {colorize(color, key)}{root_msg}:" ) print() for phase in portage.const.EBUILD_PHASES: @@ -2001,7 +2003,10 @@ class Scheduler(PollScheduler): def _failed_pkg_msg(self, failed_pkg, action, preposition): pkg = failed_pkg.pkg -msg = f"{bad('Failed')} to {action} {colorize('INFORM', pkg.cpv)}" + +color = "PKG_BINARY_MERGE" if failed_pkg.pkg.built else "INFORM" + +msg = f"{bad('Failed')} to {action} {colorize(color, pkg.cpv)}" if pkg.root_config.settings["ROOT"] != "/": msg += f" {preposition} {pkg.root}"
[gentoo-commits] proj/portage:master commit in: lib/portage/dbapi/
commit: b2c91af6fb2dfdd227caf9a2eff588f02d2bf9fc Author: Oskari Pirhonen gmail com> AuthorDate: Tue Sep 5 01:21:22 2023 + Commit: Sam James gentoo org> CommitDate: Fri Sep 15 04:28:23 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=b2c91af6 vartree: keep build dir if postinst fails Bug: https://bugs.gentoo.org/704866 Signed-off-by: Oskari Pirhonen gmail.com> Signed-off-by: Sam James gentoo.org> lib/portage/dbapi/vartree.py | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/portage/dbapi/vartree.py b/lib/portage/dbapi/vartree.py index 7d1bba712e..08ea9234f6 100644 --- a/lib/portage/dbapi/vartree.py +++ b/lib/portage/dbapi/vartree.py @@ -6070,8 +6070,11 @@ class dblink: ebuild_phase.wait() self._elog_process() -if "noclean" not in self.settings.features and ( -retval == os.EX_OK or "fail-clean" in self.settings.features +# Keep the build dir around if postinst fails (bug #704866) +if ( +not self._postinst_failure +and "noclean" not in self.settings.features +and (retval == os.EX_OK or "fail-clean" in self.settings.features) ): if myebuild is None: myebuild = os.path.join(inforoot, self.pkg + ".ebuild")
[gentoo-commits] proj/portage:master commit in: /
commit: 07d747c9a3cc2d9be24870cf3a07ddc301d3ae76 Author: Oskari Pirhonen gmail com> AuthorDate: Tue Sep 5 01:26:10 2023 + Commit: Sam James gentoo org> CommitDate: Fri Sep 15 04:28:23 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=07d747c9 update NEWS Signed-off-by: Oskari Pirhonen gmail.com> Closes: https://github.com/gentoo/portage/pull/1090 Signed-off-by: Sam James gentoo.org> NEWS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS b/NEWS index 3e9e36f23f..023bea3f85 100644 --- a/NEWS +++ b/NEWS @@ -12,6 +12,8 @@ Bug fixes: * emerge: ensure paths are UTF-8 encoded in _needs_move() (bug #913103). +* vartree: keep build dir if postinst fails (bug #704866). + portage-3.0.51 (2023-08-20) --
[gentoo-commits] proj/portage:master commit in: bin/
commit: 6eaa4b55ed75e36ac19d9083dfb9f6c040c415fa Author: Sam James gentoo org> AuthorDate: Fri Sep 8 21:42:47 2023 + Commit: Sam James gentoo org> CommitDate: Fri Sep 8 21:42:47 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=6eaa4b55 bin: drop cgroup-release-agent Left over from FEATURES="cgroup". Fixes: f8e3b11496bd6d602a690535c4a3bb32bb8e9744 Signed-off-by: Sam James gentoo.org> bin/cgroup-release-agent | 2 -- 1 file changed, 2 deletions(-) diff --git a/bin/cgroup-release-agent b/bin/cgroup-release-agent deleted file mode 100755 index b024e08300..00 --- a/bin/cgroup-release-agent +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exec rmdir "/sys/fs/cgroup/portage/${1}"
[gentoo-commits] proj/portage:master commit in: lib/portage/
commit: 5d60ca35e66e241c092c8f42b2edf65789e51f28 Author: Sam James gentoo org> AuthorDate: Fri Sep 8 20:35:36 2023 + Commit: Sam James gentoo org> CommitDate: Fri Sep 8 20:35:36 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=5d60ca35 gpkg: drop more dead code _drop_privileges was only called by the gentoo.org> lib/portage/gpkg.py | 69 - 1 file changed, 69 deletions(-) diff --git a/lib/portage/gpkg.py b/lib/portage/gpkg.py index 4b94853e4c..d16dffbc27 100644 --- a/lib/portage/gpkg.py +++ b/lib/portage/gpkg.py @@ -142,29 +142,6 @@ class tar_stream_writer: def __exit__(self, exc_type, exc_value, traceback): self.close() -def _drop_privileges(self): -if self.uid: -try: -os.setuid(self.uid) -except PermissionError: -writemsg( -colorize( -"BAD", f"!!! Drop root privileges to user {self.uid} failed." -) -) -raise - -if self.gid: -try: -os.setgid(self.gid) -except PermissionError: -writemsg( -colorize( -"BAD", f"!!! Drop root privileges to group {self.gid} failed." -) -) -raise - def kill(self): """ kill external program if any error happened in python @@ -363,29 +340,6 @@ class tar_stream_reader: writemsg(colorize("BAD", f"GPKG subprocess failed: {self.cmd} \n")) raise CompressorOperationFailed("PIPE broken") -def _drop_privileges(self): -if self.uid: -try: -os.setuid(self.uid) -except PermissionError: -writemsg( -colorize( -"BAD", f"!!! Drop root privileges to user {self.uid} failed." -) -) -raise - -if self.gid: -try: -os.setgid(self.gid) -except PermissionError: -writemsg( -colorize( -"BAD", f"!!! Drop root privileges to group {self.gid} failed." -) -) -raise - def kill(self): """ kill external program if any error happened in python @@ -593,29 +547,6 @@ class checksum_helper: writemsg(colorize("BAD", f"!!!\n{self.gpg_result.decode()}")) raise InvalidSignature("GPG verify failed") -def _drop_privileges(self): -if self.uid: -try: -os.setuid(self.uid) -except PermissionError: -writemsg( -colorize( -"BAD", f"!!! Drop root privileges to user {self.uid} failed." -) -) -raise - -if self.gid: -try: -os.setgid(self.gid) -except PermissionError: -writemsg( -colorize( -"BAD", f"!!! Drop root privileges to group {self.gid} failed." -) -) -raise - def update(self, data): """ Write data to hash libs and GPG stdin.
[gentoo-commits] proj/portage:master commit in: lib/portage/
commit: 31cec19a1b976c59f8f958f86631bca0f99a5ec5 Author: Sam James gentoo org> AuthorDate: Fri Sep 8 19:49:21 2023 + Commit: Sam James gentoo org> CommitDate: Fri Sep 8 19:49:21 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=31cec19a gpkg: drop dead code (< Python 3.9 conditional) for subprocess Signed-off-by: Sam James gentoo.org> lib/portage/gpkg.py | 73 + 1 file changed, 23 insertions(+), 50 deletions(-) diff --git a/lib/portage/gpkg.py b/lib/portage/gpkg.py index 6ed2a6d00b..4b94853e4c 100644 --- a/lib/portage/gpkg.py +++ b/lib/portage/gpkg.py @@ -120,21 +120,13 @@ class tar_stream_writer: if cmd is None: self.proc = None else: -if sys.hexversion >= 0x0309: -self.proc = subprocess.Popen( -cmd, -stdin=subprocess.PIPE, -stdout=subprocess.PIPE, -user=self.uid, -group=self.gid, -) -else: -self.proc = subprocess.Popen( -cmd, -stdin=subprocess.PIPE, -stdout=subprocess.PIPE, -preexec_fn=self._drop_privileges, -) +self.proc = subprocess.Popen( +cmd, +stdin=subprocess.PIPE, +stdout=subprocess.PIPE, +user=self.uid, +group=self.gid, +) self.read_thread = threading.Thread( target=self._cmd_read_thread, name="tar_stream_cmd_read", daemon=True @@ -318,21 +310,13 @@ class tar_stream_reader: self.proc = None else: # Start external decompressor -if sys.hexversion >= 0x0309: -self.proc = subprocess.Popen( -cmd, -stdin=subprocess.PIPE, -stdout=subprocess.PIPE, -user=self.uid, -group=self.gid, -) -else: -self.proc = subprocess.Popen( -cmd, -stdin=subprocess.PIPE, -stdout=subprocess.PIPE, -preexec_fn=self._drop_privileges, -) +self.proc = subprocess.Popen( +cmd, +stdin=subprocess.PIPE, +stdout=subprocess.PIPE, +user=self.uid, +group=self.gid, +) self.read_io = self.proc.stdout # Start stdin block writing thread self.thread = threading.Thread( @@ -575,26 +559,15 @@ class checksum_helper: ) gpg_verify_command = [x for x in gpg_verify_command if x != ""] -if sys.hexversion >= 0x0309: -self.gpg_proc = subprocess.Popen( -gpg_verify_command, -stdin=subprocess.PIPE, -stdout=subprocess.PIPE, -stderr=subprocess.PIPE, -env=env, -user=self.uid, -group=self.gid, -) - -else: -self.gpg_proc = subprocess.Popen( -gpg_verify_command, -stdin=subprocess.PIPE, -stdout=subprocess.PIPE, -stderr=subprocess.PIPE, -env=env, -preexec_fn=self._drop_privileges, -) +self.gpg_proc = subprocess.Popen( +gpg_verify_command, +stdin=subprocess.PIPE, +stdout=subprocess.PIPE, +stderr=subprocess.PIPE, +env=env, +user=self.uid, +group=self.gid, +) def __del__(self): self.finish()
[gentoo-commits] proj/portage:master commit in: .github/workflows/, cnf/, man/, lib/portage/package/ebuild/_config/, ...
commit: 3e56f8a6498cd90a7d5fe472febf586455c3bad7 Author: Andreas K. Hüttel gentoo org> AuthorDate: Wed Aug 30 17:57:19 2023 + Commit: Mike Gilbert gentoo org> CommitDate: Sun Sep 3 18:07:28 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=3e56f8a6 Run PORTAGE_TRUST_HELPER before remote binary package operations Right now this is somewhat suboptimal because the helper is only called if FEATURES="binpkg-request-signature" is set, but existing signatures are also verified otherwise. Closes: https://github.com/gentoo/portage/pull/1085 Signed-off-by: Andreas K. Hüttel gentoo.org> Signed-off-by: Mike Gilbert gentoo.org> .github/workflows/ci.yml | 3 +++ NEWS | 2 ++ cnf/make.globals | 3 +++ lib/portage/dbapi/bintree.py | 12 lib/portage/package/ebuild/_config/special_env_vars.py | 1 + man/make.conf.5| 9 + 6 files changed, 30 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bf36ad19d8..fc7ab93a2b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,6 +38,9 @@ jobs: python -m pip install --upgrade pip # setuptools needed for 3.12+ because of https://github.com/mesonbuild/meson/issues/7702. python -m pip install pytest setuptools + + # symlink /bin/true to /usr/bin/getuto (or do we want to grab the script from github?) + sudo ln -s /bin/true /usr/bin/getuto - name: Test meson install --destdir /tmp/install-root run: | echo -e "[binaries]\npython = '$(command -v python)'" > /tmp/native.ini diff --git a/NEWS b/NEWS index 65e75759bf..3e9e36f23f 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,8 @@ Features: * bintree: Add new API member (invalid_paths) to allow gentoolkit to later clean up invalid binpkgs (bug #900224). +* Run PORTAGE_TRUST_HELPER before remote binary package operations. + Bug fixes: * Prevent gpg from removing /dev/null when unlocking signing key (bug #912808). diff --git a/cnf/make.globals b/cnf/make.globals index f951bb3172..bfefcc5235 100644 --- a/cnf/make.globals +++ b/cnf/make.globals @@ -150,6 +150,9 @@ PORTAGE_ELOG_MAILFROM="portage@localhost" # Signing command used by egencache PORTAGE_GPG_SIGNING_COMMAND="gpg --sign --digest-algo SHA256 --clearsign --yes --default-key \"\${PORTAGE_GPG_KEY}\" --homedir \"\${PORTAGE_GPG_DIR}\" \"\${FILE}\"" +# Trust helper executable for installing and updating package verification keys +PORTAGE_TRUST_HELPER="/usr/bin/getuto" + # btrfs.* attributes are irrelevant, see bug #527636. # security.* attributes may be special (see bug 461868), but # security.capability is specifically not excluded (bug 548516). diff --git a/lib/portage/dbapi/bintree.py b/lib/portage/dbapi/bintree.py index af2113bd84..ec31b52d00 100644 --- a/lib/portage/dbapi/bintree.py +++ b/lib/portage/dbapi/bintree.py @@ -1234,11 +1234,23 @@ class binarytree: return pkgindex if update_pkgindex else None +def _run_trust_helper(self): +portage_trust_helper = self.settings.get("PORTAGE_TRUST_HELPER", "") +if portage_trust_helper == "": +return +ret = subprocess.run(portage_trust_helper) +ret.check_returncode() + def _populate_remote(self, getbinpkg_refresh=True): self._remote_has_index = False self._remotepkgs = {} if "binpkg-request-signature" in self.settings.features: +# This is somewhat broken, we *should* run the trust helper always +# when binpackages are involved, not only when we refuse unsigned +# ones. (If the keys have expired we end up refusing signed but +# technically invalid packages...) +self._run_trust_helper() gpkg_only = True else: gpkg_only = False diff --git a/lib/portage/package/ebuild/_config/special_env_vars.py b/lib/portage/package/ebuild/_config/special_env_vars.py index ef8f06abe3..6020029e35 100644 --- a/lib/portage/package/ebuild/_config/special_env_vars.py +++ b/lib/portage/package/ebuild/_config/special_env_vars.py @@ -315,6 +315,7 @@ environ_filter = frozenset( "PORTAGE_RSYNC_RETRIES", "PORTAGE_SSH_OPTS", "PORTAGE_SYNC_STALE", +"PORTAGE_TRUST_HELPER", "PORTAGE_USE", "PORTAGE_LOG_FILTER_FILE_CMD", "PORTAGE_LOGDIR", diff --git a/man/make.conf.5 b/man/make.conf.5 index a1a433b108..2a28d2b6f7 100644 --- a/man/make.conf.5 +++ b/man/make.conf.5 @@ -1208,6 +1208,15 @@ Defaults to /var/tmp. This should not be set to point anywhere under location of any repository. .TP +\fBPORTAGE_TRUST_HELPER\fR = \fI[path]\fR +Defines an executable file which initializes and maintains +/etc/portage/gnupg, installing keys
[gentoo-commits] proj/portage:master commit in: lib/portage/util/, /, lib/portage/dbapi/
commit: 1d3b22621d332331da6e48ae653e983406f44e5f Author: gcarq protonmail com> AuthorDate: Fri Sep 1 16:46:23 2023 + Commit: Mike Gilbert gentoo org> CommitDate: Fri Sep 1 19:13:27 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=1d3b2262 emerge: ensure paths are UTF-8 encoded in _needs_move() Bug: https://bugs.gentoo.org/913103 Closes: https://github.com/gentoo/portage/pull/1086 Signed-off-by: Michael Egger protonmail.com> Signed-off-by: Mike Gilbert gentoo.org> NEWS | 2 ++ lib/portage/dbapi/vartree.py | 7 +-- lib/portage/util/movefile.py | 5 +++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index aa7ffd2652..65e75759bf 100644 --- a/NEWS +++ b/NEWS @@ -8,6 +8,8 @@ Features: Bug fixes: * Prevent gpg from removing /dev/null when unlocking signing key (bug #912808). +* emerge: ensure paths are UTF-8 encoded in _needs_move() (bug #913103). + portage-3.0.51 (2023-08-20) -- diff --git a/lib/portage/dbapi/vartree.py b/lib/portage/dbapi/vartree.py index dac3508801..7d1bba712e 100644 --- a/lib/portage/dbapi/vartree.py +++ b/lib/portage/dbapi/vartree.py @@ -6273,12 +6273,15 @@ class dblink: if mydmode is None or not stat.S_ISREG(mydmode) or mymode != mydmode: return True +src_bytes = _unicode_encode(mysrc, encoding=_encodings["fs"], errors="strict") +dest_bytes = _unicode_encode(mydest, encoding=_encodings["fs"], errors="strict") + if "xattr" in self.settings.features: excluded_xattrs = self.settings.get("PORTAGE_XATTR_EXCLUDE", "") -if not _cmpxattr(mysrc, mydest, exclude=excluded_xattrs): +if not _cmpxattr(src_bytes, dest_bytes, exclude=excluded_xattrs): return True -return not filecmp.cmp(mysrc, mydest, shallow=False) +return not filecmp.cmp(src_bytes, dest_bytes, shallow=False) def merge( diff --git a/lib/portage/util/movefile.py b/lib/portage/util/movefile.py index e2f19ba92b..75100a3acd 100644 --- a/lib/portage/util/movefile.py +++ b/lib/portage/util/movefile.py @@ -105,10 +105,11 @@ def _copyxattr(src, dest, exclude=None): ) -def _cmpxattr(src, dest, exclude=None): +def _cmpxattr(src: bytes, dest: bytes, exclude=None) -> bool: """ Compares extended attributes between |src| and |dest| and returns True -if they are equal or xattrs are not supported, False otherwise +if they are equal or xattrs are not supported, False otherwise. +Assumes all given paths are UTF-8 encoded. """ try: src_attrs = xattr.list(src)
[gentoo-commits] proj/portage:master commit in: lib/portage/
commit: 9d278330839049a818ba9f1e3985c7e502c63451 Author: Andrew Ammerlaan gentoo org> AuthorDate: Wed Aug 23 11:47:32 2023 + Commit: Mike Gilbert gentoo org> CommitDate: Thu Aug 24 18:23:41 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=9d278330 lib/portage/gpg.py: send gpg output to stdout, then send stdout to /dev/null GnuPG removes the --output file on failure. Removing /dev/null breaks all kinds of things. Instead of telling GnuPG to output to /dev/null we output to stdout and then send the stdout to /dev/null, this avoids the problem where /dev/null is removed when the key fails to unlock. Bug: https://bugs.gentoo.org/912808 Signed-off-by: Andrew Ammerlaan gentoo.org> Signed-off-by: Mike Gilbert gentoo.org> lib/portage/gpg.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/portage/gpg.py b/lib/portage/gpg.py index 6238ea6f7b..3067872244 100644 --- a/lib/portage/gpg.py +++ b/lib/portage/gpg.py @@ -35,7 +35,7 @@ class GPG: f"--homedir {self.signing_gpg_home} " f"--digest-algo {self.digest_algo} " f"--local-user {self.signing_gpg_key} " -"--output /dev/null /dev/null", +"--output - /dev/null", ) if "gpg-keepalive" in self.settings.features: @@ -61,7 +61,7 @@ class GPG: writemsg(f"{colorize('WARN', str(e))}\n") cmd = shlex_split(varexpand(self.GPG_unlock_command, mydict=self.settings)) -return_code = subprocess.Popen(cmd).wait() +return_code = subprocess.Popen(cmd, stdout=subprocess.DEVNULL).wait() if return_code == os.EX_OK: writemsg_stdout(f"{colorize('GOOD', 'unlocked')}\n")
[gentoo-commits] proj/portage:master commit in: /
commit: 6d90cf03986c63ace40c44f3eeebde0569e96b31 Author: Mike Gilbert gentoo org> AuthorDate: Thu Aug 24 18:22:27 2023 + Commit: Mike Gilbert gentoo org> CommitDate: Thu Aug 24 18:23:46 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=6d90cf03 Update NEWS Signed-off-by: Mike Gilbert gentoo.org> NEWS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/NEWS b/NEWS index d770e0b7e9..aa7ffd2652 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,9 @@ Features: * bintree: Add new API member (invalid_paths) to allow gentoolkit to later clean up invalid binpkgs (bug #900224). +Bug fixes: +* Prevent gpg from removing /dev/null when unlocking signing key (bug #912808). + portage-3.0.51 (2023-08-20) --
[gentoo-commits] proj/portage:master commit in: bin/, misc/
commit: 26bd466e1620c26adbfc78195a8f35475b49d57a Author: Ulrich Müller gentoo org> AuthorDate: Thu Aug 24 06:48:42 2023 + Commit: Ulrich Müller gentoo org> CommitDate: Thu Aug 24 06:48:42 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=26bd466e emerge-webrsync: Avoid double slash when expanding EPREFIX Signed-off-by: Ulrich Müller gentoo.org> bin/emerge-webrsync| 6 +++--- misc/emerge-delta-webrsync | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bin/emerge-webrsync b/bin/emerge-webrsync index 782a6052eb..99da05543a 100755 --- a/bin/emerge-webrsync +++ b/bin/emerge-webrsync @@ -25,7 +25,7 @@ # # Opportunistically use gentoo-functions for nicer output -functions_script="${EPREFIX:-/}/lib/gentoo/functions.sh" +functions_script="${EPREFIX}/lib/gentoo/functions.sh" source "${functions_script}" || { echo "${argv0}: Could not source ${functions_script}!" 1>&2 @@ -272,7 +272,7 @@ check_file_signature_gemato() { if [[ -n ${PORTAGE_GPG_KEY} ]] ; then local key="${PORTAGE_GPG_KEY}" else - local key="${EPREFIX:-/}"/usr/share/openpgp-keys/gentoo-release.asc + local key="${EPREFIX}/usr/share/openpgp-keys/gentoo-release.asc" fi if [[ ! -f "${key}" ]] ; then @@ -319,7 +319,7 @@ check_file_signature_gpg_unwrapped() { if [[ -n ${PORTAGE_GPG_KEY} ]] ; then local key="${PORTAGE_GPG_KEY}" else - local key="${EPREFIX:-/}"/usr/share/openpgp-keys/gentoo-release.asc + local key="${EPREFIX}/usr/share/openpgp-keys/gentoo-release.asc" fi if [[ ! -f "${key}" ]] ; then diff --git a/misc/emerge-delta-webrsync b/misc/emerge-delta-webrsync index 610a03f8f7..12930a0a68 100755 --- a/misc/emerge-delta-webrsync +++ b/misc/emerge-delta-webrsync @@ -20,7 +20,7 @@ # # Opportunistically use gentoo-functions for nicer output -functions_script="${EPREFIX:-/}/lib/gentoo/functions.sh" +functions_script="${EPREFIX}/lib/gentoo/functions.sh" source "${functions_script}" || { echo "${argv0}: Could not source ${functions_script}!" 1>&2 @@ -383,7 +383,7 @@ check_file_signature_gemato() { if [[ -n ${PORTAGE_GPG_KEY} ]] ; then local key="${PORTAGE_GPG_KEY}" else - local key="${EPREFIX:-/}"/usr/share/openpgp-keys/gentoo-release.asc + local key="${EPREFIX}/usr/share/openpgp-keys/gentoo-release.asc" fi if [[ ! -f "${key}" ]] ; then @@ -430,7 +430,7 @@ check_file_signature_gpg_unwrapped() { if [[ -n ${PORTAGE_GPG_KEY} ]] ; then local key="${PORTAGE_GPG_KEY}" else - local key="${EPREFIX:-/}"/usr/share/openpgp-keys/gentoo-release.asc + local key="${EPREFIX}/usr/share/openpgp-keys/gentoo-release.asc" fi if [[ ! -f "${key}" ]] ; then
[gentoo-commits] proj/portage:master commit in: lib/portage/env/, lib/portage/dep/, lib/portage/tests/env/, ...
commit: 104d649f2bfeac0c17db8fdd46653efeb6eab7d2 Author: James Le Cuirot gentoo org> AuthorDate: Sun Aug 20 09:46:33 2023 + Commit: Sam James gentoo org> CommitDate: Mon Aug 21 12:24:01 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=104d649f Allow building of pure Python wheel by setting "pure" appropriately It will only build a pure wheel when pure is true in all cases. Signed-off-by: James Le Cuirot gentoo.org> Closes: https://github.com/gentoo/portage/pull/1082 Signed-off-by: Sam James gentoo.org> DEVELOPING | 3 ++- lib/_emerge/meson.build | 2 +- lib/_emerge/resolver/meson.build | 2 +- lib/portage/_compat_upgrade/meson.build | 2 +- lib/portage/_emirrordist/meson.build | 2 +- lib/portage/_sets/meson.build| 2 +- lib/portage/binrepo/meson.build | 2 +- lib/portage/cache/index/meson.build | 2 +- lib/portage/cache/meson.build| 2 +- lib/portage/dbapi/meson.build| 2 +- lib/portage/dep/meson.build | 2 +- lib/portage/dep/soname/meson.build | 2 +- lib/portage/elog/meson.build | 2 +- lib/portage/emaint/meson.build | 2 +- lib/portage/emaint/modules/binhost/meson.build | 2 +- lib/portage/emaint/modules/config/meson.build| 2 +- lib/portage/emaint/modules/logs/meson.build | 2 +- lib/portage/emaint/modules/merges/meson.build| 2 +- lib/portage/emaint/modules/meson.build | 2 +- lib/portage/emaint/modules/move/meson.build | 2 +- lib/portage/emaint/modules/resume/meson.build| 2 +- lib/portage/emaint/modules/sync/meson.build | 2 +- lib/portage/emaint/modules/world/meson.build | 2 +- lib/portage/env/meson.build | 2 +- lib/portage/meson.build | 2 +- lib/portage/package/ebuild/_config/meson.build | 2 +- lib/portage/package/ebuild/_ipc/meson.build | 2 +- lib/portage/package/ebuild/_parallel_manifest/meson.build| 2 +- lib/portage/package/ebuild/meson.build | 2 +- lib/portage/package/meson.build | 2 +- lib/portage/proxy/meson.build| 2 +- lib/portage/repository/meson.build | 2 +- lib/portage/repository/storage/meson.build | 2 +- lib/portage/sync/meson.build | 2 +- lib/portage/sync/modules/cvs/meson.build | 2 +- lib/portage/sync/modules/git/meson.build | 2 +- lib/portage/sync/modules/mercurial/meson.build | 2 +- lib/portage/sync/modules/meson.build | 2 +- lib/portage/sync/modules/rsync/meson.build | 2 +- lib/portage/sync/modules/svn/meson.build | 2 +- lib/portage/sync/modules/webrsync/meson.build| 2 +- lib/portage/tests/bin/meson.build| 2 +- lib/portage/tests/dbapi/meson.build | 2 +- lib/portage/tests/dep/meson.build| 2 +- lib/portage/tests/ebuild/meson.build | 2 +- lib/portage/tests/emerge/meson.build | 2 +- lib/portage/tests/env/config/meson.build | 2 +- lib/portage/tests/env/meson.build| 2 +- lib/portage/tests/glsa/meson.build | 2 +- lib/portage/tests/gpkg/meson.build | 2 +- lib/portage/tests/lafilefixer/meson.build| 2 +- lib/portage/tests/lazyimport/meson.build | 2 +- lib/portage/tests/lint/meson.build | 2 +- lib/portage/tests/locks/meson.build | 2 +- lib/portage/tests/meson.build| 2 +- lib/portage/tests/news/meson.build | 2 +- lib/portage/tests/process/meson.build| 2 +- lib/portage/tests/resolver/binpkg_multi_instance/meson.build | 2 +- lib/portage/tests/resolver/meson.build | 2 +- lib/portage/tests/resolver/soname/meson.build| 2 +- lib/portage/tests/sets/base/meson.build | 2 +- lib/portage/tests/sets/files/meson.build | 2 +- lib/portage/tests/sets/meson.build | 2 +- lib/portage/tests/sets/shell/meson.build | 2 +-
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/dbapi/, lib/portage/dbapi/, /
commit: 71daef3ac877329a0479a72ba333a9c801a36bf3 Author: Siddhanth Rathod gmail com> AuthorDate: Thu Mar 23 16:28:14 2023 + Commit: Sam James gentoo org> CommitDate: Mon Aug 21 05:15:05 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=71daef3a bintree: Add invalid_paths member to API Add object invalid_paths for new eclean feature to deal with invalid binpkgs. This is needed for gentoolkit's eclean to handle cleaning up invalid binpkgs. gentoolkit side PR: https://github.com/gentoo/gentoolkit/pull/28 Bug: https://bugs.gentoo.org/900224 Signed-off-by: Siddhanth Rathod gmail.com> Closes: https://github.com/gentoo/portage/pull/1016 Signed-off-by: Sam James gentoo.org> NEWS| 7 +++ lib/portage/dbapi/bintree.py| 4 lib/portage/tests/dbapi/test_bintree.py | 1 + 3 files changed, 12 insertions(+) diff --git a/NEWS b/NEWS index a59af3818b..d770e0b7e9 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,10 @@ +portage-3.0.52 (UNRELEASED) +-- + +Features: +* bintree: Add new API member (invalid_paths) to allow gentoolkit to later + clean up invalid binpkgs (bug #900224). + portage-3.0.51 (2023-08-20) -- diff --git a/lib/portage/dbapi/bintree.py b/lib/portage/dbapi/bintree.py index 5f58c548d6..af2113bd84 100644 --- a/lib/portage/dbapi/bintree.py +++ b/lib/portage/dbapi/bintree.py @@ -485,6 +485,7 @@ class binarytree: self._remotepkgs = None # remote metadata indexed by cpv self._additional_pkgs = {} self.invalids = [] +self.invalid_paths: dict[str, list[str]] = {} self.settings = settings self._pkg_paths = {} self._populating = False @@ -1017,12 +1018,14 @@ class binarytree: noiselevel=-1, ) self.invalids.append(myfile[:-5]) +self.invalid_paths[myfile] = [full_path] continue try: binpkg_format = get_binpkg_format(myfile) except InvalidBinaryPackageFormat: self.invalids.append(myfile[:-5]) +self.invalid_paths[myfile[:-5]] = [full_path] continue if gpkg_only: @@ -1089,6 +1092,7 @@ class binarytree: for line in textwrap.wrap("".join(msg), 72): writemsg(f"!!! {line}\n", noiselevel=-1) self.invalids.append(mypkg) +self.invalid_paths[mypkg] = [full_path] continue multi_instance = False diff --git a/lib/portage/tests/dbapi/test_bintree.py b/lib/portage/tests/dbapi/test_bintree.py index 383d5585e7..60785b4e59 100644 --- a/lib/portage/tests/dbapi/test_bintree.py +++ b/lib/portage/tests/dbapi/test_bintree.py @@ -46,6 +46,7 @@ class BinarytreeTestCase(TestCase): "_remotepkgs", "_additional_pkgs", "invalids", +"invalid_paths", "settings", "_pkg_paths", "_populating",
[gentoo-commits] proj/portage:master commit in: /
commit: 863c4a6e8d01218e8ac56c523a7951b67ca48297 Author: Sam James gentoo org> AuthorDate: Sun Aug 20 07:55:41 2023 + Commit: Sam James gentoo org> CommitDate: Sun Aug 20 07:55:41 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=863c4a6e NEWS, meson.build: prepare for portage-3.0.51 Signed-off-by: Sam James gentoo.org> NEWS| 2 +- meson.build | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 11879d7c58..a59af3818b 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,4 @@ -portage-3.0.51 (UNRELEASED) +portage-3.0.51 (2023-08-20) -- Features: diff --git a/meson.build b/meson.build index 7c1c493497..2b15ca6557 100644 --- a/meson.build +++ b/meson.build @@ -1,7 +1,7 @@ project( 'portage', 'c', -version : '3.0.50', +version : '3.0.51', license : 'GPL-2.0-or-later', meson_version : '>=0.58.0' )
[gentoo-commits] proj/portage:master commit in: lib/portage/sync/modules/git/, /
commit: b7abeab6041247a0b5f9d750fb5c85e6f573f90c Author: Sam James gentoo org> AuthorDate: Sat Aug 19 15:38:22 2023 + Commit: Sam James gentoo org> CommitDate: Sat Aug 19 15:38:56 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=b7abeab6 sync: git: don't log on OK signature with --quiet No point in emitting a message if everything is fine when the user asks for --quiet. Bug: https://bugs.gentoo.org/673624 Signed-off-by: Sam James gentoo.org> NEWS| 2 ++ lib/portage/sync/modules/git/git.py | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 74b45f488d..11879d7c58 100644 --- a/NEWS +++ b/NEWS @@ -11,6 +11,8 @@ Bug fixes: * sync (inc. emerge-webrsync): Handle https_proxy to help users who only have it set - the expectation is to have http_proxy set (bug #691434, bug #835927, bug #911629) +* sync: git: respect --quiet more for PGP verification (bug #673624). + * emerge-webrsync: Explicitly pass http_proxy or https_proxy into gemato via --proxy (bug #911629). diff --git a/lib/portage/sync/modules/git/git.py b/lib/portage/sync/modules/git/git.py index b73b07e32a..ead276a98d 100644 --- a/lib/portage/sync/modules/git/git.py +++ b/lib/portage/sync/modules/git/git.py @@ -418,6 +418,7 @@ class GitSync(NewBase): opts = self.options.get("emerge_config").opts debug = "--debug" in opts +quiet = self.settings.get("PORTAGE_QUIET") == "1" openpgp_env = self._get_openpgp_env(self.repo.sync_openpgp_key_path, debug) @@ -459,7 +460,8 @@ class GitSync(NewBase): return False if status == "G": # good signature is good -out.einfo("Trusted signature found on top commit") +if not quiet: +out.einfo("Trusted signature found on top commit") return True if status == "U": # untrusted out.ewarn("Top commit signature is valid but not trusted")
[gentoo-commits] proj/portage:master commit in: misc/
commit: 591f0826a15e437eb02e2eddf8ed1487b05f5e94 Author: Sam James gentoo org> AuthorDate: Sat Aug 19 15:16:04 2023 + Commit: Sam James gentoo org> CommitDate: Sat Aug 19 15:16:04 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=591f0826 misc/emerge-delta-webrsync: fix incorrect warning in --help I was wrong - the full thing is indeed verified, because we check both the base + final signatures. Fixes: 0347637fe5033d3d8eb4fdafa1e86de171934819 Signed-off-by: Sam James gentoo.org> misc/emerge-delta-webrsync | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/emerge-delta-webrsync b/misc/emerge-delta-webrsync index 5b26fc14a8..610a03f8f7 100755 --- a/misc/emerge-delta-webrsync +++ b/misc/emerge-delta-webrsync @@ -152,7 +152,7 @@ for x in $*; do echo "$x isn't a valid arg. bailing." fi if [[ -n $PUKE_HELP ]]; then - echo "--no-pgp-verify; disable PGP verification of snapshot (note that patches are not verified either way)" + echo "--no-pgp-verify; disable PGP verification of snapshot and patches" echo "-u for upgrade; sync only if new snapshots are found" echo "-k for keep; keep old tree snapshots around" exit -1
[gentoo-commits] proj/portage:master commit in: /
commit: e55f7f2829e171f1fbde26e8ef50a53e8fab3d24 Author: Oskari Pirhonen gmail com> AuthorDate: Sun Aug 13 03:43:40 2023 + Commit: Sam James gentoo org> CommitDate: Sat Aug 19 15:05:19 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=e55f7f28 NEWS: add -Oline fix Signed-off-by: Oskari Pirhonen gmail.com> Closes: https://github.com/gentoo/portage/pull/1079 Signed-off-by: Sam James gentoo.org> NEWS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS b/NEWS index 25417c99ef..74b45f488d 100644 --- a/NEWS +++ b/NEWS @@ -14,6 +14,8 @@ Bug fixes: * emerge-webrsync: Explicitly pass http_proxy or https_proxy into gemato via --proxy (bug #911629). +* doebuild: gate -Oline behind MAKEFLAGS check (bug #909009). + * misc/emerge-delta-webrsync: Fix PGP logic which prevented syncing for this rarely-used tool (bug #911335).
[gentoo-commits] proj/portage:master commit in: lib/portage/package/ebuild/
commit: 87d0a7447f1464157f18a8ba0991719777003325 Author: Oskari Pirhonen gmail com> AuthorDate: Sun Aug 13 03:11:15 2023 + Commit: Sam James gentoo org> CommitDate: Sat Aug 19 15:05:19 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=87d0a744 doebuild: gate -Oline behind MAKEFLAGS check Add a check to see if MAKEFLAGS is set (alongside the existing MAKEOPTS and GNUMAKEFLAGS checks) before enabling output synchronization. This is only tangentially related to the bug below via being a (likely rare) case of MAKEFLAGS being set in the wild. Bug: https://bugs.gentoo.org/909009 Signed-off-by: Oskari Pirhonen gmail.com> Signed-off-by: Sam James gentoo.org> lib/portage/package/ebuild/doebuild.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/portage/package/ebuild/doebuild.py b/lib/portage/package/ebuild/doebuild.py index 8b65a7862f..4d4e674c4b 100644 --- a/lib/portage/package/ebuild/doebuild.py +++ b/lib/portage/package/ebuild/doebuild.py @@ -589,7 +589,7 @@ def doebuild_environment( nproc = get_cpu_count() if nproc: mysettings["MAKEOPTS"] = "-j%d" % (nproc) -if "GNUMAKEFLAGS" not in mysettings: +if "GNUMAKEFLAGS" not in mysettings and "MAKEFLAGS" not in mysettings: mysettings["GNUMAKEFLAGS"] = "--output-sync=line" if not eapi_exports_KV(eapi):
[gentoo-commits] proj/portage:master commit in: bin/
commit: a6e8b05152e2c815ed66e3a576fe7a3c06f6b1f6 Author: Sam James gentoo org> AuthorDate: Sat Aug 19 15:03:06 2023 + Commit: Sam James gentoo org> CommitDate: Sat Aug 19 15:03:06 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=a6e8b051 emerge-webrsync: drop dead --keyserver code Signed-off-by: Sam James gentoo.org> bin/emerge-webrsync | 6 -- 1 file changed, 6 deletions(-) diff --git a/bin/emerge-webrsync b/bin/emerge-webrsync index fea0085682..782a6052eb 100755 --- a/bin/emerge-webrsync +++ b/bin/emerge-webrsync @@ -280,17 +280,11 @@ check_file_signature_gemato() { die "Needed keys unavailable! Install its package or set PORTAGE_GPG_KEY to the right path." fi - local keyserver - if [[ -n ${PORTAGE_GPG_KEY_SERVER} ]] ; then - keyserver="--keyserver ${PORTAGE_GPG_KEY_SERVER}" - fi - local gemato_args=( openpgp-verify-detached -K "${key}" ) - if [[ -n ${http_proxy} || -n ${https_proxy} ]] ; then gemato_args+=( --proxy "${http_proxy:-${https_proxy}}"
[gentoo-commits] proj/portage:master commit in: misc/
commit: 79f0b50b79d6ddde4cabd2dca5eac88b2cbf40c1 Author: Sam James gentoo org> AuthorDate: Sat Aug 19 15:02:44 2023 + Commit: Sam James gentoo org> CommitDate: Sat Aug 19 15:02:44 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=79f0b50b misc/emerge-delta-webrsync: drop dead --keyserver code Signed-off-by: Sam James gentoo.org> misc/emerge-delta-webrsync | 5 - 1 file changed, 5 deletions(-) diff --git a/misc/emerge-delta-webrsync b/misc/emerge-delta-webrsync index 1a54d41734..5b26fc14a8 100755 --- a/misc/emerge-delta-webrsync +++ b/misc/emerge-delta-webrsync @@ -391,11 +391,6 @@ check_file_signature_gemato() { die "Needed keys unavailable! Install its package or set PORTAGE_GPG_KEY to the right path." fi - local keyserver - if [[ -n ${PORTAGE_GPG_KEY_SERVER} ]] ; then - keyserver="--keyserver ${PORTAGE_GPG_KEY_SERVER}" - fi - local gemato_args=( openpgp-verify-detached -K "${key}"
[gentoo-commits] proj/portage:master commit in: misc/
commit: 058af64372fc6937cb83e58653133f2dba47d410 Author: Sam James gentoo org> AuthorDate: Sat Aug 19 15:02:17 2023 + Commit: Sam James gentoo org> CommitDate: Sat Aug 19 15:02:17 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=058af643 misc/emerge-delta-webrsync: sync with emerge-webrsync for proxy support Signed-off-by: Sam James gentoo.org> misc/emerge-delta-webrsync | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/misc/emerge-delta-webrsync b/misc/emerge-delta-webrsync index b2925f0134..1a54d41734 100755 --- a/misc/emerge-delta-webrsync +++ b/misc/emerge-delta-webrsync @@ -94,8 +94,8 @@ eval "$("${portageq}" envvar -v DISTDIR EPREFIX FEATURES \ PORTAGE_BIN_PATH PORTAGE_CONFIGROOT PORTAGE_GPG_DIR \ PORTAGE_NICENESS PORTAGE_REPOSITORIES PORTAGE_RSYNC_EXTRA_OPTS \ PORTAGE_RSYNC_OPTS PORTAGE_TEMP_GPG_DIR PORTAGE_TMPDIR \ - USERLAND http_proxy ftp_proxy)" -export http_proxy ftp_proxy + USERLAND http_proxy https_proxy ftp_proxy)" +export http_proxy https_proxy ftp_proxy source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit @@ -401,6 +401,12 @@ check_file_signature_gemato() { -K "${key}" ) + if [[ -n ${http_proxy} || -n ${https_proxy} ]] ; then + gemato_args+=( + --proxy "${http_proxy:-${https_proxy}}" + ) + fi + [[ -n ${PORTAGE_GPG_KEY_SERVER} ]] && gemato_args+=( --keyserver "${PORTAGE_GPG_KEY_SERVER}" ) [[ ${PORTAGE_QUIET} == 1 ]] && gemato_args+=( --quiet ) [[ ${do_debug} == 1 ]] && gemato_args+=( --debug )
[gentoo-commits] proj/portage:master commit in: /, man/
commit: 45341379cdcdfb74ab44ffb0297564f12fb9beb5 Author: Sam James gentoo org> AuthorDate: Sat Aug 19 14:58:24 2023 + Commit: Sam James gentoo org> CommitDate: Sat Aug 19 14:59:00 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=45341379 make.conf.5: mention https_proxy We support it as of recent (from today) commits. Bug: https://bugs.gentoo.org/587484 Signed-off-by: Sam James gentoo.org> NEWS| 2 ++ man/make.conf.5 | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 1f789c6f27..25417c99ef 100644 --- a/NEWS +++ b/NEWS @@ -17,6 +17,8 @@ Bug fixes: * misc/emerge-delta-webrsync: Fix PGP logic which prevented syncing for this rarely-used tool (bug #911335). +* make.conf(5): Mention https_proxy. + portage-3.0.50 (2023-08-09) -- diff --git a/man/make.conf.5 b/man/make.conf.5 index 75206d5e75..a1a433b108 100644 --- a/man/make.conf.5 +++ b/man/make.conf.5 @@ -871,7 +871,7 @@ The user name used to drop root privileges during verification. Defaults to "nobody" .br .TP -\fBhttp_proxy ftp_proxy RSYNC_PROXY\fR = \fI[protocol://host:port]\fR +\fBhttp_proxy https_proxy ftp_proxy RSYNC_PROXY\fR = \fI[protocol://host:port]\fR These variables are used by network clients such as \fBwget\fR(1) and \fBrsync\fR(1). They are only required if you use a proxy server for internet access.
[gentoo-commits] proj/portage:master commit in: lib/portage/sync/
commit: eb3a3878e36e32ed0f8385b7ff8e978fbbe1aff3 Author: Sam James gentoo org> AuthorDate: Sat Aug 19 13:51:45 2023 + Commit: Sam James gentoo org> CommitDate: Sat Aug 19 14:49:34 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=eb3a3878 sync: handle https_proxy too Pass down https_proxy into gemato. If http_proxy isn't set, but https_proxy is, then let's fall back to it to help users out. gnupg itself doesn't use https_proxy but users may have only https_proxy set rather than http_proxy and https_proxy. We've had cases reported where users only have https_proxy and not http_proxy set, so include this to help them out too. Bug: https://bugs.gentoo.org/691434 Bug: https://bugs.gentoo.org/835927 Bug: https://bugs.gentoo.org/911629 Signed-off-by: Sam James gentoo.org> lib/portage/sync/syncbase.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/portage/sync/syncbase.py b/lib/portage/sync/syncbase.py index b7228a38a6..9c25a0299b 100644 --- a/lib/portage/sync/syncbase.py +++ b/lib/portage/sync/syncbase.py @@ -333,6 +333,8 @@ class SyncBase: # Override global proxy setting with one provided in emerge configuration if "http_proxy" in self.spawn_kwargs["env"]: proxy = self.spawn_kwargs["env"]["http_proxy"] +elif "https_proxy" in self.spawn_kwargs["env"]: +proxy = self.spawn_kwargs["env"]["https_proxy"] else: proxy = None
[gentoo-commits] proj/portage:master commit in: /
commit: aa5e2afdb7a6d5d05cc36d6e18dd354f68a73c79 Author: Sam James gentoo org> AuthorDate: Sat Aug 19 14:45:24 2023 + Commit: Sam James gentoo org> CommitDate: Sat Aug 19 14:49:34 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=aa5e2afd NEWS: update for proxy fixes Signed-off-by: Sam James gentoo.org> NEWS | 6 ++ 1 file changed, 6 insertions(+) diff --git a/NEWS b/NEWS index f7e092808a..1f789c6f27 100644 --- a/NEWS +++ b/NEWS @@ -8,6 +8,12 @@ Features: especially useful for debugging hangs during the 'Refreshing keys' stage. Bug fixes: +* sync (inc. emerge-webrsync): Handle https_proxy to help users who only have it set + - the expectation is to have http_proxy set (bug #691434, bug #835927, bug #911629) + +* emerge-webrsync: Explicitly pass http_proxy or https_proxy into gemato + via --proxy (bug #911629). + * misc/emerge-delta-webrsync: Fix PGP logic which prevented syncing for this rarely-used tool (bug #911335).
[gentoo-commits] proj/portage:master commit in: bin/, lib/portage/package/ebuild/_config/
commit: 2410f8d7dde2ac12de4ec040696bcbb51e09ce9f Author: Sam James gentoo org> AuthorDate: Sat Aug 19 13:54:08 2023 + Commit: Sam James gentoo org> CommitDate: Sat Aug 19 14:49:34 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=2410f8d7 save-ebuild-env.sh, special_env_vars.py: add https_proxy For parity with http_proxy. Bug: https://bugs.gentoo.org/691434 Bug: https://bugs.gentoo.org/835927 Bug: https://bugs.gentoo.org/911629 Signed-off-by: Sam James gentoo.org> bin/save-ebuild-env.sh | 2 +- lib/portage/package/ebuild/_config/special_env_vars.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/save-ebuild-env.sh b/bin/save-ebuild-env.sh index 20cd868665..3a2560aabf 100644 --- a/bin/save-ebuild-env.sh +++ b/bin/save-ebuild-env.sh @@ -28,7 +28,7 @@ __save_ebuild_env() { # misc variables inherited from the calling environment unset COLORTERM DISPLAY EDITOR LESS LESSOPEN LOGNAME LS_COLORS PAGER \ - TERM TERMCAP USER ftp_proxy http_proxy no_proxy + TERM TERMCAP USER ftp_proxy http_proxy https_proxy no_proxy # other variables inherited from the calling environment unset CVS_RSH ECHANGELOG_USER GPG_AGENT_INFO \ diff --git a/lib/portage/package/ebuild/_config/special_env_vars.py b/lib/portage/package/ebuild/_config/special_env_vars.py index beb411188c..ef8f06abe3 100644 --- a/lib/portage/package/ebuild/_config/special_env_vars.py +++ b/lib/portage/package/ebuild/_config/special_env_vars.py @@ -215,6 +215,7 @@ environ_whitelist = frozenset( "USER", "ftp_proxy", "http_proxy", +"https_proxy", "no_proxy", # tempdir settings "TMPDIR",
[gentoo-commits] proj/portage:master commit in: bin/
commit: aa37e3993866f1d75e855f8c7300749fadd846af Author: Sam James gentoo org> AuthorDate: Sat Aug 19 13:49:53 2023 + Commit: Sam James gentoo org> CommitDate: Sat Aug 19 14:49:33 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=aa37e399 emerge-webrsync: pass --proxy to gemato if http_proxy or https_proxy is set Make sure we pass proxy settings down into gemato. We include a fallback w/ https_proxy, but note that gnupg doesn't actually use https_proxy but we've had cases reported where users only have https_proxy and not http_proxy set, so include this to help them out too. Bug: https://bugs.gentoo.org/691434 Bug: https://bugs.gentoo.org/835927 Bug: https://bugs.gentoo.org/911629 Signed-off-by: Sam James gentoo.org> bin/emerge-webrsync | 7 +++ 1 file changed, 7 insertions(+) diff --git a/bin/emerge-webrsync b/bin/emerge-webrsync index 7ef6d0d5a9..fea0085682 100755 --- a/bin/emerge-webrsync +++ b/bin/emerge-webrsync @@ -290,6 +290,13 @@ check_file_signature_gemato() { -K "${key}" ) + + if [[ -n ${http_proxy} || -n ${https_proxy} ]] ; then + gemato_args+=( + --proxy "${http_proxy:-${https_proxy}}" + ) + fi + [[ -n ${PORTAGE_GPG_KEY_SERVER} ]] && gemato_args+=( --keyserver "${PORTAGE_GPG_KEY_SERVER}" ) [[ ${PORTAGE_QUIET} == 1 ]] && gemato_args+=( --quiet ) [[ ${do_debug} == 1 ]] && gemato_args+=( --debug )
[gentoo-commits] proj/portage:master commit in: bin/
commit: f0b44fc1cc67114662b84905bc1e0cd9ce1bba28 Author: Sam James gentoo org> AuthorDate: Sat Aug 19 13:49:19 2023 + Commit: Sam James gentoo org> CommitDate: Sat Aug 19 14:49:33 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=f0b44fc1 emerge-webrsync: handle https_proxy too If `https_proxy` is also set in make.conf, pick that up so it's passed down to wget. Bug: https://bugs.gentoo.org/691434 Bug: https://bugs.gentoo.org/835927 Bug: https://bugs.gentoo.org/911629 Signed-off-by: Sam James gentoo.org> bin/emerge-webrsync | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/emerge-webrsync b/bin/emerge-webrsync index 7b3163b813..7ef6d0d5a9 100755 --- a/bin/emerge-webrsync +++ b/bin/emerge-webrsync @@ -83,8 +83,8 @@ eval "$("${portageq}" envvar -v DISTDIR EPREFIX FEATURES \ PORTAGE_BIN_PATH PORTAGE_CONFIGROOT PORTAGE_GPG_DIR \ PORTAGE_NICENESS PORTAGE_REPOSITORIES PORTAGE_RSYNC_EXTRA_OPTS \ PORTAGE_RSYNC_OPTS PORTAGE_TEMP_GPG_DIR PORTAGE_TMPDIR \ - USERLAND http_proxy ftp_proxy)" -export http_proxy ftp_proxy + USERLAND http_proxy https_proxy ftp_proxy)" +export http_proxy https_proxy ftp_proxy source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
[gentoo-commits] proj/portage:master commit in: misc/
commit: fe8b6d95b9c46b67cd4cf0040b5ae81704056cb7 Author: Sam James gentoo org> AuthorDate: Sat Aug 19 13:35:04 2023 + Commit: Sam James gentoo org> CommitDate: Sat Aug 19 13:35:04 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=fe8b6d95 misc/emerge-delta-webrsync: fix copyright header, whitespace Signed-off-by: Sam James gentoo.org> misc/emerge-delta-webrsync | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/misc/emerge-delta-webrsync b/misc/emerge-delta-webrsync index 8859bd79fe..b2925f0134 100755 --- a/misc/emerge-delta-webrsync +++ b/misc/emerge-delta-webrsync @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# Copyright 1999-2014 Gentoo Foundation +# Copyright 1999-2023 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # Author: Brian Harring , kar...@gentoo.org originally. # Rewritten from the old, Perl-based emerge-webrsync script @@ -374,7 +374,6 @@ check_file_digest() { return "${r}" } - check_file_signature_gemato() { local signature="$1" local file="$2"
[gentoo-commits] proj/portage:master commit in: misc/, /
commit: 0347637fe5033d3d8eb4fdafa1e86de171934819 Author: Sam James gentoo org> AuthorDate: Sat Aug 19 13:31:19 2023 + Commit: Sam James gentoo org> CommitDate: Sat Aug 19 13:33:47 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=0347637f misc/emerge-delta-webrsync: fix pgp verification Sync the logic with bin/emerge-webrsync to bring in the recent updates from portage-3.0.47 onwards. Bug: https://bugs.gentoo.org/911335 Signed-off-by: Sam James gentoo.org> NEWS | 4 + misc/emerge-delta-webrsync | 295 - 2 files changed, 242 insertions(+), 57 deletions(-) diff --git a/NEWS b/NEWS index ad541b95b1..f7e092808a 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,10 @@ Features: * sync: git, rsync: now respects --debug for better output from gemato. This is especially useful for debugging hangs during the 'Refreshing keys' stage. +Bug fixes: +* misc/emerge-delta-webrsync: Fix PGP logic which prevented syncing for this + rarely-used tool (bug #911335). + portage-3.0.50 (2023-08-09) -- diff --git a/misc/emerge-delta-webrsync b/misc/emerge-delta-webrsync index d4c70fb9c4..8859bd79fe 100755 --- a/misc/emerge-delta-webrsync +++ b/misc/emerge-delta-webrsync @@ -19,6 +19,51 @@ # gpg --homedir /etc/portage/gnupg --edit-key $KEY_ID trust # +# Opportunistically use gentoo-functions for nicer output +functions_script="${EPREFIX:-/}/lib/gentoo/functions.sh" +source "${functions_script}" || { + echo "${argv0}: Could not source ${functions_script}!" 1>&2 + + ebegin() { + printf '%s*%s %s ... ' "${GOOD}" "${NORMAL}" "$*" + } + + eend() { + local r=${1:-0} + shift + if [[ $r -eq 0 ]] ; then + printf '[ %sok%s ]\n' "${GOOD}" "${NORMAL}" + else + printf '%s [ %s!!%s ]\n' "$*" "${BAD}" "${NORMAL}" + fi + return "${r}" + } + + einfo() { + echo "${argv0##*/}: $*" + } + + ewarn() { + echo "${argv0##*/}: warning: $*" 1>&2 + } + + eerror() { + echo "${argv0##*/}: error: $*" 1>&2 + } + +} + +# Only echo if in normal mode +vvecho() { [[ ${PORTAGE_QUIET} != 1 ]] && echo "$@" ; } +# Only echo if in quiet mode +nvecho() { [[ ${PORTAGE_QUIET} == 1 ]] && echo "$@" ; } + +# Unfortunately, gentoo-functions doesn't yet have a die() (bug #878505) +die() { + eerror "$@" + exit 1 +} + argv0=$0 # Only echo if not in verbose mode @@ -52,13 +97,12 @@ eval "$("${portageq}" envvar -v DISTDIR EPREFIX FEATURES \ USERLAND http_proxy ftp_proxy)" export http_proxy ftp_proxy -source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit repo_name=gentoo repo_location=$(__repo_attr "${repo_name}" location) if [[ -z ${repo_location} ]]; then - eecho "Repository '${repo_name}' not found" - exit 1 + die "Repository '${repo_name}' not found" fi if [ -z "$NICENESS_PULLED" ]; then @@ -89,7 +133,12 @@ for x in $*; do PORTAGE_QUIET=1 continue ;; + --no-pgp-verify) + no_pgp_verify=1 + continue + ;; esac + if [[ $x == "-u" ]]; then MUST_SYNC='' elif [[ $x == "-k" ]]; then @@ -103,6 +152,7 @@ for x in $*; do echo "$x isn't a valid arg. bailing." fi if [[ -n $PUKE_HELP ]]; then + echo "--no-pgp-verify; disable PGP verification of snapshot (note that patches are not verified either way)" echo "-u for upgrade; sync only if new snapshots are found" echo "-k for keep; keep old tree snapshots around" exit -1 @@ -114,35 +164,68 @@ if [[ ! -d $STATE_DIR ]]; then exit -2 fi -has webrsync-gpg ${FEATURES} && webrsync_gpg=1 || webrsync_gpg=0 +handle_pgp_setup() { + # 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 || webrsync_gpg=0 + + 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 + # calls for backward compatibility (this triggers a deprecation warning + # above). Since direct emerge-webrsync
[gentoo-commits] proj/portage:master commit in: lib/portage/sync/modules/git/
commit: 89deda23ff5bd3feec45f5a6d70aa3b36e326068 Author: Sam James gentoo org> AuthorDate: Thu Aug 17 06:59:48 2023 + Commit: Sam James gentoo org> CommitDate: Thu Aug 17 06:59:48 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=89deda23 sync: git: fix debugging line leftover Fixes: 9268a92b9666eaaf263999b18220c0d56d8c476c Signed-off-by: Sam James gentoo.org> lib/portage/sync/modules/git/git.py | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/portage/sync/modules/git/git.py b/lib/portage/sync/modules/git/git.py index 478e816370..b73b07e32a 100644 --- a/lib/portage/sync/modules/git/git.py +++ b/lib/portage/sync/modules/git/git.py @@ -420,7 +420,6 @@ class GitSync(NewBase): debug = "--debug" in opts openpgp_env = self._get_openpgp_env(self.repo.sync_openpgp_key_path, debug) -logging.getLogger("gemato").setLevel(logging.DEBUG) if debug: old_level = logging.getLogger().getEffectiveLevel()
[gentoo-commits] proj/portage:master commit in: lib/portage/sync/modules/git/, lib/portage/sync/, ...
commit: 9268a92b9666eaaf263999b18220c0d56d8c476c Author: Sam James gentoo org> AuthorDate: Sun Aug 13 04:36:04 2023 + Commit: Sam James gentoo org> CommitDate: Thu Aug 17 06:52:55 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=9268a92b sync: rsync, git: respect --debug for gemato Respect --debug and pass it down to gemato so we get nice debugging output when e.g. 'refreshing keys' is stuck. Bug: https://bugs.gentoo.org/646194 Bug: https://bugs.gentoo.org/647696 Bug: https://bugs.gentoo.org/691666 Bug: https://bugs.gentoo.org/779766 Bug: https://bugs.gentoo.org/873133 Bug: https://bugs.gentoo.org/906875 Bug: https://github.com/projg2/gemato/issues/7 Bug: https://github.com/projg2/gemato/issues/25 Signed-off-by: Sam James gentoo.org> lib/portage/sync/modules/git/git.py | 15 +-- lib/portage/sync/modules/rsync/rsync.py | 11 +-- lib/portage/sync/syncbase.py| 12 3 files changed, 30 insertions(+), 8 deletions(-) diff --git a/lib/portage/sync/modules/git/git.py b/lib/portage/sync/modules/git/git.py index 46194ad6cf..0b46bd9238 100644 --- a/lib/portage/sync/modules/git/git.py +++ b/lib/portage/sync/modules/git/git.py @@ -1,4 +1,4 @@ -# Copyright 2005-2022 Gentoo Authors +# Copyright 2005-2023 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 import logging @@ -416,7 +416,16 @@ class GitSync(NewBase): ) return False -openpgp_env = self._get_openpgp_env(self.repo.sync_openpgp_key_path) +opts = self.options.get("emerge_config").opts +debug = "--debug" in opts + +openpgp_env = self._get_openpgp_env(self.repo.sync_openpgp_key_path, debug) +logging.getLogger("gemato").setLevel(logging.DEBUG) + +if debug: +old_level = logging.getLogger().getEffectiveLevel() +logging.getLogger().setLevel(logging.DEBUG) +logging.getLogger("gemato").setLevel(logging.DEBUG) try: out = EOutput() @@ -475,6 +484,8 @@ class GitSync(NewBase): finally: if openpgp_env is not None: openpgp_env.close() +if debug: +logging.getLogger().setLevel(old_level) def retrieve_head(self, **kwargs) -> tuple[int, bool]: """Get information about the head commit""" diff --git a/lib/portage/sync/modules/rsync/rsync.py b/lib/portage/sync/modules/rsync/rsync.py index aca51f2533..b095d6cb86 100644 --- a/lib/portage/sync/modules/rsync/rsync.py +++ b/lib/portage/sync/modules/rsync/rsync.py @@ -1,4 +1,4 @@ -# Copyright 1999-2020 Gentoo Authors +# Copyright 1999-2023 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 import datetime @@ -147,11 +147,16 @@ class RsyncSync(NewBase): else: self.max_age = 0 +debug = "--debug" in opts +if debug: +old_level = logging.getLogger().getEffectiveLevel() +logging.getLogger().setLevel(logging.DEBUG) + openpgp_env = None if self.verify_metamanifest and gemato is not None: # Use isolated environment if key is specified, # system environment otherwise -openpgp_env = self._get_openpgp_env(self.repo.sync_openpgp_key_path) +openpgp_env = self._get_openpgp_env(self.repo.sync_openpgp_key_path, debug) try: # Load and update the keyring early. If it fails, then verification @@ -484,6 +489,8 @@ class RsyncSync(NewBase): self.repo_storage.abort_update() if openpgp_env is not None: openpgp_env.close() +if debug: +logging.getLogger().setLevel(old_level) def _process_exitcode(self, exitcode, syncuri, out, maxretries): if exitcode == 0: diff --git a/lib/portage/sync/syncbase.py b/lib/portage/sync/syncbase.py index 44d94524a5..b7228a38a6 100644 --- a/lib/portage/sync/syncbase.py +++ b/lib/portage/sync/syncbase.py @@ -1,4 +1,4 @@ -# Copyright 2014-2020 Gentoo Authors +# Copyright 2014-2023 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 """ @@ -328,7 +328,7 @@ class SyncBase: loop.run_until_complete(decorated_func()) out.eend(0) -def _get_openpgp_env(self, openpgp_key_path=None): +def _get_openpgp_env(self, openpgp_key_path=None, debug=False): if gemato is not None: # Override global proxy setting with one provided in emerge configuration if "http_proxy" in self.spawn_kwargs["env"]: @@ -337,9 +337,13 @@ class SyncBase: proxy = None if openpgp_key_path: -openpgp_env = gemato.openpgp.OpenPGPEnvironment(proxy=proxy) +openpgp_env = gemato.openpgp.OpenPGPEnvironment( +proxy=proxy, debug=debug +)
[gentoo-commits] proj/portage:master commit in: /, lib/_emerge/
commit: ab71ec960b65b2d77e5669d8979dc72e3f4ffb41 Author: Sam James gentoo org> AuthorDate: Thu Aug 17 06:46:53 2023 + Commit: Sam James gentoo org> CommitDate: Thu Aug 17 06:52:55 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=ab71ec96 lib: _emerge: call portage.util.initialize_logger() We don't have a root logger setup otherwise which means we can't get nice output from things like gemato which define their own logger names/domains. And respect --debug for it. Signed-off-by: Sam James gentoo.org> NEWS| 9 + lib/_emerge/main.py | 4 2 files changed, 13 insertions(+) diff --git a/NEWS b/NEWS index d442a42ab0..ad541b95b1 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,12 @@ +portage-3.0.51 (UNRELEASED) +-- + +Features: +* emerge: Set up logging immediately and respect --debug for log level. + +* sync: git, rsync: now respects --debug for better output from gemato. This is + especially useful for debugging hangs during the 'Refreshing keys' stage. + portage-3.0.50 (2023-08-09) -- diff --git a/lib/_emerge/main.py b/lib/_emerge/main.py index 41bed09696..d92f069901 100644 --- a/lib/_emerge/main.py +++ b/lib/_emerge/main.py @@ -1191,6 +1191,10 @@ def emerge_main(args: Optional[list[str]] = None): myaction, myopts, myfiles = parse_opts(args, silent=True) if "--debug" in myopts: os.environ["PORTAGE_DEBUG"] = "1" +portage.util.initialize_logger(logging.DEBUG) +else: +portage.util.initialize_logger() + if "--config-root" in myopts: os.environ["PORTAGE_CONFIGROOT"] = myopts["--config-root"] if "--sysroot" in myopts:
[gentoo-commits] proj/portage:master commit in: lib/portage/sync/modules/git/
commit: 1055d09fa606bb169159e051e3f82809e52a Author: Sam James gentoo org> AuthorDate: Sun Aug 13 04:40:11 2023 + Commit: Sam James gentoo org> CommitDate: Thu Aug 17 06:52:55 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=1055d09f sync: git: dump gpg output if verification fails with --debug Signed-off-by: Sam James gentoo.org> lib/portage/sync/modules/git/git.py | 8 1 file changed, 8 insertions(+) diff --git a/lib/portage/sync/modules/git/git.py b/lib/portage/sync/modules/git/git.py index 0b46bd9238..478e816370 100644 --- a/lib/portage/sync/modules/git/git.py +++ b/lib/portage/sync/modules/git/git.py @@ -480,6 +480,14 @@ class GitSync(NewBase): else: expl = "unknown issue" out.eerror(f"No valid signature found: {expl}") + +if debug: +writemsg_level( +f"!!! Got following output from gpg: {status}\n", +level=logging.DEBUG, +noiselevel=-1, +) + return False finally: if openpgp_env is not None:
[gentoo-commits] proj/portage:master commit in: /
commit: 4f4adbfb1b60ca04c8c04cd858d2cdebdf201b8c Author: Sam James gentoo org> AuthorDate: Thu Aug 10 01:43:14 2023 + Commit: Sam James gentoo org> CommitDate: Thu Aug 10 01:43:14 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=4f4adbfb NEWS: add missing entry for compgen removal Bug: https://bugs.gentoo.org/909148 Fixes: f24dd0d9808559571509add2c8c69c1bcb2bfec6 Signed-off-by: Sam James gentoo.org> NEWS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/NEWS b/NEWS index bfa5527bd0..c69975bc9c 100644 --- a/NEWS +++ b/NEWS @@ -15,6 +15,9 @@ Bug fixes: * install-qa-check.d/05prefix: Fix prefixifying shebang for >= EAPI 7 ebuilds (bug #909147). +* bin/save-ebuild-env.sh: Stop using compgen and hence stop needing readline + (bug #909148). + * env-update: Check exit code from ldconfig (bug #910376). * emerge: Fix 'no ebuilds available' message always mentioning binpkgs
[gentoo-commits] proj/portage:master commit in: /
commit: 4b993bf9a580c74f36fe28f6c505f208d9be1595 Author: Sam James gentoo org> AuthorDate: Thu Aug 10 01:44:35 2023 + Commit: Sam James gentoo org> CommitDate: Thu Aug 10 01:44:35 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=4b993bf9 NEWS: add another news entry >From 8cc2348a2c0706f57962fee09a91c5a5b85f1b99. Signed-off-by: Sam James gentoo.org> NEWS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS b/NEWS index c69975bc9c..d442a42ab0 100644 --- a/NEWS +++ b/NEWS @@ -18,6 +18,8 @@ Bug fixes: * bin/save-ebuild-env.sh: Stop using compgen and hence stop needing readline (bug #909148). +* _reflink_linux_file_copy: Fix -Wmaybe-uninitialized. + * env-update: Check exit code from ldconfig (bug #910376). * emerge: Fix 'no ebuilds available' message always mentioning binpkgs
[gentoo-commits] proj/portage:master commit in: /
commit: 8f31c37475e4c230f7add81468d8825e01d81d37 Author: Sam James gentoo org> AuthorDate: Thu Aug 10 01:42:07 2023 + Commit: Sam James gentoo org> CommitDate: Thu Aug 10 01:42:07 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=8f31c374 NEWS: fix entry for cgroup removal Fixes: f8e3b11496bd6d602a690535c4a3bb32bb8e9744 Signed-off-by: Sam James gentoo.org> NEWS | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/NEWS b/NEWS index c39e046717..bfa5527bd0 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,10 @@ Breaking changes: * Portage now installed with Meson and Python sdist + wheel now prepared with meson-python for PEP 517 compliance. +* FEATURES=cgroup was removed since it was based on version 1 cgroups, which + caused some issues and version 1 cgroups are obsolete. Use + FEATURES=pid-sandbox instead. + Bug fixes: * install-qa-check.d/05prefix: Fix prefixifying shebang for >= EAPI 7 ebuilds (bug #909147). @@ -31,11 +35,6 @@ Bug fixes: portage-3.0.49 (2023-06-21) -- -Breaking changes: -* FEATURES=cgroup was removed since it was based on version 1 cgroups, which - caused some issues and version 1 cgroups are obsolete. Use - FEATURES=pid-sandbox instead. - Bug fixes: * Adjust write tests for DISTDIR and PORTAGE_TMPDIR to work with automount directories (bug #485100, bug #890812).
[gentoo-commits] proj/portage:master commit in: /
commit: 72c7a1401553f25f21bf3993a9feeebc0f3eddc1 Author: Sam James gentoo org> AuthorDate: Wed Aug 9 02:48:49 2023 + Commit: Sam James gentoo org> CommitDate: Wed Aug 9 02:48:49 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=72c7a140 NEWS, meson.build: prepare for portage-3.0.50 Signed-off-by: Sam James gentoo.org> NEWS| 2 +- meson.build | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 281cbc2c9..c39e04671 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,4 @@ -portage-3.0.50 (UNRELEASED) +portage-3.0.50 (2023-08-09) -- Breaking changes: diff --git a/meson.build b/meson.build index 3d2a053b5..7c1c49349 100644 --- a/meson.build +++ b/meson.build @@ -1,7 +1,7 @@ project( 'portage', 'c', -version : '3.0.49', +version : '3.0.50', license : 'GPL-2.0-or-later', meson_version : '>=0.58.0' )
[gentoo-commits] proj/portage:master commit in: /
commit: ac0c147f9dc0f57535390fac2181e0efefd9b48c Author: Sam James gentoo org> AuthorDate: Tue Aug 8 04:52:06 2023 + Commit: Sam James gentoo org> CommitDate: Tue Aug 8 04:52:06 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=ac0c147f NEWS: update Bug: https://bugs.gentoo.org/911594 Signed-off-by: Sam James gentoo.org> NEWS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS b/NEWS index 53f0f921f..281cbc2c9 100644 --- a/NEWS +++ b/NEWS @@ -26,6 +26,8 @@ Bug fixes: * Define BROOT in pkg_* phases following PMS change. +* portage(5): Fix description of 'volatile' repos.conf setting (bug #911594). + portage-3.0.49 (2023-06-21) --
[gentoo-commits] proj/portage:master commit in: man/
commit: 6db114e2efd6ef05dbb285698f4b104f305ff113 Author: Christian Becke web de> AuthorDate: Wed Aug 2 10:47:51 2023 + Commit: Sam James gentoo org> CommitDate: Tue Aug 8 04:50:17 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=6db114e2 portage(5): fix description of volatile attribute The description of the 'volatile' keyword in the 'repos.conf' section in the portage(5) man page seems to be inconsistent. I think the first two sentences correctly describe the behaviour of 'volatile' and agree with the comments in portage/repository/config.py: "Specifies whether a repository is volatile. Volatile repositories are assumed to contain changes made outside of Portage. This prohibits optimizations from occurring by assuming the integrity of the repository and its caches may be violated." The remainder of the paragraph inverts the meaning of 'volatile' and does not agree with the code in portage/repository/config.py: "Disabling this option allows local changes to be made to the repository for e.g. development safely. For git-synced repositories, Portage will not perform destructive operations. Per default, repositories are considered volatile if their directory is owned by either 'root' or 'portage' and if it is under /var/db/repos. Otherwise, the repository is considered non volatile." Bug: https://bugs.gentoo.org/911594 Signed-off-by: Christian Becke web.de> Signed-off-by: Sam James gentoo.org> man/portage.5 | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/man/portage.5 b/man/portage.5 index 4bae67720..1c0ce22bd 100644 --- a/man/portage.5 +++ b/man/portage.5 @@ -1265,11 +1265,11 @@ sync\-openpgp\-key\-path setting. Defaults to no, false. Specifies whether a repository is volatile. Volatile repositories are assumed to contain changes made outside of Portage. This prohibits optimizations from occurring by assuming the integrity of the repository -and its caches may be violated. Disabling this option allows local changes to -be made to the repository for e.g. development safely. For git-synced -repositories, Portage will not perform destructive operations. -Per default, repositories are considered volatile if their directory is owned -by either 'root' or 'portage' and if it is under /var/db/repos. Otherwise, +and its caches may be violated. Enabling this option allows local changes to +be made to the repository for e.g. development safely. When enabled, Portage +will not perform destructive operations for git-synced repositories. Per +default, repositories are considered volatile if their directory is not owned +by either 'root' or 'portage' or if it is not under /var/db/repos. Otherwise, the repository is considered non volatile. .TP
[gentoo-commits] proj/portage:master commit in: lib/portage/package/ebuild/, bin/, /
commit: cfa3149797c2204f3a156ec2909c444baa640a6b Author: James Le Cuirot gentoo org> AuthorDate: Sun Aug 6 09:40:02 2023 + Commit: Sam James gentoo org> CommitDate: Sun Aug 6 22:28:50 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=cfa31497 Define BROOT in pkg_* phases following PMS change Closes: https://bugs.gentoo.org/911797 Bug: https://bugs.gentoo.org/911574 Signed-off-by: James Le Cuirot gentoo.org> Closes: https://github.com/gentoo/portage/pull/1077 Signed-off-by: Sam James gentoo.org> NEWS | 3 +++ bin/phase-helpers.sh | 4 ++-- lib/portage/package/ebuild/config.py | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 53db165e8..53f0f921f 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,7 @@ portage-3.0.50 (UNRELEASED) Breaking changes: * The minimum supported Python version is now >= Python 3.9. + * Portage now installed with Meson and Python sdist + wheel now prepared with meson-python for PEP 517 compliance. @@ -23,6 +24,8 @@ Bug fixes: * Use the correct Python library path when launching scripts directly from a virtual environment. +* Define BROOT in pkg_* phases following PMS change. + portage-3.0.49 (2023-06-21) -- diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh index f1b762b0a..3f12b3707 100644 --- a/bin/phase-helpers.sh +++ b/bin/phase-helpers.sh @@ -945,8 +945,8 @@ ___best_version_and_has_version_common() { -r) root=${ROOT%/}/${EPREFIX#/} ;; -d) root=${ESYSROOT:-/} ;; -b) - # Use /${PORTAGE_OVERRIDE_EPREFIX#/} which is equivalent - # to BROOT, except BROOT is only defined in src_* phases. + # Use /${PORTAGE_OVERRIDE_EPREFIX#/} to support older + # EAPIs, as it is equivalent to BROOT. root=/${PORTAGE_OVERRIDE_EPREFIX#/} cmd+=(env EPREFIX="${PORTAGE_OVERRIDE_EPREFIX}") ;; diff --git a/lib/portage/package/ebuild/config.py b/lib/portage/package/ebuild/config.py index 91303d7ad..e07d27e8f 100644 --- a/lib/portage/package/ebuild/config.py +++ b/lib/portage/package/ebuild/config.py @@ -3338,7 +3338,7 @@ class config: if not (src_like_phase and eapi_attrs.sysroot): mydict.pop("ESYSROOT", None) -if not (src_like_phase and eapi_attrs.broot): +if not eapi_attrs.broot: mydict.pop("BROOT", None) if phase == "depend" or (
[gentoo-commits] proj/portage:master commit in: cnf/
commit: 697e297e45c69ee81199f5c40894ee276370726b Author: James Le Cuirot gentoo org> AuthorDate: Thu Aug 3 19:46:52 2023 + Commit: Sam James gentoo org> CommitDate: Thu Aug 3 21:15:08 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=697e297e Fix risc vs riscv typo in Meson file Closes: https://github.com/gentoo/portage/pull/1076 Signed-off-by: Sam James gentoo.org> cnf/meson.build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cnf/meson.build b/cnf/meson.build index d0d4c9ab1..abd151465 100644 --- a/cnf/meson.build +++ b/cnf/meson.build @@ -66,8 +66,8 @@ arch = { 'loongarch64' : 'loong', 'mips64' : 'mips', 'parisc' : 'hppa', -'riscv32' : 'risc', -'riscv64' : 'risc', +'riscv32' : 'riscv', +'riscv64' : 'riscv', 's390x' : 's390', 'sh4' : 'sh', 'sparc64' : 'sparc',
[gentoo-commits] proj/portage:master commit in: cnf/
commit: c96f8a304f4486f4a491cd351a5b4ace0f7b00de Author: James Le Cuirot gentoo org> AuthorDate: Thu Aug 3 18:15:38 2023 + Commit: Sam James gentoo org> CommitDate: Thu Aug 3 21:15:08 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=c96f8a30 Fix Meson CPU detection for make.conf I used the CPU name rather than the family by mistake. Signed-off-by: James Le Cuirot gentoo.org> Signed-off-by: Sam James gentoo.org> cnf/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cnf/meson.build b/cnf/meson.build index 00af62085..d0d4c9ab1 100644 --- a/cnf/meson.build +++ b/cnf/meson.build @@ -59,7 +59,7 @@ if eprefix != '' ) endif -arch = host_machine.cpu() +arch = host_machine.cpu_family() arch = { 'aarch64' : 'arm64',
[gentoo-commits] proj/portage:master commit in: src/
commit: 8cc2348a2c0706f57962fee09a91c5a5b85f1b99 Author: Mike Gilbert gentoo org> AuthorDate: Wed Aug 2 15:21:26 2023 + Commit: Mike Gilbert gentoo org> CommitDate: Wed Aug 2 15:26:01 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=8cc2348a _reflink_linux_file_copy: initialize error to 0 Avoids a compiler warning: ``` ../src/portage_util_file_copy_reflink_linux.c: In function ‘_reflink_linux_file_copy’: ../src/portage_util_file_copy_reflink_linux.c:379:12: warning: ‘error’ may be used uninitialized [-Wmaybe-uninitialized] 379 | if (!error && ftruncate(fd_out, offset_out) < 0) |^ ../src/portage_util_file_copy_reflink_linux.c:205:22: note: ‘error’ was declared here 205 | int eintr_retry, error, fd_in, fd_out, stat_in_acquired, stat_out_acquired; | ^ ``` Signed-off-by: Mike Gilbert gentoo.org> src/portage_util_file_copy_reflink_linux.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/portage_util_file_copy_reflink_linux.c b/src/portage_util_file_copy_reflink_linux.c index 74ba4a010..e98db3db8 100644 --- a/src/portage_util_file_copy_reflink_linux.c +++ b/src/portage_util_file_copy_reflink_linux.c @@ -214,6 +214,7 @@ _reflink_linux_file_copy(PyObject *self, PyObject *args) return NULL; eintr_retry = 1; +error = 0; offset_out = 0; stat_in_acquired = 0; stat_out_acquired = 0;
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/dbapi/
commit: 058613d54790fc164b2a2df266b96a60047a7d13 Author: James Le Cuirot gentoo org> AuthorDate: Sun Jul 30 21:34:29 2023 + Commit: Sam James gentoo org> CommitDate: Wed Aug 2 06:31:20 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=058613d5 Respect TMPDIR instead of hardcoding /tmp in test_bintree.py It was breaking the Portage sandbox. Signed-off-by: James Le Cuirot gentoo.org> Closes: https://github.com/gentoo/portage/pull/1071 Signed-off-by: Sam James gentoo.org> lib/portage/tests/dbapi/test_bintree.py | 28 +--- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/lib/portage/tests/dbapi/test_bintree.py b/lib/portage/tests/dbapi/test_bintree.py index 4b4982a54..383d5585e 100644 --- a/lib/portage/tests/dbapi/test_bintree.py +++ b/lib/portage/tests/dbapi/test_bintree.py @@ -17,14 +17,18 @@ class BinarytreeTestCase(TestCase): binarytree() self.assertEqual(str(cm.exception), "pkgdir parameter is required") with self.assertRaises(TypeError) as cm: -binarytree(pkgdir="/tmp") +binarytree(pkgdir=os.getenv("TMPDIR", "/tmp")) self.assertEqual(str(cm.exception), "settings parameter is required") def test_init_with_legacy_params_warns(self): with self.assertWarns(DeprecationWarning): -binarytree(_unused=None, pkgdir="/tmp", settings=MagicMock()) +binarytree( +_unused=None, pkgdir=os.getenv("TMPDIR", "/tmp"), settings=MagicMock() +) with self.assertWarns(DeprecationWarning): -binarytree(virtual=None, pkgdir="/tmp", settings=MagicMock()) +binarytree( +virtual=None, pkgdir=os.getenv("TMPDIR", "/tmp"), settings=MagicMock() +) def test_instance_has_required_attrs(self): # Quite smoky test. What would it be a better testing strategy? @@ -63,11 +67,13 @@ class BinarytreeTestCase(TestCase): no_multi_instance_settings = MagicMock() no_multi_instance_settings.features = "" no_multi_instance_bt = binarytree( -pkgdir="/tmp", settings=no_multi_instance_settings +pkgdir=os.getenv("TMPDIR", "/tmp"), settings=no_multi_instance_settings ) multi_instance_settings = MagicMock() multi_instance_settings.features = "binpkg-multi-instance" -multi_instance_bt = binarytree(pkgdir="/tmp", settings=multi_instance_settings) +multi_instance_bt = binarytree( +pkgdir=os.getenv("TMPDIR", "/tmp"), settings=multi_instance_settings +) for attr in required_attrs_no_multi_instance: getattr(no_multi_instance_bt, attr) getattr(multi_instance_bt, attr) @@ -77,7 +83,7 @@ class BinarytreeTestCase(TestCase): @patch("portage.dbapi.bintree.binarytree._populate_local") def test_populate_without_updates_repos_nor_getbinspkgs(self, ppopulate_local): -bt = binarytree(pkgdir="/tmp", settings=MagicMock()) +bt = binarytree(pkgdir=os.getenv("TMPDIR", "/tmp"), settings=MagicMock()) ppopulate_local.return_value = {} bt.populate() ppopulate_local.assert_called_once_with(reindex=True) @@ -86,7 +92,7 @@ class BinarytreeTestCase(TestCase): @patch("portage.dbapi.bintree.binarytree._populate_local") def test_populate_calls_twice_populate_local_if_updates(self, ppopulate_local): -bt = binarytree(pkgdir="/tmp", settings=MagicMock()) +bt = binarytree(pkgdir=os.getenv("TMPDIR", "/tmp"), settings=MagicMock()) bt.populate() self.assertIn(call(reindex=True), ppopulate_local.mock_calls) self.assertIn(call(), ppopulate_local.mock_calls) @@ -96,7 +102,7 @@ class BinarytreeTestCase(TestCase): @patch("portage.dbapi.bintree.binarytree._populate_local") def test_populate_with_repos(self, ppopulate_local, ppopulate_additional): repos = ("one", "two") -bt = binarytree(pkgdir="/tmp", settings=MagicMock()) +bt = binarytree(pkgdir=os.getenv("TMPDIR", "/tmp"), settings=MagicMock()) bt.populate(add_repos=repos) ppopulate_additional.assert_called_once_with(repos) @@ -109,7 +115,7 @@ class BinarytreeTestCase(TestCase): refresh = "something" settings = MagicMock() settings.__getitem__.return_value = "/some/path" -bt = binarytree(pkgdir="/tmp", settings=settings) +bt = binarytree(pkgdir=os.getenv("TMPDIR", "/tmp"), settings=settings) bt.populate(getbinpkgs=True, getbinpkg_refresh=refresh) ppopulate_remote.assert_called_once_with(getbinpkg_refresh=refresh) @@ -126,7 +132,7 @@ class BinarytreeTestCase(TestCase): settings.__getitem__.return_value = portage_root pBinRepoConfigLoader.return_value = None conf_file = os.path.join(portage_root, BINREPOS_CONF_FILE) -bt =
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/sync/, lib/portage/tests/sets/shell/, ...
commit: f3b90592994c418286b10d883b4aee9a104f5e75 Author: James Le Cuirot gentoo org> AuthorDate: Fri Jul 21 20:36:31 2023 + Commit: Sam James gentoo org> CommitDate: Wed Aug 2 06:31:20 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=f3b90592 Drop custom test runner bits in favour of pytest Signed-off-by: James Le Cuirot gentoo.org> Signed-off-by: Sam James gentoo.org> .builds/lint.yml | 2 +- .github/workflows/lint.yml | 2 +- DEVELOPING | 2 +- TEST-NOTES | 2 +- lib/portage/tests/__init__.py | 269 + lib/portage/tests/conftest.py | 27 ++- lib/portage/tests/dep/meson.build | 10 +- .../tests/dep/{testAtom.py => test_atom.py}| 0 ...ckRequiredUse.py => test_check_required_use.py} | 0 ...endedAtomDict.py => test_extended_atom_dict.py} | 0 ...fectingUSE.py => test_extract_affecting_use.py} | 0 .../dep/{testStandalone.py => test_standalone.py} | 0 lib/portage/tests/glsa/test_security_set.py| 16 +- lib/portage/tests/meson.build | 1 - lib/portage/tests/process/test_poll.py | 1 - lib/portage/tests/process/test_unshare_net.py | 13 - .../tests/resolver/test_autounmask_multilib_use.py | 2 - .../resolver/test_autounmask_use_slot_conflict.py | 2 - lib/portage/tests/resolver/test_or_choices.py | 2 - lib/portage/tests/runTests.py | 79 -- lib/portage/tests/sets/base/meson.build| 4 +- ...lPackageSet.py => test_internal_package_set.py} | 0 .../{testVariableSet.py => test_variable_set.py} | 0 lib/portage/tests/sets/files/meson.build | 4 +- ...estConfigFileSet.py => test_config_file_set.py} | 0 ...estStaticFileSet.py => test_static_file_set.py} | 0 lib/portage/tests/sets/shell/meson.build | 2 +- .../sets/shell/{testShell.py => test_shell.py} | 0 lib/portage/tests/sync/test_sync_local.py | 13 +- lib/portage/tests/util/file_copy/test_copyfile.py | 11 +- .../tests/util/futures/test_iter_completed.py | 12 +- meson.build| 4 +- runtests | 184 -- tox.ini| 2 +- 34 files changed, 49 insertions(+), 617 deletions(-) diff --git a/.builds/lint.yml b/.builds/lint.yml index 847552aac..e7aad2114 100644 --- a/.builds/lint.yml +++ b/.builds/lint.yml @@ -25,7 +25,7 @@ tasks: - black: | source .venv/bin/activate cd portage - STRAGGLERS="$(find bin runtests -type f -not -name '*.py' -not -name '*.sh' | \ + STRAGGLERS="$(find bin -type f -not -name '*.py' -not -name '*.sh' | \ xargs grep -l '#!/usr/bin/env python' | \ tr '\n' ' ')" time black --check --diff --color . $STRAGGLERS diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index f2af40957..69b9578d4 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -11,7 +11,7 @@ jobs: id: stragglers run: | echo "::set-output name=missed::$( - find bin runtests -type f -not -name '*.py' -not -name '*.sh' | \ + find bin -type f -not -name '*.py' -not -name '*.sh' | \ xargs grep -l '#!/usr/bin/env python' | tr $'\n' ' ')" - uses: psf/black@stable with: diff --git a/DEVELOPING b/DEVELOPING index a49afff83..8302f9aa1 100644 --- a/DEVELOPING +++ b/DEVELOPING @@ -223,7 +223,7 @@ and commit. - meson setup -Dmodules-only=true build - meson test -C build --verbose Use meson setup's --native-file to override the Python version. See - PYTHON_SUPPORTED_VERSIONS in runtests. + Python versions listed in tox.ini. 4. Version bump the ebuild locally (don't push) and verify it can re-install itself: emerge --oneshot sys-apps/portage diff --git a/TEST-NOTES b/TEST-NOTES index 8be5f9cf3..8a1b981bb 100644 --- a/TEST-NOTES +++ b/TEST-NOTES @@ -42,4 +42,4 @@ functionality. You should raise portage.tests.SkipException in that case. emerge -- -The emerge namespace currently has 0 tests (and no runner) +The emerge namespace currently has 0 tests diff --git a/lib/portage/tests/__init__.py b/lib/portage/tests/__init__.py index d8e0cc78f..ef5985298 100644 --- a/lib/portage/tests/__init__.py +++ b/lib/portage/tests/__init__.py @@ -1,5 +1,5 @@ # tests/__init__.py -- Portage Unit Test functionality -# Copyright 2006-2021 Gentoo Authors +# Copyright 2006-2023 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 import argparse @@ -64,175 +64,6 @@ def cnf_sbindir(): return os.path.join(portage.const.EPREFIX or "/", "usr", "sbin") -def main(): -suite =
[gentoo-commits] proj/portage:master commit in: lib/portage/util/, /
commit: 19c27a2471c78d5e17b14325477fee60ead791e5 Author: James Le Cuirot gentoo org> AuthorDate: Sun Jul 30 13:19:10 2023 + Commit: Sam James gentoo org> CommitDate: Wed Aug 2 06:31:20 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=19c27a24 Use the correct library path when launching scripts directly from a venv It's not clear what bin_entry_point.sh was trying to do before. The regular expression didn't appear to match any likely shebang. The wrapper already runs under the desired Python, so we only need to use sys.executable, which points to the venv's python symlink. We don't need to worry about handling non-Python scripts any more either as the new Meson-based build system just installs these directly to bin rather than creating an entrypoint for them. Any Python-based Portage scripts they execute are now tried from the same directory first and will therefore use the correct environment, as above. Signed-off-by: James Le Cuirot gentoo.org> Signed-off-by: Sam James gentoo.org> NEWS| 3 +++ lib/portage/util/bin_entry_point.py | 18 +- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/NEWS b/NEWS index 0e3541af4..53db165e8 100644 --- a/NEWS +++ b/NEWS @@ -20,6 +20,9 @@ Bug fixes: * Ensure non-Python (s)bin scripts launch other Python-based Portage scripts using the same environment. +* Use the correct Python library path when launching scripts directly from a + virtual environment. + portage-3.0.49 (2023-06-21) -- diff --git a/lib/portage/util/bin_entry_point.py b/lib/portage/util/bin_entry_point.py index bb012b6b7..efa8b17b7 100644 --- a/lib/portage/util/bin_entry_point.py +++ b/lib/portage/util/bin_entry_point.py @@ -1,9 +1,8 @@ -# Copyright 2021 Gentoo Authors +# Copyright 2021-2023 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 __all__ = ["bin_entry_point"] -import re import sys from portage.const import PORTAGE_BIN_PATH @@ -18,17 +17,10 @@ def bin_entry_point(): """ script_path = os.path.join(PORTAGE_BIN_PATH, os.path.basename(sys.argv[0])) if os.access(script_path, os.X_OK): -with open(script_path) as f: -shebang = f.readline() -python_match = re.search(r"/python[\d\.]*\s+([^/]*)\s+$", shebang) -if python_match: -sys.argv = [ -os.path.join(os.path.dirname(sys.argv[0]), "python"), -python_match.group(1), -script_path, -] + sys.argv[1:] -os.execvp(sys.argv[0], sys.argv) -sys.argv[0] = script_path +sys.argv = [ +sys.executable, +script_path, +] + sys.argv[1:] os.execvp(sys.argv[0], sys.argv) else: print("File not found:", script_path, file=sys.stderr)
[gentoo-commits] proj/portage:master commit in: lib/portage/sync/modules/svn/, lib/portage/tests/lazyimport/, ...
commit: ad3994394af0bc975ec7c28bd60de496b580c25e Author: James Le Cuirot gentoo org> AuthorDate: Sat Jul 15 11:20:27 2023 + Commit: Sam James gentoo org> CommitDate: Wed Aug 2 06:31:19 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=ad399439 Migrate from setuptools to Meson and meson-python This makes Portage PEP 517 compliant. When building via meson-python, the man pages and logrotate config are no longer included as there seems little point. Bug: https://bugs.gentoo.org/910035 Signed-off-by: James Le Cuirot gentoo.org> Signed-off-by: Sam James gentoo.org> .builds/ci.yml | 22 +- .builds/lint.yml | 10 +- .github/workflows/ci.yml | 21 +- .github/workflows/lint.yml | 11 +- DEVELOPING | 13 +- MANIFEST.in| 30 - NEWS | 2 + bin/meson.build| 73 ++ cnf/meson.build| 144 doc/api/meson.build| 43 + doc/fragment/meson.build | 5 + doc/fragment/version.in| 1 + doc/meson.build| 57 ++ doc/portage.docbook| 2 - lib/_emerge/AbstractEbuildProcess.py | 7 +- lib/_emerge/create_depgraph_params.py | 10 +- lib/_emerge/meson.build| 101 +++ lib/_emerge/resolver/meson.build | 14 + lib/meson.build| 2 + lib/portage/__init__.py| 11 +- lib/portage/_compat_upgrade/meson.build| 10 + lib/portage/_emirrordist/meson.build | 15 + lib/portage/_sets/meson.build | 15 + lib/portage/binrepo/meson.build| 8 + lib/portage/cache/index/meson.build| 9 + lib/portage/cache/meson.build | 20 + lib/portage/const.py | 61 +- lib/portage/dbapi/meson.build | 22 + lib/portage/dep/meson.build| 12 + lib/portage/dep/soname/meson.build | 10 + lib/portage/elog/meson.build | 16 + lib/portage/emaint/meson.build | 11 + lib/portage/emaint/modules/binhost/meson.build | 8 + lib/portage/emaint/modules/config/meson.build | 8 + lib/portage/emaint/modules/logs/meson.build| 8 + lib/portage/emaint/modules/merges/meson.build | 8 + lib/portage/emaint/modules/meson.build | 16 + lib/portage/emaint/modules/move/meson.build| 8 + lib/portage/emaint/modules/resume/meson.build | 8 + lib/portage/emaint/modules/sync/meson.build| 8 + lib/portage/emaint/modules/world/meson.build | 8 + lib/portage/env/meson.build| 10 + lib/portage/installation.py| 21 + lib/portage/meson.build| 74 ++ lib/portage/package/ebuild/_config/meson.build | 17 + lib/portage/package/ebuild/_ipc/meson.build| 10 + .../package/ebuild/_parallel_manifest/meson.build | 10 + lib/portage/package/ebuild/meson.build | 23 + lib/portage/package/meson.build| 9 + lib/portage/proxy/meson.build | 9 + lib/portage/repository/meson.build | 10 + lib/portage/repository/storage/meson.build | 11 + lib/portage/sync/meson.build | 14 + lib/portage/sync/modules/cvs/meson.build | 8 + lib/portage/sync/modules/git/meson.build | 8 + lib/portage/sync/modules/mercurial/meson.build | 8 + lib/portage/sync/modules/meson.build | 14 + lib/portage/sync/modules/rsync/meson.build | 8 + lib/portage/sync/modules/svn/meson.build | 8 + lib/portage/sync/modules/webrsync/meson.build | 8 + lib/portage/tests/bin/meson.build | 14 + lib/portage/tests/conftest.py | 7 +- lib/portage/tests/dbapi/meson.build| 12 + lib/portage/tests/dep/meson.build | 28 + lib/portage/tests/ebuild/meson.build | 17 + lib/portage/tests/emerge/meson.build | 14 + lib/portage/tests/env/config/meson.build | 12 + lib/portage/tests/env/meson.build | 10 + lib/portage/tests/glsa/meson.build | 9 + lib/portage/tests/gpkg/meson.build | 15 + lib/portage/tests/lafilefixer/meson.build | 9 + lib/portage/tests/lazyimport/meson.build | 10 +
[gentoo-commits] proj/portage:master commit in: bin/, /
commit: d42384c6fd91056eab8f0450d210d9876d3efcc1 Author: James Le Cuirot gentoo org> AuthorDate: Sun Jul 30 20:45:55 2023 + Commit: Sam James gentoo org> CommitDate: Wed Aug 2 06:31:20 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=d42384c6 Make non-Python (s)bin scripts use other scripts from the same directory This is particularly important when Portage is installed in a venv to ensure that other scripts are launched using the same environment. Signed-off-by: James Le Cuirot gentoo.org> Signed-off-by: Sam James gentoo.org> NEWS| 3 +++ bin/emerge-webrsync | 20 bin/etc-update | 10 +++--- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/NEWS b/NEWS index 1f34bdd90..0e3541af4 100644 --- a/NEWS +++ b/NEWS @@ -17,6 +17,9 @@ Bug fixes: * gpkg: Fix timestamp for binary packages (bug #909067). +* Ensure non-Python (s)bin scripts launch other Python-based Portage scripts + using the same environment. + portage-3.0.49 (2023-06-21) -- diff --git a/bin/emerge-webrsync b/bin/emerge-webrsync index 3835977fc..7b3163b81 100755 --- a/bin/emerge-webrsync +++ b/bin/emerge-webrsync @@ -71,16 +71,12 @@ die() { argv0=$0 -# Use portageq from the same directory/prefix as the current script, so -# that we don't have to rely on PATH including the current EPREFIX. -scriptpath=${BASH_SOURCE[0]} -if [[ -x "${scriptpath%/*}/portageq" ]]; then - portageq=${scriptpath%/*}/portageq -elif type -P portageq > /dev/null ; then - portageq=portageq -else - die "could not find 'portageq'; aborting" -fi +# Use emerge and portageq from the same directory/prefix as the current script, +# so that we don't have to rely on PATH including the current EPREFIX. +emerge=$(PATH="${BASH_SOURCE[0]%/*}:${PATH}" type -P emerge) +[[ -n ${emerge} ]] || die "could not find 'emerge'; aborting" +portageq=$(PATH="${BASH_SOURCE[0]%/*}:${PATH}" type -P portageq) +[[ -n ${portageq} ]] || die "could not find 'portageq'; aborting" eval "$("${portageq}" envvar -v DISTDIR EPREFIX FEATURES \ FETCHCOMMAND GENTOO_MIRRORS \ @@ -461,14 +457,14 @@ sync_local() { if has metadata-transfer ${FEATURES} ; then einfo "Updating cache ..." - emerge --metadata + "${emerge}" --metadata fi local post_sync=${PORTAGE_CONFIGROOT%/}/etc/portage/bin/post_sync [[ -x "${post_sync}" ]] && "${post_sync}" # --quiet suppresses output if there are no relevant news items - has news ${FEATURES} && emerge --check-news --quiet + has news ${FEATURES} && "${emerge}" --check-news --quiet return 0 } diff --git a/bin/etc-update b/bin/etc-update index 14bd80b84..97c163420 100755 --- a/bin/etc-update +++ b/bin/etc-update @@ -10,6 +10,8 @@ # Leo Lipelis # Karl Trygve Kalleberg +cd "${BASH_SOURCE[0]%/*}" +BINDIR=${PWD} cd / type -P gsed >/dev/null && sed() { gsed "$@"; } @@ -767,7 +769,7 @@ while [[ -n $1 ]] ; do -p|--preen) PREEN=true;; -q|--quiet) QUIET=true;; -v|--verbose) VERBOSE=true;; - -V|--version) emerge --version; exit 0;; + -V|--version) "$(PATH="${BINDIR}:${PATH}" type -P emerge)" --version; exit 0;; --automode) parse_automode_flag $2 && shift || usage 1 "Invalid mode '$2'";; -*) usage 1 "Invalid option '$1'";; *)break;; @@ -801,8 +803,10 @@ portage_vars=( NO_COLOR ) -if type -P portageq > /dev/null; then - eval $(${PORTAGE_PYTHON:+"${PORTAGE_PYTHON}"} "$(type -P portageq)" envvar -v "${portage_vars[@]}") +portageq=$(PATH="${BINDIR}:${PATH}" type -P portageq) + +if [[ -n ${portageq} ]]; then + eval $(${PORTAGE_PYTHON:+"${PORTAGE_PYTHON}"} "${portageq}" envvar -v "${portage_vars[@]}") else [[ ${OS_FAMILY} == 'gentoo' ]] && die "missing portageq" fi
[gentoo-commits] proj/portage:master commit in: lib/portage/
commit: fb3debbd9455bc6288b2f420312beac836876fbd Author: James Le Cuirot gentoo org> AuthorDate: Sun Jul 23 21:27:15 2023 + Commit: Sam James gentoo org> CommitDate: Wed Aug 2 06:31:20 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=fb3debbd Fix the test_doebuild_fd_pipes.py test under CI The tests call _disable_legacy_globals, but they never reset portage.data._initialized_globals, meaning that the globals never get set again. This led to the test trying to chown with GID 0 as an unprivileged user. This only failed under CI after switching to pytest, despite it working with runTests.py, as well as locally. Running it on its own also worked fine. I don't know how it worked before, maybe it was just the ordering and some luck. Signed-off-by: James Le Cuirot gentoo.org> Signed-off-by: Sam James gentoo.org> lib/portage/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/portage/__init__.py b/lib/portage/__init__.py index 847a879cd..635eea31e 100644 --- a/lib/portage/__init__.py +++ b/lib/portage/__init__.py @@ -829,3 +829,4 @@ def _disable_legacy_globals(): global _legacy_global_var_names for k in _legacy_global_var_names: globals().pop(k, None) +portage.data._initialized_globals.clear()
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/util/futures/asyncio/, lib/portage/util/futures/, lib/portage/, ...
commit: 4c6416780a38e2103fc6e871780ed37b8d60badb Author: James Le Cuirot gentoo org> AuthorDate: Fri Jul 21 14:52:56 2023 + Commit: Sam James gentoo org> CommitDate: Wed Aug 2 06:31:19 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=4c641678 Linting fixes Signed-off-by: James Le Cuirot gentoo.org> Signed-off-by: Sam James gentoo.org> lib/portage/dbapi/__init__.py | 15 --- lib/portage/dbapi/porttree.py | 13 +++-- .../ebuild/_parallel_manifest/ManifestScheduler.py | 2 +- lib/portage/sync/modules/cvs/cvs.py | 4 ++-- .../tests/util/futures/asyncio/test_subprocess_exec.py | 4 ++-- lib/portage/util/futures/retry.py | 2 +- lib/portage/util/socks5.py | 2 +- lib/portage/versions.py | 17 + 8 files changed, 31 insertions(+), 28 deletions(-) diff --git a/lib/portage/dbapi/__init__.py b/lib/portage/dbapi/__init__.py index 428e4a48e..233da8d69 100644 --- a/lib/portage/dbapi/__init__.py +++ b/lib/portage/dbapi/__init__.py @@ -5,7 +5,8 @@ __all__ = ["dbapi"] import re import warnings -from typing import Any, Dict, List, Optional, Sequence, Tuple +from typing import Any, Dict, List, Optional, Tuple +from collections.abc import Sequence import portage @@ -30,7 +31,7 @@ from _emerge.Package import Package class dbapi: _category_re = re.compile(r"^\w[-.+\w]*$", re.UNICODE) -_categories: Optional[Tuple[str, ...]] = None +_categories: Optional[tuple[str, ...]] = None _use_mutable = False _known_keys = frozenset(auxdbkeys) _pkg_str_aux_keys = ("EAPI", "KEYWORDS", "SLOT", "repository") @@ -39,7 +40,7 @@ class dbapi: pass @property -def categories(self) -> Tuple[str, ...]: +def categories(self) -> tuple[str, ...]: """ Use self.cp_all() to generate a category list. Mutable instances can delete the self._categories attribute in cases when the cached @@ -77,7 +78,7 @@ class dbapi: # dict to map strings back to their original values. cpv_list.sort(key=cmp_sort_key(dbapi._cmp_cpv)) -def cpv_all(self) -> List[str]: +def cpv_all(self) -> list[str]: """Return all CPVs in the db Args: None @@ -94,7 +95,7 @@ class dbapi: cpv_list.extend(self.cp_list(cp)) return cpv_list -def cp_all(self, sort: bool = False) -> List[str]: +def cp_all(self, sort: bool = False) -> list[str]: """Implement this in a child class Args sort - return sorted results @@ -105,7 +106,7 @@ class dbapi: def aux_get( self, mycpv: str, mylist: str, myrepo: Optional[str] = None -) -> List[str]: +) -> list[str]: """Return the metadata keys in mylist for mycpv Args: mycpv - "sys-apps/foo-1.0" @@ -117,7 +118,7 @@ class dbapi: """ raise NotImplementedError -def aux_update(self, cpv: str, metadata_updates: Dict[str, Any]) -> None: +def aux_update(self, cpv: str, metadata_updates: dict[str, Any]) -> None: """ Args: cpv - "sys-apps/foo-1.0" diff --git a/lib/portage/dbapi/porttree.py b/lib/portage/dbapi/porttree.py index c47b66bda..fdfb6ef52 100644 --- a/lib/portage/dbapi/porttree.py +++ b/lib/portage/dbapi/porttree.py @@ -49,7 +49,8 @@ import functools import collections from collections import OrderedDict -from typing import List, Optional, Sequence, Type, Tuple, Union +from collections.abc import Sequence +from typing import Optional, Union from urllib.parse import urlparse @@ -502,7 +503,7 @@ class portdbapi(dbapi): mycpv: str, mytree: Optional[str] = None, myrepo: Optional[str] = None, -) -> Union[Tuple[None, int], Tuple[str, str], Tuple[str, None]]: +) -> Union[tuple[None, int], tuple[str, str], tuple[str, None]]: """ Returns the location of the CPV, and what overlay it was in. Searches overlays first, then PORTDIR; this allows us to return the first @@ -657,7 +658,7 @@ class portdbapi(dbapi): mylist: Sequence[str], mytree: Optional[str] = None, myrepo: Optional[str] = None, -) -> List[str]: +) -> list[str]: "stub code for returning auxilliary db information, such as SLOT, DEPEND, etc." 'input: "sys-apps/foo-1.0",["SLOT","DEPEND","HOMEPAGE"]' 'return: ["0",">=sys-libs/bar-1.0","http://www.foo.com;] or raise PortageKeyError if error' @@ -1216,9 +1217,9 @@ class portdbapi(dbapi): self, level: str, origdep: str, -mydep: Type[DeprecationWarning] = DeprecationWarning, -mykey: Type[DeprecationWarning] = DeprecationWarning, -mylist: Type[DeprecationWarning] = DeprecationWarning, +mydep:
[gentoo-commits] proj/portage:master commit in: .github/workflows/
commit: 85e69ccec067b1b7be688d7de677638acf79510c Author: James Le Cuirot gentoo org> AuthorDate: Tue Jul 25 08:07:46 2023 + Commit: Sam James gentoo org> CommitDate: Wed Aug 2 06:31:20 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=85e69cce Patch Meson in GitHub CI to fix pypy-3.9 detection Signed-off-by: James Le Cuirot gentoo.org> Signed-off-by: Sam James gentoo.org> .github/workflows/ci.yml | 4 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 519bf92c4..bf36ad19d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,6 +29,10 @@ jobs: set -xe sudo apt-get update sudo apt-get install -y --no-install-recommends libxslt-dev libxml2-dev libxml2-utils meson zstd + + # Patch Ubuntu's old Meson to fix pypy-3.9 detection. + curl -s -f https://github.com/mesonbuild/meson/commit/2540ad6e9e08370ddd0b6753fdc9314945a672f0.patch | sudo patch -d /usr/lib/python3/dist-packages -p1 --no-backup-if-mismatch + python -VV python -m site python -m pip install --upgrade pip
[gentoo-commits] proj/portage:master commit in: man/, lib/portage/, /, lib/_emerge/
commit: f8e3b11496bd6d602a690535c4a3bb32bb8e9744 Author: Florian Schmaus gentoo org> AuthorDate: Wed Jun 14 15:20:13 2023 + Commit: Sam James gentoo org> CommitDate: Sat Jul 29 11:24:45 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=f8e3b114 Drop FEATURES=cgroup, i.e., v1 cgroup usage Remove portage's usage of Linux version 1 cgroups, which are itself superseded by version 2 cgroups. This basically reverts b01a1b90d8c5 ("Add FEATURES=cgroup to isolate phase processes."). Portage's usage of version 1 cgroups has caused some issues in the past. For example https://bugs.gentoo.org/894398, where LXD got confused by the existence of the version 1 cgroup created by portage. Arguably, this could be considered a bug in LXD, but with FEATURES=pid-sandbox, as better alternative to FEATURES=cgroup exists. And removing the code for FEATURES=cgroup reduces portage's code size, which is also a plus. Bug: https://bugs.gentoo.org/894398 Signed-off-by: Florian Schmaus gentoo.org> Reviewed-by: Michał Górny gentoo.org> Closes: https://github.com/gentoo/portage/pull/1057 Signed-off-by: Sam James gentoo.org> NEWS | 5 ++ lib/_emerge/AbstractEbuildProcess.py | 88 lib/_emerge/SpawnProcess.py | 63 -- lib/portage/const.py | 1 - lib/portage/process.py | 14 -- man/make.conf.5 | 4 -- 6 files changed, 5 insertions(+), 170 deletions(-) diff --git a/NEWS b/NEWS index 4c54ba382..82e4c8780 100644 --- a/NEWS +++ b/NEWS @@ -18,6 +18,11 @@ Bug fixes: portage-3.0.49 (2023-06-21) -- +Breaking changes: +* FEATURES=cgroup was removed since it was based on version 1 cgroups, which + caused some issues and version 1 cgroups are obsolete. Use + FEATURES=pid-sandbox instead. + Bug fixes: * Adjust write tests for DISTDIR and PORTAGE_TMPDIR to work with automount directories (bug #485100, bug #890812). diff --git a/lib/_emerge/AbstractEbuildProcess.py b/lib/_emerge/AbstractEbuildProcess.py index be257a620..97408806c 100644 --- a/lib/_emerge/AbstractEbuildProcess.py +++ b/lib/_emerge/AbstractEbuildProcess.py @@ -3,10 +3,7 @@ import functools import io -import platform import stat -import subprocess -import tempfile import textwrap from _emerge.SpawnProcess import SpawnProcess from _emerge.EbuildBuildDir import EbuildBuildDir @@ -80,91 +77,6 @@ class AbstractEbuildProcess(SpawnProcess): self._async_wait() return -# Check if the cgroup hierarchy is in place. If it's not, mount it. -if ( -os.geteuid() == 0 -and platform.system() == "Linux" -and "cgroup" in self.settings.features -and self.phase not in _global_pid_phases -): -cgroup_root = "/sys/fs/cgroup" -cgroup_portage = os.path.join(cgroup_root, "portage") - -try: -# cgroup tmpfs -if not os.path.ismount(cgroup_root): -# we expect /sys/fs to be there already -if not os.path.isdir(cgroup_root): -os.mkdir(cgroup_root, 0o755) -subprocess.check_call( -[ -"mount", -"-t", -"tmpfs", -"-o", -"rw,nosuid,nodev,noexec,mode=0755", -"tmpfs", -cgroup_root, -] -) - -# portage subsystem -if not os.path.ismount(cgroup_portage): -if not os.path.isdir(cgroup_portage): -os.mkdir(cgroup_portage, 0o755) -subprocess.check_call( -[ -"mount", -"-t", -"cgroup", -"-o", -"rw,nosuid,nodev,noexec,none,name=portage", -"tmpfs", -cgroup_portage, -] -) -with open(os.path.join(cgroup_portage, "release_agent"), "w") as f: -f.write( -os.path.join( -self.settings["PORTAGE_BIN_PATH"], -"cgroup-release-agent", -) -) -with open( -os.path.join(cgroup_portage, "notify_on_release"), "w" -) as f: -f.write("1") -else: -# Update release_agent if it no longer exists, because -# it refers to a temporary path
[gentoo-commits] proj/portage:master commit in: bin/install-qa-check.d/
commit: da9e55236ef40ab4887415814c7f6ddd2abf083c Author: Florian Schmaus gentoo org> AuthorDate: Wed Jul 26 10:22:01 2023 + Commit: Sam James gentoo org> CommitDate: Sat Jul 29 03:55:20 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=da9e5523 install-qa-check.d/60openrc: be explicit about OpenRC Be explicit that this is not some arbitrary shell script that is checked by the QA check, but an OpenRC runscript. Signed-off-by: Florian Schmaus gentoo.org> Closes: https://github.com/gentoo/portage/pull/1074 Signed-off-by: Sam James gentoo.org> bin/install-qa-check.d/60openrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/install-qa-check.d/60openrc b/bin/install-qa-check.d/60openrc index 0ab27f646..4d6199432 100644 --- a/bin/install-qa-check.d/60openrc +++ b/bin/install-qa-check.d/60openrc @@ -32,7 +32,7 @@ openrc_check() { [[ -L ${i} ]] && continue f=$("${checkbashisms}" -n -f "${i}" 2>&1) [[ $? != 0 && -n ${f} ]] || continue - eqawarn "QA Notice: shell script appears to use non-POSIX feature(s):" + eqawarn "QA Notice: OpenRC shell script appears to use non-POSIX feature(s):" while read -r ; do eqawarn " ${REPLY}" done <<< "${f//${ED}}"
[gentoo-commits] proj/portage:master commit in: lib/portage/dbapi/
commit: 7c0086fc0ab60cf0a726e3c88b11a21e147f3aa2 Author: Andrew Udvare gmail com> AuthorDate: Sun Jul 16 21:42:58 2023 + Commit: Sam James gentoo org> CommitDate: Sat Jul 29 03:57:45 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=7c0086fc dbapi: add some typing Signed-off-by: Andrew Udvare gmail.com> Closes: https://github.com/gentoo/portage/pull/1069 Signed-off-by: Sam James gentoo.org> lib/portage/dbapi/__init__.py | 27 +++ lib/portage/dbapi/porttree.py | 34 -- 2 files changed, 39 insertions(+), 22 deletions(-) diff --git a/lib/portage/dbapi/__init__.py b/lib/portage/dbapi/__init__.py index 31453d149..428e4a48e 100644 --- a/lib/portage/dbapi/__init__.py +++ b/lib/portage/dbapi/__init__.py @@ -5,6 +5,7 @@ __all__ = ["dbapi"] import re import warnings +from typing import Any, Dict, List, Optional, Sequence, Tuple import portage @@ -29,7 +30,7 @@ from _emerge.Package import Package class dbapi: _category_re = re.compile(r"^\w[-.+\w]*$", re.UNICODE) -_categories = None +_categories: Optional[Tuple[str, ...]] = None _use_mutable = False _known_keys = frozenset(auxdbkeys) _pkg_str_aux_keys = ("EAPI", "KEYWORDS", "SLOT", "repository") @@ -38,7 +39,7 @@ class dbapi: pass @property -def categories(self): +def categories(self) -> Tuple[str, ...]: """ Use self.cp_all() to generate a category list. Mutable instances can delete the self._categories attribute in cases when the cached @@ -52,11 +53,11 @@ class dbapi: def close_caches(self): pass -def cp_list(self, cp, use_cache=1): +def cp_list(self, cp: str, use_cache: int = 1) -> Any: raise NotImplementedError(self) @staticmethod -def _cmp_cpv(cpv1, cpv2): +def _cmp_cpv(cpv1, cpv2) -> int: result = vercmp(cpv1.version, cpv2.version) if result == 0 and cpv1.build_time is not None and cpv2.build_time is not None: result = (cpv1.build_time > cpv2.build_time) - ( @@ -65,7 +66,7 @@ class dbapi: return result @staticmethod -def _cpv_sort_ascending(cpv_list): +def _cpv_sort_ascending(cpv_list: Sequence[Any]) -> None: """ Use this to sort self.cp_list() results in ascending order. It sorts in place and returns None. @@ -76,7 +77,7 @@ class dbapi: # dict to map strings back to their original values. cpv_list.sort(key=cmp_sort_key(dbapi._cmp_cpv)) -def cpv_all(self): +def cpv_all(self) -> List[str]: """Return all CPVs in the db Args: None @@ -93,16 +94,18 @@ class dbapi: cpv_list.extend(self.cp_list(cp)) return cpv_list -def cp_all(self, sort=False): +def cp_all(self, sort: bool = False) -> List[str]: """Implement this in a child class Args sort - return sorted results Returns: A list of strings 1 per CP in the datastore """ -return NotImplementedError +raise NotImplementedError -def aux_get(self, mycpv, mylist, myrepo=None): +def aux_get( +self, mycpv: str, mylist: str, myrepo: Optional[str] = None +) -> List[str]: """Return the metadata keys in mylist for mycpv Args: mycpv - "sys-apps/foo-1.0" @@ -114,7 +117,7 @@ class dbapi: """ raise NotImplementedError -def aux_update(self, cpv, metadata_updates): +def aux_update(self, cpv: str, metadata_updates: Dict[str, Any]) -> None: """ Args: cpv - "sys-apps/foo-1.0" @@ -124,7 +127,7 @@ class dbapi: """ raise NotImplementedError -def match(self, origdep, use_cache=1): +def match(self, origdep: str, use_cache: int = 1): """Given a dependency, try to find packages that match Args: origdep - Depend atom @@ -138,7 +141,7 @@ class dbapi: self._iter_match(mydep, self.cp_list(mydep.cp, use_cache=use_cache)) ) -def _iter_match(self, atom, cpv_iter): +def _iter_match(self, atom: str, cpv_iter): cpv_iter = iter(match_from_list(atom, cpv_iter)) if atom.repo: cpv_iter = self._iter_match_repo(atom, cpv_iter) diff --git a/lib/portage/dbapi/porttree.py b/lib/portage/dbapi/porttree.py index 3c38e99d4..c47b66bda 100644 --- a/lib/portage/dbapi/porttree.py +++ b/lib/portage/dbapi/porttree.py @@ -49,6 +49,7 @@ import functools import collections from collections import OrderedDict +from typing import List, Optional, Sequence, Type, Tuple, Union from urllib.parse import urlparse @@ -435,7 +436,9 @@ class portdbapi(dbapi): return license_path return None -def findname(self, mycpv, mytree=None, myrepo=None): +def findname( +self, mycpv: str, mytree:
[gentoo-commits] proj/portage:master commit in: lib/portage/
commit: 003a8d8ab9aaf4a6d4d0548b1ee46f79af3caf78 Author: Andrew Udvare gmail com> AuthorDate: Sun Jul 16 21:42:37 2023 + Commit: Sam James gentoo org> CommitDate: Sat Jul 29 03:57:45 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=003a8d8a versions: add basic typing Signed-off-by: Andrew Udvare gmail.com> Signed-off-by: Sam James gentoo.org> lib/portage/versions.py | 88 +++-- 1 file changed, 48 insertions(+), 40 deletions(-) diff --git a/lib/portage/versions.py b/lib/portage/versions.py index f3a224eec..4b97c6124 100644 --- a/lib/portage/versions.py +++ b/lib/portage/versions.py @@ -16,8 +16,10 @@ __all__ = [ ] import re +import typing import warnings from functools import lru_cache +from typing import Any, Dict, List, Optional, Sequence, Tuple, Union import portage @@ -28,7 +30,7 @@ portage.proxy.lazyimport.lazyimport( "portage.util:cmp_sort_key", ) from portage import _unicode_decode -from portage.eapi import _get_eapi_attrs +from portage.eapi import _eapi_attrs, _get_eapi_attrs from portage.exception import InvalidData from portage.localization import _ @@ -76,7 +78,7 @@ endversion_keys = ["pre", "p", "alpha", "beta", "rc"] _slot_re_cache = {} -def _get_slot_re(eapi_attrs): +def _get_slot_re(eapi_attrs: _eapi_attrs) -> typing.re.Pattern: cache_key = eapi_attrs.slot_operator slot_re = _slot_re_cache.get(cache_key) if slot_re is not None: @@ -96,7 +98,7 @@ def _get_slot_re(eapi_attrs): _pv_re = None -def _get_pv_re(eapi_attrs): +def _get_pv_re(eapi_attrs: _eapi_attrs) -> typing.re.Pattern: global _pv_re if _pv_re is not None: return _pv_re @@ -106,7 +108,7 @@ def _get_pv_re(eapi_attrs): return _pv_re -def ververify(myver, silent=1): +def ververify(myver: str, silent: int = 1) -> bool: if ver_regexp.match(myver): return True if not silent: @@ -115,7 +117,7 @@ def ververify(myver, silent=1): @lru_cache(1024) -def vercmp(ver1, ver2, silent=1): +def vercmp(ver1: str, ver2: str, silent: int = 1) -> Optional[int]: """ Compare two versions Example usage: @@ -262,7 +264,7 @@ def vercmp(ver1, ver2, silent=1): return rval -def pkgcmp(pkg1, pkg2): +def pkgcmp(pkg1: Tuple[str, str, str], pkg2: Tuple[str, str, str]) -> Optional[int]: """ Compare 2 package versions created in pkgsplit format. @@ -289,7 +291,7 @@ def pkgcmp(pkg1, pkg2): return vercmp("-".join(pkg1[1:]), "-".join(pkg2[1:])) -def _pkgsplit(mypkg, eapi=None): +def _pkgsplit(mypkg: str, eapi: Any = None) -> Optional[Tuple[str, str, str]]: """ @param mypkg: pv @return: @@ -317,7 +319,11 @@ _missing_cat = "null" @lru_cache(10240) -def catpkgsplit(mydata, silent=1, eapi=None): +def catpkgsplit( +mydata: Union[str, "_pkg_str"], +silent: int = 1, +eapi: Any = None, +) -> Optional[Tuple[str, ...]]: """ Takes a Category/Package-Version-Rev and returns a list of each. @@ -368,33 +374,33 @@ class _pkg_str(str): def __new__( cls, -cpv, -metadata=None, -settings=None, -eapi=None, -repo=None, -slot=None, -build_time=None, -build_id=None, -file_size=None, -mtime=None, -db=None, +cpv: str, +metadata: Optional[Dict[str, Any]] = None, +settings: Any = None, +eapi: Any = None, +repo: Optional[str] = None, +slot: Optional[str] = None, +build_time: Optional[int] = None, +build_id: Optional[str] = None, +file_size: Optional[int] = None, +mtime: Optional[int] = None, +db: Any = None, ): return str.__new__(cls, cpv) def __init__( self, -cpv, -metadata=None, -settings=None, -eapi=None, -repo=None, -slot=None, -build_time=None, -build_id=None, -file_size=None, -mtime=None, -db=None, +cpv: str, +metadata: Optional[Dict[str, Any]] = None, +settings: Any = None, +eapi: Any = None, +repo: Optional[str] = None, +slot: Optional[str] = None, +build_time: Optional[int] = None, +build_id: Optional[str] = None, +file_size: Optional[int] = None, +mtime: Optional[int] = None, +db: Any = None, ): if not isinstance(cpv, str): # Avoid TypeError from str.__init__ with PyPy. @@ -456,13 +462,13 @@ class _pkg_str(str): repo = _unknown_repo self.__dict__["repo"] = repo -def __setattr__(self, name, value): +def __setattr__(self, name: str, value: Any) -> None: raise AttributeError( "_pkg_str instances are immutable", self.__class__, name, value ) @staticmethod -def _long(var, default): +def _long(var: Any, default:
[gentoo-commits] proj/portage:master commit in: lib/portage/util/
commit: 581f923b9f888efc3313b6e06ba8a3cf84641d75 Author: Mike Gilbert gentoo org> AuthorDate: Wed Jul 26 14:27:48 2023 + Commit: Mike Gilbert gentoo org> CommitDate: Wed Jul 26 14:27:48 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=581f923b env_update: drop os.waitstatus_to_exitcode The subprocess.run() function does this translation already. Fixes: 3bba408e214ae27bdf924ba90ad4b0919a85f3c8 Signed-off-by: Mike Gilbert gentoo.org> lib/portage/util/env_update.py | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/portage/util/env_update.py b/lib/portage/util/env_update.py index 9d3b5bb25..a827963ab 100644 --- a/lib/portage/util/env_update.py +++ b/lib/portage/util/env_update.py @@ -381,7 +381,6 @@ def _env_update(makelinks, target_root, prev_mtimes, contents, env, writemsg_lev cwd="/", ).returncode -ret = os.waitstatus_to_exitcode(ret) if ret > 0: writemsg(f"!!! ldconfig failed with exit status {ret}\n", noiselevel=-1) if ret < 0:
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/news/, lib/_emerge/, lib/portage/, ...
commit: e04fd4431e7f6ea869a240b6567abaf02e77a733 Author: Sam James gentoo org> AuthorDate: Wed Jul 26 08:02:31 2023 + Commit: Sam James gentoo org> CommitDate: Wed Jul 26 08:21:18 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=e04fd443 Run `pyupgrade --py39-plus` Signed-off-by: Sam James gentoo.org> lib/_emerge/actions.py | 5 + lib/_emerge/depgraph.py | 26 +- lib/_emerge/main.py | 4 ++-- lib/portage/news.py | 10 +- lib/portage/sync/modules/git/git.py | 8 +++- lib/portage/tests/news/test_NewsItem.py | 8 6 files changed, 28 insertions(+), 33 deletions(-) diff --git a/lib/_emerge/actions.py b/lib/_emerge/actions.py index 0fee21459..323fde376 100644 --- a/lib/_emerge/actions.py +++ b/lib/_emerge/actions.py @@ -105,9 +105,6 @@ from _emerge.UnmergeDepPriority import UnmergeDepPriority from _emerge.UseFlagDisplay import pkg_use_display from _emerge.UserQuery import UserQuery -# Type annotation imports -from typing import List - def action_build( emerge_config, @@ -2792,7 +2789,7 @@ def relative_profile_path(portdir, abs_profile): return profilever -def get_libc_version(vardb: portage.dbapi.vartree.vardbapi) -> List[str]: +def get_libc_version(vardb: portage.dbapi.vartree.vardbapi) -> list[str]: libcver = [] libclist = set() for atom in expand_new_virt(vardb, portage.const.LIBC_PACKAGE_ATOM): diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py index 72747d7bc..01a49bcb5 100644 --- a/lib/_emerge/depgraph.py +++ b/lib/_emerge/depgraph.py @@ -101,7 +101,7 @@ from _emerge.resolver.circular_dependency import circular_dependency_handler from _emerge.resolver.output import Display, format_unmatched_atom # Type annotation imports -from typing import Any, Optional, Dict, List, Tuple, Union, TYPE_CHECKING +from typing import Any, Optional, Union, TYPE_CHECKING if TYPE_CHECKING: import _emerge.stdout_spinner.stdout_spinner @@ -11413,12 +11413,12 @@ def _spinner_stop(spinner): def backtrack_depgraph( settings: portage.package.ebuild.config.config, trees: portage._trees_dict, -myopts: Dict[str, Union[str, int, bool]], -myparams: Dict[str, Union[int, str, bool]], +myopts: dict[str, Union[str, int, bool]], +myparams: dict[str, Union[int, str, bool]], myaction: Optional[str], -myfiles: List[str], +myfiles: list[str], spinner: "_emerge.stdout_spinner.stdout_spinner", -) -> Tuple[Any, depgraph, List[str]]: +) -> tuple[Any, depgraph, list[str]]: """ Raises PackageSetNotFound if myfiles contains a missing package set. @@ -11435,12 +11435,12 @@ def backtrack_depgraph( def _backtrack_depgraph( settings: portage.package.ebuild.config.config, trees: portage._trees_dict, -myopts: Dict[str, Union[str, int, bool]], -myparams: Dict[str, Union[int, str, bool]], +myopts: dict[str, Union[str, int, bool]], +myparams: dict[str, Union[int, str, bool]], myaction: Optional[str], -myfiles: List[str], +myfiles: list[str], spinner: "_emerge.stdout_spinner.stdout_spinner", -) -> Tuple[Any, depgraph, List[str]]: +) -> tuple[Any, depgraph, list[str]]: debug = "--debug" in myopts mydepgraph = None max_retries = myopts.get("--backtrack", 10) @@ -11540,8 +11540,8 @@ def resume_depgraph( settings: portage.package.ebuild.config.config, trees: portage._trees_dict, mtimedb: Any, -myopts: Dict[str, Union[str, int, bool]], -myparams: Dict[str, Union[str, bool]], +myopts: dict[str, Union[str, int, bool]], +myparams: dict[str, Union[str, bool]], spinner: "_emerge.stdout_spinner.stdout_spinner", ): """ @@ -11558,8 +11558,8 @@ def _resume_depgraph( settings: portage.package.ebuild.config.config, trees: portage._trees_dict, mtimedb: Any, -myopts: Dict[str, Union[str, int, bool]], -myparams: Dict[str, Union[str, bool]], +myopts: dict[str, Union[str, int, bool]], +myparams: dict[str, Union[str, bool]], spinner: "_emerge.stdout_spinner.stdout_spinner", ): """ diff --git a/lib/_emerge/main.py b/lib/_emerge/main.py index e471ac413..41bed0969 100644 --- a/lib/_emerge/main.py +++ b/lib/_emerge/main.py @@ -21,7 +21,7 @@ portage.proxy.lazyimport.lazyimport( from portage import os from portage.sync import _SUBMODULE_PATH_MAP -from typing import Optional, List +from typing import Optional options = [ "--alphabetical", @@ -1162,7 +1162,7 @@ def profile_check(trees, myaction): return os.EX_OK -def emerge_main(args: Optional[List[str]] = None): +def emerge_main(args: Optional[list[str]] = None): """ Entry point of emerge diff --git a/lib/portage/news.py b/lib/portage/news.py index b43d81fb7..b7f10e610 100644 --- a/lib/portage/news.py +++ b/lib/portage/news.py @@ -14,8 +14,8 @@ __all__ = [ ] from
[gentoo-commits] proj/portage:master commit in: /
commit: bd7c87ccb01d9a505cb9212c7a18c3a1e7705b8c Author: Sam James gentoo org> AuthorDate: Wed Jul 26 08:04:44 2023 + Commit: Sam James gentoo org> CommitDate: Wed Jul 26 08:21:18 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=bd7c87cc CI: update tool versions Signed-off-by: Sam James gentoo.org> .pre-commit-config.yaml | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5401dcff7..53a1d33aa 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,21 +1,21 @@ --- repos: - repo: https://github.com/psf/black -rev: 22.12.0 +rev: 23.7.0 hooks: - id: black - repo: https://github.com/PyCQA/pylint -rev: v2.15.10 +rev: v3.0.0a6 hooks: - id: pylint additional_dependencies: - 'pytest' - repo: https://github.com/ikamensh/flynt/ -rev: '0.77' +rev: '1.0.0' hooks: - id: flynt - repo: https://github.com/asottile/pyupgrade -rev: v3.3.1 +rev: v3.9.0 hooks: - id: pyupgrade args: [--py39-plus]
[gentoo-commits] proj/portage:master commit in: /
commit: 41094c785115e45cc456028f1b9e914160e0d392 Author: Sam James gentoo org> AuthorDate: Wed Jul 26 08:12:01 2023 + Commit: Sam James gentoo org> CommitDate: Wed Jul 26 08:21:18 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=41094c78 runtests: update supported Python versions We're about to get rid of this, but.. Signed-off-by: Sam James gentoo.org> runtests | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/runtests b/runtests index 2b44079b8..1701190b4 100755 --- a/runtests +++ b/runtests @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright 2010-2020 Gentoo Authors +# Copyright 2010-2023 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # # Note: We don't want to import portage modules directly because we do things @@ -20,9 +20,9 @@ import tempfile # These are the versions we fully support and require to pass tests. -PYTHON_SUPPORTED_VERSIONS = ["3.7", "3.8", "3.9", "3.10"] +PYTHON_SUPPORTED_VERSIONS = ["3.9", "3.10", "3.11"] # The rest are just "nice to have". -PYTHON_NICE_VERSIONS = ["pypy3", "3.11"] +PYTHON_NICE_VERSIONS = ["pypy3", "3.12"] EPREFIX = os.environ.get("PORTAGE_OVERRIDE_EPREFIX", "/")
[gentoo-commits] proj/portage:master commit in: lib/portage/package/ebuild/_parallel_manifest/, lib/_emerge/, lib/portage/, ...
commit: 7f62c28184516d0461c12185ecaa79571369037c Author: Sam James gentoo org> AuthorDate: Wed Jul 26 08:04:35 2023 + Commit: Sam James gentoo org> CommitDate: Wed Jul 26 08:21:18 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=7f62c281 Run `flynt` Signed-off-by: Sam James gentoo.org> lib/_emerge/UseFlagDisplay.py | 2 +- lib/portage/_emirrordist/ContentDB.py | 4 ++-- lib/portage/_emirrordist/DeletionTask.py | 14 ++--- lib/portage/_emirrordist/FetchTask.py | 3 +-- lib/portage/_emirrordist/MirrorDistTask.py | 24 -- lib/portage/_emirrordist/main.py | 12 --- lib/portage/output.py | 4 ++-- .../ebuild/_parallel_manifest/ManifestProcess.py | 2 +- lib/portage/package/ebuild/digestgen.py| 2 +- lib/portage/tests/util/test_uniqueArray.py | 3 +-- 10 files changed, 29 insertions(+), 41 deletions(-) diff --git a/lib/_emerge/UseFlagDisplay.py b/lib/_emerge/UseFlagDisplay.py index 4c526947d..7027db86a 100644 --- a/lib/_emerge/UseFlagDisplay.py +++ b/lib/_emerge/UseFlagDisplay.py @@ -109,6 +109,6 @@ def pkg_use_display(pkg, opts, modified_use=None): flags.sort(key=UseFlagDisplay.sort_combined) else: flags.sort(key=UseFlagDisplay.sort_separated) -flag_displays.append(f"{varname}=\"{' '.join('{}'.format(f) for f in flags)}\"") +flag_displays.append(f"{varname}=\"{' '.join(f'{f}' for f in flags)}\"") return " ".join(flag_displays) diff --git a/lib/portage/_emirrordist/ContentDB.py b/lib/portage/_emirrordist/ContentDB.py index c9e5f3e7b..622a437aa 100644 --- a/lib/portage/_emirrordist/ContentDB.py +++ b/lib/portage/_emirrordist/ContentDB.py @@ -112,10 +112,10 @@ class ContentDB: pass if remaining: -logger.debug(("drop '%s' revision(s) from content db") % filename) +logger.debug(f"drop '{filename}' revision(s) from content db") self._shelve[distfile_key] = remaining else: -logger.debug(("drop '%s' from content db") % filename) +logger.debug(f"drop '{filename}' from content db") try: del self._shelve[distfile_key] except KeyError: diff --git a/lib/portage/_emirrordist/DeletionTask.py b/lib/portage/_emirrordist/DeletionTask.py index cb8174d10..2dd97237b 100644 --- a/lib/portage/_emirrordist/DeletionTask.py +++ b/lib/portage/_emirrordist/DeletionTask.py @@ -20,10 +20,10 @@ class DeletionTask(CompositeTask): recycle_path = os.path.join(self.config.options.recycle_dir, self.distfile) if self.config.options.dry_run: logger.info( -("dry-run: move '%s' from " "distfiles to recycle") % self.distfile +f"dry-run: move '{self.distfile}' from distfiles to recycle" ) else: -logger.debug(("move '%s' from " "distfiles to recycle") % self.distfile) +logger.debug(f"move '{self.distfile}' from distfiles to recycle") try: # note: distfile_path can be a symlink here os.rename(os.path.realpath(self.distfile_path), recycle_path) @@ -51,9 +51,9 @@ class DeletionTask(CompositeTask): success = True if self.config.options.dry_run: -logger.info(("dry-run: delete '%s' from " "distfiles") % self.distfile) +logger.info(f"dry-run: delete '{self.distfile}' from distfiles") else: -logger.debug(("delete '%s' from " "distfiles") % self.distfile) +logger.debug(f"delete '{self.distfile}' from distfiles") try: os.unlink(self.distfile_path) except OSError as e: @@ -102,7 +102,7 @@ class DeletionTask(CompositeTask): success = True for layout in self.config.layouts: if isinstance(layout, ContentHashLayout) and not self.distfile.digests: -logger.debug(("_delete_links: '%s' has " "no digests") % self.distfile) +logger.debug(f"_delete_links: '{self.distfile}' has no digests") continue distfile_path = os.path.join( self.config.options.distfiles, layout.get_path(self.distfile) @@ -134,7 +134,7 @@ class DeletionTask(CompositeTask): except KeyError: pass else: -logger.debug(("drop '%s' from " "distfiles db") % self.distfile) +logger.debug(f"drop '{self.distfile}' from distfiles db") if self.config.content_db is not None: self.config.content_db.remove(self.distfile) @@ -145,4 +145,4 @@ class DeletionTask(CompositeTask): except KeyError:
[gentoo-commits] proj/portage:master commit in: /
commit: 2276104831dcfe08d68b3c0552cae3a55c870d17 Author: Sam James gentoo org> AuthorDate: Wed Jul 26 07:59:21 2023 + Commit: Sam James gentoo org> CommitDate: Wed Jul 26 08:21:17 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=22761048 CI: allow pyupgrade to use >= 3.9 syntax Signed-off-by: Sam James gentoo.org> .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e59f5e312..5401dcff7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -18,4 +18,4 @@ repos: rev: v3.3.1 hooks: - id: pyupgrade -args: [--py37-plus] +args: [--py39-plus]
[gentoo-commits] proj/portage:master commit in: lib/portage/util/, /
commit: 3da0ff3d2dd47469becd80e744c0c3ced448a516 Author: Sam James gentoo org> AuthorDate: Sat Jul 15 08:16:45 2023 + Commit: Sam James gentoo org> CommitDate: Wed Jul 26 07:58:30 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=3da0ff3d lib: env_update: check ldconfig exit code Bug: https://bugs.gentoo.org/910376 Signed-off-by: Sam James gentoo.org> NEWS | 2 ++ lib/portage/util/env_update.py | 13 ++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index fcbbdb2a5..4c54ba382 100644 --- a/NEWS +++ b/NEWS @@ -8,6 +8,8 @@ Bug fixes: * install-qa-check.d/05prefix: Fix prefixifying shebang for >= EAPI 7 ebuilds (bug #909147). +* env-update: Check exit code from ldconfig (bug #910376). + * emerge: Fix 'no ebuilds available' message always mentioning binpkgs (bug #909853). diff --git a/lib/portage/util/env_update.py b/lib/portage/util/env_update.py index d76042a6b..5c2b2fdd5 100644 --- a/lib/portage/util/env_update.py +++ b/lib/portage/util/env_update.py @@ -1,4 +1,4 @@ -# Copyright 2010-2020 Gentoo Authors +# Copyright 2010-2023 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 __all__ = ["env_update"] @@ -6,6 +6,7 @@ __all__ = ["env_update"] import errno import glob import stat +import sys import time import portage @@ -363,12 +364,12 @@ def _env_update(makelinks, target_root, prev_mtimes, contents, env, writemsg_lev writemsg_level( _(">>> Regenerating %setc/ld.so.cache...\n") % (target_root,) ) -os.system(f"cd / ; {ldconfig} -X -r '{target_root}'") +ret = os.system(f"cd / ; {ldconfig} -X -r '{target_root}'") elif ostype in ("FreeBSD", "DragonFly"): writemsg_level( _(">>> Regenerating %svar/run/ld-elf.so.hints...\n") % target_root ) -os.system( +ret = os.system( ( "cd / ; %s -elf -i " + "-f '%svar/run/ld-elf.so.hints' '%setc/ld.so.conf'" @@ -376,6 +377,12 @@ def _env_update(makelinks, target_root, prev_mtimes, contents, env, writemsg_lev % (ldconfig, target_root, target_root) ) +ret = os.waitstatus_to_exitcode(ret) +if ret > 0: +writemsg(f"!!! ldconfig failed with exit status {ret}\n", noiselevel=-1) +if ret < 0: +writemsg(f"!!! ldconfig was killed with signal {-ret}\n", noiselevel=-1) + del specials["LDPATH"] notice = "# THIS FILE IS AUTOMATICALLY GENERATED BY env-update.\n"
[gentoo-commits] proj/portage:master commit in: lib/portage/util/
commit: a777662890a7552927ee794506a92ddffc43523e Author: Sam James gentoo org> AuthorDate: Tue Jul 25 03:19:14 2023 + Commit: Sam James gentoo org> CommitDate: Wed Jul 26 07:58:31 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=a7776628 lib: env_update: use more f-strings Signed-off-by: Sam James gentoo.org> lib/portage/util/env_update.py | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/portage/util/env_update.py b/lib/portage/util/env_update.py index a7015669e..9d3b5bb25 100644 --- a/lib/portage/util/env_update.py +++ b/lib/portage/util/env_update.py @@ -361,19 +361,17 @@ def _env_update(makelinks, target_root, prev_mtimes, contents, env, writemsg_lev # an older package installed ON TOP of a newer version will cause ldconfig # to overwrite the symlinks we just made. -X means no links. After 'clean' # we can safely create links. -writemsg_level( -_(">>> Regenerating %setc/ld.so.cache...\n") % (target_root,) -) +writemsg_level(_(f">>> Regenerating {target_root}etc/ld.so.cache...\n")) ret = subprocess.run( -[f"{ldconfig}", "-X", "-r", f"{target_root}"], cwd="/" +[ldconfig, "-X", "-r", target_root], cwd="/" ).returncode elif ostype in ("FreeBSD", "DragonFly"): writemsg_level( -_(">>> Regenerating %svar/run/ld-elf.so.hints...\n") % target_root +_(f">>> Regenerating {target_root}var/run/ld-elf.so.hints...\n") ) ret = subprocess.run( [ -f"{ldconfig}", +ldconfig, "-elf", "-i", "-f",
[gentoo-commits] proj/portage:master commit in: lib/portage/util/
commit: 3bba408e214ae27bdf924ba90ad4b0919a85f3c8 Author: Sam James gentoo org> AuthorDate: Tue Jul 25 03:16:36 2023 + Commit: Sam James gentoo org> CommitDate: Wed Jul 26 07:58:30 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=3bba408e lib: env_update: port to subprocess os.system is a bit janky here, let's use subprocess so we're not injecting multiple commands. Thanks to mgorny for the suggestion. Bug: https://bugs.gentoo.org/910376 Signed-off-by: Sam James gentoo.org> lib/portage/util/env_update.py | 24 +++- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/lib/portage/util/env_update.py b/lib/portage/util/env_update.py index 5c2b2fdd5..a7015669e 100644 --- a/lib/portage/util/env_update.py +++ b/lib/portage/util/env_update.py @@ -6,7 +6,7 @@ __all__ = ["env_update"] import errno import glob import stat -import sys +import subprocess import time import portage @@ -364,18 +364,24 @@ def _env_update(makelinks, target_root, prev_mtimes, contents, env, writemsg_lev writemsg_level( _(">>> Regenerating %setc/ld.so.cache...\n") % (target_root,) ) -ret = os.system(f"cd / ; {ldconfig} -X -r '{target_root}'") +ret = subprocess.run( +[f"{ldconfig}", "-X", "-r", f"{target_root}"], cwd="/" +).returncode elif ostype in ("FreeBSD", "DragonFly"): writemsg_level( _(">>> Regenerating %svar/run/ld-elf.so.hints...\n") % target_root ) -ret = os.system( -( -"cd / ; %s -elf -i " -+ "-f '%svar/run/ld-elf.so.hints' '%setc/ld.so.conf'" -) -% (ldconfig, target_root, target_root) -) +ret = subprocess.run( +[ +f"{ldconfig}", +"-elf", +"-i", +"-f", +f"{target_root}var/run/ld-elf.so.hints", +f"{target_root}etc/ld.so.conf", +], +cwd="/", +).returncode ret = os.waitstatus_to_exitcode(ret) if ret > 0:
[gentoo-commits] proj/portage:master commit in: /, .github/workflows/
commit: edb9a6244be524ace95a48282e114d073ff37ad8 Author: Sam James gentoo org> AuthorDate: Wed Jul 26 07:51:05 2023 + Commit: Sam James gentoo org> CommitDate: Wed Jul 26 07:58:30 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=edb9a624 Increase minimum Python version from Python 3.6/3.7 -> Python 3.9 We don't seem to have been consistent as to whether it was 3.6 or 3.7, but we weren't testing it consistently anyway. It feels too soon to go up to 3.10 unfortunately, but 3.6/3.7 are EOL and 3.8 is EOL next year, so let's do 3.9. Signed-off-by: Sam James gentoo.org> .github/workflows/ci.yml | 4 .github/workflows/lint.yml | 2 -- DEVELOPING | 2 +- NEWS | 3 +++ README.md | 2 +- setup.py | 2 +- tox.ini| 4 +--- 7 files changed, 7 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c17e74e91..6bfe4847a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,14 +12,10 @@ jobs: strategy: matrix: python-version: - - '3.7' - - '3.8' - '3.9' - '3.10' - '3.11' - '3.12-dev' - - 'pypy-3.7' - - 'pypy-3.8' - 'pypy-3.9' fail-fast: false steps: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 8263567a1..469cffe37 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -22,8 +22,6 @@ jobs: strategy: matrix: python-version: - - '3.7' - - '3.8' - '3.9' - '3.10' - '3.11' diff --git a/DEVELOPING b/DEVELOPING index 2f05d49b5..0d414c4da 100644 --- a/DEVELOPING +++ b/DEVELOPING @@ -9,7 +9,7 @@ bad habits that exist in the current codebase. Python Version -- -Python 3.7 is the minimum supported version. +Python 3.9 is the minimum supported version. Dependencies diff --git a/NEWS b/NEWS index fe59a1ddf..fcbbdb2a5 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,9 @@ portage-3.0.50 (UNRELEASED) -- +Breaking changes: +* The minimum supported Python version is now >= Python 3.9. + Bug fixes: * install-qa-check.d/05prefix: Fix prefixifying shebang for >= EAPI 7 ebuilds (bug #909147). diff --git a/README.md b/README.md index 08b06c10f..481d12bac 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ git config blame.ignoreRevsFile .git-blame-ignore-revs Dependencies -Python and Bash should be the only hard dependencies. Python 3.7 is the +Python and Bash should be the only hard dependencies. Python 3.9 is the minimum supported version. Native Extensions diff --git a/setup.py b/setup.py index 3c343aabd..4525264c7 100755 --- a/setup.py +++ b/setup.py @@ -921,5 +921,5 @@ setup( "Programming Language :: Python :: 3", "Topic :: System :: Installation/Setup", ], -python_requires=">=3.6", +python_requires=">=3.9", ) diff --git a/tox.ini b/tox.ini index cec7dd833..4ea388e35 100644 --- a/tox.ini +++ b/tox.ini @@ -1,11 +1,9 @@ [tox] -envlist = py{37,38,39,310,311,312}-{pylint,test},pypy3-test +envlist = py{39,310,311,312}-{pylint,test},pypy3-test skipsdist = True [gh-actions] python = - 3.7: py37 - 3.8: py38 3.9: py39 3.10: py310 3.11: py311
[gentoo-commits] proj/portage:master commit in: lib/_emerge/
commit: f228252f4b4c3b33ff1e199f55bec9a6a104b80c Author: Berin Aniesh gmail com> AuthorDate: Mon Jul 10 03:10:07 2023 + Commit: Sam James gentoo org> CommitDate: Tue Jul 11 05:00:43 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=f228252f depgraph.py: fix wrong type annotations Fixes: 7e8a730b85b77f9495f4999ac173dc726777203f Bug: https://bugs.gentoo.org/910171 Signed-off-by: Berin Aniesh gmail.com> Closes: https://github.com/gentoo/portage/pull/1067 Signed-off-by: Sam James gentoo.org> lib/_emerge/depgraph.py | 18 +++--- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py index 1aeae6257..72747d7bc 100644 --- a/lib/_emerge/depgraph.py +++ b/lib/_emerge/depgraph.py @@ -101,7 +101,11 @@ from _emerge.resolver.circular_dependency import circular_dependency_handler from _emerge.resolver.output import Display, format_unmatched_atom # Type annotation imports -from typing import Any, Optional, Dict, List, Tuple, Union +from typing import Any, Optional, Dict, List, Tuple, Union, TYPE_CHECKING + +if TYPE_CHECKING: +import _emerge.stdout_spinner.stdout_spinner + # Exposes a depgraph interface to dep_check. _dep_check_graph_interface = collections.namedtuple( @@ -11409,7 +11413,7 @@ def _spinner_stop(spinner): def backtrack_depgraph( settings: portage.package.ebuild.config.config, trees: portage._trees_dict, -myopts: Dict[str, Any], +myopts: Dict[str, Union[str, int, bool]], myparams: Dict[str, Union[int, str, bool]], myaction: Optional[str], myfiles: List[str], @@ -11431,7 +11435,7 @@ def backtrack_depgraph( def _backtrack_depgraph( settings: portage.package.ebuild.config.config, trees: portage._trees_dict, -myopts: Dict[str, Any], +myopts: Dict[str, Union[str, int, bool]], myparams: Dict[str, Union[int, str, bool]], myaction: Optional[str], myfiles: List[str], @@ -11536,8 +11540,8 @@ def resume_depgraph( settings: portage.package.ebuild.config.config, trees: portage._trees_dict, mtimedb: Any, -myopts: Dict[str, str], -myparams: Dict[str, Any], +myopts: Dict[str, Union[str, int, bool]], +myparams: Dict[str, Union[str, bool]], spinner: "_emerge.stdout_spinner.stdout_spinner", ): """ @@ -11554,8 +11558,8 @@ def _resume_depgraph( settings: portage.package.ebuild.config.config, trees: portage._trees_dict, mtimedb: Any, -myopts: Dict[str, str], -myparams: Dict[str, Any], +myopts: Dict[str, Union[str, int, bool]], +myparams: Dict[str, Union[str, bool]], spinner: "_emerge.stdout_spinner.stdout_spinner", ): """
[gentoo-commits] proj/portage:master commit in: /, lib/_emerge/
commit: b199d0307b47f9fb06dbe533d7e24926a561c238 Author: Oskari Pirhonen gmail com> AuthorDate: Sun Jul 9 05:08:27 2023 + Commit: Sam James gentoo org> CommitDate: Sun Jul 9 06:24:28 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=b199d030 depgraph.py: fix "no ebuilds/binpkgs" message The "there are no binary packages to satisfy" was being unconditionally output for packages that could not be found. Fix the logic for choosing between the "binary packages" and "ebuilds" form of the message. This is a temporary stopgap as alluded to by me in the bug, but the tl;dr is that some entries in the `myopts` dict have "y"/"n" values whereas some are True/unset, and this discrepancy should be sorted out. [sam: Add NEWS and Fixes, although the change in that commit _shouldn't_ have been wrong, it is because of a quirk for now...] Bug: https://bugs.gentoo.org/909853 Signed-off-by: Oskari Pirhonen gmail.com> Closes: https://github.com/gentoo/portage/pull/1065 Fixes: 0b21a5a392bd84c07b94373991f59108fbe98516 Signed-off-by: Sam James gentoo.org> NEWS| 3 +++ lib/_emerge/depgraph.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index d40c309cd..fe59a1ddf 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,9 @@ Bug fixes: * install-qa-check.d/05prefix: Fix prefixifying shebang for >= EAPI 7 ebuilds (bug #909147). +* emerge: Fix 'no ebuilds available' message always mentioning binpkgs + (bug #909853). + * gpkg: Fix timestamp for binary packages (bug #909067). portage-3.0.49 (2023-06-21) diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py index a36ab6351..1aeae6257 100644 --- a/lib/_emerge/depgraph.py +++ b/lib/_emerge/depgraph.py @@ -6456,7 +6456,7 @@ class depgraph: cp_exists = True break -if self._frozen_config.myopts.get("--usepkgonly", "y"): +if self._frozen_config.myopts.get("--usepkgonly", False): writemsg( f"\nemerge: there are no binary packages to satisfy {green(xinfo)}.\n", noiselevel=-1,
[gentoo-commits] proj/portage:master commit in: .builds/
commit: 9a41acc7ee5d39c390d9a09421ad2671acee0be8 Author: Oskari Pirhonen gmail com> AuthorDate: Sat Jul 8 06:43:58 2023 + Commit: Sam James gentoo org> CommitDate: Sun Jul 9 00:35:14 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=9a41acc7 sr.ht ci: install pytest Ensure pytest exists on sourcehut builds before running Portage test suite. Signed-off-by: Oskari Pirhonen gmail.com> Closes: https://github.com/gentoo/portage/pull/1064 Signed-off-by: Sam James gentoo.org> .builds/ci.yml | 7 +++ 1 file changed, 7 insertions(+) diff --git a/.builds/ci.yml b/.builds/ci.yml index 18cdbe47a..797aea074 100644 --- a/.builds/ci.yml +++ b/.builds/ci.yml @@ -20,6 +20,13 @@ tasks: - setup-python: | portage/.builds/setup-python.sh "${PYTHON_VERSIONS[@]}" + - setup-tests: | + for py in "${PYTHON_VERSIONS[@]}"; do +source ".venv-$py/bin/activate" +pip install pytest +deactivate + done + - test-install: | for py in "${PYTHON_VERSIONS[@]}"; do source ".venv-$py/bin/activate"
[gentoo-commits] proj/portage:master commit in: bin/
commit: f24dd0d9808559571509add2c8c69c1bcb2bfec6 Author: Kerin Millar plushkava net> AuthorDate: Sun Jun 25 20:03:04 2023 + Commit: Sam James gentoo org> CommitDate: Mon Jul 3 20:18:37 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=f24dd0d9 bin/save-ebuild-env.sh: refrain from using the compgen builtin For the compgen builtin to be available requires that bash be compiled with --enable-readline. Rather than rely on compgen to generate a list of function names, parse their names out of declare -F instead. Specify -v for the following unset command, so that bash is coerced into unsetting only variables, as is intended. Expand the applicable variable names with "${!___@}". Owing to the constraints placed on identifiers, it's not particularly important that it be done this way, but I think it better expresses the intent. Signed-off-by: Kerin Millar plushkava.net> Bug: https://bugs.gentoo.org/909148 Signed-off-by: Sam James gentoo.org> bin/save-ebuild-env.sh | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bin/save-ebuild-env.sh b/bin/save-ebuild-env.sh index bba468da1..20cd86866 100644 --- a/bin/save-ebuild-env.sh +++ b/bin/save-ebuild-env.sh @@ -83,8 +83,12 @@ __save_ebuild_env() { ___eapi_has_usex && unset -f usex # Clear out the triple underscore namespace as it is reserved by the PM. - unset -f $(compgen -A function ___) - unset ${!___*} + while IFS=' ' read -r _ _ REPLY; do + if [[ ${REPLY} == ___* ]]; then + unset -f "${REPLY}" + fi + done < <(declare -F) + unset -v REPLY "${!___@}" # portage config variables and variables set directly by portage unset ACCEPT_LICENSE BUILD_PREFIX COLS \
[gentoo-commits] proj/portage:master commit in: /
commit: ffba5c4c48d8b937927ee67ac7c3dfc226827ddc Author: Sam James gentoo org> AuthorDate: Sun Jun 25 07:56:41 2023 + Commit: Sam James gentoo org> CommitDate: Thu Jun 29 08:22:53 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=ffba5c4c NEWS: update Bug: https://bugs.gentoo.org/640658 Bug: https://bugs.gentoo.org/909067 Signed-off-by: Sam James gentoo.org> NEWS | 9 + 1 file changed, 9 insertions(+) diff --git a/NEWS b/NEWS index 1f82a856f..d40c309cd 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,12 @@ +portage-3.0.50 (UNRELEASED) +-- + +Bug fixes: +* install-qa-check.d/05prefix: Fix prefixifying shebang for >= EAPI 7 ebuilds + (bug #909147). + +* gpkg: Fix timestamp for binary packages (bug #909067). + portage-3.0.49 (2023-06-21) --
[gentoo-commits] proj/portage:master commit in: lib/portage/
commit: 59973d0f5829ebbae615a001a97abb652431a61b Author: Sheng Yu protonmail com> AuthorDate: Sat Jun 24 20:28:20 2023 + Commit: Sam James gentoo org> CommitDate: Thu Jun 29 08:22:53 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=59973d0f gpkg: fix incorrect gpkg timestamp [sam: Quoting dwfreed from the bug: "utcnow() produces a naive datetime object, and most methods of datetime objects treat naive datetime objects as local time."] Bug: https://bugs.gentoo.org/909067 Signed-off-by: Sheng Yu protonmail.com> Closes: https://github.com/gentoo/portage/pull/1060 Signed-off-by: Sam James gentoo.org> lib/portage/gpkg.py | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/portage/gpkg.py b/lib/portage/gpkg.py index 7451c68c2..6ed2a6d00 100644 --- a/lib/portage/gpkg.py +++ b/lib/portage/gpkg.py @@ -1012,7 +1012,7 @@ class gpkg: gpkg_version_file = tarfile.TarInfo( os.path.join(self.basename, self.gpkg_version) ) -gpkg_version_file.mtime = datetime.utcnow().timestamp() +gpkg_version_file.mtime = datetime.now().timestamp() container.addfile(gpkg_version_file) checksum_info = checksum_helper(self.settings) checksum_info.finish() @@ -1032,7 +1032,7 @@ class gpkg: checksum_info = checksum_helper(self.settings) image_tarinfo = self._create_tarinfo("image") -image_tarinfo.mtime = datetime.utcnow().timestamp() +image_tarinfo.mtime = datetime.now().timestamp() with tar_stream_writer( image_tarinfo, container, image_tar_format, compression_cmd, checksum_info ) as image_writer: @@ -1114,7 +1114,7 @@ class gpkg: gpkg_version_file = tarfile.TarInfo( os.path.join(new_basename, self.gpkg_version) ) -gpkg_version_file.mtime = datetime.utcnow().timestamp() +gpkg_version_file.mtime = datetime.now().timestamp() container.addfile(gpkg_version_file) checksum_info = checksum_helper(self.settings) checksum_info.finish() @@ -1182,7 +1182,7 @@ class gpkg: gpkg_version_file = tarfile.TarInfo( os.path.join(self.prefix, self.gpkg_version) ) -gpkg_version_file.mtime = datetime.utcnow().timestamp() +gpkg_version_file.mtime = datetime.now().timestamp() container.addfile(gpkg_version_file) checksum_info = checksum_helper(self.settings) checksum_info.finish() @@ -1253,7 +1253,7 @@ class gpkg: if metadata is None: metadata = {} metadata_tarinfo = self._create_tarinfo("metadata") -metadata_tarinfo.mtime = datetime.utcnow().timestamp() +metadata_tarinfo.mtime = datetime.now().timestamp() if self.create_signature: checksum_info = checksum_helper( @@ -1274,7 +1274,7 @@ class gpkg: ) as metadata_tar: for m in metadata: m_info = tarfile.TarInfo(os.path.join("metadata", m)) -m_info.mtime = datetime.utcnow().timestamp() +m_info.mtime = datetime.now().timestamp() if isinstance(metadata[m], bytes): m_data = io.BytesIO(metadata[m]) @@ -1329,7 +1329,7 @@ class gpkg: gpkg_version_file = tarfile.TarInfo( os.path.join(self.basename, self.gpkg_version) ) -gpkg_version_file.mtime = datetime.utcnow().timestamp() +gpkg_version_file.mtime = datetime.now().timestamp() container.addfile(gpkg_version_file) checksum_info = checksum_helper(self.settings) checksum_info.finish() @@ -1350,7 +1350,7 @@ class gpkg: paths = list(contents) paths.sort() image_tarinfo = self._create_tarinfo("image") -image_tarinfo.mtime = datetime.utcnow().timestamp() +image_tarinfo.mtime = datetime.now().timestamp() with tar_stream_writer( image_tarinfo, container, image_tar_format, compression_cmd, checksum_info ) as image_writer: @@ -1518,7 +1518,7 @@ class gpkg: manifest_tarinfo = tarfile.TarInfo(os.path.join(basename, "Manifest")) manifest_tarinfo.size = manifest.tell() -manifest_tarinfo.mtime = datetime.utcnow().timestamp() +manifest_tarinfo.mtime = datetime.now().timestamp() manifest.seek(0) container.addfile(manifest_tarinfo, manifest) manifest.close() @@ -1562,7 +1562,7 @@ class gpkg: signature = io.BytesIO(checksum_info.gpg_output) signature_tarinfo = tarfile.TarInfo(f"{tarinfo.name}.sig") signature_tarinfo.size = len(signature.getvalue()) -signature_tarinfo.mtime = datetime.utcnow().timestamp() +signature_tarinfo.mtime = datetime.now().timestamp()
[gentoo-commits] proj/portage:master commit in: bin/install-qa-check.d/
commit: 6066bb766f43ca06a5b0f08baa5946ff678f0c29 Author: Benda Xu debian org> AuthorDate: Sun Jun 25 09:03:00 2023 + Commit: Sam James gentoo org> CommitDate: Thu Jun 29 08:22:53 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=6066bb76 bin/install-qa-check.d/05prefix: prefixify init-script shebangs. Init scripts in /etc/init.d have OpenRC shebangs "#!/sbin/openrc-run". They should be prefixified like a executable script in a Prefix. Signed-off-by: Benda Xu gentoo.org> Bug: https://bugs.gentoo.org/640658 Closes: https://github.com/gentoo/portage/pull/1061 Signed-off-by: Sam James gentoo.org> bin/install-qa-check.d/05prefix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/install-qa-check.d/05prefix b/bin/install-qa-check.d/05prefix index 7488ad9e4..28f2c06af 100644 --- a/bin/install-qa-check.d/05prefix +++ b/bin/install-qa-check.d/05prefix @@ -76,8 +76,8 @@ install_qa_check_prefix() { fi continue fi - # unprefixed shebang, is the script directly in ${PATH}? - if [[ ":${PATH}:" == *":${fp}:"* ]] ; then + # unprefixed shebang, is the script directly in ${PATH} or an init script? + if [[ ":${PATH}:${EPREFIX}/etc/init.d:" == *":${fp}:"* ]] ; then if [[ -e ${EROOT}${line[0]} || -e ${ED}${line[0]} ]] ; then # is it unprefixed, but we can just fix it because a # prefixed variant exists
[gentoo-commits] proj/portage:master commit in: lib/_emerge/
commit: 043ce446b6451fc9e74539634fc2e8e266c8b39e Author: Berin Aniesh gmail com> AuthorDate: Mon Jun 19 01:32:12 2023 + Commit: Sam James gentoo org> CommitDate: Thu Jun 29 08:19:28 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=043ce446 actions.py: Remove unused variable Signed-off-by: Berin Aniesh gmail.com> Closes: https://github.com/gentoo/portage/pull/1058 Signed-off-by: Sam James gentoo.org> lib/_emerge/actions.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/_emerge/actions.py b/lib/_emerge/actions.py index 74760..0fee21459 100644 --- a/lib/_emerge/actions.py +++ b/lib/_emerge/actions.py @@ -1908,7 +1908,6 @@ def action_info(settings, trees, myopts, myfiles): append( getportageversion( settings["PORTDIR"], -None, settings.profile_path, chost, trees[settings["EROOT"]]["vartree"].dbapi, @@ -2858,7 +2857,6 @@ def get_profile_version( def getportageversion( portdir: str, -_unused: None, profile: str, chost: str, vardb: portage.dbapi.vartree.vardbapi, @@ -3527,7 +3525,6 @@ def run_action(emerge_config): writemsg_stdout( getportageversion( emerge_config.target_config.settings["PORTDIR"], -None, emerge_config.target_config.settings.profile_path, emerge_config.target_config.settings.get("CHOST"), emerge_config.target_config.trees["vartree"].dbapi,
[gentoo-commits] proj/portage:master commit in: lib/portage/util/
commit: f95d78c1636d081b906e613a0f26e2c318c80c5d Author: Berin Aniesh gmail com> AuthorDate: Sun Jun 18 04:53:01 2023 + Commit: Sam James gentoo org> CommitDate: Thu Jun 29 08:19:28 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=f95d78c1 ExtractKernelVersion.py: Remove repeated/unreachable code Signed-off-by: Berin Aniesh gmail.com> Signed-off-by: Sam James gentoo.org> lib/portage/util/ExtractKernelVersion.py | 4 1 file changed, 4 deletions(-) diff --git a/lib/portage/util/ExtractKernelVersion.py b/lib/portage/util/ExtractKernelVersion.py index 5914dd020..6a6501b5d 100644 --- a/lib/portage/util/ExtractKernelVersion.py +++ b/lib/portage/util/ExtractKernelVersion.py @@ -31,16 +31,12 @@ def ExtractKernelVersion(base_dir): ) except OSError as details: return (None, str(details)) -except OSError as details: -return (None, str(details)) try: for i in range(4): lines.append(f.readline()) except OSError as details: return (None, str(details)) -except OSError as details: -return (None, str(details)) finally: f.close()
[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/_emerge/
commit: 5de6c63d0779eee0942a294b3a53ee1cce9d6d07 Author: Berin Aniesh gmail com> AuthorDate: Sun Jun 18 03:41:12 2023 + Commit: Sam James gentoo org> CommitDate: Thu Jun 29 08:19:27 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=5de6c63d actions.py: refactor getportageversion() into smaller functions Signed-off-by: Berin Aniesh gmail.com> Signed-off-by: Sam James gentoo.org> lib/_emerge/actions.py | 51 -- 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/lib/_emerge/actions.py b/lib/_emerge/actions.py index 60199dae6..dae6b6b7b 100644 --- a/lib/_emerge/actions.py +++ b/lib/_emerge/actions.py @@ -2789,16 +2789,23 @@ def relative_profile_path(portdir, abs_profile): profilever = None return profilever +def get_libc_version(vardb): +libcver = [] +libclist = set() +for atom in expand_new_virt(vardb, portage.const.LIBC_PACKAGE_ATOM): +if not atom.blocker: +libclist.update(vardb.match(atom)) +if libclist: +for cpv in sorted(libclist): +libc_split = portage.catpkgsplit(cpv)[1:] +if libc_split[-1] == "r0": +libc_split = libc_split[:-1] +libcver.append("-".join(libc_split)) +else: +libcver = ["unavailable"] +return libcver -def getportageversion(portdir, _unused, profile, chost, vardb): -pythonver = ( -"python" -f" {sys.version_info[0]}" -f".{sys.version_info[1]}" -f".{sys.version_info[2]}" -f"-{sys.version_info[3]}" -f"-{sys.version_info[4]}" -) +def get_profile_version(portdir, profile, vardb): profilever = None repositories = vardb.settings.repositories if profile: @@ -2838,21 +2845,21 @@ def getportageversion(portdir, _unused, profile, chost, vardb): if profilever is None: profilever = "unavailable" + +return profilever -libcver = [] -libclist = set() -for atom in expand_new_virt(vardb, portage.const.LIBC_PACKAGE_ATOM): -if not atom.blocker: -libclist.update(vardb.match(atom)) -if libclist: -for cpv in sorted(libclist): -libc_split = portage.catpkgsplit(cpv)[1:] -if libc_split[-1] == "r0": -libc_split = libc_split[:-1] -libcver.append("-".join(libc_split)) -else: -libcver = ["unavailable"] +def getportageversion(portdir, _unused, profile, chost, vardb): +pythonver = ( +"python" +f" {sys.version_info[0]}" +f".{sys.version_info[1]}" +f".{sys.version_info[2]}" +f"-{sys.version_info[3]}" +f"-{sys.version_info[4]}" +) +profilever = get_profile_version(portdir, profile, vardb) +libcver = get_libc_version(vardb) gccver = getgccversion(chost) unameout = platform.release() + " " + platform.machine()
[gentoo-commits] proj/portage:master commit in: lib/_emerge/
commit: e29cb58272b26fb6a4eeae27f4b127f80b34a88c Author: Berin Aniesh gmail com> AuthorDate: Mon Jun 19 01:30:25 2023 + Commit: Sam James gentoo org> CommitDate: Thu Jun 29 08:19:28 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=e29cb582 actions.py: More type annotations Signed-off-by: Berin Aniesh gmail.com> Signed-off-by: Sam James gentoo.org> lib/_emerge/actions.py | 17 ++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/_emerge/actions.py b/lib/_emerge/actions.py index 01bf82fcb..74760 100644 --- a/lib/_emerge/actions.py +++ b/lib/_emerge/actions.py @@ -105,6 +105,9 @@ from _emerge.UnmergeDepPriority import UnmergeDepPriority from _emerge.UseFlagDisplay import pkg_use_display from _emerge.UserQuery import UserQuery +# Type annotation imports +from typing import List + def action_build( emerge_config, @@ -2790,7 +2793,7 @@ def relative_profile_path(portdir, abs_profile): return profilever -def get_libc_version(vardb): +def get_libc_version(vardb: portage.dbapi.vartree.vardbapi) -> List[str]: libcver = [] libclist = set() for atom in expand_new_virt(vardb, portage.const.LIBC_PACKAGE_ATOM): @@ -2807,7 +2810,9 @@ def get_libc_version(vardb): return libcver -def get_profile_version(portdir, profile, vardb): +def get_profile_version( +portdir: str, profile: str, vardb: portage.dbapi.vartree.vardbapi +) -> str: profilever = None repositories = vardb.settings.repositories if profile: @@ -2851,7 +2856,13 @@ def get_profile_version(portdir, profile, vardb): return profilever -def getportageversion(portdir, _unused, profile, chost, vardb): +def getportageversion( +portdir: str, +_unused: None, +profile: str, +chost: str, +vardb: portage.dbapi.vartree.vardbapi, +) -> str: pythonver = ( "python" f" {sys.version_info[0]}"
[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/tests/resolver/, lib/_emerge/, /
commit: a2da08b6dfbfd2ef803aac6302f9de1f7c00a143 Author: Sam James gentoo org> AuthorDate: Wed Jun 21 18:54:24 2023 + Commit: Sam James gentoo org> CommitDate: Wed Jun 21 18:55:45 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=a2da08b6 Revert "depgraph: Don't ignore downgrades as missed_updates" This reverts commit 44afa8445dc46464200fe46c1e09e0c7475067bf. This is just so we can make a release for the other fixes in master like the Perl bits and keep a linear history. Signed-off-by: Sam James gentoo.org> NEWS | 2 -- lib/_emerge/depgraph.py| 4 +++- lib/portage/tests/resolver/test_slot_conflict_blocked_prune.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index cb68579f4..f2f716073 100644 --- a/NEWS +++ b/NEWS @@ -5,8 +5,6 @@ Bug fixes: * Adjust write tests for DISTDIR and PORTAGE_TMPDIR to work with automount directories (bug #485100, bug #890812). -* depgraph: Don't ignore downgrades as missed_updates (bug #622270). - * depgraph: Do not allow slotted deps to be satisfied by wrong slots (bug #463976, bug #592880, bug #596664, bug #631490, bug #764365, bug #793992). diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py index 28acfed9d..a36ab6351 100644 --- a/lib/_emerge/depgraph.py +++ b/lib/_emerge/depgraph.py @@ -1287,7 +1287,9 @@ class depgraph: pkg.root, pkg.slot_atom ): any_selected = True -if not chosen_pkg.installed and chosen_pkg.version == pkg.version: +if chosen_pkg > pkg or ( +not chosen_pkg.installed and chosen_pkg.version == pkg.version +): missed_update = False break if any_selected and missed_update: diff --git a/lib/portage/tests/resolver/test_slot_conflict_blocked_prune.py b/lib/portage/tests/resolver/test_slot_conflict_blocked_prune.py index b23126d5f..14e98cd00 100644 --- a/lib/portage/tests/resolver/test_slot_conflict_blocked_prune.py +++ b/lib/portage/tests/resolver/test_slot_conflict_blocked_prune.py @@ -63,7 +63,7 @@ class SlotConflictBlockedPruneTestCase(TestCase): ["@world"], options={"--deep": True, "--update": True, "--verbose": True}, success=True, -mergelist=[], +mergelist=["x11-base/xwayland-23.1.1"], ), )
[gentoo-commits] proj/portage:master commit in: /
commit: f537f520422af0900049c760b435ab3e0938240d Author: Sam James gentoo org> AuthorDate: Wed Jun 21 18:55:28 2023 + Commit: Sam James gentoo org> CommitDate: Wed Jun 21 18:55:45 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=f537f520 NEWS, setup.py: prepare for portage-3.0.49 Signed-off-by: Sam James gentoo.org> NEWS | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index f2f716073..1f82a856f 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,4 @@ -portage-3.0.49 (UNRELEASED) +portage-3.0.49 (2023-06-21) -- Bug fixes: diff --git a/setup.py b/setup.py index ad607f8d9..3c343aabd 100755 --- a/setup.py +++ b/setup.py @@ -816,7 +816,7 @@ def get_data_files(regular_files, venv_files): setup( name="portage", -version="3.0.48.1", +version="3.0.49", url="https://wiki.gentoo.org/wiki/Project:Portage;, project_urls={ "Release Notes": "https://gitweb.gentoo.org/proj/portage.git/plain/NEWS;,
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/
commit: ed1314f10623b25365a697c74eb25d557eb91edd Author: Sam James gentoo org> AuthorDate: Mon Jun 19 20:25:34 2023 + Commit: Sam James gentoo org> CommitDate: Mon Jun 19 21:17:37 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=ed1314f1 tests: rename test_unecessary_slot_upgrade.py -> test_unnecessary_slot_upgrade.py Signed-off-by: Sam James gentoo.org> .../{test_unecessary_slot_upgrade.py => test_unnecessary_slot_upgrade.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/lib/portage/tests/resolver/test_unecessary_slot_upgrade.py b/lib/portage/tests/resolver/test_unnecessary_slot_upgrade.py similarity index 100% rename from lib/portage/tests/resolver/test_unecessary_slot_upgrade.py rename to lib/portage/tests/resolver/test_unnecessary_slot_upgrade.py
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/
commit: 2af4bc17d1b4ea1581bb191dfa7f34ec64ab140b Author: YiFei Zhu gmail com> AuthorDate: Mon Jun 12 02:07:39 2023 + Commit: Sam James gentoo org> CommitDate: Fri Jun 16 03:34:46 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=2af4bc17 tests: resolver: Test the (bad) behavior of bug #622270 Without fixing the bug. This is so we have a baseline behavior to compare against. Bug: https://bugs.gentoo.org/439688 Bug: https://bugs.gentoo.org/622270 Signed-off-by: YiFei Zhu gmail.com> Signed-off-by: Sam James gentoo.org> .../resolver/test_slot_conflict_blocked_prune.py | 78 ++ 1 file changed, 78 insertions(+) diff --git a/lib/portage/tests/resolver/test_slot_conflict_blocked_prune.py b/lib/portage/tests/resolver/test_slot_conflict_blocked_prune.py new file mode 100644 index 0..14e98cd00 --- /dev/null +++ b/lib/portage/tests/resolver/test_slot_conflict_blocked_prune.py @@ -0,0 +1,78 @@ +# Copyright 2023 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 SlotConflictBlockedPruneTestCase(TestCase): +def testSlotConflictBlockedPrune(self): +""" +Bug 622270 +Downgrading package (as openssl here) due to un-accepting unstable. +Dependent package (as rustup here) cannot be rebuilt due to missing +keyword, so dependee downgrade is cancelled, but other dependents +(such as xwayland here) are rebuilt nevertheless. This should not +happen and the rebuilds should be pruned. +""" +ebuilds = { +"x11-base/xwayland-23.1.1": { +"EAPI": "5", +"RDEPEND": "dev-libs/openssl:=", +}, +"dev-util/rustup-1.25.2": { +"EAPI": "5", +"RDEPEND": "dev-libs/openssl:0=", +"KEYWORDS": "~x86", +}, +"dev-libs/openssl-1.1.1u": { +"EAPI": "5", +"SLOT": "0/1.1", +}, +"dev-libs/openssl-3.1.1": { +"EAPI": "5", +"SLOT": "0/3", +"KEYWORDS": "~x86", +}, +} + +installed = { +"x11-base/xwayland-23.1.1": { +"EAPI": "5", +"RDEPEND": "dev-libs/openssl:0/3=", +}, +"dev-util/rustup-1.25.2": { +"EAPI": "5", +"RDEPEND": "dev-libs/openssl:0/3=", +"KEYWORDS": "~x86", +}, +"dev-libs/openssl-3.1.1": { +"EAPI": "5", +"SLOT": "0/3", +"KEYWORDS": "~x86", +}, +} + +world = ["x11-base/xwayland", "dev-util/rustup"] + +test_cases = ( +ResolverPlaygroundTestCase( +["@world"], +options={"--deep": True, "--update": True, "--verbose": True}, +success=True, +mergelist=["x11-base/xwayland-23.1.1"], +), +) + +playground = ResolverPlayground( +ebuilds=ebuilds, installed=installed, world=world +) +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.cleanup()
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/
commit: ff457f742b513a65e6609054e5310f8beee488ec Author: YiFei Zhu gmail com> AuthorDate: Tue Jun 13 08:08:51 2023 + Commit: Sam James gentoo org> CommitDate: Fri Jun 16 03:34:46 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=ff457f74 tests: resolver: Test the broken behavior of Perl rebuild bug Bug: https://bugs.gentoo.org/463976 Bug: https://bugs.gentoo.org/592880 Bug: https://bugs.gentoo.org/596664 Bug: https://bugs.gentoo.org/631490 Bug: https://bugs.gentoo.org/764365 Bug: https://bugs.gentoo.org/793992 Signed-off-by: YiFei Zhu gmail.com> Signed-off-by: Sam James gentoo.org> .../tests/resolver/test_perl_rebuild_bug.py| 121 + 1 file changed, 121 insertions(+) diff --git a/lib/portage/tests/resolver/test_perl_rebuild_bug.py b/lib/portage/tests/resolver/test_perl_rebuild_bug.py new file mode 100644 index 0..928fd47d7 --- /dev/null +++ b/lib/portage/tests/resolver/test_perl_rebuild_bug.py @@ -0,0 +1,121 @@ +# Copyright 2023 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 PerlRebuildBugTestCase(TestCase): +def __init__(self, *args, **kwargs): +super().__init__(*args, **kwargs) + +def testPerlRebuildBug(self): +""" +The infamous Perl rebuild bug. + +A non-slotted build-time dependency cycle is created by: +dev-lang/perl -> sys-libs/zlib -> sys-devel/automake -> dev-lang/perl +Everything else depends on this cycle. + +Bug in solving for smallest cycle causes slot in RDEPEND of +dev-perl/Locale-gettext to be ignored, so all dependencies other than +perl's >=sys-libs/zlib-1.2.12 are satisfied by already-installed +packages. dev-perl/Locale-gettext and sys-devel/automake become leaves +of the depgraph after satisfied packages are ignored. They become +emerged first. This causes an issue because dev-perl/Locale-gettext is +now built before the slot upgrade of dev-lang/perl. +""" +ebuilds = { +"dev-lang/perl-5.36.0-r2": { +"EAPI": "5", +"DEPEND": ">=sys-libs/zlib-1.2.12", +"RDEPEND": ">=sys-libs/zlib-1.2.12", +"SLOT": "0/5.36", +}, +"dev-perl/Locale-gettext-1.70.0-r1": { +"EAPI": "5", +"DEPEND": "dev-lang/perl", +"RDEPEND": "dev-lang/perl:=", +}, +"sys-apps/help2man-1.49.3": { +"EAPI": "5", +"DEPEND": "dev-lang/perl dev-perl/Locale-gettext", +"RDEPEND": "dev-lang/perl dev-perl/Locale-gettext", +}, +"sys-devel/automake-1.16.5": { +"EAPI": "5", +"DEPEND": "dev-lang/perl", +"RDEPEND": "dev-lang/perl", +}, +"sys-libs/zlib-1.2.13-r1": { +"EAPI": "5", +"DEPEND": "sys-devel/automake", +}, +} + +installed = { +"dev-lang/perl-5.34.0-r3": { +"EAPI": "5", +"DEPEND": "sys-libs/zlib", +"RDEPEND": "sys-libs/zlib", +"SLOT": "0/5.34", +}, +"dev-perl/Locale-gettext-1.70.0-r1": { +"EAPI": "5", +"DEPEND": "dev-lang/perl", +"RDEPEND": "dev-lang/perl:0/5.34=", +}, +"sys-apps/help2man-1.48.5": { +"EAPI": "5", +"DEPEND": "dev-lang/perl dev-perl/Locale-gettext", +"RDEPEND": "dev-lang/perl dev-perl/Locale-gettext", +}, +"sys-devel/automake-1.16.4": { +"EAPI": "5", +"DEPEND": "dev-lang/perl", +"RDEPEND": "dev-lang/perl", +}, +"sys-libs/zlib-1.2.11-r4": { +"EAPI": "5", +"DEPEND": "sys-devel/automake", +}, +} + +world = ["sys-apps/help2man"] + +test_cases = ( +ResolverPlaygroundTestCase( +["@world"], +options={"--deep": True, "--update": True, "--verbose": True}, +success=True, +ambiguous_merge_order=True, +merge_order_assertions=( +( +"dev-perl/Locale-gettext-1.70.0-r1", +"dev-lang/perl-5.36.0-r2", +), +), +mergelist=[ +"dev-perl/Locale-gettext-1.70.0-r1", +"sys-devel/automake-1.16.5", +"sys-libs/zlib-1.2.13-r1", +"dev-lang/perl-5.36.0-r2", +"sys-apps/help2man-1.49.3", +
[gentoo-commits] proj/portage:master commit in: lib/_emerge/, lib/portage/tests/resolver/
commit: 224207c7d1988a354d004507bb7ecfb90b4ef097 Author: YiFei Zhu gmail com> AuthorDate: Tue Jun 13 00:47:52 2023 + Commit: Sam James gentoo org> CommitDate: Fri Jun 16 03:34:46 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=224207c7 depgraph: Do not allow slotted deps to be satisfied by wrong slots This may be part of what caused the "perl rebuild bug". The "priority" of perl, when seen by perl modules, may have "satisfied" set to an installed perl of a wrong slot. Compounding this factor with bug #756199 where find_smallest_cycle would select a single node, in this case because the dependency of perl is satisfied and the priority then gets ignored, the "cycle" becomes a perl module alone and gets rebuilt early. I also updated the test from the previous patch to account for this change. No other tests seems affected. For a larger scale test, I reproduced this initially with a stage3 chroot from a Jan 1 2022 stage3 snapshot, and testing in an equivalent dockerfile would work too: FROM gentoo/stage3:amd64-openrc-20220101 RUN emerge-webrsync COPY . /portage Before this patch (USE flags omitted): # cd /portage && bin/emerge -puDN @world 2>&1 | grep -i perl [ebuild U ] app-admin/perl-cleaner-2.30-r1 [2.30] [ebuild rR] virtual/perl-File-Temp-0.231.100 [ebuild rR] dev-perl/Locale-gettext-1.70.0-r1 [ebuild rR] dev-perl/MIME-Charset-1.12.2-r1 [ebuild rR] dev-perl/Module-Build-0.423.100 [ebuild rR] dev-perl/Text-CharWidth-0.40.0-r2 [ebuild U ] dev-lang/perl-5.36.0-r2 [5.34.0-r3] [ebuild N ] virtual/perl-CPAN-2.330.0 [ebuild U ] virtual/perl-ExtUtils-MakeMaker-7.640.0 [7.620.0] [ebuild U ] virtual/perl-File-Spec-3.840.0 [3.800.0] [...] After this patch: # cd /portage && bin/emerge -puDN @world 2>&1 | grep -i perl [ebuild U ] app-admin/perl-cleaner-2.30-r1 [2.30] [ebuild U ] dev-lang/perl-5.36.0-r2:0/5.36 [5.34.0-r3:0/5.34] [ebuild N ] virtual/perl-CPAN-2.330.0 [ebuild U ] virtual/perl-ExtUtils-MakeMaker-7.640.0 [7.620.0] [ebuild U ] virtual/perl-Data-Dumper-2.184.0 [2.179.0] [ebuild U ] virtual/perl-File-Spec-3.840.0 [3.800.0] [ebuild U ] virtual/perl-Test-Harness-3.440.0-r1 [3.430.0] [ebuild rR] dev-perl/Pod-Parser-1.630.0-r1 [ebuild rR] dev-perl/Text-CharWidth-0.40.0-r2 [ebuild rR] dev-perl/Text-WrapI18N-0.60.0-r2 [...] Bug: https://bugs.gentoo.org/463976 Bug: https://bugs.gentoo.org/592880 Bug: https://bugs.gentoo.org/596664 Bug: https://bugs.gentoo.org/631490 Bug: https://bugs.gentoo.org/764365 Bug: https://bugs.gentoo.org/793992 Signed-off-by: YiFei Zhu gmail.com> Closes: https://github.com/gentoo/portage/pull/1055 Signed-off-by: Sam James gentoo.org> lib/_emerge/depgraph.py | 18 ++ lib/portage/tests/resolver/test_perl_rebuild_bug.py | 4 ++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py index 60e57b226..28acfed9d 100644 --- a/lib/_emerge/depgraph.py +++ b/lib/_emerge/depgraph.py @@ -4042,6 +4042,16 @@ class depgraph: inst_pkg, modified_use=self._pkg_use_enabled(inst_pkg) ) ] +# Do not allow slotted deps to be satisfied by wrong slots. +# Otherwise, slot-operator-dependent packages may rebuild +# before the slotted package they are dependent on. +if child and atom.slot_operator == "=": +inst_pkgs = [ +inst_pkg +for inst_pkg in inst_pkgs +if inst_pkg.slot == child.slot +and inst_pkg.sub_slot == child.sub_slot +] if inst_pkgs: for inst_pkg in inst_pkgs: if self._pkg_visibility_check(inst_pkg): @@ -4161,6 +4171,14 @@ class depgraph: inst_pkg, modified_use=self._pkg_use_enabled(inst_pkg) ) ] +# Do not allow slotted deps to be satisfied by wrong slots. +if child and atom.slot_operator == "=": +inst_pkgs = [ +inst_pkg +for inst_pkg in inst_pkgs +if inst_pkg.slot == child.slot +and inst_pkg.sub_slot == child.sub_slot +] if inst_pkgs: for inst_pkg in inst_pkgs: if self._pkg_visibility_check(inst_pkg): diff --git a/lib/portage/tests/resolver/test_perl_rebuild_bug.py b/lib/portage/tests/resolver/test_perl_rebuild_bug.py index 928fd47d7..7e376f396 100644 --- a/lib/portage/tests/resolver/test_perl_rebuild_bug.py +++
[gentoo-commits] proj/portage:master commit in: lib/_emerge/, lib/portage/tests/resolver/
commit: 44afa8445dc46464200fe46c1e09e0c7475067bf Author: YiFei Zhu gmail com> AuthorDate: Mon Jun 12 02:23:09 2023 + Commit: Sam James gentoo org> CommitDate: Fri Jun 16 03:34:46 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=44afa844 depgraph: Don't ignore downgrades as missed_updates Missed updates can also come in the form of package downgrades, when, for example, there are keyword changes. They can cause rebuilds, and these rebuilds may be not possible due to reasons such as keywords or masks. In this case, prior to this patch, portage would cancel the downgrade, but the rebuilds would be requested endlessly, because bug 439688's backtrack code does not trigger. To reproduce, on an ACCEPT_KEYWORDS=~amd64 machine, emerge =dev-libs/openssl=3.0.9, dev-util/rustup, and something else that depends on openssl. Then un-accept ~amd64 for openssl and rustup. Prior to this patch, a @world upgrade would cause: These are the packages that would be merged, in order: Calculating dependencies... done! [ebuild rR] dev-libs/libevent-2.1.12-r1:0/2.1-7::gentoo [ebuild rR] net-misc/rsync-3.2.7-r2::gentoo [...] Total: 71 packages (71 reinstalls), Size of downloads: 0 KiB There are no packages marked "R", only "rR". There are no section labeled "The following packages are causing rebuilds:" either. After this patch, we have: These are the packages that would be merged, in order: Calculating dependencies... done! Total: 0 packages, Size of downloads: 0 KiB WARNING: One or more updates/rebuilds have been skipped due to a dependency conflict: dev-libs/openssl:0 (dev-libs/openssl-1.1.1u:0/1.1::gentoo, ebuild scheduled for merge) dev-libs/openssl:0/3= required by (dev-util/rustup-1.25.2:0/0::gentoo, installed) I also updated the test from the previous patch to account for this change. No other tests seems affected. Bug: https://bugs.gentoo.org/439688 Bug: https://bugs.gentoo.org/622270 Signed-off-by: YiFei Zhu gmail.com> Closes: https://github.com/gentoo/portage/pull/1053 Signed-off-by: Sam James gentoo.org> lib/_emerge/depgraph.py| 4 +--- lib/portage/tests/resolver/test_slot_conflict_blocked_prune.py | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py index 77133e99c..60e57b226 100644 --- a/lib/_emerge/depgraph.py +++ b/lib/_emerge/depgraph.py @@ -1287,9 +1287,7 @@ class depgraph: pkg.root, pkg.slot_atom ): any_selected = True -if chosen_pkg > pkg or ( -not chosen_pkg.installed and chosen_pkg.version == pkg.version -): +if not chosen_pkg.installed and chosen_pkg.version == pkg.version: missed_update = False break if any_selected and missed_update: diff --git a/lib/portage/tests/resolver/test_slot_conflict_blocked_prune.py b/lib/portage/tests/resolver/test_slot_conflict_blocked_prune.py index 14e98cd00..b23126d5f 100644 --- a/lib/portage/tests/resolver/test_slot_conflict_blocked_prune.py +++ b/lib/portage/tests/resolver/test_slot_conflict_blocked_prune.py @@ -63,7 +63,7 @@ class SlotConflictBlockedPruneTestCase(TestCase): ["@world"], options={"--deep": True, "--update": True, "--verbose": True}, success=True, -mergelist=["x11-base/xwayland-23.1.1"], +mergelist=[], ), )
[gentoo-commits] proj/portage:master commit in: /
commit: c5fe39fa9bae5f77e50b8130fbf66b9865e9d1b0 Author: Sam James gentoo org> AuthorDate: Fri Jun 16 03:15:44 2023 + Commit: Sam James gentoo org> CommitDate: Fri Jun 16 03:34:46 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=c5fe39fa NEWS: update Signed-off-by: Sam James gentoo.org> NEWS | 17 ++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index f3afbc366..cb68579f4 100644 --- a/NEWS +++ b/NEWS @@ -1,12 +1,23 @@ +portage-3.0.49 (UNRELEASED) +-- + Bug fixes: +* Adjust write tests for DISTDIR and PORTAGE_TMPDIR to work with automount + directories (bug #485100, bug #890812). + +* depgraph: Don't ignore downgrades as missed_updates (bug #622270). + +* depgraph: Do not allow slotted deps to be satisfied by wrong slots + (bug #463976, bug #592880, bug #596664, bug #631490, bug #764365, bug #793992). + + This is the notorious "Perl rebuild" bug where Perl modules would get rebuilt + _before_ a new dev-lang/perl and therefore be broken at runtime. + * dosym: Prevent globbing of argument in dosym_canonicalize(). * emerge-webrsync: Give a nicer error message if the requested key isn't on the filesystem (bug #905868). -* Adjust write tests for DISTDIR and PORTAGE_TMPDIR to work with automount - directories (bug #485100, bug #890812). - * glsa-check: appropriately handle more error cases with invalid GLSAs (bug #905660)
[gentoo-commits] proj/portage:master commit in: /, lib/portage/
commit: 63691996a5c2bcebf93c27ee8548c7520f9517d7 Author: John Helmert III gentoo org> AuthorDate: Fri Jun 16 02:26:50 2023 + Commit: John Helmert III gentoo org> CommitDate: Fri Jun 16 02:26:50 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=63691996 lib/portage/glsa: raise GlsaFormatException on invalid range types Bug: https://bugs.gentoo.org/905660 Signed-off-by: John Helmert III gentoo.org> NEWS| 3 +++ lib/portage/glsa.py | 14 -- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 6982e1d5f..f3afbc366 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,9 @@ Bug fixes: * Adjust write tests for DISTDIR and PORTAGE_TMPDIR to work with automount directories (bug #485100, bug #890812). +* glsa-check: appropriately handle more error cases with invalid GLSAs + (bug #905660) + portage-3.0.48.1 (2023-06-06) diff --git a/lib/portage/glsa.py b/lib/portage/glsa.py index 3b82c0de1..648159ad8 100644 --- a/lib/portage/glsa.py +++ b/lib/portage/glsa.py @@ -268,7 +268,13 @@ def makeAtom(pkgname, versionNode): @rtype:String @return: the portage atom """ -op = opMapping[versionNode.getAttribute("range")] +rangetype = versionNode.getAttribute("range") +if rangetype in opMapping: +op = opMapping[rangetype] +else: +raise GlsaFormatException( +_(f"Invalid range found for '{pkgname}': {rangetype}") +) version = getText(versionNode, format="strip") rValue = f"{op}{pkgname}-{version}" try: @@ -292,7 +298,11 @@ def makeVersion(versionNode): @rtype:String @return: the version string """ -op = opMapping[versionNode.getAttribute("range")] +rangetype = versionNode.getAttribute("range") +if rangetype in opMapping: +op = opMapping[rangetype] +else: +raise GlsaFormatException(_(f"Invalid range found: {rangetype}")) version = getText(versionNode, format="strip") rValue = f"{op}{version}" try:
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/glsa/
commit: 924c9655c71622315fb8f9fbb5167e4a2e5650b8 Author: John Helmert III gentoo org> AuthorDate: Fri Jun 16 02:26:53 2023 + Commit: John Helmert III gentoo org> CommitDate: Fri Jun 16 02:26:54 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=924c9655 tests/glsa/test_security_set: support manipulation of glsa range attributes Signed-off-by: John Helmert III gentoo.org> lib/portage/tests/glsa/test_security_set.py | 22 -- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/lib/portage/tests/glsa/test_security_set.py b/lib/portage/tests/glsa/test_security_set.py index 968e2bf2b..35f7aa5ab 100644 --- a/lib/portage/tests/glsa/test_security_set.py +++ b/lib/portage/tests/glsa/test_security_set.py @@ -30,8 +30,8 @@ class SecuritySetTestCase(TestCase): remote - %(unaffected_version)s - %(unaffected_version)s + %(unaffected_version)s + %(affected_version)s @@ -96,21 +96,30 @@ class SecuritySetTestCase(TestCase): "glsa_id": "201301-01", "pkgname": "A-vulnerable", "cp": "cat/A-vulnerable", +"unaffected_range": "ge", +"affected_range": "lt", "unaffected_version": "2.2", +"affected_version": "2.2", "arch": "*", }, { "glsa_id": "201301-02", "pkgname": "B-not-vulnerable", "cp": "cat/B-not-vulnerable", +"unaffected_range": "ge", +"affected_range": "lt", "unaffected_version": "4.4", +"affected_version": "4.4", "arch": "*", }, { "glsa_id": "201301-03", "pkgname": "NotInstalled", "cp": "cat/NotInstalled", +"unaffected_range": "ge", +"affected_range": "lt", "unaffected_version": "3.5", +"affected_version": "3.5", "arch": "*", }, ) @@ -171,7 +180,10 @@ class SecuritySetTestCase(TestCase): "glsa_id": "201301-04", "pkgname": "A-vulnerable", "cp": "cat/A-vulnerable", +"unaffected_range": "ge", +"affected_range": "lt", "unaffected_version": "2.2", +"affected_version": "2.2", # Use an invalid delimiter (comma) "arch": "amd64,sparc", }, @@ -179,7 +191,10 @@ class SecuritySetTestCase(TestCase): "glsa_id": "201301-05", "pkgname": "A-vulnerable", "cp": "cat/A-vulnerable", +"unaffected_range": "ge", +"affected_range": "lt", "unaffected_version": "2.2", +"affected_version": "2.2", # Use an invalid arch (~arch) "arch": "~amd64", }, @@ -187,7 +202,10 @@ class SecuritySetTestCase(TestCase): "glsa_id": "201301-06", "pkgname": "A-vulnerable", "cp": "cat/A-vulnerable", +"unaffected_range": "ge", +"affected_range": "lt", "unaffected_version": "2.2", +"affected_version": "2.2", # Two valid arches followed by an invalid one "arch": "amd64 sparc ", },
[gentoo-commits] proj/portage:master commit in: lib/portage/tests/glsa/
commit: bc9342d07f5a46f9ef5a220144decb9553342669 Author: John Helmert III gentoo org> AuthorDate: Fri Jun 16 02:26:57 2023 + Commit: John Helmert III gentoo org> CommitDate: Fri Jun 16 02:26:57 2023 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=bc9342d0 tests/glsa/test_security_set: test glsa with invalid range attribute Bug: https://bugs.gentoo.org/905660 Closes: https://github.com/gentoo/portage/pull/1056 Signed-off-by: John Helmert III gentoo.org> lib/portage/tests/glsa/test_security_set.py | 10 ++ 1 file changed, 10 insertions(+) diff --git a/lib/portage/tests/glsa/test_security_set.py b/lib/portage/tests/glsa/test_security_set.py index 35f7aa5ab..867a7cd4f 100644 --- a/lib/portage/tests/glsa/test_security_set.py +++ b/lib/portage/tests/glsa/test_security_set.py @@ -209,6 +209,16 @@ class SecuritySetTestCase(TestCase): # Two valid arches followed by an invalid one "arch": "amd64 sparc ", }, +{ +"glsa_id": "201301-07", +"pkgname": "A-vulnerable", +"cp": "cat/A-vulnerable", +"unaffected_range": "None", +"affected_range": "lt", +"unaffected_version": "2.2", +"affected_version": "2.2", +"arch": "*", +}, ) world = ["cat/A"]