tools/patch-renumber.sh
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Tue Oct 14 21:30:27 2008 +0000 (2008-10-14)
changeset 935 e175e3538310
permissions -rwxr-xr-x
Introduce the notion of a 'sample comment'.

- presence of the sample's reported.by file is now mandatory.
- when saving a sample, reporter name & URL are queried, to avoid operator forget about creating the reported.by file.
- when saving a sample, one can store a few-liner comment.
- when recalling a sample, the reporter name, URL and comment (if present) are printed.
- update the powerpc-e500v2-linux-gnuspe sample to include Nate's comment (from his original mail).
- update all samples that were missing the reported.by file.

/trunk/scripts/saveSample.sh | 46 35 11 0 ++++++++++++++++++------
/trunk/scripts/showSamples.sh | 12 6 6 0 +++---
/trunk/samples/powerpc-e500v2-linux-gnuspe/reported.by | 15 15 0 0 ++++++++
/trunk/samples/samples.mk | 22 17 5 0 +++++++++--
4 files changed, 73 insertions(+), 22 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