diff options
author | 2012-09-09 19:28:00 +0100 | |
---|---|---|
committer | 2012-09-09 19:28:00 +0100 | |
commit | 9b9e198770c3980d8db91997af348f0b07fbf99e (patch) | |
tree | 95af75f4b987b22a50b0e51371f3361432678243 | |
parent | 012179625e140693f4d4b9d600dbac1d97739ed3 (diff) | |
download | paludis-9b9e198770c3980d8db91997af348f0b07fbf99e.tar.gz paludis-9b9e198770c3980d8db91997af348f0b07fbf99e.tar.xz |
Stub implementation of apply_user_patches for EAPI 5
-rwxr-xr-x | paludis/repositories/e/e_repository_TEST_4_setup.sh | 1 | ||||
-rw-r--r-- | paludis/repositories/e/e_repository_TEST_5.cc | 27 | ||||
-rwxr-xr-x | paludis/repositories/e/e_repository_TEST_5_setup.sh | 54 | ||||
-rw-r--r-- | paludis/repositories/e/eapis/5.conf | 2 | ||||
-rw-r--r-- | paludis/repositories/e/ebuild/5/Makefile.am | 2 | ||||
-rw-r--r-- | paludis/repositories/e/ebuild/5/apply_user_patches.bash | 28 | ||||
-rw-r--r-- | paludis/repositories/e/ebuild/5/src_prepare.bash | 69 |
7 files changed, 182 insertions, 1 deletions
diff --git a/paludis/repositories/e/e_repository_TEST_4_setup.sh b/paludis/repositories/e/e_repository_TEST_4_setup.sh index 27b13de25..e9205bd9f 100755 --- a/paludis/repositories/e/e_repository_TEST_4_setup.sh +++ b/paludis/repositories/e/e_repository_TEST_4_setup.sh @@ -1156,6 +1156,7 @@ pkg_pretend() { [[ -z $(type -t doheader) ]] || die [[ -z $(type -t newheader) ]] || die [[ -z ${EBUILD_PHASE_FUNC} ]] || die + [[ -z $(type -t apply_user_patches) ]] || die } END mkdir -p "cat/no-new-stdin" diff --git a/paludis/repositories/e/e_repository_TEST_5.cc b/paludis/repositories/e/e_repository_TEST_5.cc index f020a4fb8..bc9c86d2b 100644 --- a/paludis/repositories/e/e_repository_TEST_5.cc +++ b/paludis/repositories/e/e_repository_TEST_5.cc @@ -212,6 +212,33 @@ TEST(ERepository, InstallEAPI5) id->perform_action(pretend_action); ASSERT_TRUE(! pretend_action.failed()); } + + { + const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( + PackageDepSpec(parse_user_package_dep_spec("=cat/apply-user-patches-5", + &env, { })), make_null_shared_ptr(), { }))]->last()); + ASSERT_TRUE(bool(id)); + EXPECT_EQ("5", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value()); + id->perform_action(action); + } + + { + const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( + PackageDepSpec(parse_user_package_dep_spec("=cat/apply-user-patches-default-5", + &env, { })), make_null_shared_ptr(), { }))]->last()); + ASSERT_TRUE(bool(id)); + EXPECT_EQ("5", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value()); + id->perform_action(action); + } + + { + const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( + PackageDepSpec(parse_user_package_dep_spec("=cat/apply-user-patches-uncalled-5", + &env, { })), make_null_shared_ptr(), { }))]->last()); + ASSERT_TRUE(bool(id)); + EXPECT_EQ("5", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value()); + EXPECT_THROW(id->perform_action(action), ActionFailedError); + } } TEST(ERepository, RequiredUse) diff --git a/paludis/repositories/e/e_repository_TEST_5_setup.sh b/paludis/repositories/e/e_repository_TEST_5_setup.sh index 2bbf6c325..279c4aef7 100755 --- a/paludis/repositories/e/e_repository_TEST_5_setup.sh +++ b/paludis/repositories/e/e_repository_TEST_5_setup.sh @@ -356,5 +356,59 @@ pkg_pretend() { } END +mkdir -p "cat/apply-user-patches" || exit 1 +cat << 'END' > cat/apply-user-patches/apply-user-patches-5.ebuild || exit 1 +EAPI="5" +DESCRIPTION="The Description" +HOMEPAGE="http://example.com/" +SRC_URI="" +SLOT="0" +IUSE="" +LICENSE="GPL-2" +KEYWORDS="test" + +S="${WORKDIR}" + +src_prepare() { + apply_user_patches && die +} +END + +mkdir -p "cat/apply-user-patches-default" || exit 1 +cat << 'END' > cat/apply-user-patches-default/apply-user-patches-default-5.ebuild || exit 1 +EAPI="5" +DESCRIPTION="The Description" +HOMEPAGE="http://example.com/" +SRC_URI="" +SLOT="0" +IUSE="" +LICENSE="GPL-2" +KEYWORDS="test" + +S="${WORKDIR}" + +src_prepare() { + default +} +END + +mkdir -p "cat/apply-user-patches-uncalled" || exit 1 +cat << 'END' > cat/apply-user-patches-uncalled/apply-user-patches-uncalled-5.ebuild || exit 1 +EAPI="5" +DESCRIPTION="The Description" +HOMEPAGE="http://example.com/" +SRC_URI="" +SLOT="0" +IUSE="" +LICENSE="GPL-2" +KEYWORDS="test" + +S="${WORKDIR}" + +src_prepare() { + : +} +END + cd .. cd .. diff --git a/paludis/repositories/e/eapis/5.conf b/paludis/repositories/e/eapis/5.conf index 3e5fec9dc..353a4483a 100644 --- a/paludis/repositories/e/eapis/5.conf +++ b/paludis/repositories/e/eapis/5.conf @@ -18,7 +18,7 @@ utility_path_suffixes = 5 4 3 2 1 0 dependency_spec_tree_parse_options = ${dependency_spec_tree_parse_options} allow_at_most_one -load_modules = ${load_modules} usex +load_modules = ${load_modules} usex apply_user_patches use_stable_mask_force = true diff --git a/paludis/repositories/e/ebuild/5/Makefile.am b/paludis/repositories/e/ebuild/5/Makefile.am index fbcb91989..95e8612a8 100644 --- a/paludis/repositories/e/ebuild/5/Makefile.am +++ b/paludis/repositories/e/ebuild/5/Makefile.am @@ -5,7 +5,9 @@ SUBDIRS = . libexecprog5dir = $(libexecdir)/paludis/5 libexecprog5_SCRIPTS = \ + src_prepare.bash \ src_test.bash \ + apply_user_patches.bash \ usex.bash \ output_functions.bash diff --git a/paludis/repositories/e/ebuild/5/apply_user_patches.bash b/paludis/repositories/e/ebuild/5/apply_user_patches.bash new file mode 100644 index 000000000..037aede94 --- /dev/null +++ b/paludis/repositories/e/ebuild/5/apply_user_patches.bash @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2012 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 + +apply_user_patches() +{ + touch "${T}"/paludis-apply_user_patches-called + return 1 +} + diff --git a/paludis/repositories/e/ebuild/5/src_prepare.bash b/paludis/repositories/e/ebuild/5/src_prepare.bash new file mode 100644 index 000000000..3bf9bd394 --- /dev/null +++ b/paludis/repositories/e/ebuild/5/src_prepare.bash @@ -0,0 +1,69 @@ +#!/usr/bin/env bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006, 2007, 2009 Ciaran McCreesh +# Copyright (c) 2008, 2012 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_src_prepare() +{ + apply_user_patches +} + +src_prepare() +{ + default_src_prepare +} + +ebuild_f_prepare() +{ + if [[ -d "${S}" ]] ; then + cd "${S}" || die "cd to \${S} (\"${S}\") failed" + elif [[ -n "${PALUDIS_NO_S_WORKDIR_FALLBACK}" ]] ; then + die "\${S} (\"${S}\") does not exist" + elif [[ -d "${WORKDIR}" ]] ; then + cd "${WORKDIR}" || die "cd to \${WORKDIR} (\"${WORKDIR}\") failed" + fi + + if hasq "prepare" ${SKIP_FUNCTIONS} ; then + ebuild_section "Skipping src_prepare (SKIP_FUNCTIONS)" + else + if [[ $(type -t pre_src_prepare ) == "function" ]] ; then + ebuild_section "Starting pre_src_prepare" + pre_src_prepare + ebuild_section "Done pre_src_prepare" + fi + + rm -f "${T}"/paludis-apply_user_patches-called + + ebuild_section "Starting src_prepare" + src_prepare + ebuild_section "Done src_prepare" + + [[ -f "${T}"/paludis-apply_user_patches-called ]] \ + || die "apply_user_patches must be called during src_prepare" + + if [[ $(type -t post_src_prepare ) == "function" ]] ; then + ebuild_section "Starting post_src_prepare" + post_src_prepare + ebuild_section "Done post_src_prepare" + fi + fi +} + |