aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-03-10 19:52:56 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-03-10 19:52:56 +0000
commitd1a64b0b441552842f9627843df2fc9ada84c825 (patch)
tree222d9e86e3c5d8da912ca3f0ed10a9f6a6ed87d0
parent980669944323ea90dfca23d462ea67ed86b46fa7 (diff)
downloadpaludis-d1a64b0b441552842f9627843df2fc9ada84c825.tar.gz
paludis-d1a64b0b441552842f9627843df2fc9ada84c825.tar.xz
More quoting tests
-rw-r--r--paludis/repositories/gentoo/ebuild.cc3
-rw-r--r--paludis/repositories/gentoo/ebuild.sr1
-rw-r--r--paludis/repositories/gentoo/ebuild/builtin_metadata.bash3
-rw-r--r--paludis/repositories/gentoo/ebuild_entries.cc1
-rw-r--r--paludis/repositories/gentoo/portage_repository_TEST.cc44
-rwxr-xr-xpaludis/repositories/gentoo/portage_repository_TEST_setup.sh9
6 files changed, 43 insertions, 18 deletions
diff --git a/paludis/repositories/gentoo/ebuild.cc b/paludis/repositories/gentoo/ebuild.cc
index b376113..e7d4d4e 100644
--- a/paludis/repositories/gentoo/ebuild.cc
+++ b/paludis/repositories/gentoo/ebuild.cc
@@ -382,6 +382,9 @@ EbuildInstallCommand::extend_command(const Command & cmd)
j(install_params.expand_vars->end()) ; i != j ; ++i)
result.with_setenv(i->first, i->second);
+ if (ebuild_ip_build == install_params.phase && ! install_params.no_userpriv)
+ result.with_uid_gid(params.environment->reduced_uid(), params.environment->reduced_gid());
+
return result;
}
diff --git a/paludis/repositories/gentoo/ebuild.sr b/paludis/repositories/gentoo/ebuild.sr
index 2f7a88d..ccc2b2e 100644
--- a/paludis/repositories/gentoo/ebuild.sr
+++ b/paludis/repositories/gentoo/ebuild.sr
@@ -61,6 +61,7 @@ make_class_EbuildInstallCommandParams()
key profiles "std::tr1::shared_ptr<const FSEntryCollection>"
key expand_vars "std::tr1::shared_ptr<const AssociativeCollection<std::string, std::string> >"
key disable_cfgpro bool
+ key no_userpriv bool
key debug_build InstallDebugOption
key slot SlotName
key phase EbuildInstallCommandPhase
diff --git a/paludis/repositories/gentoo/ebuild/builtin_metadata.bash b/paludis/repositories/gentoo/ebuild/builtin_metadata.bash
index dbc951f..2170925 100644
--- a/paludis/repositories/gentoo/ebuild/builtin_metadata.bash
+++ b/paludis/repositories/gentoo/ebuild/builtin_metadata.bash
@@ -1,7 +1,7 @@
#!/bin/bash
# vim: set sw=4 sts=4 et :
-# Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+# Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
#
# Based in part upon ebuild.sh from Portage, which is Copyright 1995-2005
# Gentoo Foundation and distributed under the terms of the GNU General
@@ -31,6 +31,7 @@ ebuild_f_metadata()
local k=${!key}
k=${k/\\/\\\\}
k=${k/\"/\\\"}
+ k=${k/\$/\\\$}
echo "${key}=\""${k}"\""
set +o noglob
done
diff --git a/paludis/repositories/gentoo/ebuild_entries.cc b/paludis/repositories/gentoo/ebuild_entries.cc
index a3b338f..c9b0955 100644
--- a/paludis/repositories/gentoo/ebuild_entries.cc
+++ b/paludis/repositories/gentoo/ebuild_entries.cc
@@ -500,6 +500,7 @@ EbuildEntries::install(const QualifiedPackageName & q, const VersionSpec & v,
.config_protect_mask(_imp->portage_repository->profile_variable("CONFIG_PROTECT_MASK"))
.loadsaveenv_dir(_imp->params.buildroot / stringify(q.category) / (
stringify(q.package) + "-" + stringify(v)) / "temp")
+ .no_userpriv(false)
.slot(SlotName(metadata->slot)));
EbuildInstallCommand build_cmd(command_params, install_params);
diff --git a/paludis/repositories/gentoo/portage_repository_TEST.cc b/paludis/repositories/gentoo/portage_repository_TEST.cc
index 563c2c1..a3aaab3 100644
--- a/paludis/repositories/gentoo/portage_repository_TEST.cc
+++ b/paludis/repositories/gentoo/portage_repository_TEST.cc
@@ -522,24 +522,34 @@ namespace test_cases
void run()
{
- TestEnvironment env;
- std::tr1::shared_ptr<AssociativeCollection<std::string, std::string> > keys(
- new AssociativeCollection<std::string, std::string>::Concrete);
- keys->insert("format", "ebuild");
- keys->insert("names_cache", "/var/empty");
- keys->insert("location", "portage_repository_TEST_dir/repo7");
- keys->insert("profiles", "portage_repository_TEST_dir/repo7/profiles/profile");
- std::tr1::shared_ptr<PortageRepository> repo(make_ebuild_repository(
- &env, keys));
-
- for (int pass = 1 ; pass <= 2 ; ++pass)
+ for (int opass = 1 ; opass <= 3 ; ++opass)
{
- TestMessageSuffix pass_suffix(stringify(pass), true);
- std::tr1::shared_ptr<const VersionMetadata> m;
-
- m = repo->version_metadata(QualifiedPackageName("cat-one/pkg-one"), VersionSpec("1"));
- TEST_CHECK_EQUAL(m->description, "The Description");
- TEST_CHECK_EQUAL(m->eapi, "0");
+ TestMessageSuffix opass_suffix("opass=" + stringify(opass), true);
+
+ TestEnvironment env;
+ std::tr1::shared_ptr<AssociativeCollection<std::string, std::string> > keys(
+ new AssociativeCollection<std::string, std::string>::Concrete);
+ keys->insert("format", "ebuild");
+ keys->insert("names_cache", "/var/empty");
+ keys->insert("write_cache", "portage_repository_TEST_dir/repo7/metadata/cache");
+ keys->insert("location", "portage_repository_TEST_dir/repo7");
+ keys->insert("profiles", "portage_repository_TEST_dir/repo7/profiles/profile");
+ std::tr1::shared_ptr<PortageRepository> repo(make_ebuild_repository(
+ &env, keys));
+
+ for (int pass = 1 ; pass <= 3 ; ++pass)
+ {
+ TestMessageSuffix pass_suffix("pass=" + stringify(pass), true);
+ std::tr1::shared_ptr<const VersionMetadata> m;
+
+ m = repo->version_metadata(QualifiedPackageName("cat-one/pkg-one"), VersionSpec("1"));
+ TEST_CHECK_EQUAL(m->description, "The Description");
+ TEST_CHECK_EQUAL(m->eapi, "0");
+
+ m = repo->version_metadata(QualifiedPackageName("cat-one/pkg-one"), VersionSpec("2"));
+ TEST_CHECK_EQUAL(m->description, "dquote \" squote ' backslash \\ dollar $");
+ TEST_CHECK_EQUAL(m->eapi, "0");
+ }
}
}
} test_portage_repository_metadata_uncached;
diff --git a/paludis/repositories/gentoo/portage_repository_TEST_setup.sh b/paludis/repositories/gentoo/portage_repository_TEST_setup.sh
index 5fc9373..9262151 100755
--- a/paludis/repositories/gentoo/portage_repository_TEST_setup.sh
+++ b/paludis/repositories/gentoo/portage_repository_TEST_setup.sh
@@ -134,6 +134,15 @@ IUSE=""
LICENSE="GPL-2"
KEYWORDS="test"
END
+cat <<"END" > cat-one/pkg-one/pkg-one-2.ebuild || exit 1
+DESCRIPTION="dquote \" squote ' backslash \\ dollar \$"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE=""
+LICENSE="GPL-2"
+KEYWORDS="test"
+END
cat <<END > cat-one/pkg-two/pkg-two-1.ebuild || exit 1
i am a fish
END