aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-07-05 21:07:14 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-07-05 21:07:14 +0000
commit4676ff10070fa36b7813c2860382064690ef37c5 (patch)
treefc1e9032fddaa3c45ad6fb0b8e846853b76ff072
parent3d7ecc0ab67ffdc5b88ff68706f164582458f9b6 (diff)
downloadpaludis-4676ff10070fa36b7813c2860382064690ef37c5.tar.gz
paludis-4676ff10070fa36b7813c2860382064690ef37c5.tar.xz
Add ${AA} support. Strip trailing spaces from ${A} and ${AA}, kde-meta.eclass relies upon this.
-rw-r--r--paludis/ebuild.cc2
-rw-r--r--paludis/ebuild.hh4
-rw-r--r--paludis/portage_repository.cc108
-rwxr-xr-xsrc/install_TEST_setup.sh12
4 files changed, 121 insertions, 5 deletions
diff --git a/paludis/ebuild.cc b/paludis/ebuild.cc
index de86e81..3b83690 100644
--- a/paludis/ebuild.cc
+++ b/paludis/ebuild.cc
@@ -261,6 +261,7 @@ EbuildFetchCommand::extend_command(const MakeEnvCommand & cmd)
{
MakeEnvCommand result(cmd
("A", fetch_params.get<ecfpk_a>())
+ ("AA", fetch_params.get<ecfpk_aa>())
("USE", fetch_params.get<ecfpk_use>())
("USE_EXPAND", fetch_params.get<ecfpk_use_expand>())
("FLAT_SRC_URI", fetch_params.get<ecfpk_flat_src_uri>())
@@ -306,6 +307,7 @@ EbuildInstallCommand::extend_command(const MakeEnvCommand & cmd)
{
MakeEnvCommand result(cmd
("A", install_params.get<ecipk_a>())
+ ("AA", install_params.get<ecipk_aa>())
("USE", install_params.get<ecipk_use>())
("USE_EXPAND", install_params.get<ecipk_use_expand>())
("ROOT", install_params.get<ecipk_root>())
diff --git a/paludis/ebuild.hh b/paludis/ebuild.hh
index b960ec4..6ca83e9 100644
--- a/paludis/ebuild.hh
+++ b/paludis/ebuild.hh
@@ -249,6 +249,7 @@ namespace paludis
enum EbuildFetchCommandParamsKeys
{
ecfpk_a,
+ ecfpk_aa,
ecfpk_use,
ecfpk_use_expand,
ecfpk_flat_src_uri,
@@ -270,6 +271,7 @@ namespace paludis
SmartRecordTag<comparison_mode::NoComparisonTag, void>,
SmartRecordKeys<EbuildFetchCommandParamsKeys, last_ecfpk>,
SmartRecordKey<ecfpk_a, std::string>,
+ SmartRecordKey<ecfpk_aa, std::string>,
SmartRecordKey<ecfpk_use, std::string>,
SmartRecordKey<ecfpk_use_expand, std::string>,
SmartRecordKey<ecfpk_flat_src_uri, std::string>,
@@ -323,6 +325,7 @@ namespace paludis
enum EbuildInstallCommandParamsKeys
{
ecipk_a,
+ ecipk_aa,
ecipk_use,
ecipk_use_expand,
ecipk_root,
@@ -345,6 +348,7 @@ namespace paludis
SmartRecordTag<comparison_mode::NoComparisonTag, void>,
SmartRecordKeys<EbuildInstallCommandParamsKeys, last_ecipk>,
SmartRecordKey<ecipk_a, std::string>,
+ SmartRecordKey<ecipk_aa, std::string>,
SmartRecordKey<ecipk_use, std::string>,
SmartRecordKey<ecipk_use_expand, std::string>,
SmartRecordKey<ecipk_root, std::string>,
diff --git a/paludis/portage_repository.cc b/paludis/portage_repository.cc
index bd13562..24ecdd9 100644
--- a/paludis/portage_repository.cc
+++ b/paludis/portage_repository.cc
@@ -1355,6 +1355,69 @@ PortageRepository::do_is_mirror(const std::string & s) const
return _imp->mirrors.end() != _imp->mirrors.find(s);
}
+namespace
+{
+ class AAFinder :
+ private InstantiationPolicy<AAFinder, instantiation_method::NonCopyableTag>,
+ protected DepAtomVisitorTypes::ConstVisitor
+ {
+ private:
+ mutable std::list<const StringDepAtom *> _atoms;
+
+ protected:
+ void visit(const AllDepAtom * a)
+ {
+ std::for_each(a->begin(), a->end(), accept_visitor(
+ static_cast<DepAtomVisitorTypes::ConstVisitor *>(this)));
+ }
+
+ void visit(const AnyDepAtom *) PALUDIS_ATTRIBUTE((noreturn))
+ {
+ throw InternalError(PALUDIS_HERE, "Found unexpected AnyDepAtom");
+ }
+
+ void visit(const UseDepAtom * a)
+ {
+ std::for_each(a->begin(), a->end(), accept_visitor(
+ static_cast<DepAtomVisitorTypes::ConstVisitor *>(this)));
+ }
+
+ void visit(const PlainTextDepAtom * a)
+ {
+ _atoms.push_back(a);
+ }
+
+ void visit(const PackageDepAtom * a)
+ {
+ _atoms.push_back(a);
+ }
+
+ void visit(const BlockDepAtom * a)
+ {
+ _atoms.push_back(a);
+ }
+
+ public:
+ AAFinder(const DepAtom::ConstPointer a)
+ {
+ a->accept(static_cast<DepAtomVisitorTypes::ConstVisitor *>(this));
+ }
+
+ typedef std::list<const StringDepAtom *>::const_iterator Iterator;
+
+ Iterator begin()
+ {
+ return _atoms.begin();
+ }
+
+ Iterator end() const
+ {
+ return _atoms.end();
+ }
+ };
+
+}
+
void
PortageRepository::do_install(const QualifiedPackageName & q, const VersionSpec & v,
const InstallOptions & o) const
@@ -1395,13 +1458,14 @@ PortageRepository::do_install(const QualifiedPackageName & q, const VersionSpec
(restricts.end() != std::find(restricts.begin(), restricts.end(), "nomirror"));
}
- std::string archives, flat_src_uri;
+ std::string archives, all_archives, flat_src_uri;
{
std::set<std::string> already_in_archives;
- DepAtomFlattener f(_imp->env, &e,
- PortageDepParser::parse(metadata->get_ebuild_interface()->get<evm_src_uri>(),
+ /* make A and FLAT_SRC_URI */
+ DepAtom::ConstPointer f_atom(PortageDepParser::parse(metadata->get_ebuild_interface()->get<evm_src_uri>(),
PortageDepParserPolicy<PlainTextDepAtom, false>::get_instance()));
+ DepAtomFlattener f(_imp->env, &e, f_atom);
for (DepAtomFlattener::Iterator ff(f.begin()), ff_end(f.end()) ; ff != ff_end ; ++ff)
{
@@ -1478,6 +1542,35 @@ PortageRepository::do_install(const QualifiedPackageName & q, const VersionSpec
flat_src_uri.append(*m + "/" + (*ff)->text().substr(p + 1) + " ");
}
}
+
+ /* make AA */
+ DepAtom::ConstPointer g_atom(PortageDepParser::parse(
+ metadata->get_ebuild_interface()->get<evm_src_uri>(),
+ PortageDepParserPolicy<PlainTextDepAtom, false>::get_instance()));
+ AAFinder g(g_atom);
+ std::set<std::string> already_in_all_archives;
+
+ for (AAFinder::Iterator gg(g.begin()), gg_end(g.end()) ; gg != gg_end ; ++gg)
+ {
+ std::string::size_type p((*gg)->text().rfind('/'));
+ if (std::string::npos == p)
+ {
+ if (already_in_all_archives.end() == already_in_all_archives.find((*gg)->text()))
+ {
+ all_archives.append((*gg)->text());
+ already_in_all_archives.insert((*gg)->text());
+ }
+ }
+ else
+ {
+ if (already_in_all_archives.end() == already_in_all_archives.find((*gg)->text().substr(p + 1)))
+ {
+ all_archives.append((*gg)->text().substr(p + 1));
+ already_in_all_archives.insert((*gg)->text().substr(p + 1));
+ }
+ }
+ all_archives.append(" ");
+ }
}
std::string use;
@@ -1532,6 +1625,13 @@ PortageRepository::do_install(const QualifiedPackageName & q, const VersionSpec
expand_vars.insert(std::make_pair(stringify(*u), value));
}
+ /* Strip trailing space. Some ebuilds rely upon this. From kde-meta.eclass:
+ * [[ -n ${A/${TARBALL}/} ]] && unpack ${A/${TARBALL}/}
+ * Rather annoying.
+ */
+ archives = strip_trailing(archives, " ");
+ all_archives = strip_trailing(all_archives, " ");
+
EbuildFetchCommand fetch_cmd(EbuildCommandParams::create((
param<ecpk_environment>(_imp->env),
param<ecpk_db_entry>(&e),
@@ -1546,6 +1646,7 @@ PortageRepository::do_install(const QualifiedPackageName & q, const VersionSpec
)),
EbuildFetchCommandParams::create((
param<ecfpk_a>(archives),
+ param<ecfpk_aa>(all_archives),
param<ecfpk_use>(use),
param<ecfpk_use_expand>(join(_imp->expand_list.begin(),
_imp->expand_list.end(), " ")),
@@ -1577,6 +1678,7 @@ PortageRepository::do_install(const QualifiedPackageName & q, const VersionSpec
EbuildInstallCommandParams::create((
param<ecipk_use>(use),
param<ecipk_a>(archives),
+ param<ecipk_aa>(all_archives),
param<ecipk_use_expand>(join(_imp->expand_list.begin(),
_imp->expand_list.end(), " ")),
param<ecipk_expand_vars>(expand_vars),
diff --git a/src/install_TEST_setup.sh b/src/install_TEST_setup.sh
index 3cbc573..b511e8e 100755
--- a/src/install_TEST_setup.sh
+++ b/src/install_TEST_setup.sh
@@ -84,9 +84,9 @@ inherit foo
DESCRIPTION="Test target"
HOMEPAGE="http://paludis.berlios.de/"
-SRC_URI="http://invalid.domain/${P}.tar.gz"
+SRC_URI="http://invalid.domain/${P}.tar.gz oink? ( http://example.com/foo.tar.gz )"
SLOT="0"
-IUSE=""
+IUSE="oink"
LICENSE="GPL-2"
KEYWORDS="test"
@@ -97,6 +97,14 @@ pkg_setup() {
[[ ${PROFILE_ORDERING:-0} != 2 ]] && die "bad profile source ordering"
}
+src_unpack() {
+ hasq "${P}.tar.gz" ${A} || die
+ hasq "${P}.tar.gz" ${AA} || die
+ hasq "foo.tar.gz" ${A} && die
+ hasq "foo.tar.gz" ${AA} || die
+ unpack ${A}
+}
+
src_compile() {
inherit_was_ok || die "inherit didn't work"
}