aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-08-09 15:36:38 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-08-09 02:49:19 +0100
commit7d26dfa099626ddc354f1793b071f3b5c12b8923 (patch)
tree788f1736bbfc268e771673d3a731ebec6256ab42
parentb27f5bc69db94543a9018b5150222ffab7f659e6 (diff)
downloadpaludis-7d26dfa099626ddc354f1793b071f3b5c12b8923.tar.gz
paludis-7d26dfa099626ddc354f1793b071f3b5c12b8923.tar.xz
Add parameterised choice values.
-rw-r--r--doc/configuration/use.html.part.in16
-rw-r--r--paludis/choice.hh10
-rw-r--r--paludis/elike_choices-fwd.hh1
-rw-r--r--paludis/elike_choices.cc122
-rw-r--r--paludis/elike_choices.hh29
-rw-r--r--paludis/environment.hh22
-rw-r--r--paludis/environments/no_config/no_config_environment.cc10
-rw-r--r--paludis/environments/no_config/no_config_environment.hh7
-rw-r--r--paludis/environments/paludis/paludis_environment.cc10
-rw-r--r--paludis/environments/paludis/paludis_environment.hh7
-rw-r--r--paludis/environments/paludis/use_conf.cc172
-rw-r--r--paludis/environments/paludis/use_conf.hh9
-rw-r--r--paludis/environments/portage/portage_environment.cc9
-rw-r--r--paludis/environments/portage/portage_environment.hh7
-rw-r--r--paludis/environments/test/test_environment.cc10
-rw-r--r--paludis/environments/test/test_environment.hh7
-rw-r--r--paludis/repositories/e/e_choice_value.cc14
-rw-r--r--paludis/repositories/e/e_choice_value.hh7
-rw-r--r--paludis/repositories/e/e_installed_repository_id.cc2
-rw-r--r--paludis/repositories/e/eapi.cc1
-rw-r--r--paludis/repositories/e/eapi.hh2
-rw-r--r--paludis/repositories/e/eapis/exheres-0.conf1
-rw-r--r--paludis/repositories/e/ebuild.cc22
-rwxr-xr-xpaludis/repositories/e/ebuild/utils/emake11
-rw-r--r--paludis/repositories/e/ebuild_id.cc12
-rw-r--r--paludis/repositories/fake/fake_package_id.cc5
-rw-r--r--src/output/colour_formatter.cc12
-rw-r--r--vim/syntax/paludis-use-conf.vim7
28 files changed, 518 insertions, 26 deletions
diff --git a/doc/configuration/use.html.part.in b/doc/configuration/use.html.part.in
index 30be775..e3d1202 100644
--- a/doc/configuration/use.html.part.in
+++ b/doc/configuration/use.html.part.in
@@ -29,6 +29,9 @@ specification may be any of:</p>
<ul>
<li><code>flag</code>, which enables that flag.</li>
+ <li><code>flag=value</code>, which enables that flag and sets its parameter value. Most flags do not
+ use parameters, and so any parameter value specified is ignored. See the <code>BUILD_OPTIONS: jobs</code>
+ flag below for an example of one that does.</li>
<li><code>-flag</code>, which disables that flag.</li>
<li><code>label:</code>, which marks any subsequent flags on that line as applying to a particular use expand
(Gentoo) or suboption (Exherbo) label. Common examples of use expand labels are <code>VIDEO_CARDS</code>,
@@ -59,6 +62,15 @@ default <code>VIDEO_CARDS</code> from your profile, you will need to use <code>*
<dt>optional_tests</dt>
<dd>If set, Paludis will run any 'optional' tests provided by a package.</dd>
+
+ <dt>expensive_tests</dt>
+ <dd>If set, Paludis will run any 'expensive' tests provided by a package. This option should generally
+ only be set by package maintainers, since tests marked as expensive are probably too painful in terms
+ of CPU time or disk space requirements to run on user systems.</dd>
+
+ <dt>jobs</dt>
+ <dd>If set to an unsigned integer, specifies the number of jobs to run in parallel when build systems
+ support this (e.g. <code>BUILD_OPTIONS: jobs=4</code> would imply <code>make -j4</code>).</dd>
</dl>
<p>Note that these special flags are <em>not</em> use flags from an ebuild perspective. They are used only by Paludis
@@ -91,5 +103,9 @@ dev-cpp/* doc
# But we do want split debug symbols for a few packages
dev-cpp/* BUILD_OPTIONS: split strip
+
+# We want to run four jobs in parallel if possible (Exheres format packages
+# only; Gentoo EAPIs use the MAKEOPTS environment variable instead)
+*/* BUILD_OPTIONS: jobs=4
</pre>
diff --git a/paludis/choice.hh b/paludis/choice.hh
index 1aa24d6..4faf3eb 100644
--- a/paludis/choice.hh
+++ b/paludis/choice.hh
@@ -317,6 +317,9 @@ namespace paludis
*
* For example, the 'nls' flag in 'USE'.
*
+ * Some choice values have an associated parameter. For example,
+ * build_options:jobs=4.
+ *
* \ingroup g_choices
* \since 0.32
*/
@@ -372,6 +375,13 @@ namespace paludis
*/
virtual bool explicitly_listed() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+ /**
+ * This flag's parameter, or an empty string if it doesn't have one.
+ *
+ * \since 0.40
+ */
+ virtual const std::string parameter() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+
///\}
};
diff --git a/paludis/elike_choices-fwd.hh b/paludis/elike_choices-fwd.hh
index fe50faf..28732a9 100644
--- a/paludis/elike_choices-fwd.hh
+++ b/paludis/elike_choices-fwd.hh
@@ -31,6 +31,7 @@ namespace paludis
struct ELikeOptionalTestsChoiceValue;
struct ELikeRecommendedTestsChoiceValue;
struct ELikeExpensiveTestsChoiceValue;
+ struct ELikeJobsChoiceValue;
const ChoicePrefixName canonical_build_options_prefix() PALUDIS_VISIBLE PALUDIS_ATTRIBUTE((warn_unused_result));
const std::string canonical_build_options_raw_name() PALUDIS_VISIBLE PALUDIS_ATTRIBUTE((warn_unused_result));
diff --git a/paludis/elike_choices.cc b/paludis/elike_choices.cc
index f7e42b5..d611cd4 100644
--- a/paludis/elike_choices.cc
+++ b/paludis/elike_choices.cc
@@ -21,6 +21,8 @@
#include <paludis/environment.hh>
#include <paludis/util/tribool.hh>
#include <paludis/util/stringify.hh>
+#include <paludis/util/destringify.hh>
+#include <paludis/util/log.hh>
using namespace paludis;
@@ -84,6 +86,12 @@ ELikeStripChoiceValue::explicitly_listed() const
return true;
}
+const std::string
+ELikeStripChoiceValue::parameter() const
+{
+ return "";
+}
+
const UnprefixedChoiceName
ELikeSplitChoiceValue::canonical_unprefixed_name()
{
@@ -144,6 +152,12 @@ ELikeSplitChoiceValue::explicitly_listed() const
return true;
}
+const std::string
+ELikeSplitChoiceValue::parameter() const
+{
+ return "";
+}
+
const UnprefixedChoiceName
ELikeOptionalTestsChoiceValue::canonical_unprefixed_name()
{
@@ -204,6 +218,12 @@ ELikeOptionalTestsChoiceValue::explicitly_listed() const
return true;
}
+const std::string
+ELikeOptionalTestsChoiceValue::parameter() const
+{
+ return "";
+}
+
const UnprefixedChoiceName
ELikeRecommendedTestsChoiceValue::canonical_unprefixed_name()
{
@@ -264,6 +284,12 @@ ELikeRecommendedTestsChoiceValue::explicitly_listed() const
return true;
}
+const std::string
+ELikeRecommendedTestsChoiceValue::parameter() const
+{
+ return "";
+}
+
const ChoicePrefixName
paludis::canonical_build_options_prefix()
{
@@ -342,3 +368,99 @@ ELikeExpensiveTestsChoiceValue::explicitly_listed() const
return true;
}
+const std::string
+ELikeExpensiveTestsChoiceValue::parameter() const
+{
+ return "";
+}
+
+const UnprefixedChoiceName
+ELikeJobsChoiceValue::canonical_unprefixed_name()
+{
+ return UnprefixedChoiceName("jobs");
+}
+
+const ChoiceNameWithPrefix
+ELikeJobsChoiceValue::canonical_name_with_prefix()
+{
+ return ChoiceNameWithPrefix(stringify(canonical_build_options_prefix()) + ":" + stringify(canonical_unprefixed_name()));
+}
+
+namespace
+{
+ std::string get_jobs(const std::tr1::shared_ptr<const PackageID> & id,
+ const std::string & env_value)
+ {
+ if (env_value.empty())
+ return "1";
+
+ try
+ {
+ return stringify(destringify<unsigned>(env_value));
+ }
+ catch (const DestringifyError &)
+ {
+ Context context("When getting value of the jobs option for '" + stringify(*id) + "':");
+ Log::get_instance()->message("elike_jobs_choice_value.invalid", ll_warning, lc_context)
+ << "Value '" << env_value << "' is not an unsigned integer, using \"1\" instead";
+ return "1";
+ }
+ }
+}
+
+ELikeJobsChoiceValue::ELikeJobsChoiceValue(const std::tr1::shared_ptr<const PackageID> & id,
+ const Environment * const env, const std::tr1::shared_ptr<const Choice> & choice) :
+ _enabled(env->want_choice_enabled(id, choice, canonical_unprefixed_name()).is_true()),
+ _parameter(get_jobs(id, env->value_for_choice_parameter(id, choice, canonical_unprefixed_name())))
+{
+}
+
+const UnprefixedChoiceName
+ELikeJobsChoiceValue::unprefixed_name() const
+{
+ return canonical_unprefixed_name();
+}
+
+const ChoiceNameWithPrefix
+ELikeJobsChoiceValue::name_with_prefix() const
+{
+ return canonical_name_with_prefix();
+}
+
+bool
+ELikeJobsChoiceValue::enabled() const
+{
+ return _enabled;
+}
+
+bool
+ELikeJobsChoiceValue::enabled_by_default() const
+{
+ return false;
+}
+
+bool
+ELikeJobsChoiceValue::locked() const
+{
+ return false;
+}
+
+const std::string
+ELikeJobsChoiceValue::description() const
+{
+ return "Set with an integer value to specify how many jobs the package's build "
+ "system should use, where supported";
+}
+
+bool
+ELikeJobsChoiceValue::explicitly_listed() const
+{
+ return true;
+}
+
+const std::string
+ELikeJobsChoiceValue::parameter() const
+{
+ return _parameter;
+}
+
diff --git a/paludis/elike_choices.hh b/paludis/elike_choices.hh
index fb59838..e8d6670 100644
--- a/paludis/elike_choices.hh
+++ b/paludis/elike_choices.hh
@@ -45,6 +45,7 @@ namespace paludis
virtual bool locked() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual const std::string description() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual bool explicitly_listed() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::string parameter() const PALUDIS_ATTRIBUTE((warn_unused_result));
static const UnprefixedChoiceName canonical_unprefixed_name() PALUDIS_ATTRIBUTE((warn_unused_result));
static const ChoiceNameWithPrefix canonical_name_with_prefix() PALUDIS_ATTRIBUTE((warn_unused_result));
@@ -67,6 +68,7 @@ namespace paludis
virtual bool locked() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual const std::string description() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual bool explicitly_listed() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::string parameter() const PALUDIS_ATTRIBUTE((warn_unused_result));
static const UnprefixedChoiceName canonical_unprefixed_name() PALUDIS_ATTRIBUTE((warn_unused_result));
static const ChoiceNameWithPrefix canonical_name_with_prefix() PALUDIS_ATTRIBUTE((warn_unused_result));
@@ -89,6 +91,7 @@ namespace paludis
virtual bool locked() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual const std::string description() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual bool explicitly_listed() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::string parameter() const PALUDIS_ATTRIBUTE((warn_unused_result));
static const UnprefixedChoiceName canonical_unprefixed_name() PALUDIS_ATTRIBUTE((warn_unused_result));
static const ChoiceNameWithPrefix canonical_name_with_prefix() PALUDIS_ATTRIBUTE((warn_unused_result));
@@ -111,6 +114,7 @@ namespace paludis
virtual bool locked() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual const std::string description() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual bool explicitly_listed() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::string parameter() const PALUDIS_ATTRIBUTE((warn_unused_result));
static const UnprefixedChoiceName canonical_unprefixed_name() PALUDIS_ATTRIBUTE((warn_unused_result));
static const ChoiceNameWithPrefix canonical_name_with_prefix() PALUDIS_ATTRIBUTE((warn_unused_result));
@@ -133,6 +137,31 @@ namespace paludis
virtual bool locked() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual const std::string description() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual bool explicitly_listed() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::string parameter() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ static const UnprefixedChoiceName canonical_unprefixed_name() PALUDIS_ATTRIBUTE((warn_unused_result));
+ static const ChoiceNameWithPrefix canonical_name_with_prefix() PALUDIS_ATTRIBUTE((warn_unused_result));
+ };
+
+ class PALUDIS_VISIBLE ELikeJobsChoiceValue :
+ public ChoiceValue
+ {
+ private:
+ const bool _enabled;
+ const std::string _parameter;
+
+ public:
+ ELikeJobsChoiceValue(const std::tr1::shared_ptr<const PackageID> &,
+ const Environment * const env, const std::tr1::shared_ptr<const Choice> &);
+
+ virtual const UnprefixedChoiceName unprefixed_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const ChoiceNameWithPrefix name_with_prefix() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual bool enabled() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual bool enabled_by_default() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual bool locked() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::string description() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual bool explicitly_listed() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::string parameter() const PALUDIS_ATTRIBUTE((warn_unused_result));
static const UnprefixedChoiceName canonical_unprefixed_name() PALUDIS_ATTRIBUTE((warn_unused_result));
static const ChoiceNameWithPrefix canonical_name_with_prefix() PALUDIS_ATTRIBUTE((warn_unused_result));
diff --git a/paludis/environment.hh b/paludis/environment.hh
index d094031..da6d76e 100644
--- a/paludis/environment.hh
+++ b/paludis/environment.hh
@@ -106,6 +106,28 @@ namespace paludis
PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
/**
+ * What string value, if any, is set for the parameter for a particular
+ * choice for a particular package?
+ *
+ * There is no difference between "not set" and "set to an empty
+ * string".
+ *
+ * Only for use by Repository, to get defaults from the environment.
+ * Clients should query the metadata key directly.
+ *
+ * The third parameter is the name of the value, which might not
+ * have been created yet.
+ *
+ * \since 0.40
+ */
+ virtual const std::string value_for_choice_parameter(
+ const std::tr1::shared_ptr<const PackageID> &,
+ const std::tr1::shared_ptr<const Choice> &,
+ const UnprefixedChoiceName &
+ ) const
+ PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+
+ /**
* Return a collection of known value names for a particular
* choice.
*
diff --git a/paludis/environments/no_config/no_config_environment.cc b/paludis/environments/no_config/no_config_environment.cc
index 9c5af10..c20f7b7 100644
--- a/paludis/environments/no_config/no_config_environment.cc
+++ b/paludis/environments/no_config/no_config_environment.cc
@@ -624,6 +624,16 @@ NoConfigEnvironment::want_choice_enabled(
return Tribool(indeterminate);
}
+const std::string
+NoConfigEnvironment::value_for_choice_parameter(
+ const std::tr1::shared_ptr<const PackageID> &,
+ const std::tr1::shared_ptr<const Choice> &,
+ const UnprefixedChoiceName &
+ ) const
+{
+ return "";
+}
+
std::tr1::shared_ptr<const Set<UnprefixedChoiceName> >
NoConfigEnvironment::known_choice_value_names(
const std::tr1::shared_ptr<const PackageID> &,
diff --git a/paludis/environments/no_config/no_config_environment.hh b/paludis/environments/no_config/no_config_environment.hh
index 08307c1..30c465a 100644
--- a/paludis/environments/no_config/no_config_environment.hh
+++ b/paludis/environments/no_config/no_config_environment.hh
@@ -145,6 +145,13 @@ namespace paludis
) const
PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::string value_for_choice_parameter(
+ const std::tr1::shared_ptr<const PackageID> &,
+ const std::tr1::shared_ptr<const Choice> &,
+ const UnprefixedChoiceName &
+ ) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
virtual std::tr1::shared_ptr<const Set<UnprefixedChoiceName> > known_choice_value_names(
const std::tr1::shared_ptr<const PackageID> &,
const std::tr1::shared_ptr<const Choice> &
diff --git a/paludis/environments/paludis/paludis_environment.cc b/paludis/environments/paludis/paludis_environment.cc
index 95fc295..8920584 100644
--- a/paludis/environments/paludis/paludis_environment.cc
+++ b/paludis/environments/paludis/paludis_environment.cc
@@ -544,6 +544,16 @@ PaludisEnvironment::want_choice_enabled(
return _imp->config->use_conf()->want_choice_enabled(id, choice, value);
}
+const std::string
+PaludisEnvironment::value_for_choice_parameter(
+ const std::tr1::shared_ptr<const PackageID> & id,
+ const std::tr1::shared_ptr<const Choice> & choice,
+ const UnprefixedChoiceName & value
+ ) const
+{
+ return _imp->config->use_conf()->value_for_choice_parameter(id, choice, value);
+}
+
std::tr1::shared_ptr<const Set<UnprefixedChoiceName> >
PaludisEnvironment::known_choice_value_names(
const std::tr1::shared_ptr<const PackageID> & id,
diff --git a/paludis/environments/paludis/paludis_environment.hh b/paludis/environments/paludis/paludis_environment.hh
index 70b45e8..c981a40 100644
--- a/paludis/environments/paludis/paludis_environment.hh
+++ b/paludis/environments/paludis/paludis_environment.hh
@@ -157,6 +157,13 @@ namespace paludis
) const
PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::string value_for_choice_parameter(
+ const std::tr1::shared_ptr<const PackageID> &,
+ const std::tr1::shared_ptr<const Choice> &,
+ const UnprefixedChoiceName &
+ ) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
virtual std::tr1::shared_ptr<const Set<UnprefixedChoiceName> > known_choice_value_names(
const std::tr1::shared_ptr<const PackageID> &,
const std::tr1::shared_ptr<const Choice> &
diff --git a/paludis/environments/paludis/use_conf.cc b/paludis/environments/paludis/use_conf.cc
index 2ccba3d..63f13c7 100644
--- a/paludis/environments/paludis/use_conf.cc
+++ b/paludis/environments/paludis/use_conf.cc
@@ -39,6 +39,7 @@
#include <paludis/util/hashes.hh>
#include <paludis/util/tribool.hh>
#include <paludis/util/make_shared_ptr.hh>
+#include <paludis/util/make_named_values.hh>
#include <paludis/spec_tree.hh>
#include <paludis/choice.hh>
#include <tr1/unordered_map>
@@ -49,9 +50,36 @@
using namespace paludis;
using namespace paludis::paludis_environment;
+namespace paludis
+{
+ namespace n
+ {
+ struct enabled;
+ struct parameter;
+ }
+}
+
+namespace
+{
+ struct FlagNameState
+ {
+ NamedValue<n::enabled, Tribool> enabled;
+ NamedValue<n::parameter, std::string> parameter;
+ };
+
+ std::pair<std::string, std::string> split_equals(const std::string & s)
+ {
+ std::string::size_type p(s.find('='));
+ if (std::string::npos == p)
+ return std::make_pair(s, "");
+ else
+ return std::make_pair(s.substr(0, p), s.substr(p + 1));
+ }
+}
+
typedef std::pair<ChoicePrefixName, UnprefixedChoiceName> FlagNamePair;
-typedef std::tr1::unordered_map<FlagNamePair, Tribool, Hash<FlagNamePair> > FlagNamePairWithStateMap;
+typedef std::tr1::unordered_map<FlagNamePair, FlagNameState, Hash<FlagNamePair> > FlagNamePairWithStateMap;
typedef std::list<ChoicePrefixName> MinusStarPrefixList;
typedef std::pair<FlagNamePairWithStateMap, MinusStarPrefixList> UseInfo;
typedef std::pair<std::tr1::shared_ptr<const PackageDepSpec>, UseInfo> PDSWithUseInfo;
@@ -132,8 +160,15 @@ UseConf::add(const FSEntry & filename)
if (*t == "-*")
i->second.second.push_back(prefix);
else if ('-' == t->at(0))
+ {
+ std::pair<std::string, std::string> ts(split_equals(t->substr(1)));
+ FlagNameState s(make_named_values<FlagNameState>(
+ value_for<n::enabled>(false),
+ value_for<n::parameter>(ts.second)
+ ));
i->second.first.insert(std::make_pair(
- FlagNamePair(prefix, UnprefixedChoiceName(t->substr(1))), false)).first->second = false;
+ FlagNamePair(prefix, UnprefixedChoiceName(ts.first)), s)).first->second = s;
+ }
else if (':' == t->at(t->length() - 1))
{
std::string p;
@@ -141,7 +176,15 @@ UseConf::add(const FSEntry & filename)
prefix = ChoicePrefixName(p);
}
else
- i->second.first.insert(std::make_pair(FlagNamePair(prefix, UnprefixedChoiceName(*t)), true)).first->second = true;
+ {
+ std::pair<std::string, std::string> ts(split_equals(*t));
+ FlagNameState s(make_named_values<FlagNameState>(
+ value_for<n::enabled>(true),
+ value_for<n::parameter>(ts.second)
+ ));
+ i->second.first.insert(std::make_pair(
+ FlagNamePair(prefix, UnprefixedChoiceName(ts.first)), s)).first->second = s;
+ }
}
}
else
@@ -155,8 +198,16 @@ UseConf::add(const FSEntry & filename)
if (*t == "-*")
i->second.second.push_back(prefix);
else if ('-' == t->at(0))
+ {
+ std::pair<std::string, std::string> ts(split_equals(t->substr(1)));
+ FlagNameState s(make_named_values<FlagNameState>(
+ value_for<n::enabled>(false),
+ value_for<n::parameter>(ts.second)
+ ));
i->second.first.insert(
- std::make_pair(FlagNamePair(prefix, UnprefixedChoiceName(t->substr(1))), false)).first->second = false;
+ std::make_pair(FlagNamePair(
+ prefix, UnprefixedChoiceName(ts.first)), s)).first->second = s;
+ }
else if (':' == t->at(t->length() - 1))
{
std::string p;
@@ -164,7 +215,15 @@ UseConf::add(const FSEntry & filename)
prefix = ChoicePrefixName(p);
}
else
- i->second.first.insert(std::make_pair(FlagNamePair(prefix, UnprefixedChoiceName(*t)), true)).first->second = true;
+ {
+ std::pair<std::string, std::string> ts(split_equals(*t));
+ FlagNameState s(make_named_values<FlagNameState>(
+ value_for<n::enabled>(true),
+ value_for<n::parameter>(ts.second)
+ ));
+ i->second.first.insert(std::make_pair(FlagNamePair(
+ prefix, UnprefixedChoiceName(ts.first)), s)).first->second = s;
+ }
}
}
}
@@ -178,8 +237,15 @@ UseConf::add(const FSEntry & filename)
if (*t == "-*")
i->second.second.second.push_back(prefix);
else if ('-' == t->at(0))
+ {
+ std::pair<std::string, std::string> ts(split_equals(t->substr(1)));
+ FlagNameState s(make_named_values<FlagNameState>(
+ value_for<n::enabled>(false),
+ value_for<n::parameter>(ts.second)
+ ));
i->second.second.first.insert(std::make_pair(
- FlagNamePair(prefix, UnprefixedChoiceName(t->substr(1))), false)).first->second = false;
+ FlagNamePair(prefix, UnprefixedChoiceName(ts.first)), s)).first->second = s;
+ }
else if (':' == t->at(t->length() - 1))
{
std::string p;
@@ -187,8 +253,15 @@ UseConf::add(const FSEntry & filename)
prefix = ChoicePrefixName(p);
}
else
+ {
+ std::pair<std::string, std::string> ts(split_equals(*t));
+ FlagNameState s(make_named_values<FlagNameState>(
+ value_for<n::enabled>(true),
+ value_for<n::parameter>(ts.second)
+ ));
i->second.second.first.insert(std::make_pair(
- FlagNamePair(prefix, UnprefixedChoiceName(*t)), true)).first->second = true;
+ FlagNamePair(prefix, UnprefixedChoiceName(ts.first)), s)).first->second = s;
+ }
}
}
}
@@ -219,7 +292,7 @@ UseConf::want_choice_enabled(
FlagNamePairWithStateMap::const_iterator i(p->second.first.find(std::make_pair(choice->prefix(), f)));
if (p->second.first.end() != i)
- result = i->second;
+ result = i->second.enabled();
if (result.is_indeterminate())
for (MinusStarPrefixList::const_iterator m(p->second.second.begin()), m_end(p->second.second.end()) ;
@@ -260,7 +333,7 @@ UseConf::want_choice_enabled(
FlagNamePairWithStateMap::const_iterator i(r->second.second.first.find(std::make_pair(choice->prefix(), f)));
if (i != r->second.second.first.end())
- result = i->second;
+ result = i->second.enabled();
if (result.is_indeterminate())
for (MinusStarPrefixList::const_iterator m(r->second.second.second.begin()), m_end(r->second.second.second.end()) ;
@@ -289,7 +362,7 @@ UseConf::want_choice_enabled(
FlagNamePairWithStateMap::const_iterator i(p->second.first.find(std::make_pair(choice->prefix(), f)));
if (p->second.first.end() != i)
- result = i->second;
+ result = i->second.enabled();
if (result.is_indeterminate())
for (MinusStarPrefixList::const_iterator m(p->second.second.begin()), m_end(p->second.second.end()) ;
@@ -309,6 +382,85 @@ UseConf::want_choice_enabled(
return result;
}
+const std::string
+UseConf::value_for_choice_parameter(
+ const std::tr1::shared_ptr<const PackageID> & id,
+ const std::tr1::shared_ptr<const Choice> & choice,
+ const UnprefixedChoiceName & f
+ ) const
+{
+ Context context("When checking parameter of flag prefix '" + stringify(choice->prefix()) +
+ "' name '" + stringify(f) + "' for '" + stringify(*id) + "':");
+
+ std::string result;
+ bool found(false);
+
+ /* highest priority: specific */
+ Qualified::const_iterator q(_imp->qualified.find(id->name()));
+ if (_imp->qualified.end() != q)
+ {
+ for (PDSWithUseInfoList::const_iterator p(q->second.begin()), p_end(q->second.end()) ; p != p_end ; ++p)
+ {
+ if (! match_package(*_imp->env, *p->first, *id, MatchPackageOptions()))
+ continue;
+
+ FlagNamePairWithStateMap::const_iterator i(p->second.first.find(std::make_pair(choice->prefix(), f)));
+ if (p->second.first.end() != i)
+ {
+ result = i->second.parameter();
+ found = true;
+ }
+ }
+ }
+
+ if (found)
+ return result;
+
+ /* next: named sets */
+ for (Sets::iterator r(_imp->sets.begin()), r_end(_imp->sets.end()) ; r != r_end ; ++r)
+ {
+ Lock lock(_imp->set_mutex);
+ if (! r->second.first)
+ {
+ r->second.first = _imp->env->set(r->first);
+ if (! r->second.first)
+ {
+ Log::get_instance()->message("paludis_environment.use_conf.unknown_set", ll_warning, lc_no_context) << "Set name '"
+ << r->first << "' does not exist";
+ r->second.first.reset(new SetSpecTree(make_shared_ptr(new AllDepSpec)));
+ }
+ }
+
+ if (! match_package_in_set(*_imp->env, *r->second.first, *id, MatchPackageOptions()))
+ continue;
+
+ FlagNamePairWithStateMap::const_iterator i(r->second.second.first.find(std::make_pair(choice->prefix(), f)));
+ if (i != r->second.second.first.end())
+ {
+ result = i->second.parameter();
+ found = true;
+ }
+ }
+
+ if (found)
+ return result;
+
+ /* last: unspecific */
+
+ for (Unqualified::const_iterator p(_imp->unqualified.begin()), p_end(_imp->unqualified.end()) ; p != p_end ; ++p)
+ {
+ if (! match_package(*_imp->env, *p->first, *id, MatchPackageOptions()))
+ continue;
+
+ FlagNamePairWithStateMap::const_iterator i(p->second.first.find(std::make_pair(choice->prefix(), f)));
+ if (p->second.first.end() != i)
+ result = i->second.parameter();
+ }
+
+ return result;
+}
+
+
std::tr1::shared_ptr<const Set<UnprefixedChoiceName> >
UseConf::known_choice_value_names(
const std::tr1::shared_ptr<const PackageID> & id,
diff --git a/paludis/environments/paludis/use_conf.hh b/paludis/environments/paludis/use_conf.hh
index c5f6a88..9140718 100644
--- a/paludis/environments/paludis/use_conf.hh
+++ b/paludis/environments/paludis/use_conf.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
*
* 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
@@ -65,6 +65,13 @@ namespace paludis
) const
PALUDIS_ATTRIBUTE((warn_unused_result));
+ const std::string value_for_choice_parameter(
+ const std::tr1::shared_ptr<const PackageID> &,
+ const std::tr1::shared_ptr<const Choice> &,
+ const UnprefixedChoiceName &
+ ) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
std::tr1::shared_ptr<const Set<UnprefixedChoiceName> > known_choice_value_names(
const std::tr1::shared_ptr<const PackageID> &,
const std::tr1::shared_ptr<const Choice> &
diff --git a/paludis/environments/portage/portage_environment.cc b/paludis/environments/portage/portage_environment.cc
index 8293d6c..8b277b2 100644
--- a/paludis/environments/portage/portage_environment.cc
+++ b/paludis/environments/portage/portage_environment.cc
@@ -581,6 +581,15 @@ PortageEnvironment::want_choice_enabled(
return state;
}
+const std::string
+PortageEnvironment::value_for_choice_parameter(
+ const std::tr1::shared_ptr<const PackageID> &,
+ const std::tr1::shared_ptr<const Choice> &,
+ const UnprefixedChoiceName &) const
+{
+ return "";
+}
+
std::string
PortageEnvironment::paludis_command() const
{
diff --git a/paludis/environments/portage/portage_environment.hh b/paludis/environments/portage/portage_environment.hh
index 0e2a8d5..c8c5512 100644
--- a/paludis/environments/portage/portage_environment.hh
+++ b/paludis/environments/portage/portage_environment.hh
@@ -104,6 +104,13 @@ namespace paludis
) const
PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::string value_for_choice_parameter(
+ const std::tr1::shared_ptr<const PackageID> &,
+ const std::tr1::shared_ptr<const Choice> &,
+ const UnprefixedChoiceName &
+ ) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
virtual std::tr1::shared_ptr<const Set<UnprefixedChoiceName> > known_choice_value_names(
const std::tr1::shared_ptr<const PackageID> &,
const std::tr1::shared_ptr<const Choice> &
diff --git a/paludis/environments/test/test_environment.cc b/paludis/environments/test/test_environment.cc
index a26ff8d..0930d13 100644
--- a/paludis/environments/test/test_environment.cc
+++ b/paludis/environments/test/test_environment.cc
@@ -274,6 +274,16 @@ TestEnvironment::want_choice_enabled(
return Tribool(indeterminate);
}
+const std::string
+TestEnvironment::value_for_choice_parameter(
+ const std::tr1::shared_ptr<const PackageID> &,
+ const std::tr1::shared_ptr<const Choice> &,
+ const UnprefixedChoiceName &
+ ) const
+{
+ return "";
+}
+
std::tr1::shared_ptr<const Set<UnprefixedChoiceName> >
TestEnvironment::known_choice_value_names(
const std::tr1::shared_ptr<const PackageID> &,
diff --git a/paludis/environments/test/test_environment.hh b/paludis/environments/test/test_environment.hh
index 381344b..52f661f 100644
--- a/paludis/environments/test/test_environment.hh
+++ b/paludis/environments/test/test_environment.hh
@@ -131,6 +131,13 @@ namespace paludis
) const
PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::string value_for_choice_parameter(
+ const std::tr1::shared_ptr<const PackageID> &,
+ const std::tr1::shared_ptr<const Choice> &,
+ const UnprefixedChoiceName &
+ ) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
virtual std::tr1::shared_ptr<const Set<UnprefixedChoiceName> > known_choice_value_names(
const std::tr1::shared_ptr<const PackageID> &,
const std::tr1::shared_ptr<const Choice> &
diff --git a/paludis/repositories/e/e_choice_value.cc b/paludis/repositories/e/e_choice_value.cc
index 3639c36..736e293 100644
--- a/paludis/repositories/e/e_choice_value.cc
+++ b/paludis/repositories/e/e_choice_value.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2008 Ciaran McCreesh
+ * Copyright (c) 2008, 2009 Ciaran McCreesh
*
* 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
@@ -25,7 +25,8 @@ using namespace paludis::erepository;
EChoiceValue::EChoiceValue(const ChoicePrefixName & r, const UnprefixedChoiceName & v, const ChoiceNameWithPrefix & np, const QualifiedPackageName & p,
const std::tr1::shared_ptr<const UseDesc> & d,
- bool b, bool def, bool l, bool x, const std::string & o) :
+ bool b, bool def, bool l, bool x, const std::string & o,
+ const std::string & pv) :
_prefix(r),
_unprefixed_name(v),
_name_with_prefix(np),
@@ -35,7 +36,8 @@ EChoiceValue::EChoiceValue(const ChoicePrefixName & r, const UnprefixedChoiceNam
_enabled_by_default(def),
_locked(l),
_explicitly_listed(x),
- _override_description(o)
+ _override_description(o),
+ _parameter(pv)
{
}
@@ -85,3 +87,9 @@ EChoiceValue::explicitly_listed() const
return _explicitly_listed;
}
+const std::string
+EChoiceValue::parameter() const
+{
+ return _parameter;
+}
+
diff --git a/paludis/repositories/e/e_choice_value.hh b/paludis/repositories/e/e_choice_value.hh
index 170fabe..7ecd06f 100644
--- a/paludis/repositories/e/e_choice_value.hh
+++ b/paludis/repositories/e/e_choice_value.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2008 Ciaran McCreesh
+ * Copyright (c) 2008, 2009 Ciaran McCreesh
*
* 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
@@ -47,6 +47,7 @@ namespace paludis
const bool _locked;
const bool _explicitly_listed;
const std::string _override_description;
+ const std::string _parameter;
public:
EChoiceValue(const ChoicePrefixName & r,
@@ -56,7 +57,8 @@ namespace paludis
const std::tr1::shared_ptr<const UseDesc> & d,
bool b, bool def,
bool l, bool x,
- const std::string & o);
+ const std::string & o,
+ const std::string & pr);
const UnprefixedChoiceName unprefixed_name() const;
const ChoiceNameWithPrefix name_with_prefix() const;
@@ -65,6 +67,7 @@ namespace paludis
bool locked() const;
const std::string description() const;
bool explicitly_listed() const;
+ const std::string parameter() const PALUDIS_ATTRIBUTE((warn_unused_result));
};
}
}
diff --git a/paludis/repositories/e/e_installed_repository_id.cc b/paludis/repositories/e/e_installed_repository_id.cc
index 594c317..875f888 100644
--- a/paludis/repositories/e/e_installed_repository_id.cc
+++ b/paludis/repositories/e/e_installed_repository_id.cc
@@ -1012,7 +1012,7 @@ EInstalledRepositoryID::make_choice_value(const std::tr1::shared_ptr<const Choic
enabled = (raw_use_key()->value()->end() != raw_use_key()->value()->find(name_with_prefix));
return make_shared_ptr(new EChoiceValue(c->prefix(), v, ChoiceNameWithPrefix(name_with_prefix), name(), std::tr1::shared_ptr<const UseDesc>(),
- enabled, enabled, true, explicitly_listed, override_description));
+ enabled, enabled, true, explicitly_listed, override_description, ""));
}
void
diff --git a/paludis/repositories/e/eapi.cc b/paludis/repositories/e/eapi.cc
index 49f99ce..027ab9d 100644
--- a/paludis/repositories/e/eapi.cc
+++ b/paludis/repositories/e/eapi.cc
@@ -82,6 +82,7 @@ namespace
value_for<n::env_ebuild_phase>(check_get(k, "env_ebuild_phase")),
value_for<n::env_filesdir>(check_get(k, "env_filesdir")),
value_for<n::env_iuse_implicit>(check_get(k, "env_iuse_implicit")),
+ value_for<n::env_jobs>(check_get(k, "env_jobs")),
value_for<n::env_kv>(check_get(k, "env_kv")),
value_for<n::env_p>(check_get(k, "env_p")),
value_for<n::env_pf>(check_get(k, "env_pf")),
diff --git a/paludis/repositories/e/eapi.hh b/paludis/repositories/e/eapi.hh
index 7f127aa..894e846 100644
--- a/paludis/repositories/e/eapi.hh
+++ b/paludis/repositories/e/eapi.hh
@@ -89,6 +89,7 @@ namespace paludis
struct env_ebuild_phase;
struct env_filesdir;
struct env_iuse_implicit;
+ struct env_jobs;
struct env_kv;
struct env_p;
struct env_pf;
@@ -293,6 +294,7 @@ namespace paludis
NamedValue<n::env_ebuild_phase, std::string> env_ebuild_phase;
NamedValue<n::env_filesdir, std::string> env_filesdir;
NamedValue<n::env_iuse_implicit, std::string> env_iuse_implicit;
+ NamedValue<n::env_jobs, std::string> env_jobs;
NamedValue<n::env_kv, std::string> env_kv;
NamedValue<n::env_p, std::string> env_p;
NamedValue<n::env_pf, std::string> env_pf;
diff --git a/paludis/repositories/e/eapis/exheres-0.conf b/paludis/repositories/e/eapis/exheres-0.conf
index 6968ed4..03b7849 100644
--- a/paludis/repositories/e/eapis/exheres-0.conf
+++ b/paludis/repositories/e/eapis/exheres-0.conf
@@ -277,6 +277,7 @@ env_a = ARCHIVES
env_replacing_ids = REPLACING_IDS
env_replaced_by_id = REPLACED_BY_ID
env_ebuild_phase = EXHERES_PHASE
+env_jobs = EXJOBS
uri_labels = \
default = URIListedThenMirrorsLabel ; \
diff --git a/paludis/repositories/e/ebuild.cc b/paludis/repositories/e/ebuild.cc
index 695fa36..9253f93 100644
--- a/paludis/repositories/e/ebuild.cc
+++ b/paludis/repositories/e/ebuild.cc
@@ -48,6 +48,7 @@
#include <paludis/package_id.hh>
#include <paludis/metadata_key.hh>
#include <paludis/action.hh>
+#include <paludis/elike_choices.hh>
#include <sys/resource.h>
#include <sys/time.h>
@@ -89,6 +90,21 @@ EbuildCommand::failure()
return false;
}
+namespace
+{
+ std::string get_jobs(const std::tr1::shared_ptr<const PackageID> & id)
+ {
+ std::tr1::shared_ptr<const ChoiceValue> choice;
+ if (id->choices_key())
+ choice = id->choices_key()->value()->find_by_name_with_prefix(
+ ELikeJobsChoiceValue::canonical_name_with_prefix());
+ if (choice && choice->enabled())
+ return choice->parameter();
+ else
+ return "";
+ }
+}
+
bool
EbuildCommand::operator() ()
{
@@ -275,6 +291,12 @@ EbuildCommand::operator() ()
.with_setenv("EXLIBSDIRS", join(params.exlibsdirs()->begin(),
params.exlibsdirs()->end(), " "));
+ if (! params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_jobs().empty())
+ cmd
+ .with_setenv("PALUDIS_JOBS_VAR", params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_jobs())
+ .with_setenv(params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_jobs(),
+ get_jobs(params.package_id()));
+
if (params.package_id()->eapi()->supported()->ebuild_options()->want_portage_emulation_vars())
cmd = add_portage_vars(cmd);
diff --git a/paludis/repositories/e/ebuild/utils/emake b/paludis/repositories/e/ebuild/utils/emake
index 43fb804..5110b31 100755
--- a/paludis/repositories/e/ebuild/utils/emake
+++ b/paludis/repositories/e/ebuild/utils/emake
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
# vim: set sw=4 sts=4 et :
-# Copyright (c) 2006, 2007 Ciaran McCreesh
+# Copyright (c) 2006, 2007, 2009 Ciaran McCreesh
#
# 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
@@ -19,8 +19,13 @@
source "${PALUDIS_EBUILD_DIR}"/die_functions.bash
-echo ${EMAKE_WRAPPER} ${MAKE:-make} ${MAKEOPTS} ${EXTRA_EMAKE} "$@" 1>&2
-${EMAKE_WRAPPER} ${MAKE:-make} ${MAKEOPTS} ${EXTRA_EMAKE} "$@"
+PALUDIS_JOBS_ARGS=
+if [[ -n "${PALUDIS_JOBS_VAR}" ]] && [[ -n "${!PALUDIS_JOBS_VAR}" ]] ; then
+ PALUDIS_JOBS_ARGS="-j${!PALUDIS_JOBS_VAR}"
+fi
+
+echo ${EMAKE_WRAPPER} ${MAKE:-make} ${PALUDIS_JOBS_ARGS} ${MAKEOPTS} ${EXTRA_EMAKE} "$@" 1>&2
+${EMAKE_WRAPPER} ${MAKE:-make} ${PALUDIS_JOBS_ARGS} ${MAKEOPTS} ${EXTRA_EMAKE} "$@"
ret=$?
[[ 0 != $ret ]] && paludis_die_or_error "emake returned error $ret"
exit $ret
diff --git a/paludis/repositories/e/ebuild_id.cc b/paludis/repositories/e/ebuild_id.cc
index dbe61aa..12c6954 100644
--- a/paludis/repositories/e/ebuild_id.cc
+++ b/paludis/repositories/e/ebuild_id.cc
@@ -1329,7 +1329,7 @@ EbuildID::make_choice_value(
return make_shared_ptr(new EChoiceValue(choice->prefix(), value_name, ChoiceNameWithPrefix(name_with_prefix), name(),
_imp->repository->use_desc(),
- enabled, enabled_by_default, force_locked || locked, explicitly_listed, override_description));
+ enabled, enabled_by_default, force_locked || locked, explicitly_listed, override_description, ""));
}
namespace
@@ -1428,6 +1428,16 @@ EbuildID::add_build_options(const std::tr1::shared_ptr<Choices> & choices) const
build_options->add(make_shared_ptr(new ELikeSplitChoiceValue(shared_from_this(), _imp->environment, build_options)));
build_options->add(make_shared_ptr(new ELikeStripChoiceValue(shared_from_this(), _imp->environment, build_options)));
}
+
+ /* jobs */
+ if (! eapi()->supported()->ebuild_environment_variables()->env_jobs().empty())
+ {
+ if (! _imp->defined_phases)
+ throw InternalError(PALUDIS_HERE, "bug! no defined_phases yet");
+
+ build_options->add(make_shared_ptr(new ELikeJobsChoiceValue(
+ shared_from_this(), _imp->environment, build_options)));
+ }
}
}
diff --git a/paludis/repositories/fake/fake_package_id.cc b/paludis/repositories/fake/fake_package_id.cc
index 5256868..ed519cd 100644
--- a/paludis/repositories/fake/fake_package_id.cc
+++ b/paludis/repositories/fake/fake_package_id.cc
@@ -470,6 +470,11 @@ namespace
{
return true;
}
+
+ virtual const std::string parameter() const PALUDIS_ATTRIBUTE((warn_unused_result))
+ {
+ return env->value_for_choice_parameter(id, choice, value_name);
+ }
};
}
diff --git a/src/output/colour_formatter.cc b/src/output/colour_formatter.cc
index c46a754..28a08a8 100644
--- a/src/output/colour_formatter.cc
+++ b/src/output/colour_formatter.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
*
* 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
@@ -35,7 +35,10 @@ ColourFormatter::format(const ChoiceValue & f, const format::Plain &) const
std::string
ColourFormatter::format(const ChoiceValue & f, const format::Enabled &) const
{
- return colour(cl_flag_on, stringify(f.unprefixed_name()));
+ std::string s(colour(cl_flag_on, stringify(f.unprefixed_name())));
+ if (! f.parameter().empty())
+ s.append("=" + f.parameter());
+ return s;
}
std::string
@@ -47,7 +50,10 @@ ColourFormatter::format(const ChoiceValue & f, const format::Disabled &) const
std::string
ColourFormatter::format(const ChoiceValue & f, const format::Forced &) const
{
- return colour(cl_flag_on, "(" + stringify(f.unprefixed_name()) + ")");
+ std::string s(colour(cl_flag_on, "(" + stringify(f.unprefixed_name())));
+ if (! f.parameter().empty())
+ s.append("=" + f.parameter());
+ return s + ")";
}
std::string
diff --git a/vim/syntax/paludis-use-conf.vim b/vim/syntax/paludis-use-conf.vim
index fbb9185..02dae6e 100644
--- a/vim/syntax/paludis-use-conf.vim
+++ b/vim/syntax/paludis-use-conf.vim
@@ -1,7 +1,7 @@
" Vim syntax file
" Language: Paludis use.conf files
" Author: Ciaran McCreesh
-" Copyright: Copyright (c) 2007 Ciaran McCreesh
+" Copyright: Copyright (c) 2007, 2009 Ciaran McCreesh
" Licence: You may redistribute this under the same terms as Vim itself
"
" Syntax highlighting for Paludis use.conf files.
@@ -23,7 +23,9 @@ syn match PaludisUseConfPDS /^[^ \t#\/]\+\/[^ \t#\/]\+\s*/
syn match PaludisUseConfWildcard contained /\(\*\/\@=\|\/\@<=\*\)/
syn match PaludisUseConfSet /^[^ \t#\/]\+\S\@!/
\ nextgroup=PaludisUseConfFlag,PaludisUseConfPrefix,PaludisUseConfContinuation skipwhite
-syn match PaludisUseConfFlag contained /\S\@<![a-zA-Z0-9\-_*]\+\S\@!/
+syn match PaludisUseConfFlag contained /\S\@<![a-zA-Z0-9\-_*]\+\(\S\@!\|=\@=\)/
+ \ nextgroup=PaludisUseConfFlag,PaludisUseConfFlagValue,PaludisUseConfPrefix,PaludisUseConfContinuation skipwhite
+syn match PaludisUseConfFlagValue contained /=\S*/
\ nextgroup=PaludisUseConfFlag,PaludisUseConfPrefix,PaludisUseConfContinuation skipwhite
syn match PaludisUseConfPrefix contained /[a-zA-Z0-9_*][a-zA-Z0-9\-_*]*:/
\ nextgroup=PaludisUseConfFlag,PaludisUseConfPrefix,PaludisUseConfContinuation skipwhite
@@ -36,6 +38,7 @@ hi def link PaludisUseConfSet Special
hi def link PaludisUseConfWildcard Special
hi def link PaludisUseConfPrefix Constant
hi def link PaludisUseConfFlag Keyword
+hi def link PaludisUseConfFlagValue Type
hi def link PaludisUseConfContinuation Preproc
let b:current_syntax = "paludis-use-conf"