Browse Source

🔨 Fix mfprep string test

Scott Lahteine 2 years ago
parent
commit
e88fabafc8
1 changed files with 14 additions and 13 deletions
  1. 14
    13
      buildroot/share/git/mfprep

+ 14
- 13
buildroot/share/git/mfprep View File

18
 TAG1=$1
18
 TAG1=$1
19
 TAG2=${2:-"HEAD"}
19
 TAG2=${2:-"HEAD"}
20
 
20
 
21
+DEST=2.1.x
22
+
21
 # Validate that the required tags exist
23
 # Validate that the required tags exist
22
 
24
 
23
 MTAG=`git tag | grep -e "^bf-$TAG1\$"`
25
 MTAG=`git tag | grep -e "^bf-$TAG1\$"`
24
-[[ -n $MTAG ]] || { echo "Can't find tag bf-$TAG1" ; exit 1 ; }
26
+[[ -n "$MTAG" ]] || { echo "Can't find tag bf-$TAG1" ; exit 1 ; }
25
 MTAG=`git tag | grep -e "^$TAG1\$"`
27
 MTAG=`git tag | grep -e "^$TAG1\$"`
26
-[[ -n $MTAG ]] || { echo "Can't find tag $TAG1" ; exit 1 ; }
28
+[[ -n "$MTAG" ]] || { echo "Can't find tag $TAG1" ; exit 1 ; }
27
 
29
 
28
-# Generate log of recent commits for bugfix-2.0.x and 2.0.x
30
+# Generate log of recent commits for bugfix-2.0.x and DEST
29
 
31
 
30
 TMPDIR=`mktemp -d`
32
 TMPDIR=`mktemp -d`
31
 LOGB="$TMPDIR/log-bf.txt"
33
 LOGB="$TMPDIR/log-bf.txt"
32
-LOG2="$TMPDIR/log-20x.txt"
34
+LOG2="$TMPDIR/log-2x.txt"
33
 TMPF="$TMPDIR/tmp.txt"
35
 TMPF="$TMPDIR/tmp.txt"
34
-SCRF="$TMPDIR/update-20x.sh"
36
+SCRF="$TMPDIR/update-$DEST.sh"
35
 
37
 
36
 git checkout bugfix-2.0.x
38
 git checkout bugfix-2.0.x
37
 git log --pretty="[%h] %s" bf-$TAG1..$TAG2 | grep -v '\[cron\]' | $SED '1!G;h;$!d' >"$LOGB"
39
 git log --pretty="[%h] %s" bf-$TAG1..$TAG2 | grep -v '\[cron\]' | $SED '1!G;h;$!d' >"$LOGB"
38
 
40
 
39
-git checkout 2.0.x
41
+git checkout $DEST
40
 git log --pretty="[%h] %s" $TAG1..$TAG2 | $SED '1!G;h;$!d' >"$LOG2" || { echo "Can't find tag bf-$TAG1" ; exit 1 ; }
42
 git log --pretty="[%h] %s" $TAG1..$TAG2 | $SED '1!G;h;$!d' >"$LOG2" || { echo "Can't find tag bf-$TAG1" ; exit 1 ; }
41
 
43
 
42
-# Go through commit text from 2.0.x removing all matches from the bugfix log
44
+# Go through commit text from DEST removing all matches from the bugfix log
43
 
45
 
44
 cat "$LOG2" | while read line; do
46
 cat "$LOG2" | while read line; do
45
-  #echo "... $line"
46
-  if [[ $line =~ \(((#[0-9]{5}),* *)((#[0-9]{5}),* *)?((#[0-9]{5}),* *)?\)$ ]]; then
47
+  if [[ $line =~ \(((#[0-9]{5}),* *)((#[0-9]{5}),* *)?((#[0-9]{5}),* *)?((#[0-9]{5}),* *)?((#[0-9]{5}),* *)?((#[0-9]{5}),* *)?\)$ ]]; then
47
     PATT=""
48
     PATT=""
48
     for i in ${!BASH_REMATCH[@]}; do
49
     for i in ${!BASH_REMATCH[@]}; do
49
       if ((i > 0 && (i % 2 == 0))); then
50
       if ((i > 0 && (i % 2 == 0))); then
54
       fi
55
       fi
55
     done
56
     done
56
     #echo "... $PATT"
57
     #echo "... $PATT"
57
-    [[ -n $PATT ]] && { grep -vE "$PATT" "$LOGB" >"$TMPF" ; cp "$TMPF" "$LOGB" ; }
58
+    [[ -n "$PATT" ]] && { grep -vE "$PATT" "$LOGB" >"$TMPF" ; cp "$TMPF" "$LOGB" ; }
58
   else
59
   else
59
     PATT=$( $SED -E 's/^\[[0-9a-f]{10}\]( . )?(.+)$/\2/' <<<"$line" )
60
     PATT=$( $SED -E 's/^\[[0-9a-f]{10}\]( . )?(.+)$/\2/' <<<"$line" )
60
-    [[ -n $PATT ]] && { grep -v "$PATT" "$LOGB" >"$TMPF" ; cp "$TMPF" "$LOGB" ; }
61
+    [[ -n "$PATT" ]] && { grep -v "$PATT" "$LOGB" >"$TMPF" ; cp "$TMPF" "$LOGB" ; }
61
   fi
62
   fi
62
 done
63
 done
63
 
64
 
64
 # Convert remaining commits into git commands
65
 # Convert remaining commits into git commands
65
 
66
 
66
-echo -e "#!/usr/bin/env bash\nset -e\ngit checkout 2.0.x\n" >"$TMPF"
67
+echo -e "#!/usr/bin/env bash\nset -e\ngit checkout ${DEST}\n" >"$TMPF"
67
 cat "$LOGB" | while read line; do
68
 cat "$LOGB" | while read line; do
68
   if [[ $line =~ ^\[([0-9a-f]{10})\]\ *(.*)$ ]]; then
69
   if [[ $line =~ ^\[([0-9a-f]{10})\]\ *(.*)$ ]]; then
69
     CID=${BASH_REMATCH[1]}
70
     CID=${BASH_REMATCH[1]}
74
   fi
75
   fi
75
 done
76
 done
76
 mv "$TMPF" "$SCRF"
77
 mv "$TMPF" "$SCRF"
77
-chmod ug+x "$SCRF"
78
+chmod +x "$SCRF"
78
 
79
 
79
 ((DRYRUN)) && rm -r "$TMPDIR" || open "$TMPDIR"
80
 ((DRYRUN)) && rm -r "$TMPDIR" || open "$TMPDIR"

Loading…
Cancel
Save