]> xenbits.xensource.com Git - people/royger/osstest.git/commitdiff
mfi-common: set_freebsd_runvars: Never set freebsd_distpath to `/amd64' etc.
authorIan Jackson <ian.jackson@eu.citrix.com>
Thu, 17 May 2018 10:54:48 +0000 (11:54 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Wed, 23 May 2018 16:13:28 +0000 (17:13 +0100)
Logically, the final branch of the if should be qualified with a check
for the emptiness of FreeBSDDist.  This is awkward in the current
structure, since we really want to do the distpath lookup only if
needed.  (This is not very important right now, but we are about to
add another case which will do a more-likely-to-bomb-out and
more-likely-to-block-on-the-db lookup.)  So refactor into `return'
style.  This lets us introduce local variables in each branch.

Now gate the final branch appropriately.  The overall result is that
if no useful FreeBSD build is found, we simply do not set the
freebsd_* runvars, rather than setting them to wrong values (eg,
`freebsd_distpath=/i386'.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
CC: Roger Pau Monné <roger.pau@citrix.com>
mfi-common

index cef28ad15ff573b0b5b9ef2be5e8fca5f8d39ac7..17b1b5091ba5e7ba8e59bb8f38007d314a5ad3d1 100644 (file)
@@ -133,14 +133,19 @@ set_freebsd_runvars () {
     local envvar="FREEBSD_${arch^^}_BUILDJOB"
     if [ -n "${!envvar}" ]; then
         freebsd_runvars="freebsdbuildjob=${!envvar}"
-    elif [ -n "$FREEBSD_DIST" ] && [ -n "$FREEBSD_VERSION" ]; then
+        return
+    fi
+    if [ -n "$FREEBSD_DIST" ] && [ -n "$FREEBSD_VERSION" ]; then
         freebsd_runvars="freebsd_distpath=$FREEBSD_DIST/$arch \
                          freebsd_version=$FREEBSD_VERSION"
-    else
-        local distpath=`getconfig "FreeBSDDist"`
+        return
+    fi
+    local distpath=`getconfig "FreeBSDDist"`
+    if [ -n "$distpath" ]; then
         local version=`getconfig "FreeBSDVersion"`
         freebsd_runvars="freebsd_distpath=$distpath/$arch \
                          freebsd_version=$version"
+        return
     fi
 }