From c9cf1a3a0bb3dc6ca5f801e6886fb4f0be90c767 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Thu, 12 Mar 2009 00:28:45 +0000 Subject: Move ebuild helpers into an ebuild-helpers subdirectory. svn path=/main/trunk/; revision=13063 --- bin/dobin | 29 ------ bin/doconfd | 14 --- bin/dodir | 6 -- bin/dodoc | 28 ------ bin/doenvd | 14 --- bin/doexe | 29 ------ bin/dohard | 14 --- bin/dohtml | 186 ------------------------------------- bin/doinfo | 22 ----- bin/doinitd | 14 --- bin/doins | 98 ------------------- bin/dolib | 41 -------- bin/dolib.a | 7 -- bin/dolib.so | 7 -- bin/doman | 62 ------------- bin/domo | 26 ------ bin/dosbin | 27 ------ bin/dosed | 36 ------- bin/dosym | 14 --- bin/ebuild-helpers/dobin | 29 ++++++ bin/ebuild-helpers/doconfd | 14 +++ bin/ebuild-helpers/dodir | 6 ++ bin/ebuild-helpers/dodoc | 28 ++++++ bin/ebuild-helpers/doenvd | 14 +++ bin/ebuild-helpers/doexe | 29 ++++++ bin/ebuild-helpers/dohard | 14 +++ bin/ebuild-helpers/dohtml | 186 +++++++++++++++++++++++++++++++++++++ bin/ebuild-helpers/doinfo | 22 +++++ bin/ebuild-helpers/doinitd | 14 +++ bin/ebuild-helpers/doins | 98 +++++++++++++++++++ bin/ebuild-helpers/dolib | 41 ++++++++ bin/ebuild-helpers/dolib.a | 7 ++ bin/ebuild-helpers/dolib.so | 7 ++ bin/ebuild-helpers/doman | 62 +++++++++++++ bin/ebuild-helpers/domo | 26 ++++++ bin/ebuild-helpers/dosbin | 27 ++++++ bin/ebuild-helpers/dosed | 36 +++++++ bin/ebuild-helpers/dosym | 14 +++ bin/ebuild-helpers/ecompress | 92 ++++++++++++++++++ bin/ebuild-helpers/ecompressdir | 136 +++++++++++++++++++++++++++ bin/ebuild-helpers/emake | 25 +++++ bin/ebuild-helpers/fowners | 9 ++ bin/ebuild-helpers/fperms | 9 ++ bin/ebuild-helpers/newbin | 18 ++++ bin/ebuild-helpers/newconfd | 18 ++++ bin/ebuild-helpers/newdoc | 18 ++++ bin/ebuild-helpers/newenvd | 18 ++++ bin/ebuild-helpers/newexe | 18 ++++ bin/ebuild-helpers/newinitd | 18 ++++ bin/ebuild-helpers/newins | 21 +++++ bin/ebuild-helpers/newlib.a | 18 ++++ bin/ebuild-helpers/newlib.so | 18 ++++ bin/ebuild-helpers/newman | 18 ++++ bin/ebuild-helpers/newsbin | 18 ++++ bin/ebuild-helpers/portageq | 1 + bin/ebuild-helpers/prepall | 24 +++++ bin/ebuild-helpers/prepalldocs | 16 ++++ bin/ebuild-helpers/prepallinfo | 10 ++ bin/ebuild-helpers/prepallman | 17 ++++ bin/ebuild-helpers/prepallstrip | 6 ++ bin/ebuild-helpers/prepinfo | 31 +++++++ bin/ebuild-helpers/preplib | 29 ++++++ bin/ebuild-helpers/prepman | 30 ++++++ bin/ebuild-helpers/prepstrip | 178 +++++++++++++++++++++++++++++++++++ bin/ebuild-helpers/sed | 28 ++++++ bin/ebuild.sh | 2 +- bin/ecompress | 92 ------------------ bin/ecompressdir | 136 --------------------------- bin/emake | 25 ----- bin/fowners | 9 -- bin/fperms | 9 -- bin/misc-functions.sh | 3 +- bin/newbin | 18 ---- bin/newconfd | 18 ---- bin/newdoc | 18 ---- bin/newenvd | 18 ---- bin/newexe | 18 ---- bin/newinitd | 18 ---- bin/newins | 21 ----- bin/newlib.a | 18 ---- bin/newlib.so | 18 ---- bin/newman | 18 ---- bin/newsbin | 18 ---- bin/prepall | 24 ----- bin/prepalldocs | 16 ---- bin/prepallinfo | 10 -- bin/prepallman | 17 ---- bin/prepallstrip | 6 -- bin/prepinfo | 31 ------- bin/preplib | 29 ------ bin/prepman | 30 ------ bin/prepstrip | 178 ----------------------------------- bin/sed | 28 ------ pym/portage/tests/bin/setup_env.py | 3 +- 94 files changed, 1521 insertions(+), 1518 deletions(-) delete mode 100755 bin/dobin delete mode 100755 bin/doconfd delete mode 100755 bin/dodir delete mode 100755 bin/dodoc delete mode 100755 bin/doenvd delete mode 100755 bin/doexe delete mode 100755 bin/dohard delete mode 100755 bin/dohtml delete mode 100755 bin/doinfo delete mode 100755 bin/doinitd delete mode 100755 bin/doins delete mode 100755 bin/dolib delete mode 100755 bin/dolib.a delete mode 100755 bin/dolib.so delete mode 100755 bin/doman delete mode 100755 bin/domo delete mode 100755 bin/dosbin delete mode 100755 bin/dosed delete mode 100755 bin/dosym create mode 100755 bin/ebuild-helpers/dobin create mode 100755 bin/ebuild-helpers/doconfd create mode 100755 bin/ebuild-helpers/dodir create mode 100755 bin/ebuild-helpers/dodoc create mode 100755 bin/ebuild-helpers/doenvd create mode 100755 bin/ebuild-helpers/doexe create mode 100755 bin/ebuild-helpers/dohard create mode 100755 bin/ebuild-helpers/dohtml create mode 100755 bin/ebuild-helpers/doinfo create mode 100755 bin/ebuild-helpers/doinitd create mode 100755 bin/ebuild-helpers/doins create mode 100755 bin/ebuild-helpers/dolib create mode 100755 bin/ebuild-helpers/dolib.a create mode 100755 bin/ebuild-helpers/dolib.so create mode 100755 bin/ebuild-helpers/doman create mode 100755 bin/ebuild-helpers/domo create mode 100755 bin/ebuild-helpers/dosbin create mode 100755 bin/ebuild-helpers/dosed create mode 100755 bin/ebuild-helpers/dosym create mode 100755 bin/ebuild-helpers/ecompress create mode 100755 bin/ebuild-helpers/ecompressdir create mode 100755 bin/ebuild-helpers/emake create mode 100755 bin/ebuild-helpers/fowners create mode 100755 bin/ebuild-helpers/fperms create mode 100755 bin/ebuild-helpers/newbin create mode 100755 bin/ebuild-helpers/newconfd create mode 100755 bin/ebuild-helpers/newdoc create mode 100755 bin/ebuild-helpers/newenvd create mode 100755 bin/ebuild-helpers/newexe create mode 100755 bin/ebuild-helpers/newinitd create mode 100755 bin/ebuild-helpers/newins create mode 100755 bin/ebuild-helpers/newlib.a create mode 100755 bin/ebuild-helpers/newlib.so create mode 100755 bin/ebuild-helpers/newman create mode 100755 bin/ebuild-helpers/newsbin create mode 120000 bin/ebuild-helpers/portageq create mode 100755 bin/ebuild-helpers/prepall create mode 100755 bin/ebuild-helpers/prepalldocs create mode 100755 bin/ebuild-helpers/prepallinfo create mode 100755 bin/ebuild-helpers/prepallman create mode 100755 bin/ebuild-helpers/prepallstrip create mode 100755 bin/ebuild-helpers/prepinfo create mode 100755 bin/ebuild-helpers/preplib create mode 100755 bin/ebuild-helpers/prepman create mode 100755 bin/ebuild-helpers/prepstrip create mode 100755 bin/ebuild-helpers/sed delete mode 100755 bin/ecompress delete mode 100755 bin/ecompressdir delete mode 100755 bin/emake delete mode 100755 bin/fowners delete mode 100755 bin/fperms delete mode 100755 bin/newbin delete mode 100755 bin/newconfd delete mode 100755 bin/newdoc delete mode 100755 bin/newenvd delete mode 100755 bin/newexe delete mode 100755 bin/newinitd delete mode 100755 bin/newins delete mode 100755 bin/newlib.a delete mode 100755 bin/newlib.so delete mode 100755 bin/newman delete mode 100755 bin/newsbin delete mode 100755 bin/prepall delete mode 100755 bin/prepalldocs delete mode 100755 bin/prepallinfo delete mode 100755 bin/prepallman delete mode 100755 bin/prepallstrip delete mode 100755 bin/prepinfo delete mode 100755 bin/preplib delete mode 100755 bin/prepman delete mode 100755 bin/prepstrip delete mode 100755 bin/sed diff --git a/bin/dobin b/bin/dobin deleted file mode 100755 index 958a37fee..000000000 --- a/bin/dobin +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash -# Copyright 1999-2006 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 [[ $# -lt 1 ]] ; then - vecho "$0: at least one argument needed" 1>&2 - exit 1 -fi - -if [[ ! -d ${D}${DESTTREE}/bin ]] ; then - install -d "${D}${DESTTREE}/bin" || exit 2 -fi - -ret=0 - -for x in "$@" ; do - if [[ -e ${x} ]] ; then - install -m0755 -o ${PORTAGE_INST_UID:-0} -g ${PORTAGE_INST_GID:-0} "${x}" "${D}${DESTTREE}/bin" - else - echo "!!! ${0##*/}: $x does not exist" 1>&2 - false - fi - ((ret+=$?)) -done - -exit ${ret} diff --git a/bin/doconfd b/bin/doconfd deleted file mode 100755 index 9952ec0f6..000000000 --- a/bin/doconfd +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash -# Copyright 1999-2006 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 - exit 1 -fi - -exec \ -env \ -INSDESTTREE="/etc/conf.d/" \ -doins "$@" diff --git a/bin/dodir b/bin/dodir deleted file mode 100755 index 1902c6f38..000000000 --- a/bin/dodir +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -# Copyright 1999-2006 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Id$ - -exec install -d ${DIROPTIONS} "${@/#/${D}/}" diff --git a/bin/dodoc b/bin/dodoc deleted file mode 100755 index adf49d04f..000000000 --- a/bin/dodoc +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -# Copyright 1999-2007 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Id$ - -if [ $# -lt 1 ] ; then - source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh - vecho "${0##*/}: at least one argument needed" 1>&2 - exit 1 -fi - -dir="${D}usr/share/doc/${PF}/${_E_DOCDESTTREE_}" -if [ ! -d "${dir}" ] ; then - install -d "${dir}" -fi - -ret=0 -for x in "$@" ; do - if [ -s "${x}" ] ; then - install -m0644 "${x}" "${dir}" - ecompress --queue "${dir}/${x##*/}" - elif [ ! -e "${x}" ] ; then - echo "!!! ${0##*/}: $x does not exist" 1>&2 - ((++ret)) - fi -done - -exit ${ret} diff --git a/bin/doenvd b/bin/doenvd deleted file mode 100755 index eb7dcd720..000000000 --- a/bin/doenvd +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash -# Copyright 1999-2006 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 - exit 1 -fi - -exec \ -env \ -INSDESTTREE="/etc/env.d/" \ -doins "$@" diff --git a/bin/doexe b/bin/doexe deleted file mode 100755 index 6e72c1c75..000000000 --- a/bin/doexe +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash -# 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 [[ $# -lt 1 ]] ; then - echo "$0: at least one argument needed" 1>&2 - exit 1 -fi - -if [[ ! -d ${D}${_E_EXEDESTTREE_} ]] ; then - install -d "${D}${_E_EXEDESTTREE_}" -fi - -for x in "$@" ; do - if [ -L "${x}" ] ; then - cp "${x}" "${T}" - mysrc="${T}"/$(/usr/bin/basename "${x}") - elif [ -d "${x}" ] ; then - vecho "doexe: warning, skipping directory ${x}" - continue - else - mysrc="${x}" - fi - install $EXEOPTIONS "$mysrc" "$D$_E_EXEDESTTREE_" || \ - echo "!!! ${0##*/}: $mysrc does not exist" 1>&2 -done diff --git a/bin/dohard b/bin/dohard deleted file mode 100755 index dfd7bd341..000000000 --- a/bin/dohard +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash -# Copyright 1999-2007 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Id$ - -if [[ $# -ne 2 ]] ; then - echo "$0: two arguments needed" 1>&2 - exit 1 -fi - -destdir=${2%/*} -[[ ! -d ${D}${destdir} ]] && dodir "${destdir}" - -exec ln -f "${D}$1" "${D}$2" diff --git a/bin/dohtml b/bin/dohtml deleted file mode 100755 index 1c707bdfd..000000000 --- a/bin/dohtml +++ /dev/null @@ -1,186 +0,0 @@ -#!/usr/bin/python -# Copyright 1999-2006 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Id$ - -# -# Typical usage: -# dohtml -r docs/* -# - put all files and directories in docs into /usr/share/doc/${PF}/html -# dohtml foo.html -# - put foo.html into /usr/share/doc/${PF}/html -# -# -# Detailed usage: -# dohtml -# - will install the files in the list of files (space-separated list) into -# /usr/share/doc/${PF}/html, provided the file ends in .htm, .html, .css, -# .js, ,gif, .jpeg, .jpg, or .png. -# dohtml -r -# - will do as 'dohtml', but recurse into all directories, as long as the -# directory name is not CVS -# dohtml -A jpe,java [-r] -# - will do as 'dohtml' but add .jpe,.java (default filter list is -# added to your list) -# dohtml -a png,gif,html,htm [-r] -# - will do as 'dohtml' but filter on .png,.gif,.html,.htm (default filter -# list is ignored) -# dohtml -x CVS,SCCS,RCS -r -# - will do as 'dohtml -r', but ignore directories named CVS, SCCS, RCS -# - -import os -import sys - -def dodir(path): - os.spawnlp(os.P_WAIT, "install", "install", "-d", path) - -def dofile(src,dst): - os.spawnlp(os.P_WAIT, "install", "install", "-m0644", src, dst) - -def eqawarn(lines): - cmd = "source '%s/isolated-functions.sh' ; " % \ - os.environ["PORTAGE_BIN_PATH"] - for line in lines: - cmd += "eqawarn \"%s\" ; " % line - os.spawnlp(os.P_WAIT, "bash", "bash", "-c", cmd) - -skipped_directories = [] - -def install(basename, dirname, options, prefix=""): - fullpath = basename - if prefix: - fullpath = prefix + "/" + fullpath - if dirname: - fullpath = dirname + "/" + fullpath - - if options.DOCDESTTREE: - destdir = options.D + "usr/share/doc/" + options.PF + "/" + options.DOCDESTTREE + "/" + options.doc_prefix + "/" + prefix - else: - destdir = options.D + "usr/share/doc/" + options.PF + "/html/" + options.doc_prefix + "/" + prefix - - if os.path.isfile(fullpath): - ext = os.path.splitext(basename)[1] - if (len(ext) and ext[1:] in options.allowed_exts) or basename in options.allowed_files: - dodir(destdir) - dofile(fullpath, destdir + "/" + basename) - elif options.recurse and os.path.isdir(fullpath) and \ - basename not in options.disallowed_dirs: - for i in os.listdir(fullpath): - pfx = basename - if prefix: pfx = prefix + "/" + pfx - install(i, dirname, options, pfx) - elif not options.recurse and os.path.isdir(fullpath): - global skipped_directories - skipped_directories.append(fullpath) - return False - else: - return False - return True - - -class OptionsClass: - def __init__(self): - self.PF = "" - self.D = "" - self.DOCDESTTREE = "" - - if "PF" in os.environ: - self.PF = os.environ["PF"] - if "D" in os.environ: - self.D = os.environ["D"] - if "_E_DOCDESTTREE_" in os.environ: - self.DOCDESTTREE = os.environ["_E_DOCDESTTREE_"] - - self.allowed_exts = [ 'htm', 'html', 'css', 'js', - 'gif', 'jpeg', 'jpg', 'png' ] - self.allowed_files = [] - self.disallowed_dirs = [ 'CVS' ] - self.recurse = False - self.verbose = False - self.doc_prefix = "" - -def print_help(): - opts = OptionsClass() - - print "dohtml [-a .foo,.bar] [-A .foo,.bar] [-f foo,bar] [-x foo,bar]" - print " [-r] [-V] [file ...]" - print - print " -a Set the list of allowed to those that are specified." - print " Default:", ",".join(opts.allowed_exts) - print " -A Extend the list of allowed file types." - print " -f Set list of allowed extensionless file names." - print " -x Set directories to be excluded from recursion." - print " Default:", ",".join(opts.disallowed_dirs) - print " -p Set a document prefix for installed files (empty by default)." - print " -r Install files and directories recursively." - print " -V Be verbose." - print - -def parse_args(): - options = OptionsClass() - args = [] - - x = 1 - while x < len(sys.argv): - arg = sys.argv[x] - if arg in ["-h","-r","-V"]: - if arg == "-h": - print_help() - sys.exit(0) - elif arg == "-r": - options.recurse = True - elif arg == "-V": - options.verbose = True - elif sys.argv[x] in ["-A","-a","-f","-x","-p"]: - x += 1 - if x == len(sys.argv): - print_help() - sys.exit(0) - elif arg == "-p": - options.doc_prefix = sys.argv[x] - else: - values = sys.argv[x].split(",") - if arg == "-A": - options.allowed_exts.extend(values) - elif arg == "-a": - options.allowed_exts = values - elif arg == "-f": - options.allowed_files = values - elif arg == "-x": - options.disallowed_dirs = values - else: - args.append(sys.argv[x]) - x += 1 - - return (options, args) - -def main(): - - (options, args) = parse_args() - - if options.verbose: - print "Allowed extensions:", options.allowed_exts - print "Document prefix : '" + options.doc_prefix + "'" - print "Allowed files :", options.allowed_files - - success = False - - for x in args: - basename = os.path.basename(x) - dirname = os.path.dirname(x) - success |= install(basename, dirname, options) - - if success: - retcode = 0 - else: - retcode = 1 - global skipped_directories - for x in skipped_directories: - eqawarn(["QA Notice: dohtml on directory " + \ - "'%s' without recursion option" % x]) - - sys.exit(retcode) - -if __name__ == "__main__": - main() diff --git a/bin/doinfo b/bin/doinfo deleted file mode 100755 index 1c9e7cc07..000000000 --- a/bin/doinfo +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -# Copyright 1999-2007 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Id$ - -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" || exit 1 -fi - -install -m0644 "$@" "${D}usr/share/info" -rval=$? -if [ $rval -ne 0 ] ; then - for x in "$@" ; do - [ -e "$x" ] || echo "!!! ${0##*/}: $x does not exist" 1>&2 - done -fi -exit $rval diff --git a/bin/doinitd b/bin/doinitd deleted file mode 100755 index 0f1af9406..000000000 --- a/bin/doinitd +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash -# 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 - exit 1 -fi - -exec \ -env \ -_E_EXEDESTTREE_="/etc/init.d/" \ -doexe "$@" diff --git a/bin/doins b/bin/doins deleted file mode 100755 index 8c06bfd9a..000000000 --- a/bin/doins +++ /dev/null @@ -1,98 +0,0 @@ -#!/bin/bash -# 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 [ $# -lt 1 ] ; then - echo "${0##*/}: at least one argument needed" 1>&2 - exit 1 -fi - -if [[ "$1" == "-r" ]] ; then - DOINSRECUR=y - shift -else - DOINSRECUR=n -fi - -if [[ ${INSDESTTREE#${D}} != "${INSDESTTREE}" ]]; then - vecho "-------------------------------------------------------" 1>&2 - vecho "You should not use \${D} with helpers." 1>&2 - vecho " --> ${INSDESTTREE}" 1>&2 - vecho "-------------------------------------------------------" 1>&2 - exit 1 -fi - -export TMP=$T/.doins_tmp -# Use separate directories to avoid potential name collisions. -mkdir -p "$TMP"/{1,2} - -[[ ! -d ${D}${INSDESTTREE} ]] && dodir "${INSDESTTREE}" - -_doins() { - local mysrc="$1" mydir="$2" cleanup="" rval - - if [ -L "$mysrc" ] ; then - cp "$mysrc" "$TMP/2" - mysrc="$TMP/2/${mysrc##*/}" - cleanup=${mysrc} - fi - - install ${INSOPTIONS} "${mysrc}" "${D}${INSDESTTREE}/${mydir}" - rval=$? - [[ -n ${cleanup} ]] && rm -f "${cleanup}" - [ $rval -ne 0 ] && echo "!!! ${0##*/}: $mysrc does not exist" 1>&2 - return $rval -} - -_xdoins() { - while read -d $'\0' x ; do - _doins "$x" "${x%/*}" - done -} - -success=0 - -for x in "$@" ; do - if [ -d "$x" ] ; then - if [ "${DOINSRECUR}" == "n" ] ; then - continue - fi - - while [ "$x" != "${x%/}" ] ; do - x=${x%/} - done - if [ "$x" = "${x%/*}" ] ; then - pushd "$PWD" >/dev/null - else - pushd "${x%/*}" >/dev/null - fi - x=${x##*/} - x_orig=$x - # Follow any symlinks recursively until we've got - # a normal directory for 'find' to traverse. - while [ -L "$x" ] ; do - pushd "$(readlink "$x")" >/dev/null - x=${PWD##*/} - pushd "${PWD%/*}" >/dev/null - done - if [[ $x != $x_orig ]] ; then - mv "$x" "$TMP/1/$x_orig" - pushd "$TMP/1" >/dev/null - fi - find "$x_orig" -type d -exec dodir "${INSDESTTREE}/{}" \; - find "$x_orig" \( -type f -or -type l \) -print0 | _xdoins - if [[ $x != $x_orig ]] ; then - popd >/dev/null - mv "$TMP/1/$x_orig" "$x" - fi - while popd >/dev/null 2>&1 ; do true ; done - ((++success)) - else - _doins "${x}" && ((++success)) - fi -done -rm -rf "$TMP" -[ $success -gt 0 ] && exit 0 || exit 1 diff --git a/bin/dolib b/bin/dolib deleted file mode 100755 index 6c6628bda..000000000 --- a/bin/dolib +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash -# Copyright 1999-2006 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Id$ - -# Setup ABI cruft -LIBDIR_VAR="LIBDIR_${ABI}" -if [[ -n ${ABI} && -n ${!LIBDIR_VAR} ]] ; then - CONF_LIBDIR=${!LIBDIR_VAR} -fi -unset LIBDIR_VAR -# we need this to default to lib so that things dont break -CONF_LIBDIR=${CONF_LIBDIR:-lib} -libdir="${D}${DESTTREE}/${CONF_LIBDIR}" - - -if [[ $# -lt 1 ]] ; then - echo "$0: at least one argument needed" 1>&2 - exit 1 -fi -if [[ ! -d ${libdir} ]] ; then - install -d "${libdir}" || exit 1 -fi - -ret=0 - -for x in "$@" ; do - if [[ -e ${x} ]] ; then - if [[ ! -L ${x} ]] ; then - install ${LIBOPTIONS} "${x}" "${libdir}" - else - ln -s "$(readlink "${x}")" "${libdir}/${x##*/}" - fi - else - echo "!!! ${0##*/}: ${x} does not exist" 1>&2 - false - fi - ((ret+=$?)) -done - -exit ${ret} diff --git a/bin/dolib.a b/bin/dolib.a deleted file mode 100755 index 3ef57d2fb..000000000 --- a/bin/dolib.a +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -# Copyright 1999-2006 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Id$ - -exec env LIBOPTIONS="-m0644" \ - dolib "$@" diff --git a/bin/dolib.so b/bin/dolib.so deleted file mode 100755 index e4d477f60..000000000 --- a/bin/dolib.so +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -# Copyright 1999-2006 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Id$ - -exec env LIBOPTIONS="-m0755" \ - dolib "$@" diff --git a/bin/doman b/bin/doman deleted file mode 100755 index 48abc39fd..000000000 --- a/bin/doman +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/bash -# Copyright 1999-2006 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 [[ $# -lt 1 ]] ; then - echo "$0: at least one argument needed" 1>&2 - exit 1 -fi - -i18n="" - -ret=0 - -for x in "$@" ; do - if [[ ${x:0:6} == "-i18n=" ]] ; then - i18n=${x:6}/ - continue - fi - if [[ ${x:0:6} == ".keep_" ]] ; then - continue - fi - - suffix=${x##*.} - - # These will be automatically decompressed by ecompressdir. - if hasq ${suffix} Z gz bz2 ; then - realname=${x%.*} - suffix=${realname##*.} - fi - - if ! hasq "${EAPI:-0}" 0 1 && \ - [[ $x =~ (.*)\.([a-z][a-z](_[A-Z][A-Z])?)\.(.*) ]] ; then - name=${BASH_REMATCH[1]##*/}.${BASH_REMATCH[4]} - mandir=${BASH_REMATCH[2]}/man${suffix:0:1} - else - name=${x##*/} - mandir=${i18n}man${suffix:0:1} - fi - - - if [[ ${mandir} =~ man[0-9n](f|p|pm)?$ ]] ; then - if [[ -s ${x} ]] ; then - if [[ ! -d ${D}/usr/share/man/${mandir} ]] ; then - install -d "${D}/usr/share/man/${mandir}" - fi - - install -m0644 "${x}" "${D}/usr/share/man/${mandir}/${name}" - ((ret+=$?)) - elif [[ ! -e ${x} ]] ; then - echo "!!! ${0##*/}: $x does not exist" 1>&2 - ((++ret)) - fi - else - vecho "doman: '${x}' is probably not a man page; skipping" 1>&2 - ((++ret)) - fi -done - -exit ${ret} diff --git a/bin/domo b/bin/domo deleted file mode 100755 index a7ba5775a..000000000 --- a/bin/domo +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -# Copyright 1999-2006 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Id$ - -mynum=${#} -if [ ${mynum} -lt 1 ] ; then - echo "${0}: at least one argument needed" - exit 1 -fi -if [ ! -d "${D}${DESTTREE}/share/locale" ] ; then - install -d "${D}${DESTTREE}/share/locale/" -fi - -for x in "$@" ; do - if [ -e "${x}" ] ; then - mytiny="${x##*/}" - mydir="${D}${DESTTREE}/share/locale/${mytiny%.*}/LC_MESSAGES" - if [ ! -d "${mydir}" ] ; then - install -d "${mydir}" - fi - install -m0644 "${x}" "${mydir}/${MOPREFIX}.mo" - else - echo "!!! ${0##*/}: $x does not exist" 1>&2 - fi -done diff --git a/bin/dosbin b/bin/dosbin deleted file mode 100755 index c9e85c0b8..000000000 --- a/bin/dosbin +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash -# Copyright 1999-2006 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 - exit 1 -fi - -if [[ ! -d ${D}${DESTTREE}/sbin ]] ; then - install -d "${D}${DESTTREE}/sbin" || exit 2 -fi - -ret=0 - -for x in "$@" ; do - if [[ -e ${x} ]] ; then - install -m0755 -o ${PORTAGE_INST_UID:-0} -g ${PORTAGE_INST_GID:-0} "${x}" "${D}${DESTTREE}/sbin" - else - echo "!!! ${0##*/}: ${x} does not exist" 1>&2 - false - fi - ((ret+=$?)) -done - -exit ${ret} diff --git a/bin/dosed b/bin/dosed deleted file mode 100755 index abcb15a79..000000000 --- a/bin/dosed +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash -# Copyright 1999-2006 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" >&2 - exit 1 -fi - -ret=0 -file_found=0 -mysed="s:${D}::g" - -for x in "$@" ; do - y=$D${x#/} - if [ -e "${y}" ] ; then - if [ -f "${y}" ] ; then - file_found=1 - sed -i -e "${mysed}" "${y}" - else - echo "${y} is not a regular file!" >&2 - false - fi - ((ret+=$?)) - else - mysed="${x}" - fi -done - -if [ $file_found = 0 ] ; then - echo "!!! ${0##*/}: $y does not exist" 1>&2 - ((ret+=1)) -fi - -exit $ret diff --git a/bin/dosym b/bin/dosym deleted file mode 100755 index da31246cb..000000000 --- a/bin/dosym +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash -# Copyright 1999-2006 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Id$ - -if [[ $# -ne 2 ]] ; then - echo "$0: two arguments needed" 1>&2 - exit 1 -fi - -destdir=${2%/*} -[[ ! -d ${D}${destdir} ]] && dodir "${destdir}" - -exec ln -snf "$1" "${D}$2" diff --git a/bin/ebuild-helpers/dobin b/bin/ebuild-helpers/dobin new file mode 100755 index 000000000..958a37fee --- /dev/null +++ b/bin/ebuild-helpers/dobin @@ -0,0 +1,29 @@ +#!/bin/bash +# Copyright 1999-2006 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 [[ $# -lt 1 ]] ; then + vecho "$0: at least one argument needed" 1>&2 + exit 1 +fi + +if [[ ! -d ${D}${DESTTREE}/bin ]] ; then + install -d "${D}${DESTTREE}/bin" || exit 2 +fi + +ret=0 + +for x in "$@" ; do + if [[ -e ${x} ]] ; then + install -m0755 -o ${PORTAGE_INST_UID:-0} -g ${PORTAGE_INST_GID:-0} "${x}" "${D}${DESTTREE}/bin" + else + echo "!!! ${0##*/}: $x does not exist" 1>&2 + false + fi + ((ret+=$?)) +done + +exit ${ret} diff --git a/bin/ebuild-helpers/doconfd b/bin/ebuild-helpers/doconfd new file mode 100755 index 000000000..9952ec0f6 --- /dev/null +++ b/bin/ebuild-helpers/doconfd @@ -0,0 +1,14 @@ +#!/bin/bash +# Copyright 1999-2006 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 + exit 1 +fi + +exec \ +env \ +INSDESTTREE="/etc/conf.d/" \ +doins "$@" diff --git a/bin/ebuild-helpers/dodir b/bin/ebuild-helpers/dodir new file mode 100755 index 000000000..1902c6f38 --- /dev/null +++ b/bin/ebuild-helpers/dodir @@ -0,0 +1,6 @@ +#!/bin/bash +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +exec install -d ${DIROPTIONS} "${@/#/${D}/}" diff --git a/bin/ebuild-helpers/dodoc b/bin/ebuild-helpers/dodoc new file mode 100755 index 000000000..adf49d04f --- /dev/null +++ b/bin/ebuild-helpers/dodoc @@ -0,0 +1,28 @@ +#!/bin/bash +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +if [ $# -lt 1 ] ; then + source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh + vecho "${0##*/}: at least one argument needed" 1>&2 + exit 1 +fi + +dir="${D}usr/share/doc/${PF}/${_E_DOCDESTTREE_}" +if [ ! -d "${dir}" ] ; then + install -d "${dir}" +fi + +ret=0 +for x in "$@" ; do + if [ -s "${x}" ] ; then + install -m0644 "${x}" "${dir}" + ecompress --queue "${dir}/${x##*/}" + elif [ ! -e "${x}" ] ; then + echo "!!! ${0##*/}: $x does not exist" 1>&2 + ((++ret)) + fi +done + +exit ${ret} diff --git a/bin/ebuild-helpers/doenvd b/bin/ebuild-helpers/doenvd new file mode 100755 index 000000000..eb7dcd720 --- /dev/null +++ b/bin/ebuild-helpers/doenvd @@ -0,0 +1,14 @@ +#!/bin/bash +# Copyright 1999-2006 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 + exit 1 +fi + +exec \ +env \ +INSDESTTREE="/etc/env.d/" \ +doins "$@" diff --git a/bin/ebuild-helpers/doexe b/bin/ebuild-helpers/doexe new file mode 100755 index 000000000..6e72c1c75 --- /dev/null +++ b/bin/ebuild-helpers/doexe @@ -0,0 +1,29 @@ +#!/bin/bash +# 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 [[ $# -lt 1 ]] ; then + echo "$0: at least one argument needed" 1>&2 + exit 1 +fi + +if [[ ! -d ${D}${_E_EXEDESTTREE_} ]] ; then + install -d "${D}${_E_EXEDESTTREE_}" +fi + +for x in "$@" ; do + if [ -L "${x}" ] ; then + cp "${x}" "${T}" + mysrc="${T}"/$(/usr/bin/basename "${x}") + elif [ -d "${x}" ] ; then + vecho "doexe: warning, skipping directory ${x}" + continue + else + mysrc="${x}" + fi + install $EXEOPTIONS "$mysrc" "$D$_E_EXEDESTTREE_" || \ + echo "!!! ${0##*/}: $mysrc does not exist" 1>&2 +done diff --git a/bin/ebuild-helpers/dohard b/bin/ebuild-helpers/dohard new file mode 100755 index 000000000..dfd7bd341 --- /dev/null +++ b/bin/ebuild-helpers/dohard @@ -0,0 +1,14 @@ +#!/bin/bash +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +if [[ $# -ne 2 ]] ; then + echo "$0: two arguments needed" 1>&2 + exit 1 +fi + +destdir=${2%/*} +[[ ! -d ${D}${destdir} ]] && dodir "${destdir}" + +exec ln -f "${D}$1" "${D}$2" diff --git a/bin/ebuild-helpers/dohtml b/bin/ebuild-helpers/dohtml new file mode 100755 index 000000000..1c707bdfd --- /dev/null +++ b/bin/ebuild-helpers/dohtml @@ -0,0 +1,186 @@ +#!/usr/bin/python +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +# +# Typical usage: +# dohtml -r docs/* +# - put all files and directories in docs into /usr/share/doc/${PF}/html +# dohtml foo.html +# - put foo.html into /usr/share/doc/${PF}/html +# +# +# Detailed usage: +# dohtml +# - will install the files in the list of files (space-separated list) into +# /usr/share/doc/${PF}/html, provided the file ends in .htm, .html, .css, +# .js, ,gif, .jpeg, .jpg, or .png. +# dohtml -r +# - will do as 'dohtml', but recurse into all directories, as long as the +# directory name is not CVS +# dohtml -A jpe,java [-r] +# - will do as 'dohtml' but add .jpe,.java (default filter list is +# added to your list) +# dohtml -a png,gif,html,htm [-r] +# - will do as 'dohtml' but filter on .png,.gif,.html,.htm (default filter +# list is ignored) +# dohtml -x CVS,SCCS,RCS -r +# - will do as 'dohtml -r', but ignore directories named CVS, SCCS, RCS +# + +import os +import sys + +def dodir(path): + os.spawnlp(os.P_WAIT, "install", "install", "-d", path) + +def dofile(src,dst): + os.spawnlp(os.P_WAIT, "install", "install", "-m0644", src, dst) + +def eqawarn(lines): + cmd = "source '%s/isolated-functions.sh' ; " % \ + os.environ["PORTAGE_BIN_PATH"] + for line in lines: + cmd += "eqawarn \"%s\" ; " % line + os.spawnlp(os.P_WAIT, "bash", "bash", "-c", cmd) + +skipped_directories = [] + +def install(basename, dirname, options, prefix=""): + fullpath = basename + if prefix: + fullpath = prefix + "/" + fullpath + if dirname: + fullpath = dirname + "/" + fullpath + + if options.DOCDESTTREE: + destdir = options.D + "usr/share/doc/" + options.PF + "/" + options.DOCDESTTREE + "/" + options.doc_prefix + "/" + prefix + else: + destdir = options.D + "usr/share/doc/" + options.PF + "/html/" + options.doc_prefix + "/" + prefix + + if os.path.isfile(fullpath): + ext = os.path.splitext(basename)[1] + if (len(ext) and ext[1:] in options.allowed_exts) or basename in options.allowed_files: + dodir(destdir) + dofile(fullpath, destdir + "/" + basename) + elif options.recurse and os.path.isdir(fullpath) and \ + basename not in options.disallowed_dirs: + for i in os.listdir(fullpath): + pfx = basename + if prefix: pfx = prefix + "/" + pfx + install(i, dirname, options, pfx) + elif not options.recurse and os.path.isdir(fullpath): + global skipped_directories + skipped_directories.append(fullpath) + return False + else: + return False + return True + + +class OptionsClass: + def __init__(self): + self.PF = "" + self.D = "" + self.DOCDESTTREE = "" + + if "PF" in os.environ: + self.PF = os.environ["PF"] + if "D" in os.environ: + self.D = os.environ["D"] + if "_E_DOCDESTTREE_" in os.environ: + self.DOCDESTTREE = os.environ["_E_DOCDESTTREE_"] + + self.allowed_exts = [ 'htm', 'html', 'css', 'js', + 'gif', 'jpeg', 'jpg', 'png' ] + self.allowed_files = [] + self.disallowed_dirs = [ 'CVS' ] + self.recurse = False + self.verbose = False + self.doc_prefix = "" + +def print_help(): + opts = OptionsClass() + + print "dohtml [-a .foo,.bar] [-A .foo,.bar] [-f foo,bar] [-x foo,bar]" + print " [-r] [-V] [file ...]" + print + print " -a Set the list of allowed to those that are specified." + print " Default:", ",".join(opts.allowed_exts) + print " -A Extend the list of allowed file types." + print " -f Set list of allowed extensionless file names." + print " -x Set directories to be excluded from recursion." + print " Default:", ",".join(opts.disallowed_dirs) + print " -p Set a document prefix for installed files (empty by default)." + print " -r Install files and directories recursively." + print " -V Be verbose." + print + +def parse_args(): + options = OptionsClass() + args = [] + + x = 1 + while x < len(sys.argv): + arg = sys.argv[x] + if arg in ["-h","-r","-V"]: + if arg == "-h": + print_help() + sys.exit(0) + elif arg == "-r": + options.recurse = True + elif arg == "-V": + options.verbose = True + elif sys.argv[x] in ["-A","-a","-f","-x","-p"]: + x += 1 + if x == len(sys.argv): + print_help() + sys.exit(0) + elif arg == "-p": + options.doc_prefix = sys.argv[x] + else: + values = sys.argv[x].split(",") + if arg == "-A": + options.allowed_exts.extend(values) + elif arg == "-a": + options.allowed_exts = values + elif arg == "-f": + options.allowed_files = values + elif arg == "-x": + options.disallowed_dirs = values + else: + args.append(sys.argv[x]) + x += 1 + + return (options, args) + +def main(): + + (options, args) = parse_args() + + if options.verbose: + print "Allowed extensions:", options.allowed_exts + print "Document prefix : '" + options.doc_prefix + "'" + print "Allowed files :", options.allowed_files + + success = False + + for x in args: + basename = os.path.basename(x) + dirname = os.path.dirname(x) + success |= install(basename, dirname, options) + + if success: + retcode = 0 + else: + retcode = 1 + global skipped_directories + for x in skipped_directories: + eqawarn(["QA Notice: dohtml on directory " + \ + "'%s' without recursion option" % x]) + + sys.exit(retcode) + +if __name__ == "__main__": + main() diff --git a/bin/ebuild-helpers/doinfo b/bin/ebuild-helpers/doinfo new file mode 100755 index 000000000..1c9e7cc07 --- /dev/null +++ b/bin/ebuild-helpers/doinfo @@ -0,0 +1,22 @@ +#!/bin/bash +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +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" || exit 1 +fi + +install -m0644 "$@" "${D}usr/share/info" +rval=$? +if [ $rval -ne 0 ] ; then + for x in "$@" ; do + [ -e "$x" ] || echo "!!! ${0##*/}: $x does not exist" 1>&2 + done +fi +exit $rval diff --git a/bin/ebuild-helpers/doinitd b/bin/ebuild-helpers/doinitd new file mode 100755 index 000000000..0f1af9406 --- /dev/null +++ b/bin/ebuild-helpers/doinitd @@ -0,0 +1,14 @@ +#!/bin/bash +# 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 + exit 1 +fi + +exec \ +env \ +_E_EXEDESTTREE_="/etc/init.d/" \ +doexe "$@" diff --git a/bin/ebuild-helpers/doins b/bin/ebuild-helpers/doins new file mode 100755 index 000000000..8c06bfd9a --- /dev/null +++ b/bin/ebuild-helpers/doins @@ -0,0 +1,98 @@ +#!/bin/bash +# 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 [ $# -lt 1 ] ; then + echo "${0##*/}: at least one argument needed" 1>&2 + exit 1 +fi + +if [[ "$1" == "-r" ]] ; then + DOINSRECUR=y + shift +else + DOINSRECUR=n +fi + +if [[ ${INSDESTTREE#${D}} != "${INSDESTTREE}" ]]; then + vecho "-------------------------------------------------------" 1>&2 + vecho "You should not use \${D} with helpers." 1>&2 + vecho " --> ${INSDESTTREE}" 1>&2 + vecho "-------------------------------------------------------" 1>&2 + exit 1 +fi + +export TMP=$T/.doins_tmp +# Use separate directories to avoid potential name collisions. +mkdir -p "$TMP"/{1,2} + +[[ ! -d ${D}${INSDESTTREE} ]] && dodir "${INSDESTTREE}" + +_doins() { + local mysrc="$1" mydir="$2" cleanup="" rval + + if [ -L "$mysrc" ] ; then + cp "$mysrc" "$TMP/2" + mysrc="$TMP/2/${mysrc##*/}" + cleanup=${mysrc} + fi + + install ${INSOPTIONS} "${mysrc}" "${D}${INSDESTTREE}/${mydir}" + rval=$? + [[ -n ${cleanup} ]] && rm -f "${cleanup}" + [ $rval -ne 0 ] && echo "!!! ${0##*/}: $mysrc does not exist" 1>&2 + return $rval +} + +_xdoins() { + while read -d $'\0' x ; do + _doins "$x" "${x%/*}" + done +} + +success=0 + +for x in "$@" ; do + if [ -d "$x" ] ; then + if [ "${DOINSRECUR}" == "n" ] ; then + continue + fi + + while [ "$x" != "${x%/}" ] ; do + x=${x%/} + done + if [ "$x" = "${x%/*}" ] ; then + pushd "$PWD" >/dev/null + else + pushd "${x%/*}" >/dev/null + fi + x=${x##*/} + x_orig=$x + # Follow any symlinks recursively until we've got + # a normal directory for 'find' to traverse. + while [ -L "$x" ] ; do + pushd "$(readlink "$x")" >/dev/null + x=${PWD##*/} + pushd "${PWD%/*}" >/dev/null + done + if [[ $x != $x_orig ]] ; then + mv "$x" "$TMP/1/$x_orig" + pushd "$TMP/1" >/dev/null + fi + find "$x_orig" -type d -exec dodir "${INSDESTTREE}/{}" \; + find "$x_orig" \( -type f -or -type l \) -print0 | _xdoins + if [[ $x != $x_orig ]] ; then + popd >/dev/null + mv "$TMP/1/$x_orig" "$x" + fi + while popd >/dev/null 2>&1 ; do true ; done + ((++success)) + else + _doins "${x}" && ((++success)) + fi +done +rm -rf "$TMP" +[ $success -gt 0 ] && exit 0 || exit 1 diff --git a/bin/ebuild-helpers/dolib b/bin/ebuild-helpers/dolib new file mode 100755 index 000000000..6c6628bda --- /dev/null +++ b/bin/ebuild-helpers/dolib @@ -0,0 +1,41 @@ +#!/bin/bash +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +# Setup ABI cruft +LIBDIR_VAR="LIBDIR_${ABI}" +if [[ -n ${ABI} && -n ${!LIBDIR_VAR} ]] ; then + CONF_LIBDIR=${!LIBDIR_VAR} +fi +unset LIBDIR_VAR +# we need this to default to lib so that things dont break +CONF_LIBDIR=${CONF_LIBDIR:-lib} +libdir="${D}${DESTTREE}/${CONF_LIBDIR}" + + +if [[ $# -lt 1 ]] ; then + echo "$0: at least one argument needed" 1>&2 + exit 1 +fi +if [[ ! -d ${libdir} ]] ; then + install -d "${libdir}" || exit 1 +fi + +ret=0 + +for x in "$@" ; do + if [[ -e ${x} ]] ; then + if [[ ! -L ${x} ]] ; then + install ${LIBOPTIONS} "${x}" "${libdir}" + else + ln -s "$(readlink "${x}")" "${libdir}/${x##*/}" + fi + else + echo "!!! ${0##*/}: ${x} does not exist" 1>&2 + false + fi + ((ret+=$?)) +done + +exit ${ret} diff --git a/bin/ebuild-helpers/dolib.a b/bin/ebuild-helpers/dolib.a new file mode 100755 index 000000000..3ef57d2fb --- /dev/null +++ b/bin/ebuild-helpers/dolib.a @@ -0,0 +1,7 @@ +#!/bin/bash +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +exec env LIBOPTIONS="-m0644" \ + dolib "$@" diff --git a/bin/ebuild-helpers/dolib.so b/bin/ebuild-helpers/dolib.so new file mode 100755 index 000000000..e4d477f60 --- /dev/null +++ b/bin/ebuild-helpers/dolib.so @@ -0,0 +1,7 @@ +#!/bin/bash +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +exec env LIBOPTIONS="-m0755" \ + dolib "$@" diff --git a/bin/ebuild-helpers/doman b/bin/ebuild-helpers/doman new file mode 100755 index 000000000..48abc39fd --- /dev/null +++ b/bin/ebuild-helpers/doman @@ -0,0 +1,62 @@ +#!/bin/bash +# Copyright 1999-2006 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 [[ $# -lt 1 ]] ; then + echo "$0: at least one argument needed" 1>&2 + exit 1 +fi + +i18n="" + +ret=0 + +for x in "$@" ; do + if [[ ${x:0:6} == "-i18n=" ]] ; then + i18n=${x:6}/ + continue + fi + if [[ ${x:0:6} == ".keep_" ]] ; then + continue + fi + + suffix=${x##*.} + + # These will be automatically decompressed by ecompressdir. + if hasq ${suffix} Z gz bz2 ; then + realname=${x%.*} + suffix=${realname##*.} + fi + + if ! hasq "${EAPI:-0}" 0 1 && \ + [[ $x =~ (.*)\.([a-z][a-z](_[A-Z][A-Z])?)\.(.*) ]] ; then + name=${BASH_REMATCH[1]##*/}.${BASH_REMATCH[4]} + mandir=${BASH_REMATCH[2]}/man${suffix:0:1} + else + name=${x##*/} + mandir=${i18n}man${suffix:0:1} + fi + + + if [[ ${mandir} =~ man[0-9n](f|p|pm)?$ ]] ; then + if [[ -s ${x} ]] ; then + if [[ ! -d ${D}/usr/share/man/${mandir} ]] ; then + install -d "${D}/usr/share/man/${mandir}" + fi + + install -m0644 "${x}" "${D}/usr/share/man/${mandir}/${name}" + ((ret+=$?)) + elif [[ ! -e ${x} ]] ; then + echo "!!! ${0##*/}: $x does not exist" 1>&2 + ((++ret)) + fi + else + vecho "doman: '${x}' is probably not a man page; skipping" 1>&2 + ((++ret)) + fi +done + +exit ${ret} diff --git a/bin/ebuild-helpers/domo b/bin/ebuild-helpers/domo new file mode 100755 index 000000000..a7ba5775a --- /dev/null +++ b/bin/ebuild-helpers/domo @@ -0,0 +1,26 @@ +#!/bin/bash +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +mynum=${#} +if [ ${mynum} -lt 1 ] ; then + echo "${0}: at least one argument needed" + exit 1 +fi +if [ ! -d "${D}${DESTTREE}/share/locale" ] ; then + install -d "${D}${DESTTREE}/share/locale/" +fi + +for x in "$@" ; do + if [ -e "${x}" ] ; then + mytiny="${x##*/}" + mydir="${D}${DESTTREE}/share/locale/${mytiny%.*}/LC_MESSAGES" + if [ ! -d "${mydir}" ] ; then + install -d "${mydir}" + fi + install -m0644 "${x}" "${mydir}/${MOPREFIX}.mo" + else + echo "!!! ${0##*/}: $x does not exist" 1>&2 + fi +done diff --git a/bin/ebuild-helpers/dosbin b/bin/ebuild-helpers/dosbin new file mode 100755 index 000000000..c9e85c0b8 --- /dev/null +++ b/bin/ebuild-helpers/dosbin @@ -0,0 +1,27 @@ +#!/bin/bash +# Copyright 1999-2006 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 + exit 1 +fi + +if [[ ! -d ${D}${DESTTREE}/sbin ]] ; then + install -d "${D}${DESTTREE}/sbin" || exit 2 +fi + +ret=0 + +for x in "$@" ; do + if [[ -e ${x} ]] ; then + install -m0755 -o ${PORTAGE_INST_UID:-0} -g ${PORTAGE_INST_GID:-0} "${x}" "${D}${DESTTREE}/sbin" + else + echo "!!! ${0##*/}: ${x} does not exist" 1>&2 + false + fi + ((ret+=$?)) +done + +exit ${ret} diff --git a/bin/ebuild-helpers/dosed b/bin/ebuild-helpers/dosed new file mode 100755 index 000000000..abcb15a79 --- /dev/null +++ b/bin/ebuild-helpers/dosed @@ -0,0 +1,36 @@ +#!/bin/bash +# Copyright 1999-2006 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" >&2 + exit 1 +fi + +ret=0 +file_found=0 +mysed="s:${D}::g" + +for x in "$@" ; do + y=$D${x#/} + if [ -e "${y}" ] ; then + if [ -f "${y}" ] ; then + file_found=1 + sed -i -e "${mysed}" "${y}" + else + echo "${y} is not a regular file!" >&2 + false + fi + ((ret+=$?)) + else + mysed="${x}" + fi +done + +if [ $file_found = 0 ] ; then + echo "!!! ${0##*/}: $y does not exist" 1>&2 + ((ret+=1)) +fi + +exit $ret diff --git a/bin/ebuild-helpers/dosym b/bin/ebuild-helpers/dosym new file mode 100755 index 000000000..da31246cb --- /dev/null +++ b/bin/ebuild-helpers/dosym @@ -0,0 +1,14 @@ +#!/bin/bash +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +if [[ $# -ne 2 ]] ; then + echo "$0: two arguments needed" 1>&2 + exit 1 +fi + +destdir=${2%/*} +[[ ! -d ${D}${destdir} ]] && dodir "${destdir}" + +exec ln -snf "$1" "${D}$2" diff --git a/bin/ebuild-helpers/ecompress b/bin/ebuild-helpers/ecompress new file mode 100755 index 000000000..6fdde5719 --- /dev/null +++ b/bin/ebuild-helpers/ecompress @@ -0,0 +1,92 @@ +#!/bin/bash +# 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 + vecho "${0##*/}: at least one argument needed" 1>&2 + exit 1 +fi + +# setup compression stuff +PORTAGE_COMPRESS=${PORTAGE_COMPRESS-bzip2} +[[ -z ${PORTAGE_COMPRESS} ]] && exit 0 + +if [[ ${PORTAGE_COMPRESS_FLAGS+set} != "set" ]] ; then + case ${PORTAGE_COMPRESS} in + bzip2|gzip) PORTAGE_COMPRESS_FLAGS="-9";; + esac +fi + +case $1 in + --suffix) + [[ -n $2 ]] && vecho "${0##*/}: --suffix takes no additional arguments" 1>&2 + + if [[ ! -e ${T}/.ecompress.suffix ]] ; then + 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 > /dev/null + suffix=$(ls compressme*) + suffix=${suffix#compressme} + cd / + rm -rf "${tmpdir}" + echo "${suffix}" > "${T}/.ecompress.suffix" + fi + cat "${T}/.ecompress.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 + ;; + *) + mask_ext_re="" + set -f + for x in $PORTAGE_COMPRESS_EXCLUDE_SUFFIXES ; do + mask_ext_re+="|$x" + done + set +f + mask_ext_re="^(${mask_ext_re:1})\$" + declare -a filtered_args=() + i=0 + for x in "$@" ; do + [[ ${x##*.} =~ $mask_ext_re ]] && continue + filtered_args[$i]=$x + (( i++ )) + done + [ $i -eq 0 ] && exit 0 + set -- "${filtered_args[@]}" + + # If a compressed version of the file already exists, simply + # delete it so that the compressor doesn't whine (bzip2 will + # complain and skip, gzip will prompt for input) + suffix=$(ecompress --suffix) + [[ -n ${suffix} ]] && echo -n "${@/%/${suffix}$'\001'}" | \ + tr '\001' '\000' | ${XARGS} -0 rm -f + # Finally, let's actually do some real work + exec "${PORTAGE_COMPRESS}" ${PORTAGE_COMPRESS_FLAGS} "$@" + ;; +esac diff --git a/bin/ebuild-helpers/ecompressdir b/bin/ebuild-helpers/ecompressdir new file mode 100755 index 000000000..4dd35e549 --- /dev/null +++ b/bin/ebuild-helpers/ecompressdir @@ -0,0 +1,136 @@ +#!/bin/bash +# 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 + vecho "${0##*/}: at least one argument needed" 1>&2 + 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) + +# funk_up_dir(action, suffix, binary) +# - action: compress or decompress +# - suffix: the compression suffix to work with +# - binary: the program to execute that'll compress/decompress +# The directory we act on is implied in the ${dir} variable +funk_up_dir() { + local act=$1 suffix=$2 binary=$3 + + local negate="" + [[ ${act} == "compress" ]] && negate="!" + + # first we act on all the files + find "${dir}" -type f ${negate} -iname '*'${suffix} -print0 | ${XARGS} -0 ${binary} + ((ret+=$?)) + + find "${dir}" -type l -print0 | \ + while read -d $'\0' brokenlink ; do + [[ -e ${brokenlink} ]] && continue + olddest=$(readlink "${brokenlink}") + [[ ${act} == "compress" ]] \ + && newdest="${olddest}${suffix}" \ + || newdest="${olddest%${suffix}}" + rm -f "${brokenlink}" + [[ ${act} == "compress" ]] \ + && ln -snf "${newdest}" "${brokenlink}${suffix}" \ + || ln -snf "${newdest}" "${brokenlink%${suffix}}" + ((ret+=$?)) + done +} + +# _relocate_skip_dirs(srctree, dsttree) +# Move all the directories we want to skip running compression +# on from srctree to dsttree. +_relocate_skip_dirs() { + local srctree="$1" dsttree="$2" + + [[ -d ${srctree} ]] || return 0 + + find "${srctree}" -name '*.ecompress.skip' -print0 | \ + while read -d $'\0' src ; 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=${dir#/} + dir="${D}${dir}" + if [[ ! -d ${dir} ]] ; then + vecho "${0##*/}: /${dir#${D}} does not exist!" + continue + fi + cd "${dir}" + actual_dir=${dir} + dir=. # use relative path to avoid 'Argument list too long' errors + + # 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 "${actual_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 -f" + funk_up_dir "decompress" ".gz" "gunzip -f" + funk_up_dir "decompress" ".bz2" "bunzip2 -f" + + # 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}"' \; + + # now lets do our work + [[ -z ${suffix} ]] && continue + vecho "${0##*/}: $(ecompress --bin) /${actual_dir#${D}}" + funk_up_dir "compress" "${suffix}" "ecompress" + + # finally, restore the skipped stuff + restore_skip_dirs +done + +exit ${ret} diff --git a/bin/ebuild-helpers/emake b/bin/ebuild-helpers/emake new file mode 100755 index 000000000..18d8f089c --- /dev/null +++ b/bin/ebuild-helpers/emake @@ -0,0 +1,25 @@ +#!/bin/bash +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ +# +# emake: Supplies some default parameters to GNU make. At the moment the +# only parameter supplied is -jN, where N is a number of +# parallel processes that should be ideal for the running host +# (e.g. on a single-CPU machine, N=2). The MAKEOPTS variable +# is set in /etc/make.globals. We don't source +# /etc/make.globals here because emake is only called from an +# ebuild. + +if [[ $PORTAGE_QUIET != 1 ]] ; then + ( + for arg in ${MAKE:-make} $MAKEOPTS $EXTRA_EMAKE "$@" ; do + [[ ${arg} == *" "* ]] \ + && printf "'%s' " "${arg}" \ + || printf "%s " "${arg}" + done + printf "\n" + ) >&2 +fi + +exec ${MAKE:-make} ${MAKEOPTS} ${EXTRA_EMAKE} "$@" diff --git a/bin/ebuild-helpers/fowners b/bin/ebuild-helpers/fowners new file mode 100755 index 000000000..766266a13 --- /dev/null +++ b/bin/ebuild-helpers/fowners @@ -0,0 +1,9 @@ +#!/bin/bash +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +# we can't prefix all arguments because +# chown takes random options +slash="/" +exec chown "${@/#${slash}/${D}${slash}}" diff --git a/bin/ebuild-helpers/fperms b/bin/ebuild-helpers/fperms new file mode 100755 index 000000000..1d5326ec9 --- /dev/null +++ b/bin/ebuild-helpers/fperms @@ -0,0 +1,9 @@ +#!/bin/bash +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +# we can't prefix all arguments because +# chmod takes random options +slash="/" +exec chmod "${@/#${slash}/${D}${slash}}" diff --git a/bin/ebuild-helpers/newbin b/bin/ebuild-helpers/newbin new file mode 100755 index 000000000..905b2802e --- /dev/null +++ b/bin/ebuild-helpers/newbin @@ -0,0 +1,18 @@ +#!/bin/bash +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +if [[ -z ${T} ]] || [[ -z ${2} ]] ; then + echo "$0: Need two arguments, old file and new file" 1>&2 + exit 1 +fi + +if [ ! -e "$1" ] ; then + echo "!!! ${0##*/}: $1 does not exist" 1>&2 + exit 1 +fi + +rm -rf "${T}/${2}" && \ +cp -f "${1}" "${T}/${2}" && \ +exec dobin "${T}/${2}" diff --git a/bin/ebuild-helpers/newconfd b/bin/ebuild-helpers/newconfd new file mode 100755 index 000000000..6d57a343c --- /dev/null +++ b/bin/ebuild-helpers/newconfd @@ -0,0 +1,18 @@ +#!/bin/bash +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +if [[ -z ${T} ]] || [[ -z ${2} ]] ; then + echo "$0: Need two arguments, old file and new file" 1>&2 + exit 1 +fi + +if [ ! -e "$1" ] ; then + echo "!!! ${0##*/}: $1 does not exist" 1>&2 + exit 1 +fi + +rm -rf "${T}/${2}" && \ +cp -f "${1}" "${T}/${2}" && \ +exec doconfd "${T}/${2}" diff --git a/bin/ebuild-helpers/newdoc b/bin/ebuild-helpers/newdoc new file mode 100755 index 000000000..331bf0d02 --- /dev/null +++ b/bin/ebuild-helpers/newdoc @@ -0,0 +1,18 @@ +#!/bin/bash +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +if [[ -z ${T} ]] || [[ -z ${2} ]] ; then + echo "$0: Need two arguments, old file and new file" 1>&2 + exit 1 +fi + +if [ ! -e "$1" ] ; then + echo "!!! ${0##*/}: $1 does not exist" 1>&2 + exit 1 +fi + +rm -rf "${T}/${2}" && \ +cp -f "${1}" "${T}/${2}" && \ +exec dodoc "${T}/${2}" diff --git a/bin/ebuild-helpers/newenvd b/bin/ebuild-helpers/newenvd new file mode 100755 index 000000000..2c03e3738 --- /dev/null +++ b/bin/ebuild-helpers/newenvd @@ -0,0 +1,18 @@ +#!/bin/bash +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +if [[ -z ${T} ]] || [[ -z ${2} ]] ; then + echo "$0: Need two arguments, old file and new file" 1>&2 + exit 1 +fi + +if [ ! -e "$1" ] ; then + echo "!!! ${0##*/}: $1 does not exist" 1>&2 + exit 1 +fi + +rm -rf "${T}/${2}" && \ +cp -f "${1}" "${T}/${2}" && \ +exec doenvd "${T}/${2}" diff --git a/bin/ebuild-helpers/newexe b/bin/ebuild-helpers/newexe new file mode 100755 index 000000000..32d7d9293 --- /dev/null +++ b/bin/ebuild-helpers/newexe @@ -0,0 +1,18 @@ +#!/bin/bash +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +if [[ -z ${T} ]] || [[ -z ${2} ]] ; then + echo "$0: Need two arguments, old file and new file" 1>&2 + exit 1 +fi + +if [ ! -e "$1" ] ; then + echo "!!! ${0##*/}: $1 does not exist" 1>&2 + exit 1 +fi + +rm -rf "${T}/${2}" && \ +cp -f "${1}" "${T}/${2}" && \ +exec doexe "${T}/${2}" diff --git a/bin/ebuild-helpers/newinitd b/bin/ebuild-helpers/newinitd new file mode 100755 index 000000000..7ab89ae0b --- /dev/null +++ b/bin/ebuild-helpers/newinitd @@ -0,0 +1,18 @@ +#!/bin/bash +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +if [[ -z ${T} ]] || [[ -z ${2} ]] ; then + echo "$0: Need two arguments, old file and new file" 1>&2 + exit 1 +fi + +if [ ! -e "$1" ] ; then + echo "!!! ${0##*/}: $1 does not exist" 1>&2 + exit 1 +fi + +rm -rf "${T}/${2}" && \ +cp -f "${1}" "${T}/${2}" && \ +exec doinitd "${T}/${2}" diff --git a/bin/ebuild-helpers/newins b/bin/ebuild-helpers/newins new file mode 100755 index 000000000..f235835a2 --- /dev/null +++ b/bin/ebuild-helpers/newins @@ -0,0 +1,21 @@ +#!/bin/bash +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +if [[ -z ${T} ]] || [[ -z ${2} ]] ; then + echo "$0: Need two arguments, old file and new file" 1>&2 + exit 1 +fi + +if [ ! -e "$1" ] ; then + echo "!!! ${0##*/}: $1 does not exist" 1>&2 + exit 1 +fi + +rm -rf "${T}/${2}" || exit $? +cp -f "${1}" "${T}/${2}" || exit $? +doins "${T}/${2}" +ret=$? +rm -rf "${T}/${2}" +exit $ret diff --git a/bin/ebuild-helpers/newlib.a b/bin/ebuild-helpers/newlib.a new file mode 100755 index 000000000..ddcb1af25 --- /dev/null +++ b/bin/ebuild-helpers/newlib.a @@ -0,0 +1,18 @@ +#!/bin/bash +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +if [[ -z ${T} ]] || [[ -z ${2} ]] ; then + echo "$0: Need two arguments, old file and new file" 1>&2 + exit 1 +fi + +if [ ! -e "$1" ] ; then + echo "!!! ${0##*/}: $1 does not exist" 1>&2 + exit 1 +fi + +rm -rf "${T}/${2}" && \ +cp -f "${1}" "${T}/${2}" && \ +exec dolib.a "${T}/${2}" diff --git a/bin/ebuild-helpers/newlib.so b/bin/ebuild-helpers/newlib.so new file mode 100755 index 000000000..eb23d2675 --- /dev/null +++ b/bin/ebuild-helpers/newlib.so @@ -0,0 +1,18 @@ +#!/bin/bash +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +if [[ -z ${T} ]] || [[ -z ${2} ]] ; then + echo "$0: Need two arguments, old file and new file" 1>&2 + exit 1 +fi + +if [ ! -e "$1" ] ; then + echo "!!! ${0##*/}: $1 does not exist" 1>&2 + exit 1 +fi + +rm -rf "${T}/${2}" && \ +cp -f "${1}" "${T}/${2}" && \ +exec dolib.so "${T}/${2}" diff --git a/bin/ebuild-helpers/newman b/bin/ebuild-helpers/newman new file mode 100755 index 000000000..2d278aedd --- /dev/null +++ b/bin/ebuild-helpers/newman @@ -0,0 +1,18 @@ +#!/bin/bash +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +if [[ -z ${T} ]] || [[ -z ${2} ]] ; then + echo "$0: Need two arguments, old file and new file" 1>&2 + exit 1 +fi + +if [ ! -e "$1" ] ; then + echo "!!! ${0##*/}: $1 does not exist" 1>&2 + exit 1 +fi + +rm -rf "${T}/${2}" && \ +cp -f "${1}" "${T}/${2}" && \ +exec doman "${T}/${2}" diff --git a/bin/ebuild-helpers/newsbin b/bin/ebuild-helpers/newsbin new file mode 100755 index 000000000..cfe754501 --- /dev/null +++ b/bin/ebuild-helpers/newsbin @@ -0,0 +1,18 @@ +#!/bin/bash +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +if [[ -z ${T} ]] || [[ -z ${2} ]] ; then + echo "$0: Need two arguments, old file and new file" 1>&2 + exit 1 +fi + +if [ ! -e "$1" ] ; then + echo "!!! ${0##*/}: $1 does not exist" 1>&2 + exit 1 +fi + +rm -rf "${T}/${2}" && \ +cp -f "${1}" "${T}/${2}" && \ +exec dosbin "${T}/${2}" diff --git a/bin/ebuild-helpers/portageq b/bin/ebuild-helpers/portageq new file mode 120000 index 000000000..4d1273c48 --- /dev/null +++ b/bin/ebuild-helpers/portageq @@ -0,0 +1 @@ +../portageq \ No newline at end of file diff --git a/bin/ebuild-helpers/prepall b/bin/ebuild-helpers/prepall new file mode 100755 index 000000000..eec5c814c --- /dev/null +++ b/bin/ebuild-helpers/prepall @@ -0,0 +1,24 @@ +#!/bin/bash +# 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 type -P chflags > /dev/null && type -P mtree > /dev/null ; then + # Save all the file flags for restoration at the end of prepall. + mtree -c -p "${D}" -k flags > "${T}/bsdflags.mtree" + # Remove all the file flags so that prepall can do anything necessary. + chflags -R noschg,nouchg,nosappnd,nouappnd "${D}" + chflags -R nosunlnk,nouunlnk "${D}" 2>/dev/null +fi + +prepallman +prepallinfo + +prepallstrip + +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 +fi diff --git a/bin/ebuild-helpers/prepalldocs b/bin/ebuild-helpers/prepalldocs new file mode 100755 index 000000000..c9509d1ff --- /dev/null +++ b/bin/ebuild-helpers/prepalldocs @@ -0,0 +1,16 @@ +#!/bin/bash +# 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 + +cd "${D}" +[[ -d usr/share/doc ]] || exit 0 + +ecompressdir --ignore /usr/share/doc/${PF}/html +ecompressdir --queue /usr/share/doc diff --git a/bin/ebuild-helpers/prepallinfo b/bin/ebuild-helpers/prepallinfo new file mode 100755 index 000000000..af95bbfce --- /dev/null +++ b/bin/ebuild-helpers/prepallinfo @@ -0,0 +1,10 @@ +#!/bin/bash +# Copyright 1999-2006 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 + +[[ ! -d ${D}usr/share/info ]] && exit 0 + +exec prepinfo diff --git a/bin/ebuild-helpers/prepallman b/bin/ebuild-helpers/prepallman new file mode 100755 index 000000000..747ed1fac --- /dev/null +++ b/bin/ebuild-helpers/prepallman @@ -0,0 +1,17 @@ +#!/bin/bash +# 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 + +ret=0 + +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/ebuild-helpers/prepallstrip b/bin/ebuild-helpers/prepallstrip new file mode 100755 index 000000000..178ded797 --- /dev/null +++ b/bin/ebuild-helpers/prepallstrip @@ -0,0 +1,6 @@ +#!/bin/bash +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +exec prepstrip "${D}" diff --git a/bin/ebuild-helpers/prepinfo b/bin/ebuild-helpers/prepinfo new file mode 100755 index 000000000..582f41fed --- /dev/null +++ b/bin/ebuild-helpers/prepinfo @@ -0,0 +1,31 @@ +#!/bin/bash +# 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 + infodir="/usr/share/info" +else + if [[ -d ${D}$1/share/info ]] ; then + infodir="$1/share/info" + else + infodir="$1/info" + fi +fi + +if [[ ! -d ${D}${infodir} ]] ; then + if [[ -n $1 ]] ; then + vecho "${0##*/}: '${infodir}' does not exist!" + exit 1 + else + exit 0 + fi +fi + +find "${D}${infodir}" -type d -print0 | while read -d $'\0' x ; do + rm -f "${x}"/dir{,.info}{,.gz,.bz2} +done + +exec ecompressdir --queue "${infodir}" diff --git a/bin/ebuild-helpers/preplib b/bin/ebuild-helpers/preplib new file mode 100755 index 000000000..71446316a --- /dev/null +++ b/bin/ebuild-helpers/preplib @@ -0,0 +1,29 @@ +#!/bin/bash +# Copyright 1999-2006 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 + +eqawarn "QA Notice: Deprecated call to 'preplib'" + +LIBDIR_VAR="LIBDIR_${ABI}" +if [ -n "${ABI}" -a -n "${!LIBDIR_VAR}" ]; then + CONF_LIBDIR="${!LIBDIR_VAR}" +fi +unset LIBDIR_VAR + +if [ -z "${CONF_LIBDIR}" ]; then + # we need this to default to lib so that things dont break + CONF_LIBDIR="lib" +fi + +if [ -z "$1" ] ; then + z="${D}usr/${CONF_LIBDIR}" +else + z="${D}$1/${CONF_LIBDIR}" +fi + +if [ -d "${z}" ] ; then + ldconfig -n -N "${z}" +fi diff --git a/bin/ebuild-helpers/prepman b/bin/ebuild-helpers/prepman new file mode 100755 index 000000000..af6ad1f82 --- /dev/null +++ b/bin/ebuild-helpers/prepman @@ -0,0 +1,30 @@ +#!/bin/bash +# 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 + mandir="${D}usr/share/man" +else + mandir="${D}$1/man" +fi + +if [[ ! -d ${mandir} ]] ; then + eqawarn "QA Notice: prepman called with non-existent dir '${mandir#${D}}'" + exit 0 +fi + +shopt -s nullglob + +really_is_mandir=0 + +# use some heuristics to test if this is a real mandir +for subdir in "${mandir}"/man* "${mandir}"/*/man* ; do + [[ -d ${subdir} ]] && really_is_mandir=1 && break +done + +[[ ${really_is_mandir} == 1 ]] && exec ecompressdir --queue "${mandir#${D}}" + +exit 0 diff --git a/bin/ebuild-helpers/prepstrip b/bin/ebuild-helpers/prepstrip new file mode 100755 index 000000000..977ccec7f --- /dev/null +++ b/bin/ebuild-helpers/prepstrip @@ -0,0 +1,178 @@ +#!/bin/bash +# 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 + +banner=false +SKIP_STRIP=false +if hasq nostrip ${FEATURES} || \ + hasq strip ${RESTRICT} +then + SKIP_STRIP=true + banner=true + hasq installsources ${FEATURES} || exit 0 +fi + +STRIP=${STRIP:-${CHOST}-strip} +type -P -- ${STRIP} > /dev/null || STRIP=strip +OBJCOPY=${OBJCOPY:-${CHOST}-objcopy} +type -P -- ${OBJCOPY} > /dev/null || OBJCOPY=objcopy + +# We'll leave out -R .note for now until we can check out the relevance +# of the section when it has the ALLOC flag set on it ... +export SAFE_STRIP_FLAGS="--strip-unneeded" +export PORTAGE_STRIP_FLAGS=${PORTAGE_STRIP_FLAGS-${SAFE_STRIP_FLAGS} -R .comment} + +if hasq installsources ${FEATURES} && ! type -P debugedit >/dev/null ; then + ewarn "FEATURES=installsources is enabled but the debugedit binary could not" + ewarn "be found. This feature will not work unless debugedit is installed!" +fi + +unset ${!INODE_*} + +inode_var_name() { + if [[ $USERLAND = BSD ]] ; then + stat -f 'INODE_%d_%i' "$1" + else + stat -c 'INODE_%d_%i' "$1" + fi +} + +save_elf_sources() { + hasq installsources ${FEATURES} || return 0 + hasq installsources ${RESTRICT} && return 0 + type -P debugedit >/dev/null || return 0 + + local x=$1 + local inode=$(inode_var_name "$x") + [[ -n ${!inode} ]] && return 0 + local sources_dir=/usr/src/debug/${CATEGORY}/${PF} + debugedit -b "${WORKDIR}" -d "${sources_dir}" \ + -l "${T}"/debug.sources "${x}" + if [[ -s ${T}/debug.sources ]] ; then + [[ -d ${D}${sources_dir} ]] || mkdir -p "${D}${sources_dir}" + grep -zv '/$' "${T}"/debug.sources | \ + (cd "${WORKDIR}"; LANG=C sort -z -u | \ + rsync -rtL0 --files-from=- "${WORKDIR}/" "${D}${sources_dir}/" ) + fi +} + +save_elf_debug() { + hasq splitdebug ${FEATURES} || return 0 + + local x=$1 + local y="${D}usr/lib/debug/${x:${#D}}.debug" + + # dont save debug info twice + [[ ${x} == *".debug" ]] && return 0 + + # this will recompute the build-id, but for now that's ok + local buildid="$( type -P debugedit >/dev/null && debugedit -i "${x}" )" + + mkdir -p $(dirname "${y}") + + local inode=$(inode_var_name "$x") + if [[ -n ${!inode} ]] ; then + ln "${D}usr/lib/debug/${!inode:${#D}}.debug" "$y" + else + eval $inode=\$x + ${OBJCOPY} --only-keep-debug "${x}" "${y}" + ${OBJCOPY} --add-gnu-debuglink="${y}" "${x}" + [[ -g ${x} ]] && chmod go-r "${y}" + [[ -u ${x} ]] && chmod go-r "${y}" + chmod a-x,o-w "${y}" + fi + + if [[ -n ${buildid} ]] ; then + local buildid_dir="${D}usr/lib/debug/.build-id/${buildid:0:2}" + local buildid_file="${buildid_dir}/${buildid:2}" + mkdir -p "${buildid_dir}" + ln -s "../../${x:${#D}}.debug" "${buildid_file}.debug" + ln -s "/${x:${#D}}" "${buildid_file}" + fi +} + +# The existance of the section .symtab tells us that a binary is stripped. +# We want to log already stripped binaries, as this may be a QA violation. +# They prevent us from getting the splitdebug data. +if ! hasq binchecks ${RESTRICT} && \ + ! hasq strip ${RESTRICT} ; then + log=$T/scanelf-already-stripped.log + scanelf -yqRBF '#k%F' -k '!.symtab' "$@" | sed -e "s#^$D##" > "$log" + if [[ -n $QA_PRESTRIPPED && -s $log && \ + ${QA_STRICT_PRESTRIPPED-unset} = unset ]] ; then + shopts=$- + set -o noglob + for x in $QA_PRESTRIPPED ; do + sed -e "s#^${x#/}\$##" -i "$log" + done + set +o noglob + set -$shopts + fi + sed -e "/^\$/d" -e "s#^#/#" -i "$log" + if [[ -s $log ]] ; then + vecho -e "\a\n" + eqawarn "QA Notice: Pre-stripped files found:" + eqawarn "$(<"$log")" + else + rm -f "$log" + fi +fi + +# Now we look for unstripped binaries. +for x in \ + $(scanelf -yqRBF '#k%F' -k '.symtab' "$@") \ + $(find "$@" -type f -name '*.a') +do + if ! ${banner} ; then + vecho "strip: ${STRIP} ${PORTAGE_STRIP_FLAGS}" + banner=true + fi + + f=$(file "${x}") || continue + [[ -z ${f} ]] && continue + + if ! ${SKIP_STRIP} ; then + # The noglob funk is to support STRIP_MASK="/*/booga" and to keep + # the for loop from expanding the globs. + # The eval echo is to support STRIP_MASK="/*/{booga,bar}" sex. + set -o noglob + strip_this=true + for m in $(eval echo ${STRIP_MASK}) ; do + [[ /${x#${D}} == ${m} ]] && strip_this=false && break + done + set +o noglob + else + strip_this=false + fi + + # only split debug info for final linked objects + # or kernel modules as debuginfo for intermediatary + # files (think crt*.o from gcc/glibc) is useless and + # actually causes problems. install sources for all + # elf types though cause that stuff is good. + + if [[ ${f} == *"current ar archive"* ]] ; then + vecho " ${x:${#D}}" + if ${strip_this} ; then + # hmm, can we split debug/sources for .a ? + ${STRIP} -g "${x}" + fi + elif [[ ${f} == *"SB executable"* || ${f} == *"SB shared object"* ]] ; then + vecho " ${x:${#D}}" + save_elf_sources "${x}" + if ${strip_this} ; then + save_elf_debug "${x}" + ${STRIP} ${PORTAGE_STRIP_FLAGS} "${x}" + fi + elif [[ ${f} == *"SB relocatable"* ]] ; then + vecho " ${x:${#D}}" + save_elf_sources "${x}" + if ${strip_this} ; then + [[ ${x} == *.ko ]] && save_elf_debug "${x}" + ${STRIP} ${SAFE_STRIP_FLAGS} "${x}" + fi + fi +done diff --git a/bin/ebuild-helpers/sed b/bin/ebuild-helpers/sed new file mode 100755 index 000000000..6fc545002 --- /dev/null +++ b/bin/ebuild-helpers/sed @@ -0,0 +1,28 @@ +#!/bin/bash +# Copyright 2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +scriptpath=${BASH_SOURCE[0]} +scriptname=${scriptpath##*/} + +if [[ sed == ${scriptname} ]] && [[ -n ${ESED} ]]; then + exec ${ESED} "$@" +elif type -P g${scriptname} > /dev/null ; then + exec g${scriptname} "$@" +else + old_IFS="${IFS}" + IFS=":" + + for path in $PATH; do + [[ ${path}/${scriptname} == ${scriptpath} ]] && continue + if [[ -x ${path}/${scriptname} ]]; then + exec ${path}/${scriptname} "$@" + exit 0 + fi + done + + IFS="${old_IFS}" +fi + +exit 1 diff --git a/bin/ebuild.sh b/bin/ebuild.sh index 9d3428349..23f1c447f 100755 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -70,7 +70,7 @@ unalias -a # Unset some variables that break things. unset GZIP BZIP BZIP2 CDPATH GREP_OPTIONS GREP_COLOR GLOBIGNORE -export PATH="/usr/local/sbin:/sbin:/usr/sbin:${PORTAGE_BIN_PATH}:/usr/local/bin:/bin:/usr/bin:${ROOTPATH}" +export PATH="/usr/local/sbin:/sbin:/usr/sbin:$PORTAGE_BIN_PATH/ebuild-helpers:/usr/local/bin:/bin:/usr/bin:${ROOTPATH}" [ ! -z "$PREROOTPATH" ] && export PATH="${PREROOTPATH%%:}:$PATH" source "${PORTAGE_BIN_PATH}/isolated-functions.sh" &>/dev/null diff --git a/bin/ecompress b/bin/ecompress deleted file mode 100755 index 6fdde5719..000000000 --- a/bin/ecompress +++ /dev/null @@ -1,92 +0,0 @@ -#!/bin/bash -# 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 - vecho "${0##*/}: at least one argument needed" 1>&2 - exit 1 -fi - -# setup compression stuff -PORTAGE_COMPRESS=${PORTAGE_COMPRESS-bzip2} -[[ -z ${PORTAGE_COMPRESS} ]] && exit 0 - -if [[ ${PORTAGE_COMPRESS_FLAGS+set} != "set" ]] ; then - case ${PORTAGE_COMPRESS} in - bzip2|gzip) PORTAGE_COMPRESS_FLAGS="-9";; - esac -fi - -case $1 in - --suffix) - [[ -n $2 ]] && vecho "${0##*/}: --suffix takes no additional arguments" 1>&2 - - if [[ ! -e ${T}/.ecompress.suffix ]] ; then - 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 > /dev/null - suffix=$(ls compressme*) - suffix=${suffix#compressme} - cd / - rm -rf "${tmpdir}" - echo "${suffix}" > "${T}/.ecompress.suffix" - fi - cat "${T}/.ecompress.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 - ;; - *) - mask_ext_re="" - set -f - for x in $PORTAGE_COMPRESS_EXCLUDE_SUFFIXES ; do - mask_ext_re+="|$x" - done - set +f - mask_ext_re="^(${mask_ext_re:1})\$" - declare -a filtered_args=() - i=0 - for x in "$@" ; do - [[ ${x##*.} =~ $mask_ext_re ]] && continue - filtered_args[$i]=$x - (( i++ )) - done - [ $i -eq 0 ] && exit 0 - set -- "${filtered_args[@]}" - - # If a compressed version of the file already exists, simply - # delete it so that the compressor doesn't whine (bzip2 will - # complain and skip, gzip will prompt for input) - suffix=$(ecompress --suffix) - [[ -n ${suffix} ]] && echo -n "${@/%/${suffix}$'\001'}" | \ - tr '\001' '\000' | ${XARGS} -0 rm -f - # Finally, let's actually do some real work - exec "${PORTAGE_COMPRESS}" ${PORTAGE_COMPRESS_FLAGS} "$@" - ;; -esac diff --git a/bin/ecompressdir b/bin/ecompressdir deleted file mode 100755 index 4dd35e549..000000000 --- a/bin/ecompressdir +++ /dev/null @@ -1,136 +0,0 @@ -#!/bin/bash -# 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 - vecho "${0##*/}: at least one argument needed" 1>&2 - 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) - -# funk_up_dir(action, suffix, binary) -# - action: compress or decompress -# - suffix: the compression suffix to work with -# - binary: the program to execute that'll compress/decompress -# The directory we act on is implied in the ${dir} variable -funk_up_dir() { - local act=$1 suffix=$2 binary=$3 - - local negate="" - [[ ${act} == "compress" ]] && negate="!" - - # first we act on all the files - find "${dir}" -type f ${negate} -iname '*'${suffix} -print0 | ${XARGS} -0 ${binary} - ((ret+=$?)) - - find "${dir}" -type l -print0 | \ - while read -d $'\0' brokenlink ; do - [[ -e ${brokenlink} ]] && continue - olddest=$(readlink "${brokenlink}") - [[ ${act} == "compress" ]] \ - && newdest="${olddest}${suffix}" \ - || newdest="${olddest%${suffix}}" - rm -f "${brokenlink}" - [[ ${act} == "compress" ]] \ - && ln -snf "${newdest}" "${brokenlink}${suffix}" \ - || ln -snf "${newdest}" "${brokenlink%${suffix}}" - ((ret+=$?)) - done -} - -# _relocate_skip_dirs(srctree, dsttree) -# Move all the directories we want to skip running compression -# on from srctree to dsttree. -_relocate_skip_dirs() { - local srctree="$1" dsttree="$2" - - [[ -d ${srctree} ]] || return 0 - - find "${srctree}" -name '*.ecompress.skip' -print0 | \ - while read -d $'\0' src ; 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=${dir#/} - dir="${D}${dir}" - if [[ ! -d ${dir} ]] ; then - vecho "${0##*/}: /${dir#${D}} does not exist!" - continue - fi - cd "${dir}" - actual_dir=${dir} - dir=. # use relative path to avoid 'Argument list too long' errors - - # 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 "${actual_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 -f" - funk_up_dir "decompress" ".gz" "gunzip -f" - funk_up_dir "decompress" ".bz2" "bunzip2 -f" - - # 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}"' \; - - # now lets do our work - [[ -z ${suffix} ]] && continue - vecho "${0##*/}: $(ecompress --bin) /${actual_dir#${D}}" - funk_up_dir "compress" "${suffix}" "ecompress" - - # finally, restore the skipped stuff - restore_skip_dirs -done - -exit ${ret} diff --git a/bin/emake b/bin/emake deleted file mode 100755 index 18d8f089c..000000000 --- a/bin/emake +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash -# Copyright 1999-2006 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Id$ -# -# emake: Supplies some default parameters to GNU make. At the moment the -# only parameter supplied is -jN, where N is a number of -# parallel processes that should be ideal for the running host -# (e.g. on a single-CPU machine, N=2). The MAKEOPTS variable -# is set in /etc/make.globals. We don't source -# /etc/make.globals here because emake is only called from an -# ebuild. - -if [[ $PORTAGE_QUIET != 1 ]] ; then - ( - for arg in ${MAKE:-make} $MAKEOPTS $EXTRA_EMAKE "$@" ; do - [[ ${arg} == *" "* ]] \ - && printf "'%s' " "${arg}" \ - || printf "%s " "${arg}" - done - printf "\n" - ) >&2 -fi - -exec ${MAKE:-make} ${MAKEOPTS} ${EXTRA_EMAKE} "$@" diff --git a/bin/fowners b/bin/fowners deleted file mode 100755 index 766266a13..000000000 --- a/bin/fowners +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash -# Copyright 1999-2007 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Id$ - -# we can't prefix all arguments because -# chown takes random options -slash="/" -exec chown "${@/#${slash}/${D}${slash}}" diff --git a/bin/fperms b/bin/fperms deleted file mode 100755 index 1d5326ec9..000000000 --- a/bin/fperms +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash -# Copyright 1999-2007 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Id$ - -# we can't prefix all arguments because -# chmod takes random options -slash="/" -exec chmod "${@/#${slash}/${D}${slash}}" diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh index c29852309..e5de71340 100755 --- a/bin/misc-functions.sh +++ b/bin/misc-functions.sh @@ -382,7 +382,8 @@ install_qa_check() { abort="yes" fi done - f=$(cat "${PORTAGE_LOG_FILE}" | check-implicit-pointer-usage.py) + f=$(cat "${PORTAGE_LOG_FILE}" | \ + "$PORTAGE_BIN_PATH"/check-implicit-pointer-usage.py) if [[ -n ${f} ]] ; then # In the future this will be a forced "die". In preparation, diff --git a/bin/newbin b/bin/newbin deleted file mode 100755 index 905b2802e..000000000 --- a/bin/newbin +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright 1999-2006 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Id$ - -if [[ -z ${T} ]] || [[ -z ${2} ]] ; then - echo "$0: Need two arguments, old file and new file" 1>&2 - exit 1 -fi - -if [ ! -e "$1" ] ; then - echo "!!! ${0##*/}: $1 does not exist" 1>&2 - exit 1 -fi - -rm -rf "${T}/${2}" && \ -cp -f "${1}" "${T}/${2}" && \ -exec dobin "${T}/${2}" diff --git a/bin/newconfd b/bin/newconfd deleted file mode 100755 index 6d57a343c..000000000 --- a/bin/newconfd +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright 1999-2006 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Id$ - -if [[ -z ${T} ]] || [[ -z ${2} ]] ; then - echo "$0: Need two arguments, old file and new file" 1>&2 - exit 1 -fi - -if [ ! -e "$1" ] ; then - echo "!!! ${0##*/}: $1 does not exist" 1>&2 - exit 1 -fi - -rm -rf "${T}/${2}" && \ -cp -f "${1}" "${T}/${2}" && \ -exec doconfd "${T}/${2}" diff --git a/bin/newdoc b/bin/newdoc deleted file mode 100755 index 331bf0d02..000000000 --- a/bin/newdoc +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright 1999-2006 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Id$ - -if [[ -z ${T} ]] || [[ -z ${2} ]] ; then - echo "$0: Need two arguments, old file and new file" 1>&2 - exit 1 -fi - -if [ ! -e "$1" ] ; then - echo "!!! ${0##*/}: $1 does not exist" 1>&2 - exit 1 -fi - -rm -rf "${T}/${2}" && \ -cp -f "${1}" "${T}/${2}" && \ -exec dodoc "${T}/${2}" diff --git a/bin/newenvd b/bin/newenvd deleted file mode 100755 index 2c03e3738..000000000 --- a/bin/newenvd +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright 1999-2006 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Id$ - -if [[ -z ${T} ]] || [[ -z ${2} ]] ; then - echo "$0: Need two arguments, old file and new file" 1>&2 - exit 1 -fi - -if [ ! -e "$1" ] ; then - echo "!!! ${0##*/}: $1 does not exist" 1>&2 - exit 1 -fi - -rm -rf "${T}/${2}" && \ -cp -f "${1}" "${T}/${2}" && \ -exec doenvd "${T}/${2}" diff --git a/bin/newexe b/bin/newexe deleted file mode 100755 index 32d7d9293..000000000 --- a/bin/newexe +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright 1999-2006 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Id$ - -if [[ -z ${T} ]] || [[ -z ${2} ]] ; then - echo "$0: Need two arguments, old file and new file" 1>&2 - exit 1 -fi - -if [ ! -e "$1" ] ; then - echo "!!! ${0##*/}: $1 does not exist" 1>&2 - exit 1 -fi - -rm -rf "${T}/${2}" && \ -cp -f "${1}" "${T}/${2}" && \ -exec doexe "${T}/${2}" diff --git a/bin/newinitd b/bin/newinitd deleted file mode 100755 index 7ab89ae0b..000000000 --- a/bin/newinitd +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright 1999-2006 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Id$ - -if [[ -z ${T} ]] || [[ -z ${2} ]] ; then - echo "$0: Need two arguments, old file and new file" 1>&2 - exit 1 -fi - -if [ ! -e "$1" ] ; then - echo "!!! ${0##*/}: $1 does not exist" 1>&2 - exit 1 -fi - -rm -rf "${T}/${2}" && \ -cp -f "${1}" "${T}/${2}" && \ -exec doinitd "${T}/${2}" diff --git a/bin/newins b/bin/newins deleted file mode 100755 index f235835a2..000000000 --- a/bin/newins +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -# Copyright 1999-2006 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Id$ - -if [[ -z ${T} ]] || [[ -z ${2} ]] ; then - echo "$0: Need two arguments, old file and new file" 1>&2 - exit 1 -fi - -if [ ! -e "$1" ] ; then - echo "!!! ${0##*/}: $1 does not exist" 1>&2 - exit 1 -fi - -rm -rf "${T}/${2}" || exit $? -cp -f "${1}" "${T}/${2}" || exit $? -doins "${T}/${2}" -ret=$? -rm -rf "${T}/${2}" -exit $ret diff --git a/bin/newlib.a b/bin/newlib.a deleted file mode 100755 index ddcb1af25..000000000 --- a/bin/newlib.a +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright 1999-2006 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Id$ - -if [[ -z ${T} ]] || [[ -z ${2} ]] ; then - echo "$0: Need two arguments, old file and new file" 1>&2 - exit 1 -fi - -if [ ! -e "$1" ] ; then - echo "!!! ${0##*/}: $1 does not exist" 1>&2 - exit 1 -fi - -rm -rf "${T}/${2}" && \ -cp -f "${1}" "${T}/${2}" && \ -exec dolib.a "${T}/${2}" diff --git a/bin/newlib.so b/bin/newlib.so deleted file mode 100755 index eb23d2675..000000000 --- a/bin/newlib.so +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright 1999-2006 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Id$ - -if [[ -z ${T} ]] || [[ -z ${2} ]] ; then - echo "$0: Need two arguments, old file and new file" 1>&2 - exit 1 -fi - -if [ ! -e "$1" ] ; then - echo "!!! ${0##*/}: $1 does not exist" 1>&2 - exit 1 -fi - -rm -rf "${T}/${2}" && \ -cp -f "${1}" "${T}/${2}" && \ -exec dolib.so "${T}/${2}" diff --git a/bin/newman b/bin/newman deleted file mode 100755 index 2d278aedd..000000000 --- a/bin/newman +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright 1999-2006 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Id$ - -if [[ -z ${T} ]] || [[ -z ${2} ]] ; then - echo "$0: Need two arguments, old file and new file" 1>&2 - exit 1 -fi - -if [ ! -e "$1" ] ; then - echo "!!! ${0##*/}: $1 does not exist" 1>&2 - exit 1 -fi - -rm -rf "${T}/${2}" && \ -cp -f "${1}" "${T}/${2}" && \ -exec doman "${T}/${2}" diff --git a/bin/newsbin b/bin/newsbin deleted file mode 100755 index cfe754501..000000000 --- a/bin/newsbin +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright 1999-2006 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Id$ - -if [[ -z ${T} ]] || [[ -z ${2} ]] ; then - echo "$0: Need two arguments, old file and new file" 1>&2 - exit 1 -fi - -if [ ! -e "$1" ] ; then - echo "!!! ${0##*/}: $1 does not exist" 1>&2 - exit 1 -fi - -rm -rf "${T}/${2}" && \ -cp -f "${1}" "${T}/${2}" && \ -exec dosbin "${T}/${2}" diff --git a/bin/prepall b/bin/prepall deleted file mode 100755 index eec5c814c..000000000 --- a/bin/prepall +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash -# 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 type -P chflags > /dev/null && type -P mtree > /dev/null ; then - # Save all the file flags for restoration at the end of prepall. - mtree -c -p "${D}" -k flags > "${T}/bsdflags.mtree" - # Remove all the file flags so that prepall can do anything necessary. - chflags -R noschg,nouchg,nosappnd,nouappnd "${D}" - chflags -R nosunlnk,nouunlnk "${D}" 2>/dev/null -fi - -prepallman -prepallinfo - -prepallstrip - -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 -fi diff --git a/bin/prepalldocs b/bin/prepalldocs deleted file mode 100755 index c9509d1ff..000000000 --- a/bin/prepalldocs +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -# 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 - -cd "${D}" -[[ -d usr/share/doc ]] || exit 0 - -ecompressdir --ignore /usr/share/doc/${PF}/html -ecompressdir --queue /usr/share/doc diff --git a/bin/prepallinfo b/bin/prepallinfo deleted file mode 100755 index af95bbfce..000000000 --- a/bin/prepallinfo +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -# Copyright 1999-2006 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 - -[[ ! -d ${D}usr/share/info ]] && exit 0 - -exec prepinfo diff --git a/bin/prepallman b/bin/prepallman deleted file mode 100755 index 747ed1fac..000000000 --- a/bin/prepallman +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -# 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 - -ret=0 - -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/prepallstrip b/bin/prepallstrip deleted file mode 100755 index 178ded797..000000000 --- a/bin/prepallstrip +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -# Copyright 1999-2006 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Id$ - -exec prepstrip "${D}" diff --git a/bin/prepinfo b/bin/prepinfo deleted file mode 100755 index 582f41fed..000000000 --- a/bin/prepinfo +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash -# 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 - infodir="/usr/share/info" -else - if [[ -d ${D}$1/share/info ]] ; then - infodir="$1/share/info" - else - infodir="$1/info" - fi -fi - -if [[ ! -d ${D}${infodir} ]] ; then - if [[ -n $1 ]] ; then - vecho "${0##*/}: '${infodir}' does not exist!" - exit 1 - else - exit 0 - fi -fi - -find "${D}${infodir}" -type d -print0 | while read -d $'\0' x ; do - rm -f "${x}"/dir{,.info}{,.gz,.bz2} -done - -exec ecompressdir --queue "${infodir}" diff --git a/bin/preplib b/bin/preplib deleted file mode 100755 index 71446316a..000000000 --- a/bin/preplib +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash -# Copyright 1999-2006 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 - -eqawarn "QA Notice: Deprecated call to 'preplib'" - -LIBDIR_VAR="LIBDIR_${ABI}" -if [ -n "${ABI}" -a -n "${!LIBDIR_VAR}" ]; then - CONF_LIBDIR="${!LIBDIR_VAR}" -fi -unset LIBDIR_VAR - -if [ -z "${CONF_LIBDIR}" ]; then - # we need this to default to lib so that things dont break - CONF_LIBDIR="lib" -fi - -if [ -z "$1" ] ; then - z="${D}usr/${CONF_LIBDIR}" -else - z="${D}$1/${CONF_LIBDIR}" -fi - -if [ -d "${z}" ] ; then - ldconfig -n -N "${z}" -fi diff --git a/bin/prepman b/bin/prepman deleted file mode 100755 index af6ad1f82..000000000 --- a/bin/prepman +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash -# 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 - mandir="${D}usr/share/man" -else - mandir="${D}$1/man" -fi - -if [[ ! -d ${mandir} ]] ; then - eqawarn "QA Notice: prepman called with non-existent dir '${mandir#${D}}'" - exit 0 -fi - -shopt -s nullglob - -really_is_mandir=0 - -# use some heuristics to test if this is a real mandir -for subdir in "${mandir}"/man* "${mandir}"/*/man* ; do - [[ -d ${subdir} ]] && really_is_mandir=1 && break -done - -[[ ${really_is_mandir} == 1 ]] && exec ecompressdir --queue "${mandir#${D}}" - -exit 0 diff --git a/bin/prepstrip b/bin/prepstrip deleted file mode 100755 index 977ccec7f..000000000 --- a/bin/prepstrip +++ /dev/null @@ -1,178 +0,0 @@ -#!/bin/bash -# 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 - -banner=false -SKIP_STRIP=false -if hasq nostrip ${FEATURES} || \ - hasq strip ${RESTRICT} -then - SKIP_STRIP=true - banner=true - hasq installsources ${FEATURES} || exit 0 -fi - -STRIP=${STRIP:-${CHOST}-strip} -type -P -- ${STRIP} > /dev/null || STRIP=strip -OBJCOPY=${OBJCOPY:-${CHOST}-objcopy} -type -P -- ${OBJCOPY} > /dev/null || OBJCOPY=objcopy - -# We'll leave out -R .note for now until we can check out the relevance -# of the section when it has the ALLOC flag set on it ... -export SAFE_STRIP_FLAGS="--strip-unneeded" -export PORTAGE_STRIP_FLAGS=${PORTAGE_STRIP_FLAGS-${SAFE_STRIP_FLAGS} -R .comment} - -if hasq installsources ${FEATURES} && ! type -P debugedit >/dev/null ; then - ewarn "FEATURES=installsources is enabled but the debugedit binary could not" - ewarn "be found. This feature will not work unless debugedit is installed!" -fi - -unset ${!INODE_*} - -inode_var_name() { - if [[ $USERLAND = BSD ]] ; then - stat -f 'INODE_%d_%i' "$1" - else - stat -c 'INODE_%d_%i' "$1" - fi -} - -save_elf_sources() { - hasq installsources ${FEATURES} || return 0 - hasq installsources ${RESTRICT} && return 0 - type -P debugedit >/dev/null || return 0 - - local x=$1 - local inode=$(inode_var_name "$x") - [[ -n ${!inode} ]] && return 0 - local sources_dir=/usr/src/debug/${CATEGORY}/${PF} - debugedit -b "${WORKDIR}" -d "${sources_dir}" \ - -l "${T}"/debug.sources "${x}" - if [[ -s ${T}/debug.sources ]] ; then - [[ -d ${D}${sources_dir} ]] || mkdir -p "${D}${sources_dir}" - grep -zv '/$' "${T}"/debug.sources | \ - (cd "${WORKDIR}"; LANG=C sort -z -u | \ - rsync -rtL0 --files-from=- "${WORKDIR}/" "${D}${sources_dir}/" ) - fi -} - -save_elf_debug() { - hasq splitdebug ${FEATURES} || return 0 - - local x=$1 - local y="${D}usr/lib/debug/${x:${#D}}.debug" - - # dont save debug info twice - [[ ${x} == *".debug" ]] && return 0 - - # this will recompute the build-id, but for now that's ok - local buildid="$( type -P debugedit >/dev/null && debugedit -i "${x}" )" - - mkdir -p $(dirname "${y}") - - local inode=$(inode_var_name "$x") - if [[ -n ${!inode} ]] ; then - ln "${D}usr/lib/debug/${!inode:${#D}}.debug" "$y" - else - eval $inode=\$x - ${OBJCOPY} --only-keep-debug "${x}" "${y}" - ${OBJCOPY} --add-gnu-debuglink="${y}" "${x}" - [[ -g ${x} ]] && chmod go-r "${y}" - [[ -u ${x} ]] && chmod go-r "${y}" - chmod a-x,o-w "${y}" - fi - - if [[ -n ${buildid} ]] ; then - local buildid_dir="${D}usr/lib/debug/.build-id/${buildid:0:2}" - local buildid_file="${buildid_dir}/${buildid:2}" - mkdir -p "${buildid_dir}" - ln -s "../../${x:${#D}}.debug" "${buildid_file}.debug" - ln -s "/${x:${#D}}" "${buildid_file}" - fi -} - -# The existance of the section .symtab tells us that a binary is stripped. -# We want to log already stripped binaries, as this may be a QA violation. -# They prevent us from getting the splitdebug data. -if ! hasq binchecks ${RESTRICT} && \ - ! hasq strip ${RESTRICT} ; then - log=$T/scanelf-already-stripped.log - scanelf -yqRBF '#k%F' -k '!.symtab' "$@" | sed -e "s#^$D##" > "$log" - if [[ -n $QA_PRESTRIPPED && -s $log && \ - ${QA_STRICT_PRESTRIPPED-unset} = unset ]] ; then - shopts=$- - set -o noglob - for x in $QA_PRESTRIPPED ; do - sed -e "s#^${x#/}\$##" -i "$log" - done - set +o noglob - set -$shopts - fi - sed -e "/^\$/d" -e "s#^#/#" -i "$log" - if [[ -s $log ]] ; then - vecho -e "\a\n" - eqawarn "QA Notice: Pre-stripped files found:" - eqawarn "$(<"$log")" - else - rm -f "$log" - fi -fi - -# Now we look for unstripped binaries. -for x in \ - $(scanelf -yqRBF '#k%F' -k '.symtab' "$@") \ - $(find "$@" -type f -name '*.a') -do - if ! ${banner} ; then - vecho "strip: ${STRIP} ${PORTAGE_STRIP_FLAGS}" - banner=true - fi - - f=$(file "${x}") || continue - [[ -z ${f} ]] && continue - - if ! ${SKIP_STRIP} ; then - # The noglob funk is to support STRIP_MASK="/*/booga" and to keep - # the for loop from expanding the globs. - # The eval echo is to support STRIP_MASK="/*/{booga,bar}" sex. - set -o noglob - strip_this=true - for m in $(eval echo ${STRIP_MASK}) ; do - [[ /${x#${D}} == ${m} ]] && strip_this=false && break - done - set +o noglob - else - strip_this=false - fi - - # only split debug info for final linked objects - # or kernel modules as debuginfo for intermediatary - # files (think crt*.o from gcc/glibc) is useless and - # actually causes problems. install sources for all - # elf types though cause that stuff is good. - - if [[ ${f} == *"current ar archive"* ]] ; then - vecho " ${x:${#D}}" - if ${strip_this} ; then - # hmm, can we split debug/sources for .a ? - ${STRIP} -g "${x}" - fi - elif [[ ${f} == *"SB executable"* || ${f} == *"SB shared object"* ]] ; then - vecho " ${x:${#D}}" - save_elf_sources "${x}" - if ${strip_this} ; then - save_elf_debug "${x}" - ${STRIP} ${PORTAGE_STRIP_FLAGS} "${x}" - fi - elif [[ ${f} == *"SB relocatable"* ]] ; then - vecho " ${x:${#D}}" - save_elf_sources "${x}" - if ${strip_this} ; then - [[ ${x} == *.ko ]] && save_elf_debug "${x}" - ${STRIP} ${SAFE_STRIP_FLAGS} "${x}" - fi - fi -done diff --git a/bin/sed b/bin/sed deleted file mode 100755 index 6fc545002..000000000 --- a/bin/sed +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -# Copyright 2007 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Id$ - -scriptpath=${BASH_SOURCE[0]} -scriptname=${scriptpath##*/} - -if [[ sed == ${scriptname} ]] && [[ -n ${ESED} ]]; then - exec ${ESED} "$@" -elif type -P g${scriptname} > /dev/null ; then - exec g${scriptname} "$@" -else - old_IFS="${IFS}" - IFS=":" - - for path in $PATH; do - [[ ${path}/${scriptname} == ${scriptpath} ]] && continue - if [[ -x ${path}/${scriptname} ]]; then - exec ${path}/${scriptname} "$@" - exit 0 - fi - done - - IFS="${old_IFS}" -fi - -exit 1 diff --git a/pym/portage/tests/bin/setup_env.py b/pym/portage/tests/bin/setup_env.py index 388428a7c..727f02e7b 100644 --- a/pym/portage/tests/bin/setup_env.py +++ b/pym/portage/tests/bin/setup_env.py @@ -9,7 +9,8 @@ from portage.tests import TestCase from portage.process import spawn from portage.const import PORTAGE_BIN_PATH -bindir = join(dirname(dirname(abspath(__file__))), "..", "..", "..", "bin") +bindir = join(dirname(dirname(abspath(__file__))), + "..", "..", "..", "bin", "ebuild-helpers") basedir = join(dirname(dirname(abspath(__file__))), "bin", "root") os.environ["D"] = os.path.join(basedir, "image") os.environ["T"] = os.path.join(basedir, "temp") -- cgit v1.2.3-1-g7c22