diff options
author | 2012-09-09 17:45:19 +0100 | |
---|---|---|
committer | 2012-09-09 17:45:19 +0100 | |
commit | 612c59bbbc5ead5a40c7d4970ac6fff486ab9c22 (patch) | |
tree | d72268d29bdbaaa5e93bf05df3eb9d698da9396f | |
parent | 2f0c98385684988519b9fb163448f5816c7fc3d2 (diff) | |
download | paludis-612c59bbbc5ead5a40c7d4970ac6fff486ab9c22.tar.gz paludis-612c59bbbc5ead5a40c7d4970ac6fff486ab9c22.tar.xz |
doheader and newheader for EAPI 5
-rw-r--r-- | configure.ac | 1 | ||||
-rw-r--r-- | paludis/repositories/e/e_repository_TEST_4.cc | 4 | ||||
-rwxr-xr-x | paludis/repositories/e/e_repository_TEST_4_setup.sh | 8 | ||||
-rw-r--r-- | paludis/repositories/e/e_repository_TEST_5.cc | 54 | ||||
-rwxr-xr-x | paludis/repositories/e/e_repository_TEST_5_setup.sh | 67 | ||||
-rw-r--r-- | paludis/repositories/e/ebuild/utils/5/Makefile.am | 15 | ||||
-rwxr-xr-x | paludis/repositories/e/ebuild/utils/5/doheader | 31 | ||||
-rwxr-xr-x | paludis/repositories/e/ebuild/utils/5/newheader | 43 | ||||
-rw-r--r-- | paludis/repositories/e/ebuild/utils/Makefile.am | 2 |
9 files changed, 218 insertions, 7 deletions
diff --git a/configure.ac b/configure.ac index 9aad5bdd3..bfa9005d8 100644 --- a/configure.ac +++ b/configure.ac @@ -1835,6 +1835,7 @@ AC_CONFIG_FILES([ paludis/repositories/e/ebuild/pbin-1/Makefile paludis/repositories/e/ebuild/utils/Makefile paludis/repositories/e/ebuild/utils/4/Makefile + paludis/repositories/e/ebuild/utils/5/Makefile paludis/repositories/e/ebuild/utils/exheres-0/Makefile paludis/repositories/fake/Makefile paludis/repositories/gemcutter/Makefile diff --git a/paludis/repositories/e/e_repository_TEST_4.cc b/paludis/repositories/e/e_repository_TEST_4.cc index c9fdfe286..c25868245 100644 --- a/paludis/repositories/e/e_repository_TEST_4.cc +++ b/paludis/repositories/e/e_repository_TEST_4.cc @@ -552,7 +552,7 @@ TEST(ERepository, RequiredUse) } } -TEST(ERepository, NoUseX) +TEST(ERepository, NoEAPI5Commands) { FSPath root(FSPath::cwd() / "e_repository_TEST_4_dir" / "root"); @@ -589,7 +589,7 @@ TEST(ERepository, NoUseX) )); const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( - PackageDepSpec(parse_user_package_dep_spec("=cat/no-usex-4::test-repo", + PackageDepSpec(parse_user_package_dep_spec("=cat/no-eapi5-commands-4::test-repo", &env, { })), make_null_shared_ptr(), { }))]->last()); ASSERT_TRUE(bool(id)); EXPECT_EQ("4", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value()); diff --git a/paludis/repositories/e/e_repository_TEST_4_setup.sh b/paludis/repositories/e/e_repository_TEST_4_setup.sh index 2375aeb6b..24482a5bc 100755 --- a/paludis/repositories/e/e_repository_TEST_4_setup.sh +++ b/paludis/repositories/e/e_repository_TEST_4_setup.sh @@ -1194,8 +1194,8 @@ src_configure() { [[ $(use_enable cheese cheese "") == --enable-cheese= ]] || die } END -mkdir -p "cat/no-usex" -cat <<'END' > cat/no-usex/no-usex-4.ebuild || exit 1 +mkdir -p "cat/no-eapi5-commands" +cat <<'END' > cat/no-eapi5-commands/no-eapi5-commands-4.ebuild || exit 1 EAPI="4" DESCRIPTION="The Description" HOMEPAGE="http://example.com/" @@ -1207,7 +1207,9 @@ KEYWORDS="test" S=${WORKDIR} pkg_pretend() { - [[ -z $(type -t usex) ]] || die + [[ -z $(type -t usex) ]] || die + [[ -z $(type -t doheader) ]] || die + [[ -z $(type -t newheader) ]] || 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 f0e255884..9d700c926 100644 --- a/paludis/repositories/e/e_repository_TEST_5.cc +++ b/paludis/repositories/e/e_repository_TEST_5.cc @@ -311,3 +311,57 @@ TEST(ERepository, NewStdin) } } +TEST(ERepository, Doheader) +{ + FSPath root(FSPath::cwd() / "e_repository_TEST_5_dir" / "root"); + + TestEnvironment env; + std::shared_ptr<Map<std::string, std::string> > keys(std::make_shared<Map<std::string, std::string>>()); + keys->insert("format", "e"); + keys->insert("names_cache", "/var/empty"); + keys->insert("location", stringify(FSPath::cwd() / "e_repository_TEST_5_dir" / "repo")); + keys->insert("profiles", stringify(FSPath::cwd() / "e_repository_TEST_5_dir" / "repo/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(FSPath::cwd() / "e_repository_TEST_5_dir" / "distdir")); + keys->insert("builddir", stringify(FSPath::cwd() / "e_repository_TEST_5_dir" / "build")); + std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env, + std::bind(from_keys, keys, std::placeholders::_1))); + env.add_repository(1, repo); + + std::shared_ptr<Map<std::string, std::string> > v_keys(std::make_shared<Map<std::string, std::string>>()); + v_keys->insert("format", "vdb"); + v_keys->insert("names_cache", "/var/empty"); + v_keys->insert("location", stringify(FSPath::cwd() / "e_repository_TEST_5_dir" / "vdb")); + v_keys->insert("root", stringify(root)); + std::shared_ptr<Repository> v_repo(VDBRepository::repository_factory_create(&env, + std::bind(from_keys, v_keys, std::placeholders::_1))); + env.add_repository(1, v_repo); + + { + InstallAction action(make_named_values<InstallActionOptions>( + n::destination() = v_repo, + n::make_output_manager() = &make_standard_output_manager, + n::perform_uninstall() = &cannot_uninstall, + n::replacing() = std::make_shared<PackageIDSequence>(), + n::want_phase() = &want_all_phases + )); + + const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( + PackageDepSpec(parse_user_package_dep_spec("=cat/doheader-5::test-repo", + &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> id2(*env[selection::RequireExactlyOne(generator::Matches( + PackageDepSpec(parse_user_package_dep_spec("=cat/doheader-dies-5::test-repo", + &env, { })), make_null_shared_ptr(), { }))]->last()); + ASSERT_TRUE(bool(id2)); + EXPECT_EQ("5", visitor_cast<const MetadataValueKey<std::string> >(**id2->find_metadata("EAPI"))->parse_value()); + EXPECT_THROW(id2->perform_action(action), ActionFailedError); + } +} + diff --git a/paludis/repositories/e/e_repository_TEST_5_setup.sh b/paludis/repositories/e/e_repository_TEST_5_setup.sh index 50439a9e8..52e73d532 100755 --- a/paludis/repositories/e/e_repository_TEST_5_setup.sh +++ b/paludis/repositories/e/e_repository_TEST_5_setup.sh @@ -169,6 +169,69 @@ EOF } END +mkdir -p "cat/doheader" || exit 1 +cat << 'END' > cat/doheader/doheader-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_install() { + echo foo >foo.h + echo foo2 >foo2.h + doheader foo.h foo2.h + [[ $(<"${D}"/usr/include/foo.h) == foo ]] || die + [[ $(<"${D}"/usr/include/foo2.h) == foo2 ]] || die + [[ -x ${D}/usr/include/foo.h ]] && die + [[ -x ${D}/usr/include/foo2.h ]] && die + + echo bar >bar.h + newheader bar.h baz.h + [[ -e ${D}/usr/include/bar.h ]] && die + [[ $(<"${D}"/usr/include/baz.h) == bar ]] || die + [[ -x ${D}/usr/include/baz.h ]] && die + + insopts -m0755 + + echo xyzzy >xyzzy.h + doheader xyzzy.h + [[ $(<"${D}"/usr/include/xyzzy.h) == xyzzy ]] || die + [[ -x ${D}/usr/include/xyzzy.h ]] || die + + echo plugh >plugh.h + newheader plugh.h plover.h + [[ -e ${D}/usr/include/plugh.h ]] && die + [[ $(<"${D}"/usr/include/plover.h) == plugh ]] || die + [[ -x ${D}/usr/include/plover.h ]] || die + + nonfatal doheader missing.h && die +} +END + +mkdir -p "cat/doheader-dies" || exit 1 +cat << 'END' > cat/doheader-dies/doheader-dies-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_install() { + doheader missing.h +} +END + mkdir -p "cat/new-stdin" || exit 1 cat << 'END' > cat/new-stdin/new-stdin-5.ebuild || exit 1 EAPI="5" @@ -189,6 +252,7 @@ src_install() { echo testenvd | newenvd - testenvd exeinto /usr/libexec echo testexe | newexe - testexe + echo testheader | newheader - testheader echo testinitd | newinitd - testinitd insinto /usr/share/test echo testins | newins - testins @@ -197,13 +261,14 @@ src_install() { echo testman.1 | newman - testman.1 echo testsbin | newsbin - testsbin - cat "${D}"/{usr/bin/testbin,etc/conf.d/testconfd,usr/share/doc/${PF}/testdoc,etc/env.d/testenvd,usr/libexec/testexe,etc/init.d/testinitd,usr/share/test/testins,usr/lib*/testlib.a,usr/lib*/testlib.so,usr/share/man/man1/testman.1,usr/sbin/testsbin} > "${T}"/new.out + cat "${D}"/{usr/bin/testbin,etc/conf.d/testconfd,usr/share/doc/${PF}/testdoc,etc/env.d/testenvd,usr/libexec/testexe,usr/include/testheader,etc/init.d/testinitd,usr/share/test/testins,usr/lib*/testlib.a,usr/lib*/testlib.so,usr/share/man/man1/testman.1,usr/sbin/testsbin} > "${T}"/new.out cat >"${T}"/new.expected <<EOF testbin testconfd testdoc testenvd testexe +testheader testinitd testins testlib.a diff --git a/paludis/repositories/e/ebuild/utils/5/Makefile.am b/paludis/repositories/e/ebuild/utils/5/Makefile.am new file mode 100644 index 000000000..a11ae9c23 --- /dev/null +++ b/paludis/repositories/e/ebuild/utils/5/Makefile.am @@ -0,0 +1,15 @@ +include $(top_srcdir)/misc/common-makefile.am + +SUBDIRS = . + +libexecprog5dir = $(libexecdir)/paludis/utils/5/ + +libexecprog5_SCRIPTS = \ + doheader \ + newheader + +TESTS = +EXTRA_DIST = \ + $(libexecprog5_SCRIPTS) \ + $(TESTS) + diff --git a/paludis/repositories/e/ebuild/utils/5/doheader b/paludis/repositories/e/ebuild/utils/5/doheader new file mode 100755 index 000000000..58631d389 --- /dev/null +++ b/paludis/repositories/e/ebuild/utils/5/doheader @@ -0,0 +1,31 @@ +#!/usr/bin/env bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Stephen Bennett +# +# Based in part upon doenvd 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 as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# 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 + +source "${PALUDIS_EBUILD_DIR}"/die_functions.bash + +if [[ ${#} -lt 1 ]]; then + paludis_die_or_error "at least one argument needed" +fi + +export INSDESTTREE=/usr/include/ +doins "$@" diff --git a/paludis/repositories/e/ebuild/utils/5/newheader b/paludis/repositories/e/ebuild/utils/5/newheader new file mode 100755 index 000000000..df4801f4f --- /dev/null +++ b/paludis/repositories/e/ebuild/utils/5/newheader @@ -0,0 +1,43 @@ +#!/usr/bin/env bash +# vim: set sw=4 sts=4 et : + +# Copyright (c) 2006 Stephen Bennett +# +# Based in part upon newenvd 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 as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +# 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 + +source "${PALUDIS_EBUILD_DIR}"/die_functions.bash + +if [[ ! -d ${!PALUDIS_TEMP_DIR_VAR} ]]; then + paludis_die_or_error "\${${PALUDIS_TEMP_DIR_VAR}} not valid; aborting" +fi + +if [[ ${#} -ne 2 ]]; then + paludis_die_or_error "exactly two arguments needed" +fi + +rm -rf "${!PALUDIS_TEMP_DIR_VAR}/${2}" + +if [[ ${1} == - && -n ${PALUDIS_NEW_STDIN} ]]; then + [[ -t 0 ]] && paludis_die_or_error "requires stdin input" + cat > "${!PALUDIS_TEMP_DIR_VAR}/${2}" +else + cp "${1}" "${!PALUDIS_TEMP_DIR_VAR}/${2}" +fi + +doheader "${!PALUDIS_TEMP_DIR_VAR}/${2}" diff --git a/paludis/repositories/e/ebuild/utils/Makefile.am b/paludis/repositories/e/ebuild/utils/Makefile.am index 53c3135c7..16aee8e44 100644 --- a/paludis/repositories/e/ebuild/utils/Makefile.am +++ b/paludis/repositories/e/ebuild/utils/Makefile.am @@ -1,6 +1,6 @@ include $(top_srcdir)/misc/common-makefile.am -SUBDIRS = . 4 exheres-0 +SUBDIRS = . 4 5 exheres-0 libexecprogdir = $(libexecdir)/paludis/utils |