public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/pkgcore/pkgcore:master commit in: src/pkgcore/scripts/, src/pkgcore/ebuild/, src/pkgcore/config/
@ 2022-12-26 17:28 Arthur Zamarin
  0 siblings, 0 replies; only message in thread
From: Arthur Zamarin @ 2022-12-26 17:28 UTC (permalink / raw
  To: gentoo-commits

commit:     bf99e1ae914c636e285f548c5ae9da79265116b3
Author:     Brian Harring <ferringb <AT> gmail <DOT> com>
AuthorDate: Wed Dec 21 06:39:36 2022 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Mon Dec 26 17:27:20 2022 +0000
URL:        https://gitweb.gentoo.org/proj/pkgcore/pkgcore.git/commit/?id=bf99e1ae

Rename domain.pkg_operations to domain.get_pkg_operations

Operations isn't a verb on it's own, so this naming isn't explanatory
on it's own.  'get_pkg_operations'- plus a docstring- is clearer, thus
the rename.

Signed-off-by: Brian Harring <ferringb <AT> gmail.com>
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 src/pkgcore/config/domain.py     | 9 +++++++--
 src/pkgcore/ebuild/ebd.py        | 2 +-
 src/pkgcore/ebuild/misc.py       | 2 +-
 src/pkgcore/ebuild/repository.py | 2 +-
 src/pkgcore/scripts/pconfig.py   | 2 +-
 src/pkgcore/scripts/pmerge.py    | 4 ++--
 6 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/src/pkgcore/config/domain.py b/src/pkgcore/config/domain.py
index f1b37ccc6..8d790ba81 100644
--- a/src/pkgcore/config/domain.py
+++ b/src/pkgcore/config/domain.py
@@ -40,13 +40,18 @@ class domain:
     def triggers(self):
         return tuple(self._triggers)
 
-    def pkg_operations(self, pkg, observer=None):
+    def get_pkg_operations(self, pkg, observer=None):
+        """Get the manager of package operations for the given package
+
+        If you wish to modify a package- invoke setup, install, etc- this is what's responsible
+        for giving you a common interface despite the format implementation varying.
+        """
         domain = self.get_package_domain(pkg)
         return pkg.operations(domain, observer=observer)
 
     def build_pkg(self, pkg, observer=None, failed=False, clean=True, **kwargs):
         domain = self.get_package_domain(pkg)
-        return domain.pkg_operations(pkg, observer=observer).build(
+        return domain.get_pkg_operations(pkg, observer=observer).build(
             observer=observer, failed=failed, clean=clean, **kwargs
         )
 

diff --git a/src/pkgcore/ebuild/ebd.py b/src/pkgcore/ebuild/ebd.py
index 10e26fb91..f85b5792d 100644
--- a/src/pkgcore/ebuild/ebd.py
+++ b/src/pkgcore/ebuild/ebd.py
@@ -788,7 +788,7 @@ class buildable(ebd, setup_mixin, format.build):
     def _setup_distfiles(self):
         # fetch distfiles
         if not self.verified_files:
-            ops = self.domain.pkg_operations(self.pkg, observer=self.observer)
+            ops = self.domain.get_pkg_operations(self.pkg, observer=self.observer)
             if ops.fetch():
                 # this break encapsulation and should be refactored.  Trace
                 # f35f2 and 6561eac for where this was refactored.

diff --git a/src/pkgcore/ebuild/misc.py b/src/pkgcore/ebuild/misc.py
index 19fa5270a..8c22b277f 100644
--- a/src/pkgcore/ebuild/misc.py
+++ b/src/pkgcore/ebuild/misc.py
@@ -598,7 +598,7 @@ def run_sanity_checks(pkgs, domain, threads=None):
     sanity_failures = defaultdict(list)
     # TODO: parallelize this across separate processes
     for pkg in pkgs:
-        pkg_ops = domain.pkg_operations(pkg)
+        pkg_ops = domain.get_pkg_operations(pkg)
         if pkg_ops.supports("sanity_check") and (failures := pkg_ops.sanity_check()):
             sanity_failures[pkg] = failures
     return sanity_failures

diff --git a/src/pkgcore/ebuild/repository.py b/src/pkgcore/ebuild/repository.py
index 2e27ada7a..f63521f5a 100644
--- a/src/pkgcore/ebuild/repository.py
+++ b/src/pkgcore/ebuild/repository.py
@@ -114,7 +114,7 @@ class repo_operations(_repo_ops.operations):
                 continue
 
             # fetch distfiles
-            pkg_ops = domain.pkg_operations(pkgs[0], observer=observer)
+            pkg_ops = domain.get_pkg_operations(pkgs[0], observer=observer)
             try:
                 if not pkg_ops.fetch(
                     list(fetchables.values()), observer, distdir=distdir

diff --git a/src/pkgcore/scripts/pconfig.py b/src/pkgcore/scripts/pconfig.py
index ff5b06cde..2965430b8 100644
--- a/src/pkgcore/scripts/pconfig.py
+++ b/src/pkgcore/scripts/pconfig.py
@@ -421,7 +421,7 @@ def package_func(options, out, err):
     domain = options.domain
     for pkg in domain.installed_repos.combined.itermatch(options.query):
         matched = True
-        ops = domain.pkg_operations(pkg)
+        ops = domain.get_pkg_operations(pkg)
         if not ops.supports("configure"):
             out.write(f"package {pkg}: nothing to configure, ignoring")
             continue

diff --git a/src/pkgcore/scripts/pmerge.py b/src/pkgcore/scripts/pmerge.py
index 30135a250..6d21bc53e 100644
--- a/src/pkgcore/scripts/pmerge.py
+++ b/src/pkgcore/scripts/pmerge.py
@@ -1140,7 +1140,7 @@ def main(options, out, err):
                 if not options.fetchonly and options.debug:
                     out.write("Forcing a clean of workdir")
 
-                pkg_ops = domain.pkg_operations(op.pkg, observer=build_obs)
+                pkg_ops = domain.get_pkg_operations(op.pkg, observer=build_obs)
                 out.write(
                     f"\n{len(op.pkg.distfiles)} file{pluralism(op.pkg.distfiles)} required-"
                 )
@@ -1172,7 +1172,7 @@ def main(options, out, err):
                         continue
                     pkg = result
                     cleanup.append(pkg.release_cached_data)
-                    pkg_ops = domain.pkg_operations(pkg, observer=build_obs)
+                    pkg_ops = domain.get_pkg_operations(pkg, observer=build_obs)
                     cleanup.append(buildop.cleanup)
 
                 cleanup.append(partial(pkg_ops.run_if_supported, "cleanup"))


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-12-26 17:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-26 17:28 [gentoo-commits] proj/pkgcore/pkgcore:master commit in: src/pkgcore/scripts/, src/pkgcore/ebuild/, src/pkgcore/config/ Arthur Zamarin

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