summaryrefslogtreecommitdiffstats
path: root/bashrc
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2008-12-18 15:22:05 +0100
committerAlexander Sulfrian <alexander@sulfrian.net>2008-12-18 15:22:05 +0100
commit410ee70f54f462f72ac4993c608b34cd9fac1bd6 (patch)
tree45a621acd2eeac74bf27d337e64513f6b403aefb /bashrc
downloadportage-ext-410ee70f54f462f72ac4993c608b34cd9fac1bd6.tar.gz
portage-ext-410ee70f54f462f72ac4993c608b34cd9fac1bd6.tar.xz
portage-ext-410ee70f54f462f72ac4993c608b34cd9fac1bd6.zip
initial commit
currently supports: auto-patch add overlay to eix index show diff to old eix index on emerge --sync Add this to your make.conf: # portage autopatch PATCH_OVERLAY="/var/lib/portage/patches" # portage overlays source /etc/portage/overlays/make.conf and create configs for the overlays in /etc/portage/overlays. Currently the only supported options are LOCATION and CACHE_FORMAT (for eix) in bash syntax like: LOCATION="/var/portage/repositories/proaudio" CACHE_FORMAT="parse*" or something like this. If CACHE_FORMAT is missing the default of eix is used. For autopatch you have to put the patches in the subdir: ${PATCH_OVERLAY}/CATEGORY/PACKAGE/ All files in that directory with .patch extension are applied during ebuild execution.
Diffstat (limited to 'bashrc')
-rw-r--r--bashrc100
1 files changed, 100 insertions, 0 deletions
diff --git a/bashrc b/bashrc
new file mode 100644
index 0000000..04c88bd
--- /dev/null
+++ b/bashrc
@@ -0,0 +1,100 @@
+#!/bin/bash
+
+# error
+eecho() {
+ case "x${NOCOLOR}" in
+ x[y,Y][e,E][s,S]|x-[t,T][r,R][u,U][e,E]|x)
+ echo -ne '\e[1;31m * \e[0m';;
+ x*)
+ echo -n " * ";;
+ esac
+
+ echo "$*"
+}
+
+# warning
+wecho() {
+ case "x${NOCOLOR}" in
+ x[y,Y][e,E][s,S]|x-[t,T][r,R][u,U][e,E]|x)
+ echo -ne '\e[1;33m * \e[0m';;
+ x*)
+ echo -n " * ";;
+ esac
+
+ echo "$*"
+}
+
+# positiv echo
+pecho() {
+ case "x${NOCOLOR}" in
+ x[y,Y][e,E][s,S]|x-[t,T][r,R][u,U][e,E]|x)
+ echo -ne '\e[1;32m * \e[0m';;
+ x*)
+ echo -n " * ";;
+ esac
+
+ echo "$*"
+}
+
+# info
+iecho() {
+ echo ">>> $*"
+}
+
+autopatch() {
+ local diff level p patches patched
+
+ [[ ! -d "$PATCH_OVERLAY" ]] && return 0
+
+ patches=$(ls -1 ${PATCH_OVERLAY}/${CATEGORY}/${PN}/${PN}-*.{patch,diff} 2>/dev/null)
+ [[ $patches == "" ]] && return 0
+
+ if ! cd ${S}; then
+ eecho "FAILED TO cd $S"
+ return 1
+ fi
+
+ for p in ${patches}; do
+ p=$(basename $p)
+ diff=${PATCH_OVERLAY}/${CATEGORY}/${PN}/${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
+ pecho "auto patching (-p${level}) ${p}"
+ patch -g0 -p${level} < $diff > /dev/null && patched=1
+ touch ${S}/.${p}
+ fi
+ fi
+ done
+ [[ $patched != 1 ]] && eecho "FAILED auto patching $p"
+ else
+ [[ ! -e $diff ]] && eecho "$diff does not exist, unable to auto patch"
+ fi
+ done
+ cd $OLDPWD
+}
+
+
+wecho "at $EBUILD_PHASE"
+
+case $EBUILD_PHASE in
+ compile)
+ if [[ ! -d "$PATCH_OVERLAY" ]]; then
+ eecho "PATCH_OVERLAY=$PATCH_OVERLAY is not a dir"
+ else
+ iecho "Checking for auto patches in ${PATCH_OVERLAY}/${CATEGORY}/${PN} ..."
+ PATH=$PATH:/usr/sbin:/usr/bin:/bin:/sbin
+ autopatch
+ fi
+ ;;
+
+ post_sync)
+ OVERLAY_CONFIG_DIR="$(update-eix --print EIXCFGDIR)/overlays"
+ PORTDIR_OVERLAY="$(sed -ne 's/LOCATION="\([^"]*\)"/\1 /;t print; d; :print p' ${OVERLAY_CONFIG_DIR}/* | xargs echo)"
+ ;;
+esac
+
+