From 4220da645611fa67b0932a8e8f2f5026bcf187c2 Mon Sep 17 00:00:00 2001 From: Stephen Rothwell Date: Thu, 19 Mar 2009 10:59:23 +1100 Subject: [PATCH] Various updates I forgot to commit --- backup_next | 5 +++- fetch_trees | 23 ++++++++++------ find_branch | 26 +++++++++++++----- make_abat_scripts | 35 +++++++++++++++++++++++++ merge_old_version | 67 +++++++++++++++++++++++++++++++++++++++++++++++ summary | 60 ++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 201 insertions(+), 15 deletions(-) create mode 100755 make_abat_scripts create mode 100755 merge_old_version create mode 100755 summary diff --git a/backup_next b/backup_next index 062648d..f9249a1 100755 --- a/backup_next +++ b/backup_next @@ -1,5 +1,8 @@ #!/bin/bash +host="fs" +[ "$1" ] && host="$1" + rsync -avHP --include next/.git --include next/.git/'**' --exclude next/'**' \ --include quilt/.git --include quilt/.git/'**' --exclude quilt/'**' \ - --delete --delete-excluded next/ fs:next/ + --delete --delete-excluded next/ "$host":next/ diff --git a/fetch_trees b/fetch_trees index c5bdf73..69105f4 100755 --- a/fetch_trees +++ b/fetch_trees @@ -1,20 +1,27 @@ #!/bin/bash -IFS=' ' - origwd=$(pwd) -while read email type name url ref; do - [[ "$email" =~ '^#.*$' ]] && { - echo $name: skipped - continue - } +get_field() +{ + grep -v '^#' ../real_control | + awk -F ' ' '$3 == "'$1'" { print $'$2'; }' +} + +trees=$(grep -v '^#' ../real_control | awk -F ' ' '{ print $3 }') + +for name in $trees; do + type=$(get_field "$name" 2) + echo $name: $type if [ "$type" = "git" ]; then git fetch "$name" continue fi + if [ "$type" = "quilt" ]; then + url=$(get_field "$name" 4) + case "$url" in http://kernel.org/*|http://www.kernel.org/*) use_rsync=true @@ -96,7 +103,7 @@ while read email type name url ref; do rm -f .series.old .series.next cd "$origwd" fi -done <../real_control +done cd ../quilt git add . diff --git a/find_branch b/find_branch index 95c3bfa..dbaf1fa 100755 --- a/find_branch +++ b/find_branch @@ -5,6 +5,9 @@ commit=$1 echo "$0: [ []]" 1>&2 exit 1 } +commit=$(git rev-parse --verify "$commit") +[ "$commit" ] || + exit 1 top=$2 [ "$top" ] || top=HEAD @@ -14,15 +17,26 @@ linus=$3 base=$(git merge-base "$linus" "$top") -git log --first-parent --pretty='format:%H %P' "$base".."$top" | +git log --first-parent --reverse --pretty='format:%H %P' "$base".."$top" | while read m p1 p2 do - [ "$p2" ] || continue + [ "$p1" = "$commit" ] && { + echo "Directly committed" + break + } + [ "$p2" ] || + continue git rev-list $base..$p2 | grep -q "$commit" || continue - branch=$(git show $m | sed -n "s/[ ]*Merge .* '\([^']*\)'/\1/p") - tree=${branch%%/*} - [ "$tree" = "quilt" ] && tree=${branch##*/} - echo "$tree" + branch=$(git show $m | sed -n "s/[ ]*Merge .*'\([^']*\)'\( of \([^ ]*\).*\)*$/\1|\3/p") + tree=${branch##*|} + branch=${branch%%|*} + [ "$tree" ] || { + tree=${branch%%/*} + [ "$tree" = "quilt" ] && tree=${branch##*/} + echo "$tree" + break + } + echo "$tree#$branch" break done diff --git a/make_abat_scripts b/make_abat_scripts new file mode 100755 index 0000000..d2a99dc --- /dev/null +++ b/make_abat_scripts @@ -0,0 +1,35 @@ +#!/bin/bash + +d="$1" + +[ -d ../abat ] || mkdir ../abat + +i=1 +for t in "IBM,9124-720 eServer OpenPower 720" "IBM,9110-51A System p5 510" "IBM,9117-MMA System p 570" +do + cat >"../abat/$d-abat.ozlabs.ibm.com-$i" <"../abat/$d-abat.linux.ibm.com-$i" <&2 + exit 1 +} + +[ -n "$3" ] && build_host="$3" + +log() +{ + echo "$@" | tee -a $LOG_FILE +} + +execute() +{ + log "$" $@ + $@ 2>&1 | tee -a $LOG_FILE + return ${PIPESTATUS[0]} +} + +GIT_EDITOR=: execute git reset --hard 'HEAD^' || { + echo "git reset failed" 1>&2 + bash -i || exit +} + +log Merging "next-$ver/$tree" +execute git merge "next-$ver/$tree" || { + echo Merge failed 1>&2 + bash -i || exit + GIT_EDITOR=: execute git commit -v -a + execute git diff -M --stat --summary 'HEAD^..' +} + +$no_build && exit 0 + +rsync -avH --exclude .git --delete . "$build_host":"$build_dir"/. || { + echo Rsync failed 1>&2 + bash -i || exit +} + +echo "Building using $build_cmd on $build_host" +ssh "$build_host" "$build_cmd" || { + echo Build failed 1>&2 + bash -i || exit +} + +d=$(date --date "5 hours ago" '+%Y%m%d') +git update-ref "refs/heads/next-$d/broken/$tree" "refs/heads/next-$d/$tree" +git update-ref "refs/heads/next-$d/$tree" "refs/heads/next-$ver/$tree" + +exit 0 diff --git a/summary b/summary new file mode 100755 index 0000000..1aa4866 --- /dev/null +++ b/summary @@ -0,0 +1,60 @@ +#!/bin/bash --norc + +LOG_FILE="../summary" + +cp /dev/null $LOG_FILE + +log() +{ + echo "$@" | tee -a $LOG_FILE +} + +patch_and_sha_ids() +{ + echo "$*" | xargs -r -n 1 git diff-tree -p | git patch-id | sort +} + +patch_ids() +{ + patch_and_sha_ids "$@" | cut -d' ' -f1 +} + +heads=$(grep -v '^#' ../real_control | awk -F ' ' '$2=="quilt" { printf("quilt/%s ", $3); } $2=="git" { printf("%s/%s ", $3, $5); }') + +seen_ids="" +seen_heads="" +seen_sha1s="" + +for h in $heads; do + mb=$(git merge-base origin/master $h) + rh=$(git rev-parse $h) + [ "$mb" = "$rh" ] && { + log $h + continue + } + + c=$(git rev-list --no-merges $mb...$rh $seen_heads | sort) + seen_heads="$seen_heads ^$rh" + [ -z "$c" ] && { + log $h + continue + } + +# origin_ids=$(patch_ids $(git rev-list --no-merges $mb..origin/master)) + + is=$(patch_and_sha_ids $c) +# is=$(join -v 1 <(echo "$is") <(echo "$origin_ids")) + is=$(join -v 1 <(echo "$is") ../origin1.ids) + is=$(join -v 1 <(echo "$is") <(echo "$seen_ids")) + c1=$(echo "$is" | cut -d' ' -f2) + [ "$is" ] && seen_ids=$( (echo "$seen_ids"; echo "$is" | cut -d' ' -f1) | sort) + + log $h \($(echo "$c" | wc -w) $(echo "$c1" | wc -w)\) + + seen_sha1s="$seen_sha1s $c1" +done + +log +git shortlog --no-walk $seen_sha1s 2>&1 | tee -a $LOG_FILE + +exit 0 -- 2.39.5