summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorYann E. MORIN" <yann.morin.1998@anciens.enib.fr>2009-10-28 23:10:06 (GMT)
committerYann E. MORIN" <yann.morin.1998@anciens.enib.fr>2009-10-28 23:10:06 (GMT)
commitde8f2cea32f14099cf756cbef40d312ffd1894a8 (patch)
treeaf4f9ce5798909cfa1eadec07390425937e3886a /scripts
parent06cb0b6ddbbb2f9275b3a71eda3f2ffeff929d90 (diff)
parent5b0242a30c12e4ce1366788126cea866b21abeba (diff)
Merge.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/addToolVersion.sh2
-rwxr-xr-xscripts/patch-renumber.sh40
2 files changed, 27 insertions, 15 deletions
diff --git a/scripts/addToolVersion.sh b/scripts/addToolVersion.sh
index c9102ca..b71ee9a 100755
--- a/scripts/addToolVersion.sh
+++ b/scripts/addToolVersion.sh
@@ -124,7 +124,7 @@ while [ $# -gt 0 ]; do
case "$1" in
# Tools:
--gcc) EXP=; OBS=; cat=CC; tool=gcc; tool_prefix=cc;;
- --binutils) EXP=; OBS=; cat=BINUTILS; tool=binutils; tool_prefix=;;
+ --binutils) EXP=; OBS=; cat=BINUTILS; tool=binutils; tool_prefix=binutils;;
--glibc) EXP=; OBS=; cat=LIBC; tool=glibc; tool_prefix=libc;;
--eglibc) EXP=; OBS=; cat=LIBC; tool=eglibc; tool_prefix=libc;;
--uClibc) EXP=; OBS=; cat=LIBC; tool=uClibc; tool_prefix=libc;;
diff --git a/scripts/patch-renumber.sh b/scripts/patch-renumber.sh
index 7ea2aa1..95bae8f 100755
--- a/scripts/patch-renumber.sh
+++ b/scripts/patch-renumber.sh
@@ -9,33 +9,45 @@ myname="$0"
doUsage() {
cat <<_EOF_
-Usage: ${myname} <dir> <base> <inc>
- Will renumber all patches found in <dir>, starting at <base>, and with
- an increment of <inc>
- Eg.: patch-renumber patches/gcc/4.3.1 100 10
+Usage: ${myname} <dir> <base> <inc> [sed_re]
+ Will renumber all patches found in 'dir', starting at 'base', and with
+ an increment of 'inc'.
+ If 'sed_re' is given, it is interpreted as a valid sed expression, and
+ it will be applied to the patch name.
+ If the environment variable FAKE is set to 'y', then the command will
+ only be printed, and not executed (so you can check beforehand).
+ Eg.:
+ patch-renumber.sh patches/gcc/4.3.1 100 10
+ patch-renumber.sh patches/gcc/4.2.4 100 10 's/(all[_-])*(gcc[-_])*//;'
_EOF_
}
-[ $# -eq 3 ] || { doUsage; exit 1; }
+[ $# -lt 3 -o $# -gt 4 ] && { doUsage; exit 1; }
[ -d "${1}" ] || { doUsage; exit 1; }
dir="${1}"
cpt="${2}"
inc="${3}"
+sed_re="${4}"
case "$(LC_ALL=C hg id "${dir}" 2>/dev/null)" in
- "") CMD="mv -v";;
- *) CMD="hg mv";;
+ "") CMD="";;
+ *) CMD="hg";;
esac
-for p in "${dir}"/*.patch; do
+if [ "${FAKE}" = "y" ]; then
+ CMD="echo ${CMD}"
+fi
+
+for p in "${dir}"/*.patch*; do
[ -e "${p}" ] || { echo "No such file '${p}'"; exit 1; }
- newname="$(printf "%03d-%s" \
- "${cpt}" \
- "$(basename "${p}" \
- |"${sed}" -r -e 's/^[[:digit:]]+[-_]//' \
- )" \
+ newname="$(printf "%03d-%s" \
+ "${cpt}" \
+ "$( basename "${p}" \
+ |"${sed}" -r -e 's/^[[:digit:]]+[-_]//' \
+ -e "${sed_re}" \
+ )" \
)"
- [ "${p}" = "${dir}/${newname}" ] || ${CMD} "${p}" "${dir}/${newname}"
+ [ "${p}" = "${dir}/${newname}" ] || ${CMD} mv -v "${p}" "${dir}/${newname}"
cpt=$((cpt+inc))
done