aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-12-05 15:54:30 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-12-05 15:42:23 +0000
commit13949d19fce22dcbe24649993dcb2589cfd2f494 (patch)
treeb844bff666f8e78a62f8165c5df652cd9ae450a8
parent18c77936edf46cd1f31369aabf2639c9e30e5064 (diff)
downloadpaludis-13949d19fce22dcbe24649993dcb2589cfd2f494.tar.gz
paludis-13949d19fce22dcbe24649993dcb2589cfd2f494.tar.xz
Support, but don't use, DEFINED_PHASES
-rw-r--r--paludis/repositories/e/e_installed_repository_id.cc20
-rw-r--r--paludis/repositories/e/e_installed_repository_id.hh1
-rw-r--r--paludis/repositories/e/e_repository_id.hh1
-rw-r--r--paludis/repositories/e/eapi.cc1
-rw-r--r--paludis/repositories/e/eapi.hh2
-rw-r--r--paludis/repositories/e/eapis/0.conf5
-rw-r--r--paludis/repositories/e/eapis/exheres-0.conf5
-rw-r--r--paludis/repositories/e/eapis/paludis-1.conf5
-rw-r--r--paludis/repositories/e/ebuild.cc42
-rwxr-xr-xpaludis/repositories/e/ebuild/ebuild.bash9
-rw-r--r--paludis/repositories/e/ebuild_flat_metadata_cache.cc12
-rw-r--r--paludis/repositories/e/ebuild_id.cc18
-rw-r--r--paludis/repositories/e/ebuild_id.hh2
13 files changed, 118 insertions, 5 deletions
diff --git a/paludis/repositories/e/e_installed_repository_id.cc b/paludis/repositories/e/e_installed_repository_id.cc
index 0fdb39a..02e3437 100644
--- a/paludis/repositories/e/e_installed_repository_id.cc
+++ b/paludis/repositories/e/e_installed_repository_id.cc
@@ -104,6 +104,7 @@ namespace paludis
std::tr1::shared_ptr<const MetadataSpecTreeKey<SimpleURISpecTree> > upstream_release_notes;
std::tr1::shared_ptr<const MetadataSpecTreeKey<PlainTextSpecTree> > remote_ids;
std::tr1::shared_ptr<const MetadataSpecTreeKey<PlainTextSpecTree> > bugs_to;
+ std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > > defined_phases;
std::tr1::shared_ptr<const MetadataValueKey<std::string> > asflags;
std::tr1::shared_ptr<const MetadataValueKey<std::string> > cbuild;
@@ -199,6 +200,18 @@ EInstalledRepositoryID::need_keys_added() const
add_metadata_key(_imp->inherited);
}
+ if (! vars->defined_phases().name().empty())
+ if ((_imp->dir / vars->defined_phases().name()).exists())
+ {
+ std::string d(file_contents(_imp->dir / vars->defined_phases().name()));
+ if (! d.empty())
+ {
+ _imp->defined_phases.reset(new EStringSetKey(shared_from_this(), vars->defined_phases().name(), vars->defined_phases().description(),
+ d, mkt_internal));
+ add_metadata_key(_imp->defined_phases);
+ }
+ }
+
if (! vars->iuse().name().empty())
{
if ((_imp->dir / vars->iuse().name()).exists())
@@ -678,6 +691,13 @@ EInstalledRepositoryID::inherited_key() const
return _imp->inherited;
}
+const std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > >
+EInstalledRepositoryID::defined_phases_key() const
+{
+ need_keys_added();
+ return _imp->defined_phases;
+}
+
const std::tr1::shared_ptr<const MetadataSpecTreeKey<ProvideSpecTree> >
EInstalledRepositoryID::provide_key() const
{
diff --git a/paludis/repositories/e/e_installed_repository_id.hh b/paludis/repositories/e/e_installed_repository_id.hh
index a156b25..24a5c1e 100644
--- a/paludis/repositories/e/e_installed_repository_id.hh
+++ b/paludis/repositories/e/e_installed_repository_id.hh
@@ -85,6 +85,7 @@ namespace paludis
virtual const std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > > raw_use_expand_hidden_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const Choices> > > choices_key() const;
virtual const std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > > inherited_key() const;
+ virtual const std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > > defined_phases_key() const;
virtual const std::tr1::shared_ptr<const MetadataSpecTreeKey<LicenseSpecTree> > license_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<bool> > transient_key() const;
diff --git a/paludis/repositories/e/e_repository_id.hh b/paludis/repositories/e/e_repository_id.hh
index bffad35..fa15212 100644
--- a/paludis/repositories/e/e_repository_id.hh
+++ b/paludis/repositories/e/e_repository_id.hh
@@ -42,6 +42,7 @@ namespace paludis
virtual const std::tr1::shared_ptr<const MetadataSpecTreeKey<PlainTextSpecTree> > raw_myoptions_key() const = 0;
virtual const std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > > raw_use_expand_key() const = 0;
virtual const std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > > raw_use_expand_hidden_key() const = 0;
+ virtual const std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > > defined_phases_key() const = 0;
virtual std::tr1::shared_ptr<const Set<std::string> > breaks_portage() const PALUDIS_ATTRIBUTE((warn_unused_result));
diff --git a/paludis/repositories/e/eapi.cc b/paludis/repositories/e/eapi.cc
index d23b560..3a7f539 100644
--- a/paludis/repositories/e/eapi.cc
+++ b/paludis/repositories/e/eapi.cc
@@ -105,6 +105,7 @@ namespace
return make_shared_ptr(new EAPIEbuildMetadataVariables(make_named_values<EAPIEbuildMetadataVariables>(
value_for<n::bugs_to>(make_metadata_variable(k, "bugs_to")),
value_for<n::build_depend>(make_metadata_variable(k, "build_depend")),
+ value_for<n::defined_phases>(make_metadata_variable(k, "defined_phases")),
value_for<n::dependencies>(make_metadata_variable(k, "dependencies")),
value_for<n::eapi>(make_metadata_variable(k, "eapi")),
value_for<n::homepage>(make_metadata_variable(k, "homepage")),
diff --git a/paludis/repositories/e/eapi.hh b/paludis/repositories/e/eapi.hh
index a20d60d..6789b78 100644
--- a/paludis/repositories/e/eapi.hh
+++ b/paludis/repositories/e/eapi.hh
@@ -46,6 +46,7 @@ namespace paludis
struct build_depend;
struct can_be_pbin;
struct choices_options;
+ struct defined_phases;
struct dependencies;
struct dependency_labels;
struct dependency_spec_tree_parse_options;
@@ -288,6 +289,7 @@ namespace paludis
{
NamedValue<n::bugs_to, EAPIMetadataVariable> bugs_to;
NamedValue<n::build_depend, EAPIMetadataVariable> build_depend;
+ NamedValue<n::defined_phases, EAPIMetadataVariable> defined_phases;
NamedValue<n::dependencies, EAPIMetadataVariable> dependencies;
NamedValue<n::eapi, EAPIMetadataVariable> eapi;
NamedValue<n::homepage, EAPIMetadataVariable> homepage;
diff --git a/paludis/repositories/e/eapis/0.conf b/paludis/repositories/e/eapis/0.conf
index 6f5f803..0b360d1 100644
--- a/paludis/repositories/e/eapis/0.conf
+++ b/paludis/repositories/e/eapis/0.conf
@@ -30,7 +30,7 @@ vdb_from_env_variables = \
CATEGORY CHOST COUNTER DEPEND DESCRIPTION EAPI FEATURES \
HOMEPAGE INHERITED IUSE KEYWORDS LICENSE PDEPEND PF \
PROVIDE RDEPEND SLOT SRC_URI USE CONFIG_PROTECT CONFIG_PROTECT_MASK \
- VDB_FORMAT PKGMANAGER USE_EXPAND USE_EXPAND_HIDDEN
+ VDB_FORMAT PKGMANAGER USE_EXPAND USE_EXPAND_HIDDEN DEFINED_PHASES
vdb_from_env_unless_empty_variables = \
ASFLAGS CBUILD CC CFLAGS CHOST CTARGET CXX CXXFLAGS \
@@ -165,6 +165,7 @@ description_properties = Properties
description_choices = Use flags
description_use_expand = USE expand flags
description_use_expand_hidden = USE expand hidden flags
+description_defined_phases = Defined phases
metadata_build_depend = DEPEND
metadata_short_description = DESCRIPTION
@@ -185,6 +186,7 @@ metadata_dependencies =
metadata_properties = PROPERTIES
metadata_use_expand = USE_EXPAND
metadata_use_expand_hidden = USE_EXPAND_HIDDEN
+metadata_defined_phases = DEFINED_PHASES
flat_list_minimum_size = 16
flat_list_build_depend = 0
@@ -213,6 +215,7 @@ flat_list_upstream_documentation = -1
flat_list_properties = 15
flat_list_use_expand = -1
flat_list_use_expand_hidden = -1
+flat_list_defined_phases = -1
env_use = USE
env_use_expand = USE_EXPAND
diff --git a/paludis/repositories/e/eapis/exheres-0.conf b/paludis/repositories/e/eapis/exheres-0.conf
index c4e3c37..89b0d68 100644
--- a/paludis/repositories/e/eapis/exheres-0.conf
+++ b/paludis/repositories/e/eapis/exheres-0.conf
@@ -31,7 +31,7 @@ vdb_from_env_variables = \
CATEGORY CHOST DEPENDENCIES SUMMARY EAPI \
HOMEPAGE INHERITED MYOPTIONS PLATFORMS LICENCES PNVR \
SLOT DOWNLOADS OPTIONS CONFIG_PROTECT CONFIG_PROTECT_MASK \
- VDB_FORMAT PKGMANAGER SUBOPTIONS HIDDEN_SUBOPTIONS
+ VDB_FORMAT PKGMANAGER SUBOPTIONS HIDDEN_SUBOPTIONS DEFINED_PHASES
vdb_from_env_unless_empty_variables = \
ASFLAGS CBUILD CC CFLAGS CHOST CTARGET CXX CXXFLAGS \
@@ -178,6 +178,7 @@ metadata_upstream_documentation = UPSTREAM_DOCUMENTATION
metadata_properties =
metadata_use_expand = SUBOPTIONS
metadata_use_expand_hidden = HIDDEN_SUBOPTIONS
+metadata_defined_phases = DEFINED_PHASES
description_build_depend =
description_short_description = Summary
@@ -205,6 +206,7 @@ description_properties =
description_choices = Options
description_use_expand = Suboptions
description_use_expand_hidden = Hidden suboptions
+description_defined_phases = Defined phases
flat_list_minimum_size = -1
flat_list_build_depend = -1
@@ -233,6 +235,7 @@ flat_list_upstream_documentation = -1
flat_list_properties = -1
flat_list_use_expand = -1
flat_list_use_expand_hidden = -1
+flat_list_defined_phases = -1
env_use = OPTIONS
env_use_expand = SUBOPTIONS
diff --git a/paludis/repositories/e/eapis/paludis-1.conf b/paludis/repositories/e/eapis/paludis-1.conf
index ed40e88..02a39c6 100644
--- a/paludis/repositories/e/eapis/paludis-1.conf
+++ b/paludis/repositories/e/eapis/paludis-1.conf
@@ -31,7 +31,7 @@ vdb_from_env_variables = \
CATEGORY CHOST COUNTER DEPEND DESCRIPTION EAPI FEATURES \
HOMEPAGE INHERITED IUSE KEYWORDS LICENSE PDEPEND PF \
PROVIDE RDEPEND SLOT SRC_URI USE CONFIG_PROTECT CONFIG_PROTECT_MASK \
- VDB_FORMAT PKGMANAGER USE_EXPAND USE_EXPAND_HIDDEN
+ VDB_FORMAT PKGMANAGER USE_EXPAND USE_EXPAND_HIDDEN DEFINED_PHASES
vdb_from_env_unless_empty_variables = \
ASFLAGS CBUILD CC CFLAGS CHOST CTARGET CXX CXXFLAGS \
@@ -167,6 +167,7 @@ metadata_use =
metadata_properties =
metadata_use_expand = USE_EXPAND
metadata_use_expand_hidden = USE_EXPAND_HIDDEN
+metadata_defined_phases = DEFINED_PHASES
description_build_depend = Build dependencies
description_short_description = Description
@@ -188,6 +189,7 @@ description_properties =
description_choices = Use flags
description_use_expand = USE expand flags
description_use_expand_hidden = USE expand hidden flags
+description_defined_phases = Defined phases
flat_list_minimum_size = -1
flat_list_build_depend = -1
@@ -217,6 +219,7 @@ flat_list_upstream_documentation = -1
flat_list_properties = -1
flat_list_use_expand = -1
flat_list_use_expand_hidden = -1
+flat_list_defined_phases = -1
env_use = USE
env_use_expand = USE_EXPAND
diff --git a/paludis/repositories/e/ebuild.cc b/paludis/repositories/e/ebuild.cc
index e6c1075..baaf1c7 100644
--- a/paludis/repositories/e/ebuild.cc
+++ b/paludis/repositories/e/ebuild.cc
@@ -57,6 +57,7 @@
#include <time.h>
#include <tr1/functional>
#include <list>
+#include <set>
#include "config.h"
@@ -557,6 +558,41 @@ EbuildMetadataCommand::load(const std::tr1::shared_ptr<const EbuildID> & id)
if (! value.empty())
id->load_remote_ids(m.remote_ids().name(), m.remote_ids().description(), value);
}
+
+ if (! m.defined_phases().name().empty())
+ {
+ std::set<std::string> defined_phases, raw_values, ebuild_functions;
+ std::string raw_value(get(keys, "PALUDIS_DECLARED_FUNCTIONS"));
+ tokenise_whitespace(raw_value, std::inserter(raw_values, raw_values.begin()));
+ tokenise_whitespace(id->eapi()->supported()->ebuild_options()->ebuild_functions(),
+ std::inserter(ebuild_functions, ebuild_functions.end()));
+
+ for (std::set<std::string>::const_iterator f(ebuild_functions.begin()), f_end(ebuild_functions.end()) ;
+ f != f_end ; ++f)
+ {
+ if (0 == f->compare(0, 8, "builtin_"))
+ continue;
+
+ if (raw_values.end() == raw_values.find(*f))
+ continue;
+
+ std::string p(*f);
+ if (0 == p.compare(0, 4, "src_"))
+ p.erase(0, 4);
+ else if (0 == p.compare(0, 4, "pkg_"))
+ p.erase(0, 4);
+ else
+ throw InternalError(PALUDIS_HERE, "Got strange phase function '" + p + "'");
+
+ defined_phases.insert(p);
+ }
+
+ if (defined_phases.empty())
+ id->load_defined_phases(m.defined_phases().name(), m.defined_phases().description(), "-");
+ else
+ id->load_defined_phases(m.defined_phases().name(), m.defined_phases().description(),
+ join(defined_phases.begin(), defined_phases.end(), " "));
+ }
}
EbuildVariableCommand::EbuildVariableCommand(const EbuildCommandParams & p,
@@ -846,6 +882,12 @@ WriteVDBEntryCommand::operator() ()
.with_pipe_command_handler(std::tr1::bind(&pipe_command_handler, params.environment(), params.package_id(), _1))
);
+ std::string defined_phases(params.package_id()->eapi()->supported()->ebuild_metadata_variables()->defined_phases().name());
+ if (! defined_phases.empty())
+ if (params.package_id()->defined_phases_key())
+ cmd.with_setenv(defined_phases, join(params.package_id()->defined_phases_key()->value()->begin(),
+ params.package_id()->defined_phases_key()->value()->end(), " "));
+
if (0 != (run_command(cmd)))
throw InstallActionError("Write VDB Entry command failed");
}
diff --git a/paludis/repositories/e/ebuild/ebuild.bash b/paludis/repositories/e/ebuild/ebuild.bash
index 8b8e323..7853237 100755
--- a/paludis/repositories/e/ebuild/ebuild.bash
+++ b/paludis/repositories/e/ebuild/ebuild.bash
@@ -35,14 +35,15 @@ unset GZIP BZIP BZIP2 CDPATH GREP_OPTIONS GREP_COLOR GLOBIGNORE
eval unset LANG ${!LC_*}
export LC_ALL=C
-# The list below should include all variables from all EAPIs
+# The list below should include all variables from all EAPIs, along with any
+# fancy fake variables
EBUILD_METADATA_VARIABLES="DEPEND RDEPEND PDEPEND IUSE SRC_URI DOWNLOADS RESTRICT \
LICENSE LICENCES KEYWORDS INHERITED PROVIDE HOMEPAGE DESCRIPTION DEPENDENCIES \
E_IUSE E_DEPEND E_RDEPEND E_PDEPEND PLATFORMS \
MYOPTIONS E_MYOPTIONS E_DEPENDENCIES BINARY_KEYWORDS BINARY_URI \
GENERATED_USING GENERATED_TIME BINARY_PLATFORMS REMOTE_IDS \
SUMMARY BUGS_TO UPSTREAM_DOCUMENTATION UPSTREAM_CHANGELOG \
- UPSTREAM_RELEASE_NOTES PROPERTIES DEFINED_PHASES"
+ UPSTREAM_RELEASE_NOTES PROPERTIES PALUDIS_DECLARED_FUNCTIONS"
unset -v ${EBUILD_METADATA_VARIABLES} ${PALUDIS_EBUILD_MUST_NOT_SET_VARIABLES}
# These can be set by C++
EBUILD_METADATA_VARIABLES="${EBUILD_METADATA_VARIABLES} SLOT EAPI OPTIONS USE"
@@ -379,6 +380,10 @@ ebuild_load_ebuild()
export ${v}="${!s_v}"
fi
done
+
+ export PALUDIS_DECLARED_FUNCTIONS=$(declare -F | while read v ; do
+ echo -n ${v/declare -f } " "
+ done )
}
perform_hook()
diff --git a/paludis/repositories/e/ebuild_flat_metadata_cache.cc b/paludis/repositories/e/ebuild_flat_metadata_cache.cc
index 3364665..883b0d3 100644
--- a/paludis/repositories/e/ebuild_flat_metadata_cache.cc
+++ b/paludis/repositories/e/ebuild_flat_metadata_cache.cc
@@ -211,6 +211,10 @@ namespace
if (-1 != m.inherited().flat_list_index() && ! m.inherited().name().empty())
id->load_inherited(m.inherited().name(), m.inherited().description(), lines.at(m.inherited().flat_list_index()));
+ if (-1 != m.defined_phases().flat_list_index() && ! m.defined_phases().name().empty())
+ if (! lines.at(m.defined_phases().flat_list_index()).empty())
+ id->load_defined_phases(m.defined_phases().name(), m.defined_phases().description(), lines.at(m.defined_phases().flat_list_index()));
+
if (-1 != m.iuse().flat_list_index() && ! m.iuse().name().empty())
id->load_iuse(m.iuse().name(), m.iuse().description(), lines.at(m.iuse().flat_list_index()));
@@ -535,6 +539,10 @@ EbuildFlatMetadataCache::load(const std::tr1::shared_ptr<const EbuildID> & id)
id->load_inherited(m.inherited().name(), m.inherited().description(), join(brief.begin(), brief.end(), " "));
}
+ if (! m.defined_phases().name().empty())
+ if (! keys[m.defined_phases().name()].empty())
+ id->load_defined_phases(m.defined_phases().name(), m.defined_phases().description(), keys[m.defined_phases().name()]);
+
if (! m.iuse().name().empty())
id->load_iuse(m.iuse().name(), m.iuse().description(), keys[m.iuse().name()]);
@@ -782,6 +790,10 @@ EbuildFlatMetadataCache::save(const std::tr1::shared_ptr<const EbuildID> & id)
if (! m.upstream_release_notes().name().empty() && id->upstream_release_notes_key())
write_kv(cache, m.upstream_release_notes().name(), flatten(id->upstream_release_notes_key()->value()));
+
+ if (! m.defined_phases().name().empty() && id->defined_phases_key())
+ write_kv(cache, m.defined_phases().name(), join(id->defined_phases_key()->value()->begin(),
+ id->defined_phases_key()->value()->end(), " "));
}
catch (const InternalError &)
{
diff --git a/paludis/repositories/e/ebuild_id.cc b/paludis/repositories/e/ebuild_id.cc
index 5feeed5..027995a 100644
--- a/paludis/repositories/e/ebuild_id.cc
+++ b/paludis/repositories/e/ebuild_id.cc
@@ -104,6 +104,7 @@ namespace paludis
mutable std::tr1::shared_ptr<const ESimpleURIKey> upstream_documentation;
mutable std::tr1::shared_ptr<const ESimpleURIKey> upstream_release_notes;
mutable std::tr1::shared_ptr<const EChoicesKey> choices;
+ mutable std::tr1::shared_ptr<const EStringSetKey> defined_phases;
std::tr1::shared_ptr<DependencyLabelSequence> build_dependencies_labels;
std::tr1::shared_ptr<DependencyLabelSequence> run_dependencies_labels;
@@ -687,6 +688,12 @@ EbuildID::inherited_key() const
return _imp->inherited;
}
+const std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > >
+EbuildID::defined_phases_key() const
+{
+ return _imp->defined_phases;
+}
+
const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> >
EbuildID::fs_location_key() const
{
@@ -874,6 +881,17 @@ EbuildID::load_inherited(const std::string & r, const std::string & h, const std
}
void
+EbuildID::load_defined_phases(const std::string & r, const std::string & h, const std::string & v) const
+{
+ if (v.empty())
+ throw InternalError(PALUDIS_HERE, "v should not be empty");
+
+ Lock l(_imp->mutex);
+ _imp->defined_phases.reset(new EStringSetKey(shared_from_this(), r, h, v, mkt_internal));
+ add_metadata_key(_imp->defined_phases);
+}
+
+void
EbuildID::load_upstream_changelog(const std::string & r, const std::string & h, const std::string & v) const
{
Lock l(_imp->mutex);
diff --git a/paludis/repositories/e/ebuild_id.hh b/paludis/repositories/e/ebuild_id.hh
index a76a063..5b5b73a 100644
--- a/paludis/repositories/e/ebuild_id.hh
+++ b/paludis/repositories/e/ebuild_id.hh
@@ -92,6 +92,7 @@ namespace paludis
virtual const std::tr1::shared_ptr<const MetadataSpecTreeKey<PlainTextSpecTree> > raw_myoptions_key() const;
virtual const std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > > raw_use_expand_key() const;
virtual const std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > > raw_use_expand_hidden_key() const;
+ virtual const std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > > defined_phases_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<bool> > transient_key() const;
@@ -134,6 +135,7 @@ namespace paludis
void load_upstream_release_notes(const std::string &, const std::string &, const std::string &) const;
void load_bugs_to(const std::string &, const std::string &, const std::string &) const;
void load_remote_ids(const std::string &, const std::string &, const std::string &) const;
+ void load_defined_phases(const std::string &, const std::string &, const std::string &) const;
virtual bool supports_action(const SupportsActionTestBase &) const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual void perform_action(Action &) const;