Skip to contentSkip to conversation

crontab: adjust to remove "." from mg-list-all-branches output

PATCH New Ian Campbell 2 participants 3 messages Feb 18, 2016 – Feb 23, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 crontab: adjust to remove "." from mg-list-all-branches output

The regex in mg-list-all-branches assumes that the BRANCHES= will either be a singleton entry separated from the following command by a hard tab or a single quoted list of space separated entries, however the xen-unstable-coverity line is singleton separated from the command by a single space.

Rather than using a hard tab (which ends up aligning things in an aesthetically displeasing way) simply quote the single list entry.

This will (I assume) have the effect of removing this line from
http://logs.test-lab.xenproject.org/osstest/results/all-branch-statuses.txt:

. Error! 0 - n/a n/a

---
 crontab | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
crontab +1 -1
index 2cfad74..c8d8cac 100755
@@ -8,7 +8,7 @@ [email protected],[email protected]
 0		*	* * *		cd testing.git && BRANCHES=xen-unstable-smoke	./cr-for-branches branches -q "./cr-daily-branch --real"
 4-59/30		*	* * *		cd testing.git &&				./cr-for-branches branches -q "./cr-daily-branch --real"
 18		9	* * 1,3,5	cd testing.git && BRANCHES=linux-next		./cr-for-branches branches -w "./cr-daily-branch --real"
-18		9	* * 3,7		cd testing.git && BRANCHES=xen-unstable-coverity ./cr-for-branches branches -w "./cr-daily-branch --real"
+18		9	* * 3,7		cd testing.git && BRANCHES='xen-unstable-coverity' ./cr-for-branches branches -w "./cr-daily-branch --real"
 18		4	* * *		cd testing.git && BRANCHES='linux-linus linux-mingo-tip-master linux-3.0 libvirt rumpuserxen' ./cr-for-branches branches -w "./cr-daily-branch --real"
 6-59/15   	*	* * *		cd testing.git && EXTRA_BRANCHES='linux-linus linux-3.0 rumpuserxen libvirt' ./cr-for-branches bisects -w "./cr-try-bisect --real"
 #8-59/5		*	* * *		cd bisects/adhoc.git &&	with-lock-ex -q data-tree-lock bash -c "./cr-try-bisect-adhoc; exit $?"
Signature · 1 line
2.6.1
#1 lore raw

PATCH 1/1 mg-list-all-branches: avoid mistakenly generating `.' in the output

The regex in mg-list-all-branches assumes that the BRANCHES= will either be a singleton entry separated from the following command by a hard tab or a single quoted list of space separated entries, however the xen-unstable-coverity line is singleton separated from the command by a single space.

We could fix this by using a hard tab, but that ends up aligning things in an aesthetically displeasing way, and relying on hard tabs is fragile.

Instead, improve the parsing in mg-list-all-branches: break out a couple of semantically (as well as syntactically) common regexp elements out into variables, and then provide two regexps: one which matches shell "assign default values" substitutions, and the other which matches the ordinary shell assignments.

We use an empty pair of () in the first regexp to make sure that they both produce the branch name list in $2. (It would be possible to use named capture groups but I'm not sure whether all our perls are recent enough.)

I have verified that the actual difference in output right now is just to remove the erroneous `.' entry.

---
 mg-list-all-branches |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
mg-list-all-branches +7 -2
index 87703c7..62d3ff1 100755
@@ -7,11 +7,16 @@ use Sort::Versions;
 
 our %branches;
 
+my $branchvar_re = '(?:EXTRA_)?BRANCHES';
+my $branchchr_re = '[-.0-9a-z ]';
+
 foreach my $f (qw(cr-for-branches crontab)) {
     open C, $f or die $!;
     while (<C>) {
-        next unless m/(?:EXTRA_)?BRANCHES[:+]?='?([-.0-9a-z ]+)/;
-        $branches{$_}=1 foreach split /\s+/, $1;
+        next unless
+	    m/\$\{$branchvar_re[:+]?=()($branchchr_re+)\b/ ||
+	    m/$branchvar_re[:+]?=('?)($branchchr_re+?)\1\s/;
+        $branches{$_}=1 foreach split /\s+/, $2;
     }
     close C or die $!;
 }
Signature · 1 line
1.7.10.4
#2 lore raw

Re: [OSSTEST PATCH] mg-list-all-branches: avoid mistakenly generating `.' in the output

Quoted 21 lines · Ian Jackson

The regex in mg-list-all-branches assumes that the BRANCHES= will either be a singleton entry separated from the following command by a hard tab or a single quoted list of space separated entries, however the xen-unstable-coverity line is singleton separated from the command by a single space.

We could fix this by using a hard tab, but that ends up aligning things in an aesthetically displeasing way, and relying on hard tabs is fragile.

Instead, improve the parsing in mg-list-all-branches: break out a couple of semantically (as well as syntactically) common regexp elements out into variables, and then provide two regexps: one which matches shell "assign default values" substitutions, and the other which matches the ordinary shell assignments.

We use an empty pair of () in the first regexp to make sure that they both produce the branch name list in $2.  (It would be possible to use named capture groups but I'm not sure whether all our perls are recent enough.)

Quoted 6 lines

I have verified that the actual difference in output right now is just to remove the erroneous `.' entry.

LGTM, Acked-by: Ian Campbell <[email protected]>

Quoted 24 lines

---
 mg-list-all-branches |    9 +++++++--

 1 file changed, 7 insertions(+), 2 deletions(-)
mg-list-all-branches +0 -0
index 87703c7..62d3ff1 100755
@@ -7,11 +7,16 @@ use Sort::Versions;


 our %branches;

mg-list-all-branches +3 -0
+my $branchvar_re = '(?:EXTRA_)?BRANCHES';
+my $branchchr_re = '[-.0-9a-z ]';
+

 foreach my $f (qw(cr-for-branches crontab)) {
     open C, $f or die $!;
     while (<C>) {
-        next unless m/(?:EXTRA_)?BRANCHES[:+]?='?([-.0-9a-z ]+)/; -        $branches{$_}=1 foreach split /\s+/, $1;
+        next unless

mg-list-all-branches +3 -0
+	    m/\$\{$branchvar_re[:+]?=()($branchchr_re+)\b/ ||
+	    m/$branchvar_re[:+]?=('?)($branchchr_re+?)\1\s/;
+        $branches{$_}=1 foreach split /\s+/, $2;
Quoted 3 lines

     }
     close C or die $!;
 }

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel