aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory M. Tuner <gmt@be-evil.net>2013-10-14 01:41:43 -0700
committerGregory M. Tuner <gmt@be-evil.net>2013-10-14 03:44:24 -0700
commit3c58d002651cc16a546ffccdbb1f7ea0a5730abd (patch)
tree1e9fb5cd60ecbbdfe3ec47bddbc72f22b2577354 /eclass/multibuild.eclass
parenteclass/multibuild: clone upstream version (diff)
downloadgmt-3c58d002651cc16a546ffccdbb1f7ea0a5730abd.tar.gz
gmt-3c58d002651cc16a546ffccdbb1f7ea0a5730abd.tar.bz2
gmt-3c58d002651cc16a546ffccdbb1f7ea0a5730abd.zip
eclass/multibuild.eclass: multibuild_merge_root: Paranoia
Check that target directories exist and if not, attempt to create them, being sure not to get mixed up by symlinks or non-directory, non-file filesystem entities. If the only file(s) installed by an ebuild are wrapped header files, the ebuild will crash without this patch. The problem is that ${ED}/usr/include does not exist; so when the eclass attempts to deploy, i.e., ${ED}/usr/include/foo.h the 'cp' invocation normally used to deploy that file will fail (stating correctly that ${ED}/usr/include does not exist) and muiltibuild_merge_root will consequently die. Signed-off-by: Gregory M. Tuner <gmt@be-evil.net>
Diffstat (limited to 'eclass/multibuild.eclass')
-rw-r--r--eclass/multibuild.eclass9
1 files changed, 9 insertions, 0 deletions
diff --git a/eclass/multibuild.eclass b/eclass/multibuild.eclass
index 0a2771e..4d402a4 100644
--- a/eclass/multibuild.eclass
+++ b/eclass/multibuild.eclass
@@ -257,6 +257,8 @@ multibuild_merge_root() {
local lockfile_l=${lockfile}.${BASHPID}
local ret
+ [[ ${dest} != /* ]] && die "Relative paths are not supported by multibuild_merge_root"
+
# Lock the install tree for merge. The touch+ln method ensures race
# condition-free locking with maximum portability.
touch "${lockfile_l}" || die
@@ -265,6 +267,13 @@ multibuild_merge_root() {
done
rm "${lockfile_l}" || die
+ if [[ ! -d "${dest}" ]] ; then
+ dest=$(readlink -m "${dest}")
+ if [[ ! -d "${dest}" ]] ; then
+ [[ -e "${dest}" ]] && die "file \"${dest}\" already exists but is not a directory."
+ mkdir -p "${dest}" || die "couldn't create directory \"${dest}\"."
+ fi
+ fi
if use userland_BSD; then
# 'cp -a -n' is broken:
# http://www.freebsd.org/cgi/query-pr.cgi?pr=174489