aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'portage_with_autodep/bin/ebuild-helpers/ecompressdir')
-rwxr-xr-xportage_with_autodep/bin/ebuild-helpers/ecompressdir73
1 files changed, 55 insertions, 18 deletions
diff --git a/portage_with_autodep/bin/ebuild-helpers/ecompressdir b/portage_with_autodep/bin/ebuild-helpers/ecompressdir
index 7a95120..a2c9e52 100755
--- a/portage_with_autodep/bin/ebuild-helpers/ecompressdir
+++ b/portage_with_autodep/bin/ebuild-helpers/ecompressdir
@@ -1,27 +1,30 @@
#!/bin/bash
-# Copyright 1999-2010 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
+source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/helper-functions.sh
if [[ -z $1 ]] ; then
helpers_die "${0##*/}: at least one argument needed"
exit 1
fi
+[[ " ${FEATURES} " == *" force-prefix "* ]] || \
+ case "$EAPI" in 0|1|2) ED=${D} EPREFIX= ;; esac
+
case $1 in
--ignore)
shift
for skip in "$@" ; do
- [[ -d ${D}${skip} || -f ${D}${skip} ]] \
- && >> "${D}${skip}.ecompress.skip"
+ [[ -d ${ED}${skip} || -f ${ED}${skip} ]] \
+ && >> "${ED}${skip}.ecompress.skip"
done
exit 0
;;
--queue)
shift
set -- "${@/%/.ecompress.dir}"
- set -- "${@/#/${D}}"
+ set -- "${@/#/${ED}}"
ret=0
for x in "$@" ; do
>> "$x"
@@ -32,10 +35,10 @@ case $1 in
;;
--dequeue)
[[ -n $2 ]] && vecho "${0##*/}: --dequeue takes no additional arguments" 1>&2
- find "${D}" -name '*.ecompress.dir' -print0 \
- | sed -e 's:\.ecompress\.dir::g' -e "s:${D}:/:g" \
+ find "${ED}" -name '*.ecompress.dir' -print0 \
+ | sed -e 's:\.ecompress\.dir::g' -e "s:${ED}:/:g" \
| ${XARGS} -0 ecompressdir
- find "${D}" -name '*.ecompress.skip' -print0 | ${XARGS} -0 rm -f
+ find "${ED}" -name '*.ecompress.skip' -print0 | ${XARGS} -0 rm -f
exit 0
;;
--*)
@@ -66,6 +69,17 @@ funk_up_dir() {
while read -r -d $'\0' brokenlink ; do
[[ -e ${brokenlink} ]] && continue
olddest=$(readlink "${brokenlink}")
+ # Ignore temporarily broken symlinks due to
+ # _relocate_skip_dirs (bug #399595), and handle
+ # absolute symlinks to files that aren't merged
+ # yet (bug #405327).
+ if [[ ${olddest} == /* ]] ; then
+ [ -e "${D}${olddest}" ] && continue
+ skip_dir_dest=${T}/ecompress-skip/${olddest#${EPREFIX}}
+ else
+ skip_dir_dest=${T}/ecompress-skip/${actual_dir#${ED}}/${brokenlink%/*}/${olddest}
+ fi
+ [[ -e ${skip_dir_dest} ]] && continue
[[ ${act} == "compress" ]] \
&& newdest="${olddest}${suffix}" \
|| newdest="${olddest%${suffix}}"
@@ -95,18 +109,28 @@ _relocate_skip_dirs() {
mv "${src}.ecompress.skip" "${dst}.ecompress.skip"
done
}
-hide_skip_dirs() { _relocate_skip_dirs "${D}" "${T}"/ecompress-skip/ ; }
-restore_skip_dirs() { _relocate_skip_dirs "${T}"/ecompress-skip/ "${D}" ; }
+hide_skip_dirs() { _relocate_skip_dirs "${ED}" "${T}"/ecompress-skip/ ; }
+restore_skip_dirs() { _relocate_skip_dirs "${T}"/ecompress-skip/ "${ED}" ; }
ret=0
rm -rf "${T}"/ecompress-skip
+decompressors=(
+ ".Z" "gunzip -f"
+ ".gz" "gunzip -f"
+ ".bz2" "bunzip2 -f"
+ ".xz" "unxz -f"
+ ".lzma" "unxz -f"
+)
+
+multijob_init
+
for dir in "$@" ; do
dir=${dir#/}
- dir="${D}${dir}"
+ dir="${ED}${dir}"
if [[ ! -d ${dir} ]] ; then
- vecho "${0##*/}: /${dir#${D}} does not exist!"
+ vecho "${0##*/}: /${dir#${ED}} does not exist!"
continue
fi
cd "${dir}"
@@ -122,18 +146,31 @@ for dir in "$@" ; do
find "${dir}" -type f -name '*.ecompress.file' -print0 | ${XARGS} -0 rm -f
# not uncommon for packages to compress doc files themselves
- funk_up_dir "decompress" ".Z" "gunzip -f"
- funk_up_dir "decompress" ".gz" "gunzip -f"
- funk_up_dir "decompress" ".bz2" "bunzip2 -f"
+ for (( d = 0; d < ${#decompressors[@]}; d += 2 )) ; do
+ # It's faster to parallelize at this stage than to try to
+ # parallelize the compressors. This is because the find|xargs
+ # ends up launching less compressors overall, so the overhead
+ # of forking children ends up dominating.
+ (
+ multijob_child_init
+ funk_up_dir "decompress" "${decompressors[i]}" "${decompressors[i+1]}"
+ ) &
+ multijob_post_fork
+ : $(( ret |= $? ))
+ done
# forcibly break all hard links as some compressors whine about it
find "${dir}" -type f -links +1 -exec env file="{}" sh -c \
'cp -p "${file}" "${file}.ecompress.break" ; mv -f "${file}.ecompress.break" "${file}"' \;
+ multijob_finish
+ : $(( ret |= $? ))
+
# now lets do our work
- [[ -z ${suffix} ]] && continue
- vecho "${0##*/}: $(ecompress --bin) /${actual_dir#${D}}"
- funk_up_dir "compress" "${suffix}" "ecompress"
+ if [[ -n ${suffix} ]] ; then
+ vecho "${0##*/}: $(ecompress --bin) /${actual_dir#${ED}}"
+ funk_up_dir "compress" "${suffix}" "ecompress"
+ fi
# finally, restore the skipped stuff
restore_skip_dirs