summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2007-03-17 02:08:23 +0000
committerMike Frysinger <vapier@gentoo.org>2007-03-17 02:08:23 +0000
commit962b3142f6aea84fa7f87277763567cfbbe264e1 (patch)
tree1ca7b995aba51ed5497af6a72c3d5940c22266c1 /bin
parentdrop the need for the force flag by default and just delete the existing file... (diff)
downloadportage-multirepo-962b3142f6aea84fa7f87277763567cfbbe264e1.tar.gz
portage-multirepo-962b3142f6aea84fa7f87277763567cfbbe264e1.tar.bz2
portage-multirepo-962b3142f6aea84fa7f87277763567cfbbe264e1.zip
redo compression so that it is queued up in src_install and then dequeued post src_install
svn path=/main/trunk/; revision=6220
Diffstat (limited to 'bin')
-rwxr-xr-xbin/dodoc2
-rwxr-xr-xbin/ecompress19
-rwxr-xr-xbin/ecompressdir63
-rwxr-xr-xbin/prepall5
-rwxr-xr-xbin/prepalldocs15
5 files changed, 89 insertions, 15 deletions
diff --git a/bin/dodoc b/bin/dodoc
index 4139cb59..4a89aa06 100755
--- a/bin/dodoc
+++ b/bin/dodoc
@@ -17,7 +17,7 @@ ret=0
for x in "$@" ; do
if [ -s "${x}" ] ; then
install -m0644 "${x}" "${dir}"
- ecompress "${dir}/${x##*/}"
+ ecompress --queue "${dir}/${x##*/}"
elif [ ! -e "${x}" ] ; then
echo "dodoc: ${x} does not exist" 1>&2
((++ret))
diff --git a/bin/ecompress b/bin/ecompress
index 7e51e3c4..de01cfde 100755
--- a/bin/ecompress
+++ b/bin/ecompress
@@ -22,6 +22,8 @@ fi
case $1 in
--suffix)
+ [[ -n $2 ]] && vecho "${0##*/}: --suffix takes no additional arguments" 1>&2
+
set -e
tmpdir="${T}"/.ecompress$$.${RANDOM}
mkdir "${tmpdir}"
@@ -38,8 +40,25 @@ case $1 in
echo "${suffix}"
;;
--bin)
+ [[ -n $2 ]] && vecho "${0##*/}: --bin takes no additional arguments" 1>&2
+
echo "${PORTAGE_COMPRESS} ${PORTAGE_COMPRESS_FLAGS}"
;;
+ --queue)
+ shift
+ exec touch "${@/%/.ecompress.file}"
+ ;;
+ --dequeue)
+ [[ -n $2 ]] && vecho "${0##*/}: --dequeue takes no additional arguments" 1>&2
+ find "${D}" -name '*.ecompress.file' -print0 \
+ | sed -e 's:\.ecompress\.file::g' \
+ | ${XARGS} -0 ecompress
+ find "${D}" -name '*.ecompress.file' -print0 | ${XARGS} -0 rm -f
+ ;;
+ --*)
+ vecho "${0##*/}: unknown arguments '$*'" 1>&2
+ exit 1
+ ;;
*)
# If a compressed version of the file already exists, simply
# delete it so that the compressor doesn't whine (bzip2 will
diff --git a/bin/ecompressdir b/bin/ecompressdir
index cad0ce26..50e8ec7a 100755
--- a/bin/ecompressdir
+++ b/bin/ecompressdir
@@ -10,6 +10,34 @@ if [[ -z $1 ]] ; then
exit 1
fi
+case $1 in
+ --ignore)
+ shift
+ for skip in "$@" ; do
+ [[ -d ${D}${skip} ]] && touch "${D}${skip}.ecompress.skip"
+ done
+ exit 0
+ ;;
+ --queue)
+ shift
+ set -- "${@/%/.ecompress.dir}"
+ set -- "${@/#/${D}}"
+ exec touch "$@"
+ ;;
+ --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" \
+ | ${XARGS} -0 ecompressdir
+ find "${D}" -name '*.ecompress.skip' -print0 | ${XARGS} -0 rm -f
+ exit 0
+ ;;
+ --*)
+ vecho "${0##*/}: unknown arguments '$*'"
+ exit 1
+ ;;
+esac
+
# figure out the new suffix
suffix=$(ecompress --suffix)
@@ -43,8 +71,32 @@ funk_up_dir() {
done
}
+# _relocate_skip_dirs(srctree, dsttree)
+# Move all the directories we want to skip running compression
+# on from srctree to dsttree.
+# TODO: this should support whitespace in paths ...
+_relocate_skip_dirs() {
+ local srctree="$1" dsttree="$2"
+
+ [[ -d ${srctree} ]] || return 0
+
+ local src dst parent
+ for src in $(find "${srctree}" -name '*.ecompress.skip') ; do
+ src=${src%.ecompress.skip}
+ dst="${dsttree}${src#${srctree}}"
+ parent=${dst%/*}
+ mkdir -p "${parent}"
+ mv "${src}" "${dst}"
+ 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}" ; }
+
ret=0
+rm -rf "${T}"/ecompress-skip
+
for dir in "$@" ; do
dir="${D}${dir}"
if [[ ! -d ${dir} ]] ; then
@@ -52,6 +104,14 @@ for dir in "$@" ; do
continue
fi
+ # hide all the stuff we want to skip
+ hide_skip_dirs "${dir}"
+
+ # since we've been requested to compress the whole dir,
+ # delete any individual queued requests
+ rm -f "${dir}.ecompress.dir"
+ 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"
funk_up_dir "decompress" "gz" "gunzip"
@@ -61,6 +121,9 @@ for dir in "$@" ; do
[[ -z ${suffix} ]] && continue
vecho "${0##*/}: $(ecompress --bin) ${dir#${D}}"
funk_up_dir "compress" "${suffix}" "ecompress"
+
+ # finally, restore the skipped stuff
+ restore_skip_dirs
done
exit ${ret}
diff --git a/bin/prepall b/bin/prepall
index 3ab82157..a192db54 100755
--- a/bin/prepall
+++ b/bin/prepall
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright 1999-2006 Gentoo Foundation
+# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
@@ -17,6 +17,9 @@ prepallman
prepallinfo
prepallstrip
+ecompressdir --dequeue
+ecompress --dequeue
+
if type -p chflags &>/dev/null && type -p mtree &>/dev/null; then
# Restore all the file flags that were saved at the beginning of prepall.
mtree -U -e -p "${D}" -k flags < "${T}/bsdflags.mtree" &> /dev/null
diff --git a/bin/prepalldocs b/bin/prepalldocs
index e188329d..cd1328e5 100755
--- a/bin/prepalldocs
+++ b/bin/prepalldocs
@@ -10,16 +10,5 @@ fi
cd "${D}"
[[ -d usr/share/doc ]] || exit 0
-# we dont want to compress the html subdir
-if [[ -d ${D}usr/share/doc/${PF}/html ]] ; then
- mv "${D}"usr/share/doc/${PF}/html "${T}"/ecompressdir-html-backup || exit 1
-fi
-
-ecompressdir /usr/share/doc
-ret=$?
-
-if [[ -d ${T}/ecompressdir-html-backup ]] ; then
- mv "${T}"/ecompressdir-html-backup "${D}"/usr/share/doc/${PF}/html
-fi
-
-exit ${ret}
+ecompressdir --ignore /usr/share/doc/${PF}/html
+ecompressdir --queue /usr/share/doc