Skip to contentSkip to conversation

cri-common: Refactor select_prevxenbranch to cri-getprevxenbranch

PATCH In review Ian Campbell 2 participants 3 messages Sep 11, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cri-common: Refactor select_prevxenbranch to cri-getprevxenbranch

This moves it outside any prevailing set -x and reduces the amount of noise in various logs.

---
 cri-common           | 16 +---------------
 cri-getprevxenbranch | 19 +++++++++++++++++++
 2 files changed, 20 insertions(+), 15 deletions(-)
 create mode 100755 cri-getprevxenbranch
cri-common +1 -15
index 94696ab..2669485 100644
@@ -61,21 +61,7 @@ repo_tree_rev_fetch_git () {
 }
 
 select_prevxenbranch () {
-	local b
-	local p
-	for b in $(./mg-list-all-branches) ; do # already sorted by version
-		case "$b" in
-		xen*)
-			if [ "x$b" = "x$xenbranch" ] ; then
-				break
-			else
-				p=$b
-			fi
-			;;
-		*)	;;
-		esac
-	done
-	prevxenbranch=$p
+	prevxenbranch=`./cri-getprevxenbranch $xenbranch`
 }
 
 select_xenbranch () {
cri-getprevxenbranch new file +19 -0
new file mode 100755
index 0000000..dce52c2
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+xenbranch=$1
+p=
+
+for b in $(./mg-list-all-branches) ; do # already sorted by version
+    case "$b" in
+	xen*)
+	    if [ "x$b" = "x$xenbranch" ] ; then
+		break
+	    else
+		p=$b
+	    fi
+	    ;;
+	*)	;;
+    esac
+done
+
+echo $p
Signature · 1 line
2.5.1
#1 lore raw

Ian Campbell writes ("[PATCH OSSTEST] cri-common: Refactor select_prevxenbranch to cri-getprevxenbranch"):

Quoted 2 lines

This moves it outside any prevailing set -x and reduces the amount of noise in various logs.

...

cri-getprevxenbranch line 3

Quoted 3 lines
cri-getprevxenbranch new file +3 -0
+#!/bin/bash
+
+xenbranch=$1

Missing set -e.

Ian.

#2 lore raw
Quoted 10 lines · Ian Jackson

Ian Campbell writes ("[PATCH OSSTEST] cri-common: Refactor select_prevxenbranch to cri-getprevxenbranch"):

Quoted 2 lines

This moves it outside any prevailing set -x and reduces the amount of noise in various logs.

...

Review

Quoted 3 lines
(quoted diff) +3 -0
+#!/bin/bash
+
+xenbranch=$1

Missing set -e.

So it is, oops.

8>---------------

Quoted 1 line

From 884b2571763164d7964de1d4dd6fd71ee1a4b6e9 Mon Sep 17 00:00:00 2001

From: Ian Campbell <[email protected]>
Date: Fri, 11 Sep 2015 10:52:49 +0100
Subject: [PATCH OSSTEST v2] cri-common: Refactor select_prevxenbranch to
cri-getprevxenbranch
To: osstest

This moves it outside any prevailing set -x and reduces the amount of noise in various logs.

---
v2: set -e

---
 cri-common           | 16 +---------------
 cri-getprevxenbranch | 21 +++++++++++++++++++++
 2 files changed, 22 insertions(+), 15 deletions(-)
 create mode 100755 cri-getprevxenbranch
cri-common +1 -15
index 94696ab..2669485 100644
@@ -61,21 +61,7 @@ repo_tree_rev_fetch_git () {
 }
 
 select_prevxenbranch () {
-	local b
-	local p
-	for b in $(./mg-list-all-branches) ; do # already sorted by version
-		case "$b" in
-		xen*)
-			if [ "x$b" = "x$xenbranch" ] ; then
-				break
-			else
-				p=$b
-			fi
-			;;
-		*)	;;
-		esac
-	done
-	prevxenbranch=$p
+	prevxenbranch=`./cri-getprevxenbranch $xenbranch`
 }
 
 select_xenbranch () {
cri-getprevxenbranch new file +21 -0
new file mode 100755
index 0000000..37ea0ee
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+xenbranch=$1
+p=
+
+set -e
+
+for b in $(./mg-list-all-branches) ; do # already sorted by version
+    case "$b" in
+	xen*)
+	    if [ "x$b" = "x$xenbranch" ] ; then
+		break
+	    else
+		p=$b
+	    fi
+	    ;;
+	*)	;;
+    esac
+done
+
+echo $p
Signature · 1 line
2.5.1