Make keepdir an external ebuild helper program.
authorUlrich Müller <ulm@gentoo.org>
Thu, 22 Aug 2013 17:22:27 +0000 (19:22 +0200)
committerZac Medico <zmedico@gentoo.org>
Thu, 22 Aug 2013 17:31:11 +0000 (10:31 -0700)
This is required by PMS section 11.3.3.8 "Installation commands".
Fixes bug #481762.

bin/ebuild-helpers/keepdir [new file with mode: 0755]
bin/ebuild.sh
bin/phase-helpers.sh
bin/save-ebuild-env.sh
doc/package/ebuild/eapi/4-python.docbook
doc/package/ebuild/eapi/5-progress.docbook

diff --git a/bin/ebuild-helpers/keepdir b/bin/ebuild-helpers/keepdir
new file mode 100755 (executable)
index 0000000..bec2feb
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/bash
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
+
+if ! ___eapi_has_prefix_variables; then
+       ED=${D}
+fi
+
+dodir "$@"
+ret=$?
+
+for x in "$@"; do
+       >> "${ED}${x}/.keep_${CATEGORY}_${PN}-${SLOT%/*}" || \
+               { echo "!!! ${0##*/}: cannot write .keep in ${ED}${x}" 1>&2; ret=1; }
+done
+
+[[ ${ret} -ne 0 ]] && __helpers_die "${0##*/} failed"
+exit ${ret}
index 18703bb8ad9a4cfcf148af3197385f9fd8447bf5..35f4b912a9fafacd6134926d8ffbebac8b53d56a 100755 (executable)
@@ -21,7 +21,7 @@ else
        # in global scope, even though they are completely useless during
        # the "depend" phase.
        for x in diropts docompress exeopts get_KV insopts \
-               keepdir KV_major KV_micro KV_minor KV_to_int \
+               KV_major KV_micro KV_minor KV_to_int \
                libopts register_die_hook register_success_hook \
                __strip_duplicate_slashes \
                use_with use_enable ; do
index ba12f1fbd8da039ff25224fabc52add240fb9400..91762bfc3de0474de7928df56d4cbcc4730cd54f 100644 (file)
@@ -141,30 +141,6 @@ docompress() {
        fi
 }
 
-# adds ".keep" files so that dirs aren't auto-cleaned
-keepdir() {
-       dodir "$@"
-       local x
-       if ! ___eapi_has_prefix_variables; then
-               local ED=${D}
-       fi
-       if [ "$1" == "-R" ] || [ "$1" == "-r" ]; then
-               shift
-               find "$@" -type d -printf "${ED}%p/.keep_${CATEGORY}_${PN}-${SLOT%/*}\n" \
-                       | tr "\n" "\0" | \
-                       while read -r -d $'\0' ; do
-                               >> "$REPLY" || \
-                                       die "Failed to recursively create .keep files"
-                       done
-       else
-               for x in "$@"; do
-                       >> "${ED}${x}/.keep_${CATEGORY}_${PN}-${SLOT%/*}" || \
-                               die "Failed to create .keep in ${ED}${x}"
-               done
-       fi
-}
-
-
 useq() {
        has $EBUILD_PHASE prerm postrm || eqawarn \
                "QA Notice: The 'useq' function is deprecated (replaced by 'use')"
index f6952450e7e9623434e49e114c1ac27e5c33d204..2a3d5eaa004d67a1431f4edd84e8779c679a9214 100644 (file)
@@ -56,7 +56,7 @@ __save_ebuild_env() {
                addread addwrite adddeny addpredict __sb_append_var \
                use usev useq has_version portageq \
                best_version use_with use_enable register_die_hook \
-               keepdir unpack __strip_duplicate_slashes econf einstall \
+               unpack __strip_duplicate_slashes econf einstall \
                __dyn_setup __dyn_unpack __dyn_clean \
                into insinto exeinto docinto \
                insopts diropts exeopts libopts docompress \
index 9e8a9daa185999b6078396dea89eb9d95aa8b7f5..a61ac05036704fc5eb747f1798649416507489b1 100644 (file)
@@ -19,7 +19,6 @@
                                        <listitem><para>docompress</para></listitem>
                                        <listitem><para>exeopts</para></listitem>
                                        <listitem><para>insopts</para></listitem>
-                                       <listitem><para>keepdir</para></listitem>
                                        <listitem><para>libopts</para></listitem>
                                        <listitem><para>use</para></listitem>
                                        <listitem><para>use_enable</para></listitem>
index 93ce6dcdeb76f4ec9bf383539820dec304fd5ee0..5fd623bc0bef21aa3963051e95a951690a5d6df5 100644 (file)
@@ -61,7 +61,6 @@
                                        <listitem><para>docompress</para></listitem>
                                        <listitem><para>exeopts</para></listitem>
                                        <listitem><para>insopts</para></listitem>
-                                       <listitem><para>keepdir</para></listitem>
                                        <listitem><para>libopts</para></listitem>
                                        <listitem><para>use</para></listitem>
                                        <listitem><para>use_enable</para></listitem>