diff options
-rwxr-xr-x | bin/ebuild.sh | 114 |
1 files changed, 48 insertions, 66 deletions
diff --git a/bin/ebuild.sh b/bin/ebuild.sh index 9e1dae182..a4e060ba4 100755 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -58,33 +58,27 @@ set_colors export SANDBOX_ON="0" # sandbox support functions; defined prior to profile.bashrc srcing, since the profile might need to add a default exception (/usr/lib64/conftest fex, bug #60147) -addread() -{ +addread() { export SANDBOX_READ="$SANDBOX_READ:$1" } -addwrite() -{ +addwrite() { export SANDBOX_WRITE="$SANDBOX_WRITE:$1" } -adddeny() -{ +adddeny() { export SANDBOX_DENY="$SANDBOX_DENY:$1" } -addpredict() -{ +addpredict() { export SANDBOX_PREDICT="$SANDBOX_PREDICT:$1" } -lchown() -{ +lchown() { chown -h "$@" } -lchgrp() -{ +lchgrp() { chgrp -h "$@" } @@ -131,7 +125,7 @@ useq() { neg=1 fi local x - + # Make sure we have this USE flag in IUSE if ! hasq "${u}" ${IUSE} ${E_IUSE} && ! hasq "${u}" ${PORTAGE_ARCHLIST} selinux; then echo "QA Notice: USE Flag '${u}' not in IUSE for ${CATEGORY}/${PF}" >&2 @@ -173,7 +167,7 @@ hasq() { local me=$1 shift - + # All the TTY checks really only help out depend. Which is nice. # Logging kills all this anyway. Everything becomes a pipe. --NJ for x in "$@"; do @@ -226,7 +220,7 @@ use_with() { return 1 fi - local UW_SUFFIX="" + local UW_SUFFIX="" if [ ! -z "${3}" ]; then UW_SUFFIX="=${3}" fi @@ -235,7 +229,7 @@ use_with() { if [ -z "${UWORD}" ]; then UWORD="$1" fi - + if useq $1; then echo "--with-${UWORD}${UW_SUFFIX}" else @@ -251,7 +245,7 @@ use_enable() { return 1 fi - local UE_SUFFIX="" + local UE_SUFFIX="" if [ ! -z "${3}" ]; then UE_SUFFIX="=${3}" fi @@ -260,7 +254,7 @@ use_enable() { if [ -z "${UWORD}" ]; then UWORD="$1" fi - + if useq $1; then echo "--enable-${UWORD}${UE_SUFFIX}" else @@ -294,13 +288,12 @@ export INSDESTTREE="" export EXEDESTTREE="" export DOCDESTTREE="" export INSOPTIONS="-m0644" -export EXEOPTIONS="-m0755" +export EXEOPTIONS="-m0755" export LIBOPTIONS="-m0644" export DIROPTIONS="-m0755" export MOPREFIX=${PN} -check_KV() -{ +check_KV() { if [ -z "${KV}" ]; then eerror "" eerror "Could not determine your kernel version." @@ -315,8 +308,7 @@ check_KV() } # adds ".keep" files so that dirs aren't auto-cleaned -keepdir() -{ +keepdir() { dodir "$@" local x if [ "$1" == "-R" ] || [ "$1" == "-r" ]; then @@ -338,8 +330,8 @@ unpack() { if [ "$USERLAND" == "BSD" ]; then tarvars="" else - tarvars="--no-same-owner" - fi + tarvars="--no-same-owner" + fi [ -z "$*" ] && die "Nothing passed to the 'unpack' command" @@ -380,7 +372,7 @@ unpack() { ;; bz2) if [ "${y}" == "tar" ]; then - bzip2 -dc "${srcdir}${x}" | tar xf - ${tarvars} + bzip2 -dc "${srcdir}${x}" | tar xf - ${tarvars} assert "$myfail" else bzip2 -dc "${srcdir}${x}" > ${x%.*} || die "$myfail" @@ -399,7 +391,7 @@ unpack() { done } -strip_duplicate_slashes () { +strip_duplicate_slashes () { if [ -n "${1}" ]; then local removed="${1/\/\///}" [ "${removed}" != "${removed/\/\///}" ] && removed=$(strip_duplicate_slashes "${removed}") @@ -429,7 +421,7 @@ econf() { if [ ! -z "${CTARGET}" ]; then LOCAL_EXTRA_ECONF="--target=${CTARGET} ${LOCAL_EXTRA_ECONF}" fi - + # if the profile defines a location to install libs to aside from default, pass it on. # if the ebuild passes in --libdir, they're responsible for the conf_libdir fun. LIBDIR_VAR="LIBDIR_${ABI}" @@ -462,7 +454,7 @@ econf() { LOCAL_EXTRA_ECONF="--libdir=${CONF_LIBDIR_RESULT} ${LOCAL_EXTRA_ECONF}" fi - + echo "${ECONF_SOURCE}/configure" \ --prefix=/usr \ --host=${CHOST} \ @@ -535,13 +527,11 @@ einstall() { fi } -pkg_setup() -{ +pkg_setup() { return } -pkg_nofetch() -{ +pkg_nofetch() { [ -z "${SRC_URI}" ] && return echo "!!! The following are listed in SRC_URI for ${PN}:" @@ -553,7 +543,7 @@ pkg_nofetch() src_unpack() { if [ "${A}" != "" ]; then unpack ${A} - fi + fi } src_compile() { @@ -565,8 +555,7 @@ src_compile() { fi } -src_test() -{ +src_test() { addpredict / if emake -j1 check -n &> /dev/null; then echo ">>> Test phase [check]: ${CATEGORY}/${PF}" @@ -586,33 +575,27 @@ src_test() SANDBOX_PREDICT="${SANDBOX_PREDICT%:/}" } -src_install() -{ +src_install() { return } -pkg_preinst() -{ +pkg_preinst() { return } -pkg_postinst() -{ +pkg_postinst() { return } -pkg_prerm() -{ +pkg_prerm() { return } -pkg_postrm() -{ +pkg_postrm() { return } -pkg_config() -{ +pkg_config() { eerror "This ebuild does not have a config function." } @@ -627,8 +610,7 @@ END chmod 0755 $1 } -dyn_setup() -{ +dyn_setup() { [ "$(type -t pre_pkg_setup)" == "function" ] && pre_pkg_setup pkg_setup [ "$(type -t post_pkg_setup)" == "function" ] && post_pkg_setup @@ -667,7 +649,7 @@ dyn_unpack() { return 0 fi fi - + install -m0700 -d "${WORKDIR}" || die "Failed to create dir '${WORKDIR}'" [ -d "$WORKDIR" ] && cd "${WORKDIR}" echo ">>> Unpacking source..." @@ -686,7 +668,7 @@ dyn_clean() { chflags -R noschg,nouchg,nosappnd,nouappnd,nosunlnk,nouunlnk \ "${BUILDDIR}" fi - + if [ "$USERLAND" == "Darwin" ] && type -p chflags &>/dev/null; then chflags -R noschg,nouchg,nosappnd,nouappnd "${BUILDDIR}" fi @@ -892,11 +874,11 @@ dyn_compile() { local srcdir=${BUILDDIR} cd "${BUILDDIR}" - if [ ! -e "build-info" ]; then + if [ ! -e "build-info" ]; then mkdir build-info fi cp "${EBUILD}" "build-info/${PF}.ebuild" - + if [ ${BUILDDIR}/.compiled -nt "${WORKDIR}" ]; then echo ">>> It appears that ${PN} is already compiled; skipping." echo ">>> (clean to force compilation)" @@ -1011,7 +993,7 @@ dyn_test() { [ "$(type -t post_src_test)" == "function" ] && post_src_test trap SIGINT SIGQUIT } - + PORTAGE_INST_UID="0" PORTAGE_INST_GID="0" @@ -1048,7 +1030,7 @@ dyn_install() { echo "UNSAFE SetUID: $i" chmod -s,o-w "$i" done - + # Now we look for all world writable files. for i in $(find "${D}/" -type f -perm -2); do echo -ne '\a' @@ -1129,7 +1111,7 @@ dyn_install() { if [[ ${UNSAFE} > 0 ]] ; then die "There are ${UNSAFE} unsafe files. Portage will not install them." fi - + # dumps perms to stdout. if error, no perms dumped. function stat_perms() { local f @@ -1230,7 +1212,7 @@ dyn_preinst() { # set IMAGE depending if this is a binary or compile merge [ "${EMERGE_FROM}" == "binary" ] && IMAGE=${PKG_TMPDIR}/${PF}/bin \ || IMAGE=${D} - + [ "$(type -t pre_pkg_preinst)" == "function" ] && pre_pkg_preinst declare -r D=${IMAGE} @@ -1459,19 +1441,19 @@ debug-print() { [ -z "$T" ] && return 0 while [ "$1" ]; do - + # extra user-configurable targets if [ "$ECLASS_DEBUG_OUTPUT" == "on" ]; then echo "debug: $1" elif [ -n "$ECLASS_DEBUG_OUTPUT" ]; then echo "debug: $1" >> $ECLASS_DEBUG_OUTPUT fi - + # default target echo "$1" >> "${T}/eclass-debug.log" # let the portage user own/write to this file chmod g+w "${T}/eclass-debug.log" &>/dev/null - + shift done } @@ -1533,7 +1515,7 @@ inherit() { #We need to back up the value of DEPEND and RDEPEND to B_DEPEND and B_RDEPEND #(if set).. and then restore them after the inherit call. - + #turn off glob expansion set -f @@ -1546,10 +1528,10 @@ inherit() { unset IUSE DEPEND RDEPEND PDEPEND #turn on glob expansion set +f - + source "$location" || export ERRORMSG="died sourcing $location in inherit()" [ -z "${ERRORMSG}" ] || die "${ERRORMSG}" - + #turn off glob expansion set -f @@ -1574,7 +1556,7 @@ inherit() { #turn on glob expansion set +f - + hasq $1 $INHERITED || export INHERITED="$INHERITED $1" export ECLASS="$PECLASS" @@ -1736,7 +1718,7 @@ if [ "$*" != "depend" ] && [ "$*" != "clean" ] && [ "$*" != "setup" ]; then # for X in /usr/lib/portage/bin/functions/*.sh; do # source ${X} || die "Failed to source ${X}" # done - + else killparent() { |