diff options
author | 2015-11-05 18:21:15 +0000 | |
---|---|---|
committer | 2015-11-05 18:21:15 +0000 | |
commit | 5b89f3bd40d17d06e3a1f26471461a3ae544c676 (patch) | |
tree | 34df88fbbcf80c1e7a76080f73facbb721e7b84f | |
parent | 55daefe197646bff5cfb39e63b9554528b74f0b4 (diff) | |
download | paludis-5b89f3bd40d17d06e3a1f26471461a3ae544c676.tar.gz paludis-5b89f3bd40d17d06e3a1f26471461a3ae544c676.tar.xz |
EAPI 6 default_src_prepare uses eapply
-rw-r--r-- | paludis/repositories/e/e_repository_TEST_5.cc | 9 | ||||
-rwxr-xr-x | paludis/repositories/e/e_repository_TEST_5_setup.sh | 31 | ||||
-rw-r--r-- | paludis/repositories/e/e_repository_TEST_6.cc | 45 | ||||
-rwxr-xr-x | paludis/repositories/e/e_repository_TEST_6_setup.sh | 181 | ||||
-rw-r--r-- | paludis/repositories/e/ebuild/6/Makefile.am | 3 | ||||
-rw-r--r-- | paludis/repositories/e/ebuild/6/src_prepare.bash | 71 |
6 files changed, 339 insertions, 1 deletions
diff --git a/paludis/repositories/e/e_repository_TEST_5.cc b/paludis/repositories/e/e_repository_TEST_5.cc index 0762d5a19..c482655b8 100644 --- a/paludis/repositories/e/e_repository_TEST_5.cc +++ b/paludis/repositories/e/e_repository_TEST_5.cc @@ -357,6 +357,15 @@ TEST(ERepository, InstallEAPI5) 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/default_src_prepare-5", + &env, { })), nullptr, { }))]->last()); + ASSERT_TRUE(bool(id)); + EXPECT_EQ("5", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value()); + id->perform_action(action); + } } 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 8f7533243..3e546ffe1 100755 --- a/paludis/repositories/e/e_repository_TEST_5_setup.sh +++ b/paludis/repositories/e/e_repository_TEST_5_setup.sh @@ -704,6 +704,37 @@ src_prepare() { } END +mkdir -p "cat/default_src_prepare/files" || exit 1 +cat << 'END' > cat/default_src_prepare/default_src_prepare-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_unpack() { + echo first > file || die +} + +PATCHES="${FILESDIR}/first.patch" + +src_configure() { + [[ $(< file) == first ]] || die file +} +END +cat << 'END' > cat/default_src_prepare/files/first.patch || exit 1 +--- directory/file ++++ directory/file +@@ -1 +1 @@ +-first ++second +END + mkdir -p "cat/subslots" || exit 1 cat << 'END' > cat/subslots/subslots-5.ebuild || exit 1 EAPI="5" diff --git a/paludis/repositories/e/e_repository_TEST_6.cc b/paludis/repositories/e/e_repository_TEST_6.cc index 654ef9384..0cda4f83f 100644 --- a/paludis/repositories/e/e_repository_TEST_6.cc +++ b/paludis/repositories/e/e_repository_TEST_6.cc @@ -652,5 +652,50 @@ TEST(ERepository, InstallEAPI6) EXPECT_EQ("6", 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/default_src_prepare-nothing-6", + &env, { })), nullptr, { }))]->last()); + ASSERT_TRUE(bool(id)); + EXPECT_EQ("6", 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/default_src_prepare-PATCHES-6", + &env, { })), nullptr, { }))]->last()); + ASSERT_TRUE(bool(id)); + EXPECT_EQ("6", 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/default_src_prepare-empty-PATCHES-6", + &env, { })), nullptr, { }))]->last()); + ASSERT_TRUE(bool(id)); + EXPECT_EQ("6", 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/default_src_prepare-PATCHES-array-6", + &env, { })), nullptr, { }))]->last()); + ASSERT_TRUE(bool(id)); + EXPECT_EQ("6", 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/default_src_prepare-empty-PATCHES-array-6", + &env, { })), nullptr, { }))]->last()); + ASSERT_TRUE(bool(id)); + EXPECT_EQ("6", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value()); + id->perform_action(action); + } } diff --git a/paludis/repositories/e/e_repository_TEST_6_setup.sh b/paludis/repositories/e/e_repository_TEST_6_setup.sh index 7fe6bcc72..94d05cc2c 100755 --- a/paludis/repositories/e/e_repository_TEST_6_setup.sh +++ b/paludis/repositories/e/e_repository_TEST_6_setup.sh @@ -1762,5 +1762,186 @@ src_prepare() { } END +mkdir -p "cat/default_src_prepare-nothing/files" || exit 1 +cat << 'END' > cat/default_src_prepare-nothing/default_src_prepare-nothing-6.ebuild || exit 1 +EAPI="6" +DESCRIPTION="The Description" +HOMEPAGE="http://example.com/" +SRC_URI="" +SLOT="0" +IUSE="" +LICENSE="GPL-2" +KEYWORDS="test" + +S=${WORKDIR} + +src_unpack() { + echo first > file || die +} + +src_configure() { + [[ $(< file) == first ]] || die file +} +END +cat << 'END' > cat/default_src_prepare-nothing/files/first.patch || exit 1 +--- directory/file ++++ directory/file +@@ -1 +1 @@ +-first ++second +END + +mkdir -p "cat/default_src_prepare-PATCHES/files" || exit 1 +cat << 'END' > cat/default_src_prepare-PATCHES/default_src_prepare-PATCHES-6.ebuild || exit 1 +EAPI="6" +DESCRIPTION="The Description" +HOMEPAGE="http://example.com/" +SRC_URI="" +SLOT="0" +IUSE="" +LICENSE="GPL-2" +KEYWORDS="test" + +S=${WORKDIR} + +PATCHES="-p0 ${FILESDIR}/first.patch ${FILESDIR}/second-*.patch" + +src_unpack() { + echo first > file || die +} + +src_configure() { + [[ $(< file) == fourth ]] || die file +} +END +cat << 'END' > cat/default_src_prepare-PATCHES/files/first.patch || exit 1 +--- file ++++ file +@@ -1 +1 @@ +-first ++second +END +cat << 'END' > cat/default_src_prepare-PATCHES/files/second-1.patch || exit 1 +--- file ++++ file +@@ -1 +1 @@ +-second ++third +END +cat << 'END' > cat/default_src_prepare-PATCHES/files/second-2.patch || exit 1 +--- file ++++ file +@@ -1 +1 @@ +-third ++fourth +END + +mkdir -p "cat/default_src_prepare-empty-PATCHES/files" || exit 1 +cat << 'END' > cat/default_src_prepare-empty-PATCHES/default_src_prepare-empty-PATCHES-6.ebuild || exit 1 +EAPI="6" +DESCRIPTION="The Description" +HOMEPAGE="http://example.com/" +SRC_URI="" +SLOT="0" +IUSE="" +LICENSE="GPL-2" +KEYWORDS="test" + +S=${WORKDIR} + +src_unpack() { + echo first > file || die +} + +PATCHES="" + +src_configure() { + [[ $(< file) == first ]] || die file +} +END +cat << 'END' > cat/default_src_prepare-empty-PATCHES/files/first.patch || exit 1 +--- directory/file ++++ directory/file +@@ -1 +1 @@ +-first ++second +END + +mkdir -p "cat/default_src_prepare-PATCHES-array/files" || exit 1 +cat << 'END' > cat/default_src_prepare-PATCHES-array/default_src_prepare-PATCHES-array-6.ebuild || exit 1 +EAPI="6" +DESCRIPTION="The Description" +HOMEPAGE="http://example.com/" +SRC_URI="" +SLOT="0" +IUSE="" +LICENSE="GPL-2" +KEYWORDS="test" + +S=${WORKDIR} + +PATCHES=( -p0 "${FILESDIR}/first with spaces.patch" "${FILESDIR}"/second-{1,2}.patch ) + +src_unpack() { + echo first > file || die +} + +src_configure() { + [[ $(< file) == fourth ]] || die file +} +END +cat << 'END' > cat/default_src_prepare-PATCHES-array/files/"first with spaces".patch || exit 1 +--- file ++++ file +@@ -1 +1 @@ +-first ++second +END +cat << 'END' > cat/default_src_prepare-PATCHES-array/files/second-1.patch || exit 1 +--- file ++++ file +@@ -1 +1 @@ +-second ++third +END +cat << 'END' > cat/default_src_prepare-PATCHES-array/files/second-2.patch || exit 1 +--- file ++++ file +@@ -1 +1 @@ +-third ++fourth +END + +mkdir -p "cat/default_src_prepare-empty-PATCHES-array/files" || exit 1 +cat << 'END' > cat/default_src_prepare-empty-PATCHES-array/default_src_prepare-empty-PATCHES-array-6.ebuild || exit 1 +EAPI="6" +DESCRIPTION="The Description" +HOMEPAGE="http://example.com/" +SRC_URI="" +SLOT="0" +IUSE="" +LICENSE="GPL-2" +KEYWORDS="test" + +S=${WORKDIR} + +src_unpack() { + echo first > file || die +} + +PATCHES=( ) + +src_configure() { + [[ $(< file) == first ]] || die file +} +END +cat << 'END' > cat/default_src_prepare-empty-PATCHES-array/files/first.patch || exit 1 +--- directory/file ++++ directory/file +@@ -1 +1 @@ +-first ++second +END + cd .. cd .. diff --git a/paludis/repositories/e/ebuild/6/Makefile.am b/paludis/repositories/e/ebuild/6/Makefile.am index 6c9ad46fd..0511c3462 100644 --- a/paludis/repositories/e/ebuild/6/Makefile.am +++ b/paludis/repositories/e/ebuild/6/Makefile.am @@ -9,7 +9,8 @@ libexecprog6_SCRIPTS = \ list_functions.bash \ multilib_functions.bash \ output_functions.bash \ - src_install.bash + src_install.bash \ + src_prepare.bash TESTS = check_SCRIPTS = $(TESTS) diff --git a/paludis/repositories/e/ebuild/6/src_prepare.bash b/paludis/repositories/e/ebuild/6/src_prepare.bash new file mode 100644 index 000000000..17cc37da8 --- /dev/null +++ b/paludis/repositories/e/ebuild/6/src_prepare.bash @@ -0,0 +1,71 @@ +#!/usr/bin/env bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006, 2007, 2009 Ciaran McCreesh +# Copyright (c) 2008, 2015 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() +{ + if ! declare -p PATCHES >/dev/null 2>&1 ; then + : + elif declare -p PATCHES | grep -q '^declare -a ' ; then + [[ ${#PATCHES[@]} -gt 0 ]] && eapply "${PATCHES[@]}" + else + [[ -n ${PATCHES} ]] && eapply ${PATCHES} + fi + eapply_user +} + +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 + + ebuild_section "Starting src_prepare" + src_prepare + ebuild_section "Done 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 +} + |