aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar David Leverton <levertond@googlemail.com> 2013-08-25 18:22:49 +0100
committerAvatar David Leverton <levertond@googlemail.com> 2013-08-25 18:22:49 +0100
commit1b60f1a7d65066b6906ff5caa14739f67f49a80f (patch)
tree13dc571a59ec73a8a4dcd58c9ab7f1630d115d78
parent5dcbfdc11cd87a7ffe41e736f782955e0b9eb947 (diff)
downloadpaludis-1b60f1a7d65066b6906ff5caa14739f67f49a80f.tar.gz
paludis-1b60f1a7d65066b6906ff5caa14739f67f49a80f.tar.xz
Make keepdir an external command
PMS says it should be, and for consistency with the other commands it was decided to keep the spec as it is and change the implementations. Also remove the non-standard non-working attempt at supporting -r/-R. Fixes: Gentoo#482128
-rw-r--r--paludis/repositories/e/e_repository_TEST_0.cc26
-rwxr-xr-xpaludis/repositories/e/e_repository_TEST_0_setup.sh50
-rw-r--r--paludis/repositories/e/e_repository_TEST_exheres_0.cc10
-rwxr-xr-xpaludis/repositories/e/e_repository_TEST_exheres_0_setup.sh20
-rw-r--r--paludis/repositories/e/ebuild/install_functions.bash22
-rw-r--r--paludis/repositories/e/ebuild/utils/Makefile.am1
-rwxr-xr-xpaludis/repositories/e/ebuild/utils/keepdir31
7 files changed, 131 insertions, 29 deletions
diff --git a/paludis/repositories/e/e_repository_TEST_0.cc b/paludis/repositories/e/e_repository_TEST_0.cc
index 43733e7..7434da4 100644
--- a/paludis/repositories/e/e_repository_TEST_0.cc
+++ b/paludis/repositories/e/e_repository_TEST_0.cc
@@ -191,7 +191,31 @@ TEST(ERepository, InstallEAPI0)
{
const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("cat/keepdir-die",
+ PackageDepSpec(parse_user_package_dep_spec("=cat/keepdir-fail-1",
+ &env, { })), nullptr, { }))]->last());
+ ASSERT_TRUE(bool(id));
+ id->perform_action(action);
+ }
+
+ {
+ const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("=cat/keepdir-fail-2",
+ &env, { })), nullptr, { }))]->last());
+ ASSERT_TRUE(bool(id));
+ id->perform_action(action);
+ }
+
+ {
+ const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("=cat/keepdir-die-1",
+ &env, { })), nullptr, { }))]->last());
+ ASSERT_TRUE(bool(id));
+ ASSERT_THROW(id->perform_action(action), ActionFailedError);
+ }
+
+ {
+ const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("=cat/keepdir-die-2",
&env, { })), nullptr, { }))]->last());
ASSERT_TRUE(bool(id));
ASSERT_THROW(id->perform_action(action), ActionFailedError);
diff --git a/paludis/repositories/e/e_repository_TEST_0_setup.sh b/paludis/repositories/e/e_repository_TEST_0_setup.sh
index a133463..968d494 100755
--- a/paludis/repositories/e/e_repository_TEST_0_setup.sh
+++ b/paludis/repositories/e/e_repository_TEST_0_setup.sh
@@ -154,6 +154,36 @@ src_install() {
einstall
}
END
+mkdir -p "cat/keepdir-fail"
+cat <<"END" > cat/keepdir-fail/keepdir-fail-1.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_install() {
+ dodir /usr/share || die
+ touch "${D}"/usr/share/monkey || die
+ keepdir /usr/share/monkey
+}
+END
+cat <<"END" > cat/keepdir-fail/keepdir-fail-2.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_install() {
+ dosym no/where /usr/share/.keep_${CATEGORY}_${PN}-${SLOT%/*} || die
+ keepdir /usr/share
+}
+END
mkdir -p "cat/keepdir-die"
cat <<"END" > cat/keepdir-die/keepdir-die-1.ebuild || exit 1
DESCRIPTION="The Description"
@@ -165,9 +195,23 @@ LICENSE="GPL-2"
KEYWORDS="test"
src_install() {
- dodir /usr/share
- touch "${D}"/usr/share/monkey
- keepdir /usr/share/monkey
+ dodir /usr/share || return
+ touch "${D}"/usr/share/monkey || return
+ keepdir /usr/share/monkey || die
+}
+END
+cat <<"END" > cat/keepdir-die/keepdir-die-2.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_install() {
+ dosym no/where /usr/share/.keep_${CATEGORY}_${PN}-${SLOT%/*} || return
+ keepdir /usr/share || die
}
END
mkdir -p "cat/dobin-fail"
diff --git a/paludis/repositories/e/e_repository_TEST_exheres_0.cc b/paludis/repositories/e/e_repository_TEST_exheres_0.cc
index 10b90f9..1ca9d32 100644
--- a/paludis/repositories/e/e_repository_TEST_exheres_0.cc
+++ b/paludis/repositories/e/e_repository_TEST_exheres_0.cc
@@ -302,7 +302,15 @@ TEST(ERepository, InstallExheres0)
{
const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("cat/keepdir-fail",
+ PackageDepSpec(parse_user_package_dep_spec("=cat/keepdir-fail-1",
+ &env, { })), nullptr, { }))]->last());
+ ASSERT_TRUE(bool(id));
+ EXPECT_THROW(id->perform_action(action), ActionFailedError);
+ }
+
+ {
+ const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("=cat/keepdir-fail-2",
&env, { })), nullptr, { }))]->last());
ASSERT_TRUE(bool(id));
EXPECT_THROW(id->perform_action(action), ActionFailedError);
diff --git a/paludis/repositories/e/e_repository_TEST_exheres_0_setup.sh b/paludis/repositories/e/e_repository_TEST_exheres_0_setup.sh
index b3619a9..e9569ac 100755
--- a/paludis/repositories/e/e_repository_TEST_exheres_0_setup.sh
+++ b/paludis/repositories/e/e_repository_TEST_exheres_0_setup.sh
@@ -388,11 +388,27 @@ PLATFORMS="test"
WORK="${WORKBASE}"
src_install() {
- dodir /usr/share
- touch "${IMAGE}"/usr/share/monkey
+ nonfatal dodir /usr/share || return
+ touch "${IMAGE}"/usr/share/monkey || return
keepdir /usr/share/monkey
}
END
+cat <<'END' > packages/cat/keepdir-fail/keepdir-fail-2.ebuild || exit 1
+DESCRIPTION="The Long Description"
+SUMMARY="The Short Description"
+HOMEPAGE="http://example.com/"
+DOWNLOADS=""
+SLOT="0"
+MYOPTIONS="spork"
+LICENCES="GPL-2"
+PLATFORMS="test"
+WORK="${WORKBASE}"
+
+src_install() {
+ nonfatal dosym no/where /usr/share/.keep_${CATEGORY}_${PN}-${SLOT%/*} || return
+ keepdir /usr/share
+}
+END
mkdir -p "packages/cat/nonfatal-keepdir"
cat <<'END' > packages/cat/nonfatal-keepdir/nonfatal-keepdir-1.ebuild || exit 1
DESCRIPTION="The Long Description"
diff --git a/paludis/repositories/e/ebuild/install_functions.bash b/paludis/repositories/e/ebuild/install_functions.bash
index 2505331..96fac08 100644
--- a/paludis/repositories/e/ebuild/install_functions.bash
+++ b/paludis/repositories/e/ebuild/install_functions.bash
@@ -31,28 +31,6 @@ export LIBOPTIONS="-m0644"
export DIROPTIONS="-m0755"
export MOPREFIX="${PN}"
-keepdir()
-{
- local keepfile_name=.keep_${CATEGORY}_${PN}-${SLOT%/*}
- if [[ ${#} -lt 1 ]]; then
- paludis_die_unless_nonfatal "at least one argument needed"
- fi
- if [[ ${@} != ${@#${!PALUDIS_IMAGE_DIR_VAR}} ]]; then
- paludis_die_unless_nonfatal "You should not use \${${PALUDIS_IMAGE_DIR_VAR}} with helpers."
- fi
- dodir "$@"
- if [[ "${1}" == "-R" ]] || [[ "${1}" == "-r" ]] ; then
- shift
- find "$@" -type d -printf "${!PALUDIS_IMAGE_DIR_VAR}/%p/${keepfile_name}\0" | xargs -0 touch
- paludis_assert_unless_nonfatal "Failed to create ${keepfile_name} files" || return 247
- else
- local f
- for f in "$@" ; do
- touch "${!PALUDIS_IMAGE_DIR_VAR}/${f}/${keepfile_name}" || paludis_die_unless_nonfatal "Couldn't touch ${keepfile_name} in ${f}" || return 247
- done
- fi
-}
-
into()
{
if [[ "${1}" == "/" ]] ; then
diff --git a/paludis/repositories/e/ebuild/utils/Makefile.am b/paludis/repositories/e/ebuild/utils/Makefile.am
index 16aee8e..9f5ee56 100644
--- a/paludis/repositories/e/ebuild/utils/Makefile.am
+++ b/paludis/repositories/e/ebuild/utils/Makefile.am
@@ -31,6 +31,7 @@ libexecprog_SCRIPTS = \
emake \
fowners \
fperms \
+ keepdir \
newbin \
newconfd \
newdoc \
diff --git a/paludis/repositories/e/ebuild/utils/keepdir b/paludis/repositories/e/ebuild/utils/keepdir
new file mode 100755
index 0000000..7b73c7d
--- /dev/null
+++ b/paludis/repositories/e/ebuild/utils/keepdir
@@ -0,0 +1,31 @@
+#!/usr/bin/env bash
+# vim: set sw=4 sts=4 et :
+
+# Copyright (c) 2006 Ciaran McCreesh
+# Copyright (c) 2013 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
+
+source "${PALUDIS_EBUILD_DIR}"/die_functions.bash
+
+dodir "$@" || exit ${?}
+
+keepfile_name=.keep_${CATEGORY}_${PN}-${SLOT%/*}
+for f in "$@" ; do
+ touch "${!PALUDIS_IMAGE_DIR_VAR}/${f}/${keepfile_name}" || paludis_die_or_error "Couldn't touch ${keepfile_name} in ${f}" || exit 247
+done