summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbin/dodoc7
-rwxr-xr-xbin/doinfo20
-rwxr-xr-xbin/ecompress44
-rwxr-xr-xbin/ecompressdir44
-rwxr-xr-xbin/misc-functions.sh4
-rwxr-xr-xbin/prepalldocs44
-rwxr-xr-xbin/prepallinfo1
-rwxr-xr-xbin/prepallman17
-rwxr-xr-xbin/prepinfo50
-rwxr-xr-xbin/prepman49
10 files changed, 154 insertions, 126 deletions
diff --git a/bin/dodoc b/bin/dodoc
index 60b6a274f..4139cb593 100755
--- a/bin/dodoc
+++ b/bin/dodoc
@@ -1,9 +1,10 @@
#!/bin/bash
-# Copyright 1999-2006 Gentoo Foundation
+# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
+# $Id$
if [ $# -lt 1 ] ; then
- echo "$0: at least one argument needed" 1>&2
+ vecho "${0##*/}: at least one argument needed" 1>&2
exit 1
fi
@@ -16,7 +17,7 @@ ret=0
for x in "$@" ; do
if [ -s "${x}" ] ; then
install -m0644 "${x}" "${dir}"
- gzip -f -9 "${dir}/${x##*/}"
+ ecompress "${dir}/${x##*/}"
elif [ ! -e "${x}" ] ; then
echo "dodoc: ${x} does not exist" 1>&2
((++ret))
diff --git a/bin/doinfo b/bin/doinfo
index 82db070b8..7e1dd30ca 100755
--- a/bin/doinfo
+++ b/bin/doinfo
@@ -1,21 +1,15 @@
#!/bin/bash
-# Copyright 1999-2006 Gentoo Foundation
+# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
-if [ ${#} -lt 1 ] ; then
- echo "doinfo: at least one argument needed"
+if [[ -z $1 ]] ; then
+ vecho "${0##*/}: at least one argument needed"
exit 1
fi
-if [ ! -d "${D}usr/share/info" ] ; then
- install -d "${D}usr/share/info"
+
+if [[ ! -d ${D}usr/share/info ]] ; then
+ install -d "${D}usr/share/info" || exit 1
fi
-for x in "$@" ; do
- if [ -e "${x}" ] ; then
- install -m0644 "${x}" "${D}usr/share/info"
- gzip -f -9 "${D}usr/share/info/${x##*/}"
- else
- echo "doinfo: ${x} does not exist"
- fi
-done
+exec install -m0644 "$@" "${D}usr/share/info"
diff --git a/bin/ecompress b/bin/ecompress
new file mode 100755
index 000000000..91172177e
--- /dev/null
+++ b/bin/ecompress
@@ -0,0 +1,44 @@
+#!/bin/bash
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: prepman 5507 2007-01-10 04:22:27Z zmedico $
+
+if [[ -z $1 ]] ; then
+ echo "${0##*/}: at least one argument needed" 1>&2
+ exit 1
+fi
+
+source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
+
+# setup compression stuff
+PORTAGE_COMPRESS=${PORTAGE_COMPRESS:-bzip2}
+if [[ -z ${PORTAGE_COMPRESS_FLAGS} ]] ; then
+ case ${PORTAGE_COMPRESS} in
+ bzip2|gzip) PORTAGE_COMPRESS_FLAGS="-9";;
+ esac
+fi
+
+case $1 in
+ --suffix)
+ set -e
+ tmpdir="${T}"/.ecompress$$.${RANDOM}
+ mkdir "${tmpdir}"
+ cd "${tmpdir}"
+ # we have to fill the file enough so that there is something
+ # to compress as some programs will refuse to do compression
+ # if it cannot actually compress the file
+ echo {0..1000} > compressme
+ ${PORTAGE_COMPRESS} ${PORTAGE_COMPRESS_FLAGS} compressme
+ suffix=$(ls compressme*)
+ suffix=${suffix#compressme}
+ cd /
+ rm -rf "${tmpdir}"
+ echo "${suffix}"
+ ;;
+ --bin)
+ echo "${PORTAGE_COMPRESS} ${PORTAGE_COMPRESS_FLAGS}"
+ ;;
+ *)
+ exec "${PORTAGE_COMPRESS}" ${PORTAGE_COMPRESS_FLAGS} "$@"
+ ;;
+esac
diff --git a/bin/ecompressdir b/bin/ecompressdir
new file mode 100755
index 000000000..405f8e2f5
--- /dev/null
+++ b/bin/ecompressdir
@@ -0,0 +1,44 @@
+#!/bin/bash
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: prepalldocs 3483 2006-06-10 21:40:40Z genone $
+
+if [[ -z $1 ]] ; then
+ echo "${0##*/}: at least one argument needed" 1>&2
+ exit 1
+fi
+
+# figure out the new suffix
+suffix=$(ecompress --suffix)
+[[ -z ${suffix} ]] && exit 0
+
+source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
+
+ret=0
+
+for dir in "$@" ; do
+ dir="${D}${dir}"
+ if [[ ! -d ${dir} ]] ; then
+ vecho "${0##*/}: ${dir#${D}} does not exist!"
+ continue
+ else
+ vecho "${0##*/}: $(ecompress --bin) ${dir#${D}}"
+ fi
+
+ find "${dir}" -type f -print0 | xargs -0 ecompress
+ ((ret+=$?))
+ find -L "${dir}" -type l | \
+ while read brokenlink ; do
+ olddest=$(readlink "${brokenlink}")
+ newdest="${olddest}${suffix}"
+ if [[ -e ${newdest} ]] ; then
+ ln -snf "${newdest}" "${brokenlink}"
+ ((ret+=$?))
+ else
+ vecho "ecompressdir: unknown broken symlink: ${brokenlink}"
+ ((++ret))
+ fi
+ done
+done
+
+exit ${ret}
diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh
index 554288621..001fcffd1 100755
--- a/bin/misc-functions.sh
+++ b/bin/misc-functions.sh
@@ -340,9 +340,7 @@ install_qa_check() {
fi
# Portage regenerates this on the installed system.
- if [[ -f ${D}/usr/share/info/dir.gz ]] ; then
- rm -f "${D}"/usr/share/info/dir.gz
- fi
+ rm -f "${D}"/usr/share/info/dir{,.gz,.bz2}
if hasq multilib-strict ${FEATURES} && \
[[ -x /usr/bin/file && -x /usr/bin/find ]] && \
diff --git a/bin/prepalldocs b/bin/prepalldocs
index 8d585d236..758b134d6 100755
--- a/bin/prepalldocs
+++ b/bin/prepalldocs
@@ -1,35 +1,25 @@
#!/bin/bash
-# Copyright 1999-2006 Gentoo Foundation
+# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
-source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
+if [[ -n $1 ]] ; then
+ vecho "${0##*/}: invalid usage; takes no arguments" 1>&2
+fi
-z="$(find "${D}"usr/share/doc \( -type f -or -type l \) -not -name "*.gz" -not -name "*.js" 2>/dev/null)"
+cd "${D}"
+[[ -d usr/share/doc ]] || exit 0
-for y in ${z} ; do
- if [ -L "${y}" ] ; then
- # Symlink ...
- mylink="${y}"
- linkto="$(readlink "${y}")"
+# 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
- if [ "${linkto##*.}" != "gz" ] ; then
- linkto="${linkto}.gz"
- fi
- if [ "${mylink##*.}" != "gz" ] ; then
- mylink="${mylink}.gz"
- fi
+ecompressdir /usr/share/doc
+ret=$?
- vecho "fixing doc symlink: ${mylink##*/}"
- ln -snf "${linkto}" "${mylink}"
- if [ "${y}" != "${mylink}" ] ; then
- vecho "removing old symlink: ${y##*/}"
- rm -f "${y}"
- fi
- else
- if [ "${y##*.}" != "gz" ] ; then
- vecho "gzipping doc: ${y##*/}"
- gzip -f -9 "${y}"
- fi
- fi
-done
+if [[ -d ${T}/ecompressdir-html-backup ]] ; then
+ mv "${T}"/html "${D}"/usr/share/doc/${PF}/html
+fi
+
+exit ${ret}
diff --git a/bin/prepallinfo b/bin/prepallinfo
index f0ed4f337..af95bbfce 100755
--- a/bin/prepallinfo
+++ b/bin/prepallinfo
@@ -7,5 +7,4 @@ source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
[[ ! -d ${D}usr/share/info ]] && exit 0
-vecho "info:"
exec prepinfo
diff --git a/bin/prepallman b/bin/prepallman
index e89ad7af0..747ed1fac 100755
--- a/bin/prepallman
+++ b/bin/prepallman
@@ -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$
@@ -7,14 +7,11 @@ source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
ret=0
-vecho "man:"
-for x in "${D}"opt/*/man "${D}"usr/share/man "${D}"usr/local/man "${D}"usr/X11R6/man ; do
- if [[ -d ${x} ]] ; then
- x=${x#${D}}
- x=${x%/man}
- prepman "${x}"
- ((ret+=$?))
- fi
-done
+find "${D}" -type d -name man > "${T}"/prepallman.filelist
+while read mandir ; do
+ mandir=${mandir#${D}}
+ prepman "${mandir%/man}"
+ ((ret+=$?))
+done < "${T}"/prepallman.filelist
exit ${ret}
diff --git a/bin/prepinfo b/bin/prepinfo
index d624561c7..2d3c80e08 100755
--- a/bin/prepinfo
+++ b/bin/prepinfo
@@ -1,47 +1,29 @@
#!/bin/bash
-# Copyright 1999-2006 Gentoo Foundation
+# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
-if [ -z "$1" ] ; then
- z="${D}usr/share/info"
+if [[ -z $1 ]] ; then
+ infodir="/usr/share/info"
else
- if [ -d "${D}$1/share/info" ] ; then
- z="${D}$1/share/info"
+ if [[ -d ${D}$1/share/info ]] ; then
+ infodir="$1/share/info"
else
- z="${D}$1/info"
+ infodir="$1/info"
fi
fi
-[ ! -d "${z}" ] && exit 0
-
-rm -f "${z}"/{dir,dir.info,dir.info.gz}
-
-for x in $(find "${z}"/ -mindepth 1 -maxdepth 1 \( -type f -or -type l \) 2>/dev/null) ; do
- if [ -L "${x}" ] ; then
- # Symlink ...
- mylink="${x}"
- linkto="$(readlink "${x}")"
-
- if [ "${linkto##*.}" != "gz" ] ; then
- linkto="${linkto}.gz"
- fi
- if [ "${mylink##*.}" != "gz" ] ; then
- mylink="${mylink}.gz"
- fi
-
- vecho "fixing GNU info symlink: ${mylink##*/}"
- ln -snf "${linkto}" "${mylink}"
- if [ "${x}" != "${mylink}" ] ; then
- vecho "removing old symlink: ${x##*/}"
- rm -f "${x}"
- fi
+if [[ ! -d ${D}${infodir} ]] ; then
+ if [[ -n $1 ]] ; then
+ vecho "${0##*/}: '${infodir}' does not exist!"
+ exit 1
else
- if [ "${x##*.}" != "gz" ] ; then
- vecho "gzipping GNU info page: ${x##*/}"
- gzip -f -9 "${x}"
- fi
+ exit 0
fi
-done
+fi
+
+rm -f "${D}${infodir}"/dir{,.info}{,.gz,.bz2}
+
+exec ecompressdir "${infodir}"
diff --git a/bin/prepman b/bin/prepman
index beccec8ff..65144a437 100755
--- a/bin/prepman
+++ b/bin/prepman
@@ -1,51 +1,30 @@
#!/bin/bash
-# Copyright 1999-2006 Gentoo Foundation
+# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
if [[ -z $1 ]] ; then
- z="${D}usr/share/man"
+ mandir="${D}usr/share/man"
else
- z="${D}$1/man"
+ mandir="${D}$1/man"
fi
-if [[ ! -d ${z} ]] ; then
- eqawarn "QA Notice: prepman called with non-existent dir '${z#${D}}'"
+if [[ ! -d ${mandir} ]] ; then
+ eqawarn "QA Notice: prepman called with non-existent dir '${mandir#${D}}'"
exit 0
fi
-for x in $(find "${z}"/ -type d 2>/dev/null) ; do
- for y in $(find "${x}"/ -mindepth 1 -maxdepth 1 \( -type f -or -type l \) ! -name '.keep_*' 2>/dev/null) ; do
- if [[ -L ${y} ]] ; then
- # Symlink ...
- mylink=${y}
- linkto=$(readlink "${y}")
-
- # Do NOT change links to directories
- if [[ -d ${z}/${linkto} ]] ; then
- continue
- fi
+shopt -s nullglob
- if [[ ${linkto##*.} != "gz" ]] && [[ ${linkto##*.} != "bz2" ]] ; then
- linkto="${linkto}.gz"
- fi
- if [[ ${mylink##*.} != "gz" ]] && [[ ${mylink##*.} != "bz2" ]] ; then
- mylink="${mylink}.gz"
- fi
+ret=0
- vecho "fixing man page symlink: ${mylink##*/}"
- ln -snf "${linkto}" "${mylink}"
- if [[ ${y} != "${mylink}" ]] ; then
- vecho "removing old symlink: ${y##*/}"
- rm -f "${y}"
- fi
- else
- if [[ ${y##*.} != "gz" ]] && [[ ${y##*.} != "bz2" ]] && [[ ! -d ${y} ]] ; then
- vecho "gzipping man page: ${y##*/}"
- gzip -f -9 "${y}"
- fi
- fi
- done
+# compress and fixup links in each dir
+for subdir in "${mandir}"/man* "${mandir}"/*/man* ; do
+ [[ -d ${subdir} ]] || continue # ignore files named 'man*'
+ ecompressdir "/${subdir#${D}}"
+ ((ret+=$?))
done
+
+exit ${ret}