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"),
