summaryrefslogtreecommitdiff
path: root/jhbuild_patches_collect
blob: a473482a317c22faba61ad6d48b51fce4d38c36e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash

O=`pwd`/collected-patches
mkdir -p $O
rm -f $O/*
M=`pwd`/checkout
IFS=$'\n'

LIST=`jhbuild -f jhbuildrc list`

for i in $LIST ; do
  D=`jhbuild -f jhbuildrc run --in-checkoutdir="$i" -- bash -c 'pwd' 2>/dev/null`
  if [ $? == 0 ] ; then
    D=`echo $D | tr '\n' ' ' `
    D=${D%% *}
#   echo "$i: $D"
    if [ "$D" != "$M" ] ; then
      cd $D
      if [ -e ".git" ]; then
          git diff --quiet --ignore-submodules || (echo "$i: dirty" && exit 1 ) || exit 1
          FN=`git format-patch -o $O origin/master`
          cd - >/dev/null
          for p in $FN; do
              echo $p
              mv $p $O/$i-`basename $p`
          done
      fi
    fi
  fi
done