From: "Zac Medico" <zmedico@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:master commit in: pym/_emerge/, man/, pym/portage/tests/resolver/
Date: Wed, 28 Mar 2018 05:56:42 +0000 (UTC) [thread overview]
Message-ID: <1522216310.1879d3ca019ebe4b870c3ee8d80910a90a8e4408.zmedico@gentoo> (raw)
commit: 1879d3ca019ebe4b870c3ee8d80910a90a8e4408
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Mar 26 20:59:57 2018 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed Mar 28 05:51:50 2018 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=1879d3ca
emerge: add --changed-slot [ y | n ] option (bug 631358)
This is similar to --changed-deps, but for SLOT metadata.
Bug: https://bugs.gentoo.org/631358
man/emerge.1 | 7 +++++++
pym/_emerge/create_depgraph_params.py | 6 ++++++
pym/_emerge/depgraph.py | 11 +++++++++++
pym/_emerge/main.py | 13 +++++++++++++
.../resolver/test_slot_change_without_revbump.py | 19 +++++++++++++++++++
5 files changed, 56 insertions(+)
diff --git a/man/emerge.1 b/man/emerge.1
index 27a1193fe..a3c8dd7cd 100644
--- a/man/emerge.1
+++ b/man/emerge.1
@@ -471,6 +471,13 @@ changed since the installed instance was built. Behavior with respect to
changed build\-time dependencies is controlled by the
\fB\-\-with\-bdeps\fR option.
.TP
+.BR "\-\-changed\-slot [ y | n ]"
+Tells emerge to replace installed packages for which the corresponding
+ebuild SLOT metadata has changed since the packages were built. This
+option also implies the \fB\-\-selective\fR option. This may also result
+in rebuilds for any installed packages that have slot/sub\-slot :=
+operator dependencies that are sensitive to the relevant SLOT metadata.
+.TP
.BR \-\-changed\-use ", " \-U
Tells emerge to include installed packages where USE flags have
changed since installation. This option also implies the
diff --git a/pym/_emerge/create_depgraph_params.py b/pym/_emerge/create_depgraph_params.py
index ff18f3acc..1fd1f5e36 100644
--- a/pym/_emerge/create_depgraph_params.py
+++ b/pym/_emerge/create_depgraph_params.py
@@ -30,6 +30,7 @@ def create_depgraph_params(myopts, myaction):
# with_test_deps: pull in test deps for packages matched by arguments
# changed_deps: rebuild installed packages with outdated deps
# changed_deps_report: report installed packages with outdated deps
+ # changed_slot: rebuild installed packages with outdated SLOT metadata
# binpkg_changed_deps: reject binary packages with outdated deps
myparams = {"recurse" : True}
@@ -64,12 +65,17 @@ def create_depgraph_params(myopts, myaction):
if rebuild_if_new_slot is not None:
myparams['rebuild_if_new_slot'] = rebuild_if_new_slot
+ changed_slot = myopts.get('--changed-slot') is True
+ if changed_slot:
+ myparams["changed_slot"] = True
+
if "--update" in myopts or \
"--newrepo" in myopts or \
"--newuse" in myopts or \
"--reinstall" in myopts or \
"--noreplace" in myopts or \
myopts.get("--changed-deps", "n") != "n" or \
+ changed_slot or \
myopts.get("--selective", "n") != "n":
myparams["selective"] = True
diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index ac7ec9d84..6af7d5714 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -2667,6 +2667,10 @@ class depgraph(object):
return changed
+ def _changed_slot(self, pkg):
+ ebuild = self._equiv_ebuild(pkg)
+ return ebuild is not None and (ebuild.slot, ebuild.sub_slot) != (pkg.slot, pkg.sub_slot)
+
def _create_graph(self, allow_unsatisfied=False):
dep_stack = self._dynamic_config._dep_stack
dep_disjunctive_stack = self._dynamic_config._dep_disjunctive_stack
@@ -6474,6 +6478,13 @@ class depgraph(object):
modified_use=self._pkg_use_enabled(pkg))):
if myeb and "--newrepo" in self._frozen_config.myopts and myeb.repo != pkg.repo:
break
+ elif self._dynamic_config.myparams.get("changed_slot") and self._changed_slot(pkg):
+ if installed:
+ break
+ else:
+ # Continue searching for a binary package
+ # with the desired SLOT metadata.
+ continue
elif reinstall_use or (not installed and respect_use):
iuses = pkg.iuse.all
old_use = self._pkg_use_enabled(pkg)
diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
index 147472cbd..4aa9585fa 100644
--- a/pym/_emerge/main.py
+++ b/pym/_emerge/main.py
@@ -136,6 +136,7 @@ def insert_optional_args(args):
'--binpkg-changed-deps' : y_or_n,
'--buildpkg' : y_or_n,
'--changed-deps' : y_or_n,
+ '--changed-slot' : y_or_n,
'--changed-deps-report' : y_or_n,
'--complete-graph' : y_or_n,
'--deep' : valid_integers,
@@ -416,6 +417,12 @@ def parse_opts(tmpcmdline, silent=False):
"choices" : true_y_or_n
},
+ "--changed-slot": {
+ "help" : ("replace installed packages with "
+ "outdated SLOT metadata"),
+ "choices" : true_y_or_n
+ },
+
"--config-root": {
"help":"specify the location for portage configuration files",
"action":"store"
@@ -852,6 +859,12 @@ def parse_opts(tmpcmdline, silent=False):
else:
myoptions.changed_deps_report = 'n'
+ if myoptions.changed_slot is not None:
+ if myoptions.changed_slot in true_y:
+ myoptions.changed_slot = True
+ else:
+ myoptions.changed_slot = None
+
if myoptions.changed_use is not False:
myoptions.reinstall = "changed-use"
myoptions.changed_use = False
diff --git a/pym/portage/tests/resolver/test_slot_change_without_revbump.py b/pym/portage/tests/resolver/test_slot_change_without_revbump.py
index d85ff7e05..5cd8c53d1 100644
--- a/pym/portage/tests/resolver/test_slot_change_without_revbump.py
+++ b/pym/portage/tests/resolver/test_slot_change_without_revbump.py
@@ -57,6 +57,25 @@ class SlotChangeWithoutRevBumpTestCase(TestCase):
success = True,
mergelist = ['app-arch/libarchive-3.1.1', "kde-base/ark-4.10.0"]),
+ ResolverPlaygroundTestCase(
+ ["app-arch/libarchive"],
+ options = {"--noreplace": True, "--usepkg": True},
+ success = True,
+ mergelist = []),
+
+ ResolverPlaygroundTestCase(
+ ["app-arch/libarchive"],
+ options = {"--usepkg": True},
+ success = True,
+ mergelist = ["[binary]app-arch/libarchive-3.1.1"]),
+
+ # Test --changed-slot
+ ResolverPlaygroundTestCase(
+ ["app-arch/libarchive"],
+ options = {"--changed-slot": True, "--usepkg": True},
+ success = True,
+ mergelist = ["app-arch/libarchive-3.1.1", "kde-base/ark-4.10.0"]),
+
)
playground = ResolverPlayground(ebuilds=ebuilds, binpkgs=binpkgs,
next reply other threads:[~2018-03-28 5:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-28 5:56 Zac Medico [this message]
-- strict thread matches above, loose matches on Subject: below --
2017-12-19 22:46 [gentoo-commits] proj/portage:master commit in: pym/_emerge/, man/, pym/portage/tests/resolver/ Michał Górny
2017-05-14 18:12 Zac Medico
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1522216310.1879d3ca019ebe4b870c3ee8d80910a90a8e4408.zmedico@gentoo \
--to=zmedico@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox