aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-05-07 20:40:09 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-05-11 14:57:59 +0100
commitaf63e305e892fdf7abbee4240cc37d9ef2658986 (patch)
tree6eb37113d751e7b2915c79dc37a8d5abf3664201
parent2c6c00d1e9dc582ca5491de1ad7b1d56b938c74e (diff)
downloadpaludis-af63e305e892fdf7abbee4240cc37d9ef2658986.tar.gz
paludis-af63e305e892fdf7abbee4240cc37d9ef2658986.tar.xz
EAPI 3 has pkg_pretend
-rw-r--r--paludis/repositories/e/e_repository_TEST.cc72
-rwxr-xr-xpaludis/repositories/e/e_repository_TEST_setup.sh30
-rw-r--r--paludis/repositories/e/eapis/3.conf5
-rw-r--r--paludis/repositories/e/ebuild/3/Makefile.am1
-rw-r--r--paludis/repositories/e/ebuild/3/pkg_pretend.bash44
5 files changed, 152 insertions, 0 deletions
diff --git a/paludis/repositories/e/e_repository_TEST.cc b/paludis/repositories/e/e_repository_TEST.cc
index d6506d8..52e61ef 100644
--- a/paludis/repositories/e/e_repository_TEST.cc
+++ b/paludis/repositories/e/e_repository_TEST.cc
@@ -1568,6 +1568,78 @@ namespace test_cases
}
} test_e_repository_install_eapi_2;
+ struct ERepositoryInstallEAPI3Test : TestCase
+ {
+ ERepositoryInstallEAPI3Test() : TestCase("install_eapi_3") { }
+
+ unsigned max_run_time() const
+ {
+ return 3000;
+ }
+
+ bool repeatable() const
+ {
+ return false;
+ }
+
+ void run()
+ {
+ TestEnvironment env;
+ env.set_paludis_command("/bin/false");
+ std::tr1::shared_ptr<Map<std::string, std::string> > keys(new Map<std::string, std::string>);
+ keys->insert("format", "ebuild");
+ keys->insert("names_cache", "/var/empty");
+ keys->insert("location", stringify(FSEntry::cwd() / "e_repository_TEST_dir" / "repo13"));
+ keys->insert("profiles", stringify(FSEntry::cwd() / "e_repository_TEST_dir" / "repo13/profiles/profile"));
+ keys->insert("layout", "traditional");
+ keys->insert("eapi_when_unknown", "0");
+ keys->insert("eapi_when_unspecified", "0");
+ keys->insert("profile_eapi", "0");
+ keys->insert("distdir", stringify(FSEntry::cwd() / "e_repository_TEST_dir" / "distdir"));
+ keys->insert("builddir", stringify(FSEntry::cwd() / "e_repository_TEST_dir" / "build"));
+ std::tr1::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
+ std::tr1::bind(from_keys, keys, std::tr1::placeholders::_1)));
+ env.package_database()->add_repository(1, repo);
+
+ std::tr1::shared_ptr<FakeInstalledRepository> installed_repo(new FakeInstalledRepository(&env, RepositoryName("installed")));
+ env.package_database()->add_repository(2, installed_repo);
+
+ InstallAction action(make_named_values<InstallActionOptions>(
+ value_for<n::destination>(installed_repo),
+ value_for<n::make_output_manager>(&make_standard_output_manager),
+ value_for<n::perform_uninstall>(&cannot_uninstall),
+ value_for<n::replacing>(make_shared_ptr(new PackageIDSequence)),
+ value_for<n::want_phase>(&want_all_phases)
+ ));
+
+ PretendAction pretend_action(make_named_values<PretendActionOptions>(
+ value_for<n::make_output_manager>(&make_standard_output_manager)
+ ));
+
+ {
+ TestMessageSuffix suffix("pkg_pretend", true);
+ const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("=cat/pkg_pretend-3",
+ &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
+ TEST_CHECK(id);
+ TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "3");
+ id->perform_action(pretend_action);
+ TEST_CHECK(! pretend_action.failed());
+ }
+
+ {
+ TestMessageSuffix suffix("pkg_pretend-failure", true);
+ const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("=cat/pkg_pretend-failure-3",
+ &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
+ TEST_CHECK(id);
+ TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "3");
+ id->perform_action(pretend_action);
+ TEST_CHECK(pretend_action.failed());
+ }
+ }
+ } test_e_repository_install_eapi_3;
+
struct ERepositoryInstallEAPIKdebuild1Test : TestCase
{
ERepositoryInstallEAPIKdebuild1Test() : TestCase("install_eapi_kdebuild_1") { }
diff --git a/paludis/repositories/e/e_repository_TEST_setup.sh b/paludis/repositories/e/e_repository_TEST_setup.sh
index 9d58ae0..4107155 100755
--- a/paludis/repositories/e/e_repository_TEST_setup.sh
+++ b/paludis/repositories/e/e_repository_TEST_setup.sh
@@ -1213,6 +1213,36 @@ pkg_setup() {
[[ $LINGUAS == "enabled_en enabled_en_GB enabled_en_GB@UTF-8" ]] || die "LINGUAS=$LINGUAS is wrong"
}
END
+mkdir -p "cat/pkg_pretend"
+cat <<"END" > cat/pkg_pretend/pkg_pretend-3.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="enabled-weasel broccoli"
+LICENSE="GPL-2"
+KEYWORDS="test"
+EAPI="3"
+
+pkg_pretend() {
+ einfo "This is my pkg_pretend. There are many like it, but this one is mine."
+}
+END
+mkdir -p "cat/pkg_pretend-failure"
+cat <<"END" > cat/pkg_pretend-failure/pkg_pretend-failure-3.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="enabled-weasel broccoli"
+LICENSE="GPL-2"
+KEYWORDS="test"
+EAPI="3"
+
+pkg_pretend() {
+ die "This is my pkg_pretend. There are many like it, but this one is mine."
+}
+END
cd ..
mkdir -p repo14/{profiles/profile,metadata,eclass} || exit 1
diff --git a/paludis/repositories/e/eapis/3.conf b/paludis/repositories/e/eapis/3.conf
index e643ef8..12c54a1 100644
--- a/paludis/repositories/e/eapis/3.conf
+++ b/paludis/repositories/e/eapis/3.conf
@@ -5,5 +5,10 @@ source ${PALUDIS_EAPIS_DIR}/2.conf
exported_name = 3
can_be_pbin = true
+ebuild_functions = ${ebuild_functions} pkg_pretend
+
ebuild_module_suffixes = 3 2 1 0
+ebuild_pretend = \
+ skipname=pretend skipifno=pretend sandbox userpriv : pretend
+
diff --git a/paludis/repositories/e/ebuild/3/Makefile.am b/paludis/repositories/e/ebuild/3/Makefile.am
index 8b015a3..b4a51af 100644
--- a/paludis/repositories/e/ebuild/3/Makefile.am
+++ b/paludis/repositories/e/ebuild/3/Makefile.am
@@ -5,6 +5,7 @@ SUBDIRS = .
libexecprog3dir = $(libexecdir)/paludis/3
libexecprog3_SCRIPTS = \
+ pkg_pretend.bash \
output_functions.bash
TESTS_ENVIRONMENT = env \
diff --git a/paludis/repositories/e/ebuild/3/pkg_pretend.bash b/paludis/repositories/e/ebuild/3/pkg_pretend.bash
new file mode 100644
index 0000000..af2cc19
--- /dev/null
+++ b/paludis/repositories/e/ebuild/3/pkg_pretend.bash
@@ -0,0 +1,44 @@
+#!/usr/bin/env bash
+# vim: set sw=4 sts=4 et :
+
+# Copyright (c) 2008 David Leverton
+#
+# Based in part upon ebuild.sh from Portage, which is Copyright 1995-2005
+# Gentoo Foundation and distributed under the terms of the GNU General
+# Public License v2.
+#
+# 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
+# Public License, version 2, as published by the Free Software Foundation.
+#
+# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+# details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+# Place, Suite 330, Boston, MA 02111-1307 USA
+
+default_pkg_nofetch()
+{
+ :
+}
+
+pkg_pretend()
+{
+ default_pkg_pretend
+}
+
+ebuild_f_pretend()
+{
+ if hasq "pretend" ${SKIP_FUNCTIONS} ; then
+ ebuild_section "Skipping pkg_pretend (SKIP_FUNCTIONS)"
+ else
+ echo
+ pkg_pretend
+ echo
+ fi
+ true
+}
+