From: Arfrever Frehtes Taifersar Arahesis Date: Sun, 21 Jul 2013 03:48:11 +0000 (+0200) Subject: make.conf-repatch.sh: Port to git and improve coding style. X-Git-Tag: v2.2.0_alpha189~44 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=6845fb0333e1a68fd58f0653341c093639b558c7;p=portage.git make.conf-repatch.sh: Port to git and improve coding style. --- diff --git a/make.conf-repatch.sh b/make.conf-repatch.sh old mode 100644 new mode 100755 index 6589e6b62..790e667cf --- a/make.conf-repatch.sh +++ b/make.conf-repatch.sh @@ -6,35 +6,36 @@ die() { exit 1 } -if [ ! -f "make.conf" -o ! -f "make.conf.x86.diff" -o ! -d ".svn" ]; then +if [[ ! -f make.conf || ! -f make.conf.x86.diff || ! -d ../.git ]]; then echo "ERROR: current directory is invalid" > /dev/stderr exit 1 fi -svn diff make.conf > make.conf.diff -svn revert make.conf +git diff --no-prefix --relative="$(basename "$(pwd)")" make.conf > make.conf.diff +git checkout -- make.conf +archs=() for x in make.conf.*.diff; do - archs="$archs $(basename ${x:10} .diff)" + archs+=("$(basename ${x:10} .diff)") done -for arch in $archs; do - echo "* Patching $arch" - cp make.conf make.conf.$arch || die "copy failed" - patch -p0 make.conf.$arch < make.conf.${arch}.diff > /dev/null || die "arch-patch failed" - patch -p0 make.conf.$arch < make.conf.diff > /dev/null || die "patch failed" +for arch in "${archs[@]}"; do + echo "* Patching ${arch}" + cp make.conf make.conf.${arch} || die "copy failed" + patch -p0 make.conf.${arch} < make.conf.${arch}.diff > /dev/null || die "arch-patch failed" + patch -p0 make.conf.${arch} < make.conf.diff > /dev/null || die "patch failed" done echo "* Re-patching make.conf" patch -p0 make.conf < make.conf.diff > /dev/null || die "repatch failed" -for arch in $archs; do - echo "* Creating diff for $arch" - diff -u make.conf make.conf.$arch > make.conf.${arch}.diff - [ -z "${KEEP_ARCH_MAKE_CONF}" ] && rm -f make.conf.$arch make.conf.${arch}.orig +for arch in "${archs[@]}"; do + echo "* Creating diff for ${arch}" + diff -u make.conf make.conf.${arch} > make.conf.${arch}.diff + [[ -z ${KEEP_ARCH_MAKE_CONF} ]] && rm -f make.conf.${arch} make.conf.${arch}.orig done rm make.conf.diff -echo "Done" \ No newline at end of file +echo "Done"