scripts/patch-renumber.sh
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Tue Jan 20 20:37:43 2009 +0000 (2009-01-20)
changeset 1149 df32ef8825f9
parent 756 63d3f428f302
child 1175 417b32da90bf
permissions -rwxr-xr-x
On 20090115.0012+0100, "Andy Johnson" <ajohnson@aecno.com> wrote:
... I added a step after
"debug" called "finish", and moved the code in crosstool.sh
after the loop that processes the steps from crosstool.sh
into a do_finish function in functions. Thus, it is now
possible to restart after the "debug" step to re-do the
final few things (clean and compress).

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