diff mbox

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

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

Commit Message

Roger Pau Monné July 26, 2017, 9:19 a.m. UTC
On Wed, Jul 26, 2017 at 09:14:33AM +0100, Roger Pau Monne wrote:
> 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.

After our IRC conversation about here strings and failure, the
following one using pipes is probably better.

---8<---
diff mbox

Patch

diff --git a/cr-daily-branch b/cr-daily-branch
index 91f73ad8..bbb1d765 100755
--- a/cr-daily-branch
+++ b/cr-daily-branch
@@ -136,9 +136,8 @@  esac
 
 case "$branch" in
 freebsd-*)
-    IFS=$'\n'
-    for anointed in \
-        `./mg-anoint list-prepared "freebsd build $freebsd_branch *"`; do
+    ./mg-anoint list-prepared "freebsd build $freebsd_branch *" | \
+    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.
@@ -150,7 +149,6 @@  freebsd-*)
             break
         fi
     done
-    unset IFS
     ;;
 esac
 
@@ -305,9 +303,8 @@  freebsd)
 	;;
 esac
 
-IFS=$'\n'
-for anointed in \
-    `./mg-anoint list-prepared "freebsd build $freebsd_branch *"`; do
+./mg-anoint list-prepared "freebsd build $freebsd_branch *" | \
+while read anointed; do
     # Retrieve previous successful FreeBSD build for each arch.
     freebsd_arch=${anointed##* }
     freebsd_envvar="FREEBSD_${freebsd_arch^^}_BUILDJOB"
@@ -316,7 +313,6 @@  for anointed in \
         export ${freebsd_envvar}=${flight_job/ /.}
     fi
 done
-unset IFS
 
 if [ "x$OLD_REVISION" = xdetermine-late ]; then
 	OLD_REVISION="`\
@@ -525,9 +521,8 @@  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
+        ./mg-anoint list-prepared "freebsd build $freebsd_branch *" | \
+        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
@@ -538,7 +533,6 @@  freebsd-*)
                 echo "Anointed artifacts from build-$freebsd_arch-freebsd"
             fi
         done
-        unset IFS
     fi
     ;;
 esac