aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-08-11 12:47:55 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-08-11 13:18:42 +0100
commit6d18970e238796c91d23480ff4df2787d1f41321 (patch)
treef247e307c0a036c70cbefba0a3f732131b272f42
parent3a162abca5d5449d2f5d43b2494440866f1984c3 (diff)
downloadpaludis-6d18970e238796c91d23480ff4df2787d1f41321.tar.gz
paludis-6d18970e238796c91d23480ff4df2787d1f41321.tar.xz
Begone, forces of check_license and demons of stupid design!
-rw-r--r--paludis/repositories/e/e_repository.cc46
-rw-r--r--paludis/repositories/e/eapi.cc1
-rw-r--r--paludis/repositories/e/eapi.hh2
-rw-r--r--paludis/repositories/e/eapis/0.conf1
-rw-r--r--paludis/repositories/e/ebuild.cc3
-rw-r--r--paludis/repositories/e/ebuild.hh2
6 files changed, 54 insertions, 1 deletions
diff --git a/paludis/repositories/e/e_repository.cc b/paludis/repositories/e/e_repository.cc
index 9dbcbc8..b5dfec6 100644
--- a/paludis/repositories/e/e_repository.cc
+++ b/paludis/repositories/e/e_repository.cc
@@ -2231,6 +2231,37 @@ namespace
{
return s->end() != s->find(f);
}
+
+ struct AcceptLicenseFinder
+ {
+ std::stringstream s;
+
+ AcceptLicenseFinder()
+ {
+ s << "*";
+ }
+
+ void visit(const LicenseSpecTree::NodeType<AllDepSpec>::Type & node)
+ {
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
+ }
+
+ void visit(const LicenseSpecTree::NodeType<AnyDepSpec>::Type & node)
+ {
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
+ }
+
+ void visit(const LicenseSpecTree::NodeType<ConditionalDepSpec>::Type & node)
+ {
+ if (node.spec()->condition_met())
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
+ }
+
+ void visit(const LicenseSpecTree::NodeType<LicenseDepSpec>::Type & node)
+ {
+ s << " " << node.spec()->text();
+ }
+ };
}
void
@@ -2269,7 +2300,7 @@ ERepository::install(const std::shared_ptr<const ERepositoryID> & id,
std::bind(std::equal_to<std::string>(), std::bind(std::mem_fn(&StringDepSpec::text), _1), "nostrip"));
}
- std::string archives, all_archives;
+ std::string archives, all_archives, accept_license;
{
std::set<std::string> already_in_archives;
@@ -2310,6 +2341,18 @@ ERepository::install(const std::shared_ptr<const ERepositoryID> & id,
}
else
all_archives = "AA-not-set-for-this-EAPI";
+
+ /* make ACCEPT_LICENSE */
+ if (! id->eapi()->supported()->ebuild_environment_variables()->env_accept_license().empty())
+ {
+ AcceptLicenseFinder g;
+ if (id->license_key())
+ id->license_key()->value()->root()->accept(g);
+
+ accept_license = g.s.str();
+ }
+ else
+ accept_license = "ACCEPT_LICENSE-not-set-for-this-EAPI";
}
/* Strip trailing space. Some ebuilds rely upon this. From kde-meta.eclass:
@@ -2504,6 +2547,7 @@ ERepository::install(const std::shared_ptr<const ERepositoryID> & id,
make_named_values<EbuildInstallCommandParams>(
n::a() = archives,
n::aa() = all_archives,
+ n::accept_license() = accept_license,
n::config_protect() = environment_updated_profile_variable("CONFIG_PROTECT"),
n::config_protect_mask() = environment_updated_profile_variable("CONFIG_PROTECT_MASK"),
n::expand_vars() = expand_vars,
diff --git a/paludis/repositories/e/eapi.cc b/paludis/repositories/e/eapi.cc
index dfce2e5..31754b7 100644
--- a/paludis/repositories/e/eapi.cc
+++ b/paludis/repositories/e/eapi.cc
@@ -75,6 +75,7 @@ namespace
n::env_a() = check_get(k, "env_a"),
n::env_aa() = check_get(k, "env_aa"),
n::env_accept_keywords() = check_get(k, "env_accept_keywords"),
+ n::env_accept_license() = check_get(k, "env_accept_license"),
n::env_arch() = check_get(k, "env_arch"),
n::env_d() = check_get(k, "env_d"),
n::env_distdir() = check_get(k, "env_distdir"),
diff --git a/paludis/repositories/e/eapi.hh b/paludis/repositories/e/eapi.hh
index 5085cc4..f14e9ad 100644
--- a/paludis/repositories/e/eapi.hh
+++ b/paludis/repositories/e/eapi.hh
@@ -84,6 +84,7 @@ namespace paludis
typedef Name<struct env_a_name> env_a;
typedef Name<struct env_aa_name> env_aa;
typedef Name<struct env_accept_keywords_name> env_accept_keywords;
+ typedef Name<struct env_accept_license_name> env_accept_license;
typedef Name<struct env_arch_name> env_arch;
typedef Name<struct env_d_name> env_d;
typedef Name<struct env_distdir_name> env_distdir;
@@ -300,6 +301,7 @@ namespace paludis
NamedValue<n::env_a, std::string> env_a;
NamedValue<n::env_aa, std::string> env_aa;
NamedValue<n::env_accept_keywords, std::string> env_accept_keywords;
+ NamedValue<n::env_accept_license, std::string> env_accept_license;
NamedValue<n::env_arch, std::string> env_arch;
NamedValue<n::env_d, std::string> env_d;
NamedValue<n::env_distdir, std::string> env_distdir;
diff --git a/paludis/repositories/e/eapis/0.conf b/paludis/repositories/e/eapis/0.conf
index fab2136..7b798f2 100644
--- a/paludis/repositories/e/eapis/0.conf
+++ b/paludis/repositories/e/eapis/0.conf
@@ -238,6 +238,7 @@ env_aa = AA
env_arch = ARCH
env_kv = KV
env_accept_keywords = ACCEPT_KEYWORDS
+env_accept_license = ACCEPT_LICENSE
env_portdir = PORTDIR
env_distdir = DISTDIR
env_d = D
diff --git a/paludis/repositories/e/ebuild.cc b/paludis/repositories/e/ebuild.cc
index d1d8e09..5b6a976 100644
--- a/paludis/repositories/e/ebuild.cc
+++ b/paludis/repositories/e/ebuild.cc
@@ -834,6 +834,9 @@ EbuildInstallCommand::extend_command(const Command & cmd)
if (! params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_aa().empty())
result.with_setenv(params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_aa(),
install_params.aa());
+ if (! params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_accept_license().empty())
+ result.with_setenv(params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_accept_license(),
+ install_params.accept_license());
if (! params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_use().empty())
result.with_setenv(params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_use(),
install_params.use());
diff --git a/paludis/repositories/e/ebuild.hh b/paludis/repositories/e/ebuild.hh
index 1a1d215..5c4bfc9 100644
--- a/paludis/repositories/e/ebuild.hh
+++ b/paludis/repositories/e/ebuild.hh
@@ -44,6 +44,7 @@ namespace paludis
{
typedef Name<struct a_name> a;
typedef Name<struct aa_name> aa;
+ typedef Name<struct accept_license_name> accept_license;
typedef Name<struct binary_dist_base_name> binary_dist_base;
typedef Name<struct binary_distdir_name> binary_distdir;
typedef Name<struct binary_ebuild_location_name> binary_ebuild_location;
@@ -175,6 +176,7 @@ namespace paludis
{
NamedValue<n::a, std::string> a;
NamedValue<n::aa, std::string> aa;
+ NamedValue<n::accept_license, std::string> accept_license;
NamedValue<n::config_protect, std::string> config_protect;
NamedValue<n::config_protect_mask, std::string> config_protect_mask;
NamedValue<n::expand_vars, std::shared_ptr<const Map<std::string, std::string> > > expand_vars;