aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-07-30 10:08:18 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-07-30 10:11:20 +0100
commite24df2f9e772fb1aac4e02bd1dd90e333131cb27 (patch)
treefa2474dffbd4f03560073ecf9455ea1668ba4181
parent5bbf8ada48ba06506312eb417d7ec219cfdffcaa (diff)
downloadpaludis-e24df2f9e772fb1aac4e02bd1dd90e333131cb27.tar.gz
paludis-e24df2f9e772fb1aac4e02bd1dd90e333131cb27.tar.xz
Make UnpackagedID strip, split, preserve_work values params
-rw-r--r--paludis/elike_choices.cc21
-rw-r--r--paludis/elike_choices.hh12
-rw-r--r--paludis/repositories/e/ebuild_id.cc6
-rw-r--r--paludis/repositories/unpackaged/installed_repository_TEST.cc6
-rw-r--r--paludis/repositories/unpackaged/unpackaged_id.cc30
-rw-r--r--paludis/repositories/unpackaged/unpackaged_id.hh7
-rw-r--r--paludis/repositories/unpackaged/unpackaged_key.cc17
-rw-r--r--paludis/repositories/unpackaged/unpackaged_repository.cc12
-rw-r--r--paludis/repositories/unpackaged/unpackaged_repository.hh5
-rw-r--r--paludis/repositories/unpackaged/unpackaged_repository_TEST.cc12
10 files changed, 105 insertions, 23 deletions
diff --git a/paludis/elike_choices.cc b/paludis/elike_choices.cc
index f537679..f68f620 100644
--- a/paludis/elike_choices.cc
+++ b/paludis/elike_choices.cc
@@ -39,8 +39,10 @@ ELikeStripChoiceValue::canonical_name_with_prefix()
}
ELikeStripChoiceValue::ELikeStripChoiceValue(const std::shared_ptr<const PackageID> & id,
- const Environment * const env, const std::shared_ptr<const Choice> & choice) :
- _enabled(! env->want_choice_enabled(id, choice, canonical_unprefixed_name()).is_false())
+ const Environment * const env, const std::shared_ptr<const Choice> & choice, const Tribool forced_value) :
+ _enabled(forced_value.is_indeterminate() ? ! env->want_choice_enabled(id, choice, canonical_unprefixed_name()).is_false() :
+ forced_value.is_true() ? true : false),
+ _forced(! forced_value.is_indeterminate())
{
}
@@ -105,8 +107,11 @@ ELikeSplitChoiceValue::canonical_name_with_prefix()
}
ELikeSplitChoiceValue::ELikeSplitChoiceValue(const std::shared_ptr<const PackageID> & id,
- const Environment * const env, const std::shared_ptr<const Choice> & choice) :
- _enabled(! env->want_choice_enabled(id, choice, canonical_unprefixed_name()).is_false())
+ const Environment * const env, const std::shared_ptr<const Choice> & choice,
+ const Tribool forced_value) :
+ _enabled(forced_value.is_indeterminate() ? ! env->want_choice_enabled(id, choice, canonical_unprefixed_name()).is_false() :
+ forced_value.is_true() ? true : false),
+ _forced(! forced_value.is_indeterminate())
{
}
@@ -546,10 +551,10 @@ ELikePreserveWorkChoiceValue::canonical_name_with_prefix()
ELikePreserveWorkChoiceValue::ELikePreserveWorkChoiceValue(const std::shared_ptr<const PackageID> & id,
const Environment * const env, const std::shared_ptr<const Choice> & choice,
- const bool by_default) :
- _enabled(by_default ?
- ! env->want_choice_enabled(id, choice, canonical_unprefixed_name()).is_false() :
- env->want_choice_enabled(id, choice, canonical_unprefixed_name()).is_true())
+ const Tribool forced_value) :
+ _enabled(forced_value.is_indeterminate() ? env->want_choice_enabled(id, choice, canonical_unprefixed_name()).is_true() :
+ forced_value.is_true() ? true : false),
+ _forced(! forced_value.is_indeterminate())
{
}
diff --git a/paludis/elike_choices.hh b/paludis/elike_choices.hh
index 6b551eb..832071a 100644
--- a/paludis/elike_choices.hh
+++ b/paludis/elike_choices.hh
@@ -22,6 +22,7 @@
#include <paludis/elike_choices-fwd.hh>
#include <paludis/util/attributes.hh>
+#include <paludis/util/tribool-fwd.hh>
#include <paludis/choice.hh>
#include <paludis/environment-fwd.hh>
#include <paludis/package_id-fwd.hh>
@@ -33,10 +34,11 @@ namespace paludis
{
private:
const bool _enabled;
+ const bool _forced;
public:
ELikeStripChoiceValue(const std::shared_ptr<const PackageID> &,
- const Environment * const env, const std::shared_ptr<const Choice> &);
+ const Environment * const env, const std::shared_ptr<const Choice> &, const Tribool forced_value);
virtual const UnprefixedChoiceName unprefixed_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual const ChoiceNameWithPrefix name_with_prefix() const PALUDIS_ATTRIBUTE((warn_unused_result));
@@ -56,10 +58,11 @@ namespace paludis
{
private:
const bool _enabled;
+ const bool _forced;
public:
ELikeSplitChoiceValue(const std::shared_ptr<const PackageID> &,
- const Environment * const env, const std::shared_ptr<const Choice> &);
+ const Environment * const env, const std::shared_ptr<const Choice> &, const Tribool forced_value);
virtual const UnprefixedChoiceName unprefixed_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual const ChoiceNameWithPrefix name_with_prefix() const PALUDIS_ATTRIBUTE((warn_unused_result));
@@ -195,16 +198,17 @@ namespace paludis
{
private:
const bool _enabled;
+ const bool _forced;
public:
/**
- * \since 0.48.1
+ * \since 0.51.0
*/
ELikePreserveWorkChoiceValue(
const std::shared_ptr<const PackageID> &,
const Environment * const env,
const std::shared_ptr<const Choice> &,
- const bool enabled_by_default);
+ const Tribool forced_value);
virtual const UnprefixedChoiceName unprefixed_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual const ChoiceNameWithPrefix name_with_prefix() const PALUDIS_ATTRIBUTE((warn_unused_result));
diff --git a/paludis/repositories/e/ebuild_id.cc b/paludis/repositories/e/ebuild_id.cc
index 3c8cfb9..50dc06f 100644
--- a/paludis/repositories/e/ebuild_id.cc
+++ b/paludis/repositories/e/ebuild_id.cc
@@ -1501,8 +1501,8 @@ EbuildID::add_build_options(const std::shared_ptr<Choices> & choices) const
/* split, strip */
if (may_be_unrestricted_strip)
{
- build_options->add(std::make_shared<ELikeSplitChoiceValue>(shared_from_this(), _imp->environment, build_options));
- build_options->add(std::make_shared<ELikeStripChoiceValue>(shared_from_this(), _imp->environment, build_options));
+ build_options->add(std::make_shared<ELikeSplitChoiceValue>(shared_from_this(), _imp->environment, build_options, indeterminate));
+ build_options->add(std::make_shared<ELikeStripChoiceValue>(shared_from_this(), _imp->environment, build_options, indeterminate));
}
/* jobs */
@@ -1522,7 +1522,7 @@ EbuildID::add_build_options(const std::shared_ptr<Choices> & choices) const
/* preserve_work */
build_options->add(std::make_shared<ELikePreserveWorkChoiceValue>(
- shared_from_this(), _imp->environment, build_options, false));
+ shared_from_this(), _imp->environment, build_options, indeterminate));
}
}
diff --git a/paludis/repositories/unpackaged/installed_repository_TEST.cc b/paludis/repositories/unpackaged/installed_repository_TEST.cc
index 336ce39..21219a6 100644
--- a/paludis/repositories/unpackaged/installed_repository_TEST.cc
+++ b/paludis/repositories/unpackaged/installed_repository_TEST.cc
@@ -392,9 +392,11 @@ namespace test_cases
n::install_under() = FSEntry("/"),
n::location() = FSEntry("installed_repository_TEST_dir/src4a"),
n::name() = QualifiedPackageName("cat/pkg4a"),
+ n::preserve_work() = indeterminate,
n::rewrite_ids_over_to_root() = -1,
n::run_dependencies() = "",
n::slot() = SlotName("foo"),
+ n::strip() = indeterminate,
n::version() = VersionSpec("1.0", { })
)));
env.package_database()->add_repository(1, source_repo);
@@ -450,9 +452,11 @@ namespace test_cases
n::install_under() = FSEntry("/"),
n::location() = FSEntry("installed_repository_TEST_dir/src4b1"),
n::name() = QualifiedPackageName("cat/pkg4b"),
+ n::preserve_work() = indeterminate,
n::rewrite_ids_over_to_root() = -1,
n::run_dependencies() = "",
n::slot() = SlotName("foo"),
+ n::strip() = indeterminate,
n::version() = VersionSpec("1.0", { })
)));
env.package_database()->add_repository(1, source_repo);
@@ -510,9 +514,11 @@ namespace test_cases
n::install_under() = FSEntry("/"),
n::location() = FSEntry("installed_repository_TEST_dir/src4b2"),
n::name() = QualifiedPackageName("cat/pkg4b"),
+ n::preserve_work() = indeterminate,
n::rewrite_ids_over_to_root() = -1,
n::run_dependencies() = "",
n::slot() = SlotName("foo"),
+ n::strip() = indeterminate,
n::version() = VersionSpec("1.0", { })
)));
env.package_database()->add_repository(1, source_repo);
diff --git a/paludis/repositories/unpackaged/unpackaged_id.cc b/paludis/repositories/unpackaged/unpackaged_id.cc
index 4017b2e..cb02654 100644
--- a/paludis/repositories/unpackaged/unpackaged_id.cc
+++ b/paludis/repositories/unpackaged/unpackaged_id.cc
@@ -63,6 +63,8 @@ namespace paludis
const std::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > run_dependencies_key;
const std::shared_ptr<const MetadataValueKey<std::string> > description_key;
const std::shared_ptr<const UnpackagedChoicesKey> choices_key;
+ const std::shared_ptr<LiteralMetadataValueKey<bool> > strip_key;
+ const std::shared_ptr<LiteralMetadataValueKey<bool> > preserve_work_key;
Imp(const Environment * const e,
const QualifiedPackageName & q,
@@ -73,6 +75,8 @@ namespace paludis
const std::string & b,
const std::string & r,
const std::string & d,
+ const Tribool ds,
+ const Tribool dw,
const UnpackagedID * const id) :
env(e),
name(q),
@@ -87,7 +91,11 @@ namespace paludis
run_dependencies_key(std::make_shared<UnpackagedDependencyKey>(env, "run_dependencies", "Run dependencies", mkt_dependencies,
run_dependencies_labels, r)),
description_key(std::make_shared<LiteralMetadataValueKey<std::string> >("description", "Description", mkt_significant, d)),
- choices_key(std::make_shared<UnpackagedChoicesKey>(env, "choices", "Choices", mkt_normal, id))
+ choices_key(std::make_shared<UnpackagedChoicesKey>(env, "choices", "Choices", mkt_normal, id)),
+ strip_key(ds.is_indeterminate() ? make_null_shared_ptr() :
+ std::make_shared<LiteralMetadataValueKey<bool>>("strip", "Strip", mkt_internal, ds.is_true() ? true : false)),
+ preserve_work_key(dw.is_indeterminate() ? make_null_shared_ptr() :
+ std::make_shared<LiteralMetadataValueKey<bool>>("preserve_work", "Preserve work", mkt_internal, dw.is_true() ? true : false))
{
build_dependencies_labels->push_back(std::make_shared<DependenciesBuildLabel>("build_dependencies",
return_literal_function(true)));
@@ -99,8 +107,8 @@ namespace paludis
UnpackagedID::UnpackagedID(const Environment * const e, const QualifiedPackageName & q,
const VersionSpec & v, const SlotName & s, const RepositoryName & n, const FSEntry & l,
- const std::string & b, const std::string & r, const std::string & d) :
- Pimp<UnpackagedID>(e, q, v, s, n, l, b, r, d, this),
+ const std::string & b, const std::string & r, const std::string & d, const Tribool ds, const Tribool dw) :
+ Pimp<UnpackagedID>(e, q, v, s, n, l, b, r, d, ds, dw, this),
_imp(Pimp<UnpackagedID>::_imp)
{
add_metadata_key(_imp->slot_key);
@@ -109,6 +117,10 @@ UnpackagedID::UnpackagedID(const Environment * const e, const QualifiedPackageNa
add_metadata_key(_imp->run_dependencies_key);
add_metadata_key(_imp->description_key);
add_metadata_key(_imp->choices_key);
+ if (_imp->strip_key)
+ add_metadata_key(_imp->strip_key);
+ if (_imp->preserve_work_key)
+ add_metadata_key(_imp->preserve_work_key);
}
UnpackagedID::~UnpackagedID()
@@ -298,6 +310,18 @@ UnpackagedID::behaviours_key() const
return make_null_shared_ptr();
}
+const std::shared_ptr<const MetadataValueKey<bool> >
+UnpackagedID::strip_key() const
+{
+ return _imp->strip_key;
+}
+
+const std::shared_ptr<const MetadataValueKey<bool> >
+UnpackagedID::preserve_work_key() const
+{
+ return _imp->preserve_work_key;
+}
+
bool
UnpackagedID::supports_action(const SupportsActionTestBase & test) const
{
diff --git a/paludis/repositories/unpackaged/unpackaged_id.hh b/paludis/repositories/unpackaged/unpackaged_id.hh
index c1a732f..3d709cf 100644
--- a/paludis/repositories/unpackaged/unpackaged_id.hh
+++ b/paludis/repositories/unpackaged/unpackaged_id.hh
@@ -24,6 +24,7 @@
#include <paludis/name-fwd.hh>
#include <paludis/util/fs_entry-fwd.hh>
#include <paludis/util/pimp.hh>
+#include <paludis/util/tribool.hh>
#include <memory>
namespace paludis
@@ -45,7 +46,8 @@ namespace paludis
public:
UnpackagedID(const Environment * const, const QualifiedPackageName &, const VersionSpec &,
const SlotName &, const RepositoryName &, const FSEntry &,
- const std::string &, const std::string &, const std::string &);
+ const std::string &, const std::string &, const std::string &,
+ const Tribool, const Tribool);
~UnpackagedID();
@@ -77,6 +79,9 @@ namespace paludis
virtual const std::shared_ptr<const MetadataCollectionKey<Set<std::string> > > from_repositories_key() const;
virtual const std::shared_ptr<const MetadataValueKey<std::shared_ptr<const Choices> > > choices_key() const;
+ const std::shared_ptr<const MetadataValueKey<bool> > strip_key() const;
+ const std::shared_ptr<const MetadataValueKey<bool> > preserve_work_key() const;
+
virtual bool supports_action(const SupportsActionTestBase &) const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual void perform_action(Action &) const;
diff --git a/paludis/repositories/unpackaged/unpackaged_key.cc b/paludis/repositories/unpackaged/unpackaged_key.cc
index 6e1db61..268c62a 100644
--- a/paludis/repositories/unpackaged/unpackaged_key.cc
+++ b/paludis/repositories/unpackaged/unpackaged_key.cc
@@ -171,9 +171,20 @@ UnpackagedChoicesKey::value() const
n::raw_name() = canonical_build_options_raw_name(),
n::show_with_no_prefix() = false
)));
- build_options->add(std::make_shared<ELikeSplitChoiceValue>(_imp->id->shared_from_this(), _imp->env, build_options));
- build_options->add(std::make_shared<ELikeStripChoiceValue>(_imp->id->shared_from_this(), _imp->env, build_options));
- build_options->add(std::make_shared<ELikePreserveWorkChoiceValue>(_imp->id->shared_from_this(), _imp->env, build_options, true));
+
+ Tribool strip(indeterminate);
+ if (_imp->id->strip_key())
+ strip = _imp->id->strip_key()->value();
+
+ build_options->add(std::make_shared<ELikeSplitChoiceValue>(_imp->id->shared_from_this(), _imp->env, build_options, strip));
+ build_options->add(std::make_shared<ELikeStripChoiceValue>(_imp->id->shared_from_this(), _imp->env, build_options, strip));
+
+ Tribool preserve_work(indeterminate);
+ if (_imp->id->preserve_work_key())
+ preserve_work = _imp->id->preserve_work_key()->value();
+
+ build_options->add(std::make_shared<ELikePreserveWorkChoiceValue>(_imp->id->shared_from_this(), _imp->env, build_options, preserve_work));
+
_imp->value->add(build_options);
}
diff --git a/paludis/repositories/unpackaged/unpackaged_repository.cc b/paludis/repositories/unpackaged/unpackaged_repository.cc
index 27098c6..26d9259 100644
--- a/paludis/repositories/unpackaged/unpackaged_repository.cc
+++ b/paludis/repositories/unpackaged/unpackaged_repository.cc
@@ -62,7 +62,7 @@ namespace paludis
const UnpackagedRepositoryParams & p) :
params(p),
id(std::make_shared<UnpackagedID>(params.environment(), params.name(), params.version(), params.slot(), n, params.location(),
- params.build_dependencies(), params.run_dependencies(), params.description())),
+ params.build_dependencies(), params.run_dependencies(), params.description(), params.strip(), params.preserve_work())),
ids(std::make_shared<PackageIDSequence>()),
package_names(std::make_shared<QualifiedPackageNameSet>()),
category_names(std::make_shared<CategoryNamePartSet>()),
@@ -254,6 +254,14 @@ UnpackagedRepository::repository_factory_create(
rewrite_ids_over_to_root = destringify<int>(f("rewrite_ids_over_to_root"));
}
+ Tribool strip(indeterminate);
+ if (! f("strip").empty())
+ strip = destringify<bool>(f("strip"));
+
+ Tribool preserve_work(indeterminate);
+ if (! f("preserve_work").empty())
+ preserve_work = destringify<bool>(f("preserve_work"));
+
return std::make_shared<UnpackagedRepository>(RepositoryName("unpackaged"),
make_named_values<unpackaged_repositories::UnpackagedRepositoryParams>(
n::build_dependencies() = build_dependencies,
@@ -262,9 +270,11 @@ UnpackagedRepository::repository_factory_create(
n::install_under() = install_under,
n::location() = location,
n::name() = QualifiedPackageName(name),
+ n::preserve_work() = preserve_work,
n::rewrite_ids_over_to_root() = rewrite_ids_over_to_root,
n::run_dependencies() = run_dependencies,
n::slot() = SlotName(slot),
+ n::strip() = strip,
n::version() = VersionSpec(version, user_version_spec_options())
));
}
diff --git a/paludis/repositories/unpackaged/unpackaged_repository.hh b/paludis/repositories/unpackaged/unpackaged_repository.hh
index 0e73ffc..718afa2 100644
--- a/paludis/repositories/unpackaged/unpackaged_repository.hh
+++ b/paludis/repositories/unpackaged/unpackaged_repository.hh
@@ -23,6 +23,7 @@
#include <paludis/repository.hh>
#include <paludis/util/map.hh>
#include <paludis/util/pimp.hh>
+#include <paludis/util/tribool.hh>
namespace paludis
{
@@ -34,9 +35,11 @@ namespace paludis
typedef Name<struct install_under_name> install_under;
typedef Name<struct location_name> location;
typedef Name<struct name_name> name;
+ typedef Name<struct preserve_work_name> preserve_work;
typedef Name<struct rewrite_ids_over_to_root_name> rewrite_ids_over_to_root;
typedef Name<struct run_dependencies_name> run_dependencies;
typedef Name<struct slot_name> slot;
+ typedef Name<struct strip_name> strip;
typedef Name<struct version_name> version;
}
@@ -50,9 +53,11 @@ namespace paludis
NamedValue<n::install_under, FSEntry> install_under;
NamedValue<n::location, FSEntry> location;
NamedValue<n::name, QualifiedPackageName> name;
+ NamedValue<n::preserve_work, Tribool> preserve_work;
NamedValue<n::rewrite_ids_over_to_root, int> rewrite_ids_over_to_root;
NamedValue<n::run_dependencies, std::string> run_dependencies;
NamedValue<n::slot, SlotName> slot;
+ NamedValue<n::strip, Tribool> strip;
NamedValue<n::version, VersionSpec> version;
};
}
diff --git a/paludis/repositories/unpackaged/unpackaged_repository_TEST.cc b/paludis/repositories/unpackaged/unpackaged_repository_TEST.cc
index 816e7bc..35a5230 100644
--- a/paludis/repositories/unpackaged/unpackaged_repository_TEST.cc
+++ b/paludis/repositories/unpackaged/unpackaged_repository_TEST.cc
@@ -81,9 +81,11 @@ namespace test_cases
n::install_under() = FSEntry("/"),
n::location() = FSEntry("unpackaged_repository_TEST_dir/pkg"),
n::name() = QualifiedPackageName("cat/pkg"),
+ n::preserve_work() = indeterminate,
n::rewrite_ids_over_to_root() = -1,
n::run_dependencies() = "",
n::slot() = SlotName("foo"),
+ n::strip() = indeterminate,
n::version() = VersionSpec("1.0", { })
)));
env.package_database()->add_repository(1, repo);
@@ -111,9 +113,11 @@ namespace test_cases
n::install_under() = FSEntry("/"),
n::location() = FSEntry("unpackaged_repository_TEST_dir/pkg"),
n::name() = QualifiedPackageName("cat/pkg"),
+ n::preserve_work() = indeterminate,
n::rewrite_ids_over_to_root() = -1,
n::run_dependencies() = "",
n::slot() = SlotName("foo"),
+ n::strip() = indeterminate,
n::version() = VersionSpec("1.0", { })
)));
env.package_database()->add_repository(1, repo);
@@ -146,9 +150,11 @@ namespace test_cases
n::install_under() = FSEntry("/"),
n::location() = FSEntry("unpackaged_repository_TEST_dir/pkg"),
n::name() = QualifiedPackageName("cat/pkg"),
+ n::preserve_work() = indeterminate,
n::rewrite_ids_over_to_root() = -1,
n::run_dependencies() = "",
n::slot() = SlotName("foo"),
+ n::strip() = indeterminate,
n::version() = VersionSpec("1.0", { })
)));
env.package_database()->add_repository(1, repo);
@@ -176,9 +182,11 @@ namespace test_cases
n::install_under() = FSEntry("/"),
n::location() = FSEntry("unpackaged_repository_TEST_dir/pkg"),
n::name() = QualifiedPackageName("cat/pkg"),
+ n::preserve_work() = indeterminate,
n::rewrite_ids_over_to_root() = -1,
n::run_dependencies() = "",
n::slot() = SlotName("foo"),
+ n::strip() = indeterminate,
n::version() = VersionSpec("1.0", { })
)));
env.package_database()->add_repository(1, repo);
@@ -217,9 +225,11 @@ namespace test_cases
n::install_under() = FSEntry("/"),
n::location() = FSEntry("unpackaged_repository_TEST_dir/pkg"),
n::name() = QualifiedPackageName("cat/pkg"),
+ n::preserve_work() = indeterminate,
n::rewrite_ids_over_to_root() = -1,
n::run_dependencies() = "",
n::slot() = SlotName("foo"),
+ n::strip() = indeterminate,
n::version() = VersionSpec("1.0", { })
)));
env.package_database()->add_repository(1, repo);
@@ -273,9 +283,11 @@ namespace test_cases
n::install_under() = FSEntry("/magic/pixie"),
n::location() = FSEntry("unpackaged_repository_TEST_dir/under_pkg"),
n::name() = QualifiedPackageName("cat/pkg"),
+ n::preserve_work() = indeterminate,
n::rewrite_ids_over_to_root() = -1,
n::run_dependencies() = "",
n::slot() = SlotName("foo"),
+ n::strip() = indeterminate,
n::version() = VersionSpec("1.0", { })
)));
env.package_database()->add_repository(1, repo);