public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/portage:master commit in: /, lib/portage/dbapi/
@ 2024-10-27 23:13 Zac Medico
  0 siblings, 0 replies; 5+ messages in thread
From: Zac Medico @ 2024-10-27 23:13 UTC (permalink / raw
  To: gentoo-commits

commit:     cc6a6b08938809bcfa4a244ab5050fd3b496807f
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Fri Oct 25 19:59:38 2024 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Oct 27 23:13:09 2024 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=cc6a6b08

binarytree: Fix _inject_repo_revisions to ignore remote packages

For remote packages that reference source repos which do not
exist locally, do not inject repo revisions.

Fixes: 5aed7289d516 ("bintree: Add REPO_REVISIONS to package index header")
Bug: https://bugs.gentoo.org/939299
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>

 NEWS                         | 3 +++
 lib/portage/dbapi/bintree.py | 9 ++++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index 110fea45ab..5c1cea5c27 100644
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,9 @@ Release notes take the form of the following optional categories:
 Bug fixes:
 * depgraph: Ignore blockers when computing virtual deps visibility (PR #1387).
 
+* binarytree: Fix _inject_repo_revisions to ignore remote packages for which
+  source repostories are missing, triggering KeyError (PR #1391).
+
 portage-3.0.66.1 (2024-09-18)
 --------------
 

diff --git a/lib/portage/dbapi/bintree.py b/lib/portage/dbapi/bintree.py
index 6099bab968..a63652c7e0 100644
--- a/lib/portage/dbapi/bintree.py
+++ b/lib/portage/dbapi/bintree.py
@@ -1948,9 +1948,16 @@ class binarytree:
         package was not built locally, and in this case its
         REPO_REVISIONS are not intended to be exposed.
         """
+        try:
+            repos = [
+                self.settings.repositories[repo_name] for repo_name in repo_revisions
+            ]
+        except KeyError:
+            # Missing repo implies package was not built locally from source.
+            return
         synced_repo_revisions = get_repo_revision_history(
             self.settings["EROOT"],
-            [self.settings.repositories[repo_name] for repo_name in repo_revisions],
+            repos,
         )
         header_repo_revisions = (
             json.loads(header["REPO_REVISIONS"]) if header.get("REPO_REVISIONS") else {}


^ permalink raw reply related	[flat|nested] 5+ messages in thread
* [gentoo-commits] proj/portage:master commit in: /, lib/portage/dbapi/
@ 2024-01-02  4:46 Sam James
  0 siblings, 0 replies; 5+ messages in thread
From: Sam James @ 2024-01-02  4:46 UTC (permalink / raw
  To: gentoo-commits

commit:     b071a966357a29e8450688a28ca918166b9e4eb0
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Jan  2 04:00:02 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Jan  2 04:09:56 2024 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=b071a966

bintree: don't call trust helper unless bindb is writable

Followup to 6ae45739e208b7a9d59e0b6056be72a5791aae04. My qualm there wrt
writable was whether or not doing something which mutated state (and therefore
possibly the package list) would be confusing but that doesn't make much sense
for a few reasons.

Anyway, change the test to be not just for no-pretend, but also whether the
bindb is writable too, as pretend is already a proxy for whether we may
not have privileges (I can imagine someone possibly having bindb privileges
but not /etc/portage/gnupg, so better to just head this off entirely).

Bug: https://bugs.gentoo.org/915842
Bug: https://bugs.gentoo.org/920180
Signed-off-by: Sam James <sam <AT> gentoo.org>

 NEWS                         | 3 ++-
 lib/portage/dbapi/bintree.py | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/NEWS b/NEWS
index 038a4dbf8c..2ee334f20c 100644
--- a/NEWS
+++ b/NEWS
@@ -9,7 +9,8 @@ Release notes take the form of the following optional categories:
 portage-3.0.61 (UNRELEASED)
 --------------
 
-TODO
+Bug fixes:
+* bintree: Don't call trust helper unless bindb is writable (bug #915842, bug #920180).
 
 portage-3.0.60 (2024-01-02)
 --------------

diff --git a/lib/portage/dbapi/bintree.py b/lib/portage/dbapi/bintree.py
index a139e37659..d352b6fc0e 100644
--- a/lib/portage/dbapi/bintree.py
+++ b/lib/portage/dbapi/bintree.py
@@ -1334,7 +1334,7 @@ class binarytree:
             # 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...)
-            if not pretend:
+            if not pretend and self.dbapi.writable:
                 self._run_trust_helper()
             gpkg_only = True
         else:


^ permalink raw reply related	[flat|nested] 5+ messages in thread
* [gentoo-commits] proj/portage:master commit in: /, lib/portage/dbapi/
@ 2023-09-26 20:54 Sam James
  0 siblings, 0 replies; 5+ messages in thread
From: Sam James @ 2023-09-26 20:54 UTC (permalink / raw
  To: gentoo-commits

commit:     5996c7bec3fe69e3ca69805777acdd8c5437b2ae
Author:     gcarq <egger.m <AT> protonmail <DOT> com>
AuthorDate: Mon Sep  4 17:01:56 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Sep 26 20:54:12 2023 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=5996c7be

vartree: Remove unused variables and parameters

Removes unused local variable cache_incomplete in aux_get()
and removes unused parameters for methods around counter_tick().

Signed-off-by: Michael Egger <egger.m <AT> protonmail.com>
Closes: https://github.com/gentoo/portage/pull/1089
Signed-off-by: Sam James <sam <AT> gentoo.org>

 NEWS                         |  3 +++
 lib/portage/dbapi/vartree.py | 24 ++++++------------------
 2 files changed, 9 insertions(+), 18 deletions(-)

diff --git a/NEWS b/NEWS
index 340516a9b4..31a188e8f6 100644
--- a/NEWS
+++ b/NEWS
@@ -26,6 +26,9 @@ Bug fixes:
 
 * fetch: fix fetching of layout.conf when FEATURES=force-mirror (bug #877793).
 
+Cleanups:
+* vartree: Remove unused variables and parameters
+
 portage-3.0.51 (2023-08-20)
 --------------
 

diff --git a/lib/portage/dbapi/vartree.py b/lib/portage/dbapi/vartree.py
index d4b510082c..3f39e2b787 100644
--- a/lib/portage/dbapi/vartree.py
+++ b/lib/portage/dbapi/vartree.py
@@ -395,7 +395,7 @@ class vardbapi(dbapi):
     def cpv_inject(self, mycpv):
         "injects a real package into our on-disk database; assumes mycpv is valid and doesn't already exist"
         ensure_dirs(self.getpath(mycpv))
-        counter = self.counter_tick(mycpv=mycpv)
+        counter = self.counter_tick()
         # write local package counter so that emerge clean does the right thing
         write_atomic(self.getpath(mycpv, filename="COUNTER"), str(counter))
 
@@ -794,7 +794,6 @@ class vardbapi(dbapi):
         pull_me = cache_these.union(wants)
         mydata = {"_mtime_": mydir_mtime}
         cache_valid = False
-        cache_incomplete = False
         cache_mtime = None
         metadata = None
         if pkg_data is not None:
@@ -1141,13 +1140,10 @@ class vardbapi(dbapi):
                 log_path=settings.get("PORTAGE_LOG_FILE"),
             )
 
-    def counter_tick(self, myroot=None, mycpv=None):
-        """
-        @param myroot: ignored, self._eroot is used instead
-        """
-        return self.counter_tick_core(incrementing=1, mycpv=mycpv)
+    def counter_tick(self) -> int:
+        return self.counter_tick_core(incrementing=1)
 
-    def get_counter_tick_core(self, myroot=None, mycpv=None):
+    def get_counter_tick_core(self) -> int:
         """
         Use this method to retrieve the counter instead
         of having to trust the value of a global counter
@@ -1165,10 +1161,7 @@ class vardbapi(dbapi):
         it also corresponds to the total number of
         installation actions that have occurred in
         the history of this package database.
-
-        @param myroot: ignored, self._eroot is used instead
         """
-        del myroot
         counter = -1
         try:
             with open(
@@ -1219,7 +1212,7 @@ class vardbapi(dbapi):
 
         return max_counter + 1
 
-    def counter_tick_core(self, myroot=None, incrementing=1, mycpv=None):
+    def counter_tick_core(self, incrementing: int = 1) -> int:
         """
         This method will grab the next COUNTER value and record it back
         to the global file. Note that every package install must have
@@ -1227,13 +1220,8 @@ class vardbapi(dbapi):
         into the same SLOT and in that case it's important that both
         packages have different COUNTER metadata.
 
-        @param myroot: ignored, self._eroot is used instead
-        @param mycpv: ignored
-        @rtype: int
         @return: new counter value
         """
-        myroot = None
-        mycpv = None
         self.lock()
         try:
             counter = self.get_counter_tick_core() - 1
@@ -4974,7 +4962,7 @@ class dblink:
 
         # write local package counter for recording
         if counter is None:
-            counter = self.vartree.dbapi.counter_tick(mycpv=self.mycpv)
+            counter = self.vartree.dbapi.counter_tick()
         with open(
             _unicode_encode(
                 os.path.join(self.dbtmpdir, "COUNTER"),


^ permalink raw reply related	[flat|nested] 5+ messages in thread
* [gentoo-commits] proj/portage:master commit in: /, lib/portage/dbapi/
@ 2023-04-07  9:52 Sam James
  0 siblings, 0 replies; 5+ messages in thread
From: Sam James @ 2023-04-07  9:52 UTC (permalink / raw
  To: gentoo-commits

commit:     2569a1a1d889a76af80ce24a005d54269df7d2e2
Author:     Sheng Yu <syu.os <AT> protonmail <DOT> com>
AuthorDate: Fri Apr  7 04:50:49 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Apr  7 09:49:11 2023 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=2569a1a1

dbapi: Catch invalid binpkg error during pkgmove

Bug: https://bugs.gentoo.org/877271
Bug: https://bugs.gentoo.org/903917
Bug: https://bugs.gentoo.org/903926
Signed-off-by: Sheng Yu <syu.os <AT> protonmail.com>
Closes: https://github.com/gentoo/portage/pull/1022
Signed-off-by: Sam James <sam <AT> gentoo.org>

 NEWS                          | 3 +++
 lib/portage/dbapi/__init__.py | 8 ++++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/NEWS b/NEWS
index 506e673e1..1d05f1de2 100644
--- a/NEWS
+++ b/NEWS
@@ -60,6 +60,9 @@ Features:
   for a time for compatibility.
 
 Bug fixes:
+* dbapi: Handle mismatched binpkg structure during pkgmoves (bug #877271,
+  bug #903917, bug #903926).
+
 * tests: util/test_shelve: fix test failure if the backend for the shelve module
   does not create the shelve db using the literal filename.
 

diff --git a/lib/portage/dbapi/__init__.py b/lib/portage/dbapi/__init__.py
index 366a6c170..31453d149 100644
--- a/lib/portage/dbapi/__init__.py
+++ b/lib/portage/dbapi/__init__.py
@@ -4,6 +4,7 @@
 __all__ = ["dbapi"]
 
 import re
+import warnings
 
 import portage
 
@@ -21,7 +22,7 @@ from portage.const import MERGING_IDENTIFIER
 from portage import os
 from portage import auxdbkeys
 from portage.eapi import _get_eapi_attrs
-from portage.exception import InvalidData
+from portage.exception import InvalidBinaryPackageFormat, InvalidData
 from portage.localization import _
 from _emerge.Package import Package
 
@@ -410,7 +411,10 @@ class dbapi:
                 updates_list, metadata, parent=pkg
             )
             if metadata_updates:
-                aux_update(cpv, metadata_updates)
+                try:
+                    aux_update(cpv, metadata_updates)
+                except InvalidBinaryPackageFormat as e:
+                    warnings.warn(e)
                 if onUpdate:
                     onUpdate(maxval, i + 1)
             if onProgress:


^ permalink raw reply related	[flat|nested] 5+ messages in thread
* [gentoo-commits] proj/portage:master commit in: /, lib/portage/dbapi/
@ 2022-11-30 22:29 Sam James
  0 siblings, 0 replies; 5+ messages in thread
From: Sam James @ 2022-11-30 22:29 UTC (permalink / raw
  To: gentoo-commits

commit:     d9699fa0b09a1d5a397edf0bb25c7662ac88e09d
Author:     Sheng Yu <syu.os <AT> protonmail <DOT> com>
AuthorDate: Wed Nov 30 18:13:29 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Nov 30 22:28:58 2022 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=d9699fa0

Properly assign filenames for remote packages

Signed-off-by: Sheng Yu <syu.os <AT> protonmail.com>
Closes: https://github.com/gentoo/portage/pull/950
Signed-off-by: Sam James <sam <AT> gentoo.org>

 NEWS                         | 2 ++
 lib/portage/dbapi/bintree.py | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index 923b95a43..1cb2b2468 100644
--- a/NEWS
+++ b/NEWS
@@ -49,6 +49,8 @@ Bug fixes:
 * env-update: Also generate PATH definition in systemd user environment file
   /etc/environment.d/10-gentoo-env.conf
 
+* bintree: Properly assign filenames for remote binpkgs.
+
 * --disable-static is only passed for libtool-enabled configure scripts in EAPI 8.
   This avoids annoying warnings when a configure script has a flag such as
   --disable-static_link that would then trigger a QA warning (bug #814380).

diff --git a/lib/portage/dbapi/bintree.py b/lib/portage/dbapi/bintree.py
index d7c18e2e9..baf001c8f 100644
--- a/lib/portage/dbapi/bintree.py
+++ b/lib/portage/dbapi/bintree.py
@@ -2031,7 +2031,7 @@ class binarytree:
         filename = None
         build_id = None
         if allocate_new:
-            filename, build_id = self._allocate_filename(cpv)
+            filename, build_id = self._allocate_filename(cpv, remote_binpkg_format)
         elif self._is_specific_instance(cpv):
             instance_key = self.dbapi._instance_key(cpv)
             path = self._pkg_paths.get(instance_key)


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-10-27 23:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-27 23:13 [gentoo-commits] proj/portage:master commit in: /, lib/portage/dbapi/ Zac Medico
  -- strict thread matches above, loose matches on Subject: below --
2024-01-02  4:46 Sam James
2023-09-26 20:54 Sam James
2023-04-07  9:52 Sam James
2022-11-30 22:29 Sam James

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox