aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar David Leverton <levertond@googlemail.com> 2014-05-18 19:42:03 +0100
committerAvatar David Leverton <levertond@googlemail.com> 2014-05-18 19:42:03 +0100
commit63c807c0b85607a2993006069d66cb7c0a9fdf59 (patch)
tree61a2f5068d86d8d3bfb35978535a827368da04f3
parent8ecc15db0ed72dfc9b6abd738a1d076202f95fb8 (diff)
downloadpaludis-63c807c0b85607a2993006069d66cb7c0a9fdf59.tar.gz
paludis-63c807c0b85607a2993006069d66cb7c0a9fdf59.tar.xz
If a subslot changes, build := dependents after
-rw-r--r--.gitignore1
-rw-r--r--paludis/resolver/Makefile.am18
-rw-r--r--paludis/resolver/orderer.cc71
-rw-r--r--paludis/resolver/resolver_TEST_subslots.cc136
-rwxr-xr-xpaludis/resolver/resolver_TEST_subslots_cleanup.sh9
-rwxr-xr-xpaludis/resolver/resolver_TEST_subslots_setup.sh51
6 files changed, 282 insertions, 4 deletions
diff --git a/.gitignore b/.gitignore
index 8646fa5..398b10f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -372,6 +372,7 @@ tags
/paludis/resolver/resolver_TEST_purges
/paludis/resolver/resolver_TEST_serialisation
/paludis/resolver/resolver_TEST_simple
+/paludis/resolver/resolver_TEST_subslots
/paludis/resolver/resolver_TEST_suggestions
/paludis/resolver/resolver_TEST_uninstalls
/paludis/selection_TEST
diff --git a/paludis/resolver/Makefile.am b/paludis/resolver/Makefile.am
index c41f07f..699cb88 100644
--- a/paludis/resolver/Makefile.am
+++ b/paludis/resolver/Makefile.am
@@ -205,6 +205,7 @@ TESTS = \
resolver_TEST_fetches \
resolver_TEST_purges \
resolver_TEST_binaries \
+ resolver_TEST_subslots \
$(if_pbin_TESTS)
if ENABLE_PBINS
@@ -226,7 +227,8 @@ check_SCRIPTS = \
resolver_TEST_fetches_setup.sh resolver_TEST_fetches_cleanup.sh \
resolver_TEST_purges_setup.sh resolver_TEST_purges_cleanup.sh \
resolver_TEST_binaries_setup.sh resolver_TEST_binaries_cleanup.sh \
- resolver_TEST_promote_binaries_setup.sh resolver_TEST_promote_binaries_cleanup.sh
+ resolver_TEST_promote_binaries_setup.sh resolver_TEST_promote_binaries_cleanup.sh \
+ resolver_TEST_subslots_setup.sh resolver_TEST_subslots_cleanup.sh
check_LIBRARIES = libpaludisresolvertest.a
@@ -416,6 +418,20 @@ resolver_TEST_promote_binaries_CXXFLAGS = $(AM_CXXFLAGS) @PALUDIS_CXXFLAGS_NO_DE
resolver_TEST_promote_binaries_LDFLAGS = @GTESTDEPS_LDFLAGS@ @GTESTDEPS_LIBS@
+resolver_TEST_subslots_SOURCES = resolver_TEST_subslots.cc
+
+resolver_TEST_subslots_LDADD = \
+ libpaludisresolvertest.a \
+ $(top_builddir)/paludis/util/gtest_runner.o \
+ $(top_builddir)/paludis/libpaludis_@PALUDIS_PC_SLOT@.la \
+ $(top_builddir)/paludis/util/libpaludisutil_@PALUDIS_PC_SLOT@.la \
+ libpaludisresolver.a \
+ $(DYNAMIC_LD_LIBS)
+
+resolver_TEST_subslots_CXXFLAGS = $(AM_CXXFLAGS) @PALUDIS_CXXFLAGS_NO_DEBUGGING@ @GTESTDEPS_CXXFLAGS@
+
+resolver_TEST_subslots_LDFLAGS = @GTESTDEPS_LDFLAGS@ @GTESTDEPS_LIBS@
+
use_existing-se.hh : use_existing.se $(top_srcdir)/misc/make_se.bash
if ! $(top_srcdir)/misc/make_se.bash --header $(srcdir)/use_existing.se > $@ ; then rm -f $@ ; exit 1 ; fi
diff --git a/paludis/resolver/orderer.cc b/paludis/resolver/orderer.cc
index 06eede3..9134177 100644
--- a/paludis/resolver/orderer.cc
+++ b/paludis/resolver/orderer.cc
@@ -53,6 +53,13 @@
#include <paludis/environment.hh>
#include <paludis/notifier_callback.hh>
#include <paludis/package_id.hh>
+#include <paludis/metadata_key.hh>
+#include <paludis/slot.hh>
+#include <paludis/slot_requirement.hh>
+#include <paludis/selection.hh>
+#include <paludis/generator.hh>
+#include <paludis/filter.hh>
+#include <paludis/filtered_generator.hh>
#include <unordered_set>
#include <unordered_map>
@@ -229,12 +236,46 @@ namespace
}
};
+ struct SlotIsLocked
+ {
+ bool visit(const SlotExactPartialRequirement &) const
+ {
+ return false;
+ }
+
+ bool visit(const SlotExactFullRequirement &) const
+ {
+ return false;
+ }
+
+ bool visit(const SlotAnyAtAllLockedRequirement &) const
+ {
+ return true;
+ }
+
+ bool visit(const SlotAnyPartialLockedRequirement &) const
+ {
+ return true;
+ }
+
+ bool visit(const SlotAnyUnlockedRequirement &) const
+ {
+ return false;
+ }
+
+ bool visit(const SlotUnknownRewrittenRequirement &) const
+ {
+ return false;
+ }
+ };
+
struct EdgesFromReasonVisitor
{
const Environment * const env;
const std::shared_ptr<NAG> nag;
const ResolventsSet & ignore_dependencies_from_resolvents;
const Resolvent resolvent;
+ const std::shared_ptr<const Decision> decision;
const std::function<NAGIndexRole (const Resolvent &)> role_for_fetching;
EdgesFromReasonVisitor(
@@ -242,11 +283,13 @@ namespace
const std::shared_ptr<NAG> & n,
const ResolventsSet & i,
const Resolvent & v,
- const std::function<NAGIndexRole (const Resolvent &)> & f) :
+ const std::shared_ptr<const Decision> & d,
+ const std::function<NAGIndexRole (const Resolvent &)> & f) :
env(e),
nag(n),
ignore_dependencies_from_resolvents(i),
resolvent(v),
+ decision(d),
role_for_fetching(f)
{
}
@@ -328,11 +371,33 @@ namespace
override_run_all_met = true;
}
+ bool build_all_met(! classifier->includes_buildish);
+ if (! build_all_met && r.already_met().is_true())
+ {
+ build_all_met = true;
+ std::shared_ptr<const PackageDepSpec> if_package(r.sanitised_dependency().spec().if_package());
+ if (if_package && if_package->slot_requirement_ptr() &&
+ if_package->slot_requirement_ptr()->accept_returning<bool>(SlotIsLocked{}))
+ {
+ const ChangesToMakeDecision *d(visitor_cast<const ChangesToMakeDecision>(*decision));
+ if (d && d->origin_id()->slot_key())
+ {
+ std::shared_ptr<const PackageIDSequence> matches((*env)[selection::BestVersionOnly(
+ generator::Matches(*if_package, r.from_id(), { }) |
+ filter::InstalledAtRoot(env->system_root_key()->parse_value()))]);
+ if (! matches->empty() && (*matches->last())->slot_key() &&
+ (*matches->last())->slot_key()->parse_value().match_values() !=
+ d->origin_id()->slot_key()->parse_value().match_values())
+ build_all_met = false;
+ }
+ }
+ }
+
nag->add_edge(from, to,
make_named_values<NAGEdgeProperties>(
n::always() = false,
n::build() = classifier->includes_buildish,
- n::build_all_met() = r.already_met().is_true() || ! classifier->includes_buildish,
+ n::build_all_met() = build_all_met,
n::run() = classifier->includes_non_post_runish,
n::run_all_met() = override_run_all_met || r.already_met().is_true() || ! classifier->includes_non_post_runish
));
@@ -502,7 +567,7 @@ Orderer::resolve()
_add_binary_cleverness(*r);
EdgesFromReasonVisitor edges_from_reason_visitor(_imp->env, _imp->resolved->nag(), ignore_dependencies_from_resolvents, (*r)->resolvent(),
- std::bind(&Orderer::_role_for_fetching, this, std::placeholders::_1));
+ (*r)->decision(), std::bind(&Orderer::_role_for_fetching, this, std::placeholders::_1));
for (Constraints::ConstIterator c((*r)->constraints()->begin()),
c_end((*r)->constraints()->end()) ;
c != c_end ; ++c)
diff --git a/paludis/resolver/resolver_TEST_subslots.cc b/paludis/resolver/resolver_TEST_subslots.cc
new file mode 100644
index 0000000..71d9d04
--- /dev/null
+++ b/paludis/resolver/resolver_TEST_subslots.cc
@@ -0,0 +1,136 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2009, 2010, 2011 Ciaran McCreesh
+ * Copyright (c) 2014 David Leverton
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <paludis/util/make_shared_copy.hh>
+
+#include <paludis/partially_made_package_dep_spec.hh>
+
+#include <paludis/resolver/resolver_test.hh>
+
+using namespace paludis;
+using namespace paludis::resolver;
+using namespace paludis::resolver::resolver_test;
+
+namespace
+{
+ struct ResolverSubslotsTestCase : ResolverTestCase
+ {
+ std::shared_ptr<ResolverTestData> data;
+
+ void SetUp()
+ {
+ data = std::make_shared<ResolverTestData>("subslots", "exheres-0", "exheres");
+ }
+
+ void TearDown()
+ {
+ data.reset();
+ }
+ };
+}
+
+TEST_F(ResolverSubslotsTestCase, SubslotChange)
+{
+ data->install("subslot", "dependency", "1")->set_slot(SlotName("0"), SlotName("1"));
+ data->install("subslot", "uses-library", "1")->build_dependencies_key()->set_from_string("=subslot/dependency-1:=0/1");
+
+ data->remove_if_dependent_helper.add_remove_if_dependent_spec(make_package_dep_spec({ }));
+ data->get_constraints_for_dependent_helper.add_less_restrictive_remove_blockers_spec(make_package_dep_spec({ }));
+ data->order_early_helper.add_early_spec(make_package_dep_spec({ }).package(QualifiedPackageName("subslot/uses-library")));
+
+ std::shared_ptr<const Resolved> resolved(data->get_resolved("=subslot/dependency-2"));
+
+ this->check_resolved(resolved,
+ n::taken_change_or_remove_decisions() = make_shared_copy(DecisionChecks()
+ .change(QualifiedPackageName("subslot/dependency"))
+ .change(QualifiedPackageName("subslot/uses-library"))
+ .finished()),
+ n::taken_unable_to_make_decisions() = make_shared_copy(DecisionChecks()
+ .finished()),
+ n::taken_unconfirmed_decisions() = make_shared_copy(DecisionChecks()
+ .finished()),
+ n::taken_unorderable_decisions() = make_shared_copy(DecisionChecks()
+ .finished()),
+ n::untaken_change_or_remove_decisions() = make_shared_copy(DecisionChecks()
+ .finished()),
+ n::untaken_unable_to_make_decisions() = make_shared_copy(DecisionChecks()
+ .finished())
+ );
+}
+
+TEST_F(ResolverSubslotsTestCase, SubslotNoChange)
+{
+ data->install("subslot", "dependency", "1")->set_slot(SlotName("0"), SlotName("1"));
+ data->install("subslot", "uses-library", "1")->build_dependencies_key()->set_from_string("=subslot/dependency-1:=0/1");
+
+ data->remove_if_dependent_helper.add_remove_if_dependent_spec(make_package_dep_spec({ }));
+ data->get_constraints_for_dependent_helper.add_less_restrictive_remove_blockers_spec(make_package_dep_spec({ }));
+ data->order_early_helper.add_early_spec(make_package_dep_spec({ }).package(QualifiedPackageName("subslot/uses-library")));
+ data->confirm_helper.add_permit_old_version_spec(make_package_dep_spec({ }));
+
+ std::shared_ptr<const Resolved> resolved(data->get_resolved("=subslot/dependency-1.1"));
+
+ this->check_resolved(resolved,
+ n::taken_change_or_remove_decisions() = make_shared_copy(DecisionChecks()
+ .change(QualifiedPackageName("subslot/uses-library"))
+ .change(QualifiedPackageName("subslot/dependency"))
+ .finished()),
+ n::taken_unable_to_make_decisions() = make_shared_copy(DecisionChecks()
+ .finished()),
+ n::taken_unconfirmed_decisions() = make_shared_copy(DecisionChecks()
+ .finished()),
+ n::taken_unorderable_decisions() = make_shared_copy(DecisionChecks()
+ .finished()),
+ n::untaken_change_or_remove_decisions() = make_shared_copy(DecisionChecks()
+ .finished()),
+ n::untaken_unable_to_make_decisions() = make_shared_copy(DecisionChecks()
+ .finished())
+ );
+}
+
+TEST_F(ResolverSubslotsTestCase, SubslotIrrelevant)
+{
+ data->install("subslot", "dependency", "1")->set_slot(SlotName("0"), SlotName("1"));
+ data->install("subslot", "uses-tool", "1")->build_dependencies_key()->set_from_string("=subslot/dependency-1:*");
+
+ data->remove_if_dependent_helper.add_remove_if_dependent_spec(make_package_dep_spec({ }));
+ data->get_constraints_for_dependent_helper.add_less_restrictive_remove_blockers_spec(make_package_dep_spec({ }));
+ data->order_early_helper.add_early_spec(make_package_dep_spec({ }).package(QualifiedPackageName("subslot/uses-tool")));
+
+ std::shared_ptr<const Resolved> resolved(data->get_resolved("=subslot/dependency-2"));
+
+ this->check_resolved(resolved,
+ n::taken_change_or_remove_decisions() = make_shared_copy(DecisionChecks()
+ .change(QualifiedPackageName("subslot/uses-tool"))
+ .change(QualifiedPackageName("subslot/dependency"))
+ .finished()),
+ n::taken_unable_to_make_decisions() = make_shared_copy(DecisionChecks()
+ .finished()),
+ n::taken_unconfirmed_decisions() = make_shared_copy(DecisionChecks()
+ .finished()),
+ n::taken_unorderable_decisions() = make_shared_copy(DecisionChecks()
+ .finished()),
+ n::untaken_change_or_remove_decisions() = make_shared_copy(DecisionChecks()
+ .finished()),
+ n::untaken_unable_to_make_decisions() = make_shared_copy(DecisionChecks()
+ .finished())
+ );
+}
+
diff --git a/paludis/resolver/resolver_TEST_subslots_cleanup.sh b/paludis/resolver/resolver_TEST_subslots_cleanup.sh
new file mode 100755
index 0000000..f590343
--- /dev/null
+++ b/paludis/resolver/resolver_TEST_subslots_cleanup.sh
@@ -0,0 +1,9 @@
+#!/usr/bin/env bash
+# vim: set ft=sh sw=4 sts=4 et :
+
+if [ -d resolver_TEST_subslots_dir ] ; then
+ rm -fr resolver_TEST_subslots_dir
+else
+ true
+fi
+
diff --git a/paludis/resolver/resolver_TEST_subslots_setup.sh b/paludis/resolver/resolver_TEST_subslots_setup.sh
new file mode 100755
index 0000000..f986223
--- /dev/null
+++ b/paludis/resolver/resolver_TEST_subslots_setup.sh
@@ -0,0 +1,51 @@
+#!/usr/bin/env bash
+# vim: set ft=sh sw=4 sts=4 et :
+
+mkdir resolver_TEST_subslots_dir || exit 1
+cd resolver_TEST_subslots_dir || exit 1
+
+mkdir -p build
+mkdir -p distdir
+mkdir -p installed
+
+mkdir -p repo/{profiles/profile,metadata}
+
+cd repo
+echo "repo" > profiles/repo_name
+:> metadata/categories.conf
+
+# subslot
+echo 'subslot' >> metadata/categories.conf
+
+mkdir -p 'packages/subslot/dependency'
+cat <<END > packages/subslot/dependency/dependency-1.1.ebuild
+EAPI="5"
+SLOT="0/1"
+KEYWORDS="test"
+DEPEND=""
+END
+cat <<END > packages/subslot/dependency/dependency-2.ebuild
+EAPI="5"
+SLOT="0/2"
+KEYWORDS="test"
+DEPEND=""
+END
+
+mkdir -p 'packages/subslot/uses-library'
+cat <<END > packages/subslot/uses-library/uses-library-1.ebuild
+EAPI="5"
+SLOT="0"
+KEYWORDS="test"
+DEPEND="subslot/dependency:="
+END
+
+mkdir -p 'packages/subslot/uses-tool'
+cat <<END > packages/subslot/uses-tool/uses-tool-1.ebuild
+EAPI="5"
+SLOT="0"
+KEYWORDS="test"
+DEPEND="subslot/dependency:*"
+END
+
+cd ..
+