]> code.ossystems Code Review - openembedded-core.git/commitdiff
wipe-sysroots: don't assume TMPDIR is under BUILDDIR
authorRoss Burton <ross.burton@intel.com>
Wed, 14 Aug 2013 14:13:44 +0000 (15:13 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 16 Aug 2013 10:14:13 +0000 (11:14 +0100)
The previous code used the environment variable BUILDDIR and assumed that TMPDIR
was a subdirectory. This often isn't the case, so instead ask bitbake where the
directories we're about to delete are.

Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
scripts/wipe-sysroot

index e751a91e92d723dbddfe6a275fc41f220e97c6f1..2d2cbeac8cf58a474b3b283c9335104c2c65b300 100755 (executable)
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
-if [ -z "$BUILDDIR" ]; then
-    echo >&2 "Error: BUILDDIR is not defined, please initialise the build system."
-    return 1
+set -e
+
+ENVS=`mktemp --suffix -wipe-sysroot-envs`
+bitbake -p -e > $ENVS
+
+eval `grep -F SSTATE_MANIFESTS= $ENVS`
+eval `grep -F STAGING_DIR= $ENVS`
+eval `grep -F STAMPS_DIR= $ENVS`
+rm -f $ENVS
+
+if [ -z "$SSTATE_MANIFESTS" -o -z "$STAGING_DIR" -o -z "$STAMPS_DIR" ]; then
+    echo "Could not determine SSTATE_MANIFESTS/STAGING_DIR/STAMPS_DIR, check above for errors"
+    exit 1
 fi
 
 # The sysroots themselves
-rm -rf $BUILDDIR/tmp/sysroots/
+rm -rf "$STAGING_DIR"
 
 # The stamps that said the sysroot was populated
-rm -rf $BUILDDIR/tmp/stamps/*/*/*.do_populate_sysroot.*
-rm -rf $BUILDDIR/tmp/stamps/*/*/*.do_populate_sysroot_setscene.*
+rm -rf "$STAMPS_DIR/*/*/*.do_populate_sysroot.*"
+rm -rf "$STAMPS_DIR/*/*/*.do_populate_sysroot_setscene.*"
 
 # The sstate manifests
-rm -rf $BUILDDIR/tmp/sstate-control/manifest-*.populate-sysroot
+rm -rf "$SSTATE_MANIFESTS/manifest-*.populate-sysroot"