scripts/patch-renumber.sh
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Thu Jan 29 22:09:55 2009 +0000 (2009-01-29)
changeset 1176 8508ec77df4c
parent 1099 e1a5096d432b
child 1192 bc411ace3c8f
permissions -rwxr-xr-x
If compiling the Java frontend, we'll require a native gcj, but only in this case.

/trunk/scripts/crosstool-NG.sh.in | 8 7 1 0 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
yann@756
     1
#!/bin/sh
yann@756
     2
# Yes, this intends to be a true POSIX script file.
yann@1175
     3
set -e
yann@756
     4
yann@756
     5
myname="$0"
yann@756
     6
yann@1175
     7
# Parse the tools' paths configuration
yann@1175
     8
. "paths.mk"
yann@1175
     9
yann@756
    10
doUsage() {
yann@756
    11
  cat <<_EOF_
yann@756
    12
Usage: ${myname} <dir> <base> <inc>
yann@756
    13
    Will renumber all patches found in <dir>, starting at <base>, and with
yann@756
    14
    an increment of <inc>
yann@756
    15
    Eg.: patch-renumber patches/gcc/4.3.1 100 10
yann@756
    16
_EOF_
yann@756
    17
}
yann@756
    18
yann@756
    19
[ $# -eq 3 ] || { doUsage; exit 1; }
yann@756
    20
[ -d "${1}" ] || { doUsage; exit 1; }
yann@756
    21
yann@756
    22
dir="${1}"
yann@756
    23
cpt="${2}"
yann@756
    24
inc="${3}"
yann@756
    25
yann@756
    26
case $(LC_ALL=C svnversion 2>/dev/null) in
yann@756
    27
    exported)   CMD="mv -v";;
yann@756
    28
    *)          CMD="svn mv";;
yann@756
    29
esac
yann@756
    30
yann@756
    31
for p in "${dir}"/*.patch; do
yann@756
    32
    [ -e "${p}" ] || { echo "No such file '${p}'"; exit 1; }
yann@1175
    33
    newname="$(printf "%03d" ${cpt})-$(basename "${p}" |"${sed}" -r -e 's/^[[:digit:]]{3}-//')"
yann@756
    34
    [ "${p}" = "${dir}/${newname}" ] || ${CMD} "${p}" "${dir}/${newname}"
yann@756
    35
    cpt=$((cpt+inc))
yann@756
    36
done