#!/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
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))
#!/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"
--- /dev/null
+#!/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
--- /dev/null
+#!/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}
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 ]] && \
#!/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}
[[ ! -d ${D}usr/share/info ]] && exit 0
-vecho "info:"
exec prepinfo
#!/bin/bash
-# Copyright 1999-2006 Gentoo Foundation
+# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
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}
#!/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}"
#!/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}