scripts/mk-patch.sh
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sun Jul 17 17:56:22 2011 +0200 (2011-07-17)
changeset 2889 f3b2199620f1
parent 2075 edc7c7958e80
permissions -rwxr-xr-x
cc/gcc: pass the install prefix to the core passes

Currently, the discrimination on the core compilers prefixes depends on
the type of core compiler to build.

This is not correct, and the caller of the core backend should specify
the prefix.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
     1 #!/bin/sh
     2 
     3 repos="$1"
     4 pdir="$2"
     5 if [ -z "${repos}" -o ! -d "${repos}" -o -z "${pdir}" -o ! -d "${pdir}" ];then
     6     printf "Usage: ${0##*/} <repos_dir> <patch_dir>\n"
     7     exit 1
     8 fi
     9 
    10 pdir="$( cd "${pdir}"; pwd)"
    11 version="$( echo "${pdir}" |sed -r -e 's,.*/([^/]+)/*$,\1,' )"
    12 branch="${version%.*}"
    13 n=$( ls -1 "${pdir}" 2>/dev/null |wc -l )
    14 
    15 r1="$( hg -R "${repos}" log -b "${branch}"  \
    16        |awk '
    17             $1=="changeset:" {
    18                 prev=rev;
    19                 split($2,a,":");
    20                 rev=a[1];
    21             }
    22             $0~/^summary:[[:space:]]+'"${branch}: (bump|update) version to ${version}\+hg"'$/ {
    23                 printf( "%d\n", prev );
    24             }
    25             '
    26      )"
    27 
    28 i=0
    29 hg -R "${repos}" log -b "${branch}" -r "${r1}:tip" --template '{rev}\n'    \
    30 |while read rev; do
    31     p="$( printf "%03d" ${i} )"
    32     i=$((i+1))
    33     if [ $( ls -1 "${pdir}/${p}-"*.patch 2>/dev/null |wc -l ) -ne 0 ]; then
    34         continue
    35     fi
    36     plog=$( hg -R "${repos}" log -r ${rev} --template '{desc|firstline}\n'  \
    37             |sed -r -e 's,[^[:alnum:]],_,g; s/_+/_/g;'                      \
    38           )
    39     pname="${p}-${plog}.patch"
    40     printf "Revision '%d' --> '%s'\n" ${rev} "${pname}"
    41     hg -R "${repos}" diff -c ${rev} --color=never >"${pdir}/${pname}"
    42     pdate="$( hg -R "${repos}" log -r ${rev} --template '{date|isodate}\n' )"
    43     touch -d "${pdate}" "${pdir}/${pname}"
    44 done