diff options
author | 2011-06-11 17:30:53 +0100 | |
---|---|---|
committer | 2011-06-11 19:13:23 +0100 | |
commit | 7ce202f0c9f10ea545daf9ed919d969e8ef19bdc (patch) | |
tree | 063e59b29b815e1940663d5fd6a6e8cfa7dbc34e | |
parent | 91cb1ee0418b3a6d90643cc51d59f7204f5b4995 (diff) | |
download | paludis-7ce202f0c9f10ea545daf9ed919d969e8ef19bdc.tar.gz paludis-7ce202f0c9f10ea545daf9ed919d969e8ef19bdc.tar.xz |
Add but do not implement keep if-same-metadata
-rw-r--r-- | paludis/resolver/decider.cc | 18 | ||||
-rw-r--r-- | paludis/resolver/decision.cc | 16 | ||||
-rw-r--r-- | paludis/resolver/decision.hh | 2 | ||||
-rw-r--r-- | paludis/resolver/use_existing.se | 1 | ||||
-rwxr-xr-x | src/clients/cave/cmd_display_resolution.cc | 3 | ||||
-rw-r--r-- | src/clients/cave/resolve_cmdline.cc | 6 | ||||
-rw-r--r-- | src/clients/cave/resolve_common.cc | 2 |
7 files changed, 45 insertions, 3 deletions
diff --git a/paludis/resolver/decider.cc b/paludis/resolver/decider.cc index dd594bd79..79488175b 100644 --- a/paludis/resolver/decider.cc +++ b/paludis/resolver/decider.cc @@ -732,6 +732,11 @@ namespace return false; break; + case ue_if_same_metadata: + if (! decision.is_same_metadata()) + return false; + break; + case ue_if_same_version: if (! decision.is_same_version()) return false; @@ -1510,6 +1515,7 @@ Decider::_try_to_find_decision_for( break; case ue_only_if_transient: + case ue_if_same_metadata: case ue_if_same: case ue_if_same_version: if (! is_transient) @@ -1528,6 +1534,7 @@ Decider::_try_to_find_decision_for( existing_id, true, true, + true, is_transient, ! resolution->constraints()->all_untaken() ); @@ -1554,10 +1561,12 @@ Decider::_try_to_find_decision_for( { bool is_same_version(existing_id->version() == installable_id->version()); bool is_same(false); + bool is_same_metadata(false); if (is_same_version) { is_same = true; + is_same_metadata = true; std::set<ChoiceNameWithPrefix> common; std::shared_ptr<const Choices> installable_choices; @@ -1605,6 +1614,7 @@ Decider::_try_to_find_decision_for( existing_choices->find_by_name_with_prefix(*f)->enabled()) { is_same = false; + is_same_metadata = false; break; } } @@ -1615,6 +1625,7 @@ Decider::_try_to_find_decision_for( const std::shared_ptr<Decision> existing(std::make_shared<ExistingNoChangeDecision>( resolution->resolvent(), existing_id, + is_same_metadata, is_same, is_same_version, is_transient, @@ -1637,6 +1648,12 @@ Decider::_try_to_find_decision_for( case ue_never: return changes_to_make; + case ue_if_same_metadata: + if (is_same_metadata) + return existing; + else + return changes_to_make; + case ue_if_same: if (is_same) return existing; @@ -1895,6 +1912,7 @@ Decider::_get_unmatching_constraints( id, true, true, + true, is_transient, ! (*c)->untaken() ); diff --git a/paludis/resolver/decision.cc b/paludis/resolver/decision.cc index 72e6f97f3..5dc3745e9 100644 --- a/paludis/resolver/decision.cc +++ b/paludis/resolver/decision.cc @@ -56,6 +56,7 @@ Decision::deserialise(Deserialisation & d) return std::make_shared<ExistingNoChangeDecision>( v.member<Resolvent>("resolvent"), v.member<std::shared_ptr<const PackageID> >("existing_id"), + v.member<bool>("is_same_metadata"), v.member<bool>("is_same"), v.member<bool>("is_same_version"), v.member<bool>("is_transient"), @@ -249,6 +250,7 @@ namespace paludis { const Resolvent resolvent; const std::shared_ptr<const PackageID> existing_id; + const bool is_same_metadata; const bool is_same; const bool is_same_version; const bool is_transient; @@ -256,9 +258,10 @@ namespace paludis Imp(const Resolvent & l, const std::shared_ptr<const PackageID> & e, - const bool s, const bool v, const bool r, const bool t) : + const bool m, const bool s, const bool v, const bool r, const bool t) : resolvent(l), existing_id(e), + is_same_metadata(m), is_same(s), is_same_version(v), is_transient(r), @@ -269,8 +272,8 @@ namespace paludis } ExistingNoChangeDecision::ExistingNoChangeDecision(const Resolvent & l, const std::shared_ptr<const PackageID> & e, - const bool s, const bool v, const bool r, const bool t) : - _imp(l, e, s, v, r, t) + const bool m, const bool s, const bool v, const bool r, const bool t) : + _imp(l, e, m, s, v, r, t) { } @@ -283,6 +286,12 @@ ExistingNoChangeDecision::existing_id() const } bool +ExistingNoChangeDecision::is_same_metadata() const +{ + return _imp->is_same_metadata; +} + +bool ExistingNoChangeDecision::is_same() const { return _imp->is_same; @@ -318,6 +327,7 @@ ExistingNoChangeDecision::serialise(Serialiser & s) const s.object("ExistingNoChangeDecision") .member(SerialiserFlags<>(), "resolvent", resolvent()) .member(SerialiserFlags<serialise::might_be_null>(), "existing_id", existing_id()) + .member(SerialiserFlags<>(), "is_same_metadata", is_same_metadata()) .member(SerialiserFlags<>(), "is_same", is_same()) .member(SerialiserFlags<>(), "is_same_version", is_same_version()) .member(SerialiserFlags<>(), "is_transient", is_transient()) diff --git a/paludis/resolver/decision.hh b/paludis/resolver/decision.hh index f107072b9..b39e20b5e 100644 --- a/paludis/resolver/decision.hh +++ b/paludis/resolver/decision.hh @@ -85,6 +85,7 @@ namespace paludis ExistingNoChangeDecision( const Resolvent &, const std::shared_ptr<const PackageID> &, + const bool is_same_metadata, const bool is_same, const bool is_same_version, const bool is_transient, @@ -95,6 +96,7 @@ namespace paludis const std::shared_ptr<const PackageID> existing_id() const PALUDIS_ATTRIBUTE((warn_unused_result)); + bool is_same_metadata() const PALUDIS_ATTRIBUTE((warn_unused_result)); bool is_same() const PALUDIS_ATTRIBUTE((warn_unused_result)); bool is_same_version() const PALUDIS_ATTRIBUTE((warn_unused_result)); bool is_transient() const PALUDIS_ATTRIBUTE((warn_unused_result)); diff --git a/paludis/resolver/use_existing.se b/paludis/resolver/use_existing.se index 4258ae650..753b3031f 100644 --- a/paludis/resolver/use_existing.se +++ b/paludis/resolver/use_existing.se @@ -9,6 +9,7 @@ make_enum_UseExisting() # must be kept in strictness order key ue_never "Never" key ue_only_if_transient "Only if it is transient" + key ue_if_same_metadata "If it is the same, including metadata" key ue_if_same "If it is the same" key ue_if_same_version "If it is the same version" key ue_if_possible "If possible" diff --git a/src/clients/cave/cmd_display_resolution.cc b/src/clients/cave/cmd_display_resolution.cc index 16182dd7b..78317943a 100755 --- a/src/clients/cave/cmd_display_resolution.cc +++ b/src/clients/cave/cmd_display_resolution.cc @@ -354,6 +354,9 @@ namespace case ue_only_if_transient: result << ", using existing only if transient"; break; + case ue_if_same_metadata: + result << ", use existing if same metadata"; + break; case ue_if_same_version: result << ", use existing if same version"; break; diff --git a/src/clients/cave/resolve_cmdline.cc b/src/clients/cave/resolve_cmdline.cc index 90252b065..ba9cc8f9a 100644 --- a/src/clients/cave/resolve_cmdline.cc +++ b/src/clients/cave/resolve_cmdline.cc @@ -118,6 +118,9 @@ ResolveCommandLineResolutionOptions::ResolveCommandLineResolutionOptions(args::A ("never", 'n', "Never") ("if-transient", 't', "Only if the installed package is transient " "(e.g. from 'cave import')") + ("if-same-metadata", 'm', "If it is the same as the proposed replacement (that is, if it has the same " + "version, and no non-special use flags or choices have had their values changed), and if significant " + "metadata has not been modified") ("if-same", 's', "If it is the same as the proposed replacement (that is, if it has the same " "version, and no non-special use flags or choices have had their values changed)") ("if-same-version", 'v', "If it is the same version as the proposed replacement") @@ -131,6 +134,9 @@ ResolveCommandLineResolutionOptions::ResolveCommandLineResolutionOptions(args::A ("never", 'n', "Never") ("if-transient", 't', "Only if the installed package is transient " "(e.g. from 'cave import') (default if --everything)") + ("if-same-metadata", 'm', "If it is the same as the proposed replacement (that is, if it has the same " + "version, and no non-special use flags or choices have had their values changed), and if significant " + "metadata has not been modified") ("if-same", 's', "If it is the same as the proposed replacement (that is, if it has the same " "version, and no non-special use flags or choices have had their values changed) (default if --complete)") ("if-same-version", 'v', "If it is the same version as the proposed replacement") diff --git a/src/clients/cave/resolve_common.cc b/src/clients/cave/resolve_common.cc index b095dfce5..f44858794 100644 --- a/src/clients/cave/resolve_common.cc +++ b/src/clients/cave/resolve_common.cc @@ -620,6 +620,8 @@ namespace return ue_never; else if (arg.argument() == "if-transient") return ue_only_if_transient; + else if (arg.argument() == "if-same-metadata") + return ue_if_same_metadata; else if (arg.argument() == "if-same") return ue_if_same; else if (arg.argument() == "if-same-version") |