summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2009-07-02 02:19:23 +0200
committerAlexander Sulfrian <alexander@sulfrian.net>2009-07-02 02:19:23 +0200
commitf68fb555b98a13517afef5188ccd86474b1e6b2a (patch)
tree4416c78f8b1e32b6a45c49442123762c91977d19
parent705848d765d71974d21efd39e94fa58ed21a73fb (diff)
downloadportage-ext-f68fb555b98a13517afef5188ccd86474b1e6b2a.tar.gz
portage-ext-f68fb555b98a13517afef5188ccd86474b1e6b2a.tar.xz
portage-ext-f68fb555b98a13517afef5188ccd86474b1e6b2a.zip
baselayout1 compatibility, changed output
surround . /etc/init.d/function.sh with if to not include it, if baselayout1 changed some debug output
-rw-r--r--bashrc50
1 files changed, 26 insertions, 24 deletions
diff --git a/bashrc b/bashrc
index e5e9956..e3ef84b 100644
--- a/bashrc
+++ b/bashrc
@@ -1,59 +1,61 @@
#!/bin/bash
-. /etc/init.d/functions.sh
+if ! type einfo >/dev/null 2>&1 ; then
+ . /etc/init.d/functions.sh
+fi
autopatch() {
- local diff level p patches patched
+ local diff level p patches patchdir
- [[ ! -d "$PATCH_OVERLAY" ]] && return 0
+ [[ ! -d "$PATCH_OVERLAY" ]] && return
- patches=$(ls -1 ${PATCH_OVERLAY}/${CATEGORY}/${PN}/{${PN},${P},${PF}}-[^0-9]*.{patch,diff} 2>/dev/null)
- [[ $patches == "" ]] && return 0
+ patchdir="${PATCH_OVERLAY}/${CATEGORY}/${PN}"
+ patches=$(ls -1 ${patchdir}/{${PN},${P},${PF}}-[^0-9]*.{patch,diff} 2>/dev/null)
+ [[ $patches == "" ]] && return
- if ! cd ${S}; then
+ if ! pushd ${S} &>/dev/null; then
eerror "FAILED TO cd $S"
- return 1
+ return
fi
for p in ${patches}; do
p=$(basename $p)
- diff=${PATCH_OVERLAY}/${CATEGORY}/${PN}/${p}
+ diff=${patchdir}/${p}
if [[ -e $diff ]] && [ ! -e ${S}/.${p} ]; then
- patched=0
for level in 0 1 2 3 4; do
- if [[ $patched == 0 ]]; then
- patch -g0 --dry -p${level} >/dev/null < $diff
- if [ $? = 0 ]; then
- ebegin "auto patching (-p${level}) ${p}"
- patch -g0 -p${level} < $diff > /dev/null && patched=1
- eend $?
- touch ${S}/.${p}
- fi
+ patch -g0 --dry -p${level} >/dev/null < $diff
+
+ if [ $? = 0 ]; then
+ ebegin "auto patching (-p${level}) ${p}"
+ patch -g0 -p${level} < $diff > /dev/null
+ eend $?
+ touch ${S}/.${p}
+
+ continue 2
fi
done
- [[ $patched != 1 ]] && eerror "FAILED auto patching $p"
+
+ eerror "FAILED auto patching $p"
else
[[ ! -e $diff ]] && eerror "$diff does not exist, unable to auto patch"
fi
done
- cd $OLDPWD
+
+ popd &>/dev/null
}
#ewarn "at $EBUILD_PHASE"
case $EBUILD_PHASE in
compile)
- ebegin "Checking for auto patches in ${PATCH_OVERLAY}/${CATEGORY}/${PN}"
-
+ einfo "Checking for auto patches in ${PATCH_OVERLAY}/${CATEGORY}/${PN}"
+
if [[ ! -d "$PATCH_OVERLAY" ]]; then
- eend 1
eerror "PATCH_OVERLAY=$PATCH_OVERLAY is not a dir"
else
PATH=$PATH:/usr/sbin:/usr/bin:/bin:/sbin
autopatch
- eend 0
fi
;;
esac
-