diff mbox

[v7,20/20] osstest: save/retrieve the last successfully tested FreeBSD build

Message ID 20170726081433.tgs7utlqyb4uacwc@dhcp-3-128.uk.xensource.com (mailing list archive)
State New, archived
Headers show

Commit Message

Roger Pau Monné July 26, 2017, 8:14 a.m. UTC
On Tue, Jul 25, 2017 at 04:18:52PM +0100, Ian Jackson wrote:
> Roger Pau Monne writes ("[PATCH v7 20/20] osstest: save/retrieve the last successfully tested FreeBSD build"):
> > And use it in order to install the hosts for the next FreeBSD flight.
> ...
> > +case "$branch" in
> > +freebsd-*)
> > +    IFS=$'\n'
> 
> That's quite brave, but I don't object.  I would have piped the output
> into `read' or something.

I have the following which can be applied on top and is IMHO better, I
also don't fancy playing with IFS. I can push a new branch with this
folded if that's more convenient.

---8<---
diff mbox

Patch

diff --git a/cr-daily-branch b/cr-daily-branch
index 91f73ad8..66e7e88b 100755
--- a/cr-daily-branch
+++ b/cr-daily-branch
@@ -136,9 +136,7 @@  esac
 
 case "$branch" in
 freebsd-*)
-    IFS=$'\n'
-    for anointed in \
-        `./mg-anoint list-prepared "freebsd build $freebsd_branch *"`; do
+    while read anointed; do
         # Check if the anointed version matches OLD_VERSION,
         # or else force a new flight, even if OLD_REVISION matches
         # NEW_REVISION.
@@ -149,8 +147,7 @@  freebsd-*)
             skipidentical=false
             break
         fi
-    done
-    unset IFS
+    done <<< `./mg-anoint list-prepared "freebsd build $freebsd_branch *"`
     ;;
 esac
 
@@ -305,9 +302,7 @@  freebsd)
 	;;
 esac
 
-IFS=$'\n'
-for anointed in \
-    `./mg-anoint list-prepared "freebsd build $freebsd_branch *"`; do
+while read anointed; do
     # Retrieve previous successful FreeBSD build for each arch.
     freebsd_arch=${anointed##* }
     freebsd_envvar="FREEBSD_${freebsd_arch^^}_BUILDJOB"
@@ -315,8 +310,7 @@  for anointed in \
         flight_job=`./mg-anoint retrieve "$anointed"`
         export ${freebsd_envvar}=${flight_job/ /.}
     fi
-done
-unset IFS
+done <<< `./mg-anoint list-prepared "freebsd build $freebsd_branch *"`
 
 if [ "x$OLD_REVISION" = xdetermine-late ]; then
 	OLD_REVISION="`\
@@ -525,9 +519,7 @@  case "$branch" in
 freebsd-*)
     if grep '^tolerable$' $mrof >/dev/null 2>&1 && $OSSTEST_ANOINT &&
        [ "x$OSSTEST_BLESSING" == "xreal" ]; then
-        IFS=$'\n'
-        for anointed in `./mg-anoint list-prepared \
-                                     "freebsd build $freebsd_branch *"`; do
+        while read anointed; do
             # Update anointed versions
             # NB: failure to update an anointed build for a specific arch
             # should not be fatal, and it's not an issue if one of the
@@ -537,8 +529,8 @@  freebsd-*)
                            $flight build-$freebsd_arch-freebsd; then
                 echo "Anointed artifacts from build-$freebsd_arch-freebsd"
             fi
-        done
-        unset IFS
+        done <<< `./mg-anoint list-prepared \
+                              "freebsd build $freebsd_branch *"`
     fi
     ;;
 esac