]> code.ossystems Code Review - openembedded-core.git/commitdiff
oe-publish-sdk: exclude sstate-cache if publishing minimal SDK
authorPaul Eggleton <paul.eggleton@linux.intel.com>
Thu, 31 Mar 2016 08:53:33 +0000 (21:53 +1300)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 31 Mar 2016 12:18:12 +0000 (13:18 +0100)
If SDK_EXT_TYPE is set to "minimal" then the SDK won't contain many
sstate artifacts, and you're required to set up an sstate mirror in this
case anyway so there's no point publishing the "stub" sstate-cache
directory from within the SDK since it won't be useful for update
purposes and may be confused with the real sstate-cache.

There is however a possibility that people might publish the real
sstate-cache directory under the same output directory provided to
oe-publish-sdk, thus deleting it after extracting (as we were doing with
other files we wanted to clean up at the end) would be problematic,
besides which extracting it and then deleting it is wasteful. Thus,
introduce a "-p" command line option to the SDK installer that we can
use to tell tar not to extract the items we don't want when publishing.
This has the added benefit of mostly keeping references to these in the
place they belong i.e. in populate_sdk_ext.bbclass.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/populate_sdk_ext.bbclass
meta/files/toolchain-shar-extract.sh
scripts/oe-publish-sdk

index 5e2ebd7969fb88a3a622baae6b2331df1c084f63..2bbd1812084416f4f317a2b39ef588b90abd20d1 100644 (file)
@@ -365,6 +365,12 @@ sdk_ext_preinst() {
                exit 1
        fi
        SDK_EXTENSIBLE="1"
+       if [ "$publish" = "1" ] ; then
+               EXTRA_TAR_OPTIONS="$EXTRA_TAR_OPTIONS --exclude=ext-sdk-prepare.py"
+               if [ "${SDK_EXT_TYPE}" = "minimal" ] ; then
+                       EXTRA_TAR_OPTIONS="$EXTRA_TAR_OPTIONS --exclude=sstate-cache"
+               fi
+       fi
 }
 SDK_PRE_INSTALL_COMMAND_task-populate-sdk-ext = "${sdk_ext_preinst}"
 
index 0295bded6e15749ffdd74c6475f3e35e7eedf9e6..23a86dd52f345a636d68f7711abf4f85b2cec570 100644 (file)
@@ -38,12 +38,14 @@ fi
 
 DEFAULT_INSTALL_DIR="@SDKPATH@"
 SUDO_EXEC=""
+EXTRA_TAR_OPTIONS=""
 target_sdk_dir=""
 answer=""
 relocate=1
 savescripts=0
 verbose=0
-while getopts ":yd:nDRS" OPT; do
+publish=0
+while getopts ":yd:npDRS" OPT; do
        case $OPT in
        y)
                answer="Y"
@@ -54,6 +56,10 @@ while getopts ":yd:nDRS" OPT; do
        n)
                prepare_buildsystem="no"
                ;;
+       p)
+               prepare_buildsystem="no"
+               publish=1
+               ;;
        D)
                verbose=1
                ;;
@@ -70,6 +76,7 @@ while getopts ":yd:nDRS" OPT; do
                echo "  -d <dir>   Install the SDK to <dir>"
                echo "======== Extensible SDK only options ============"
                echo "  -n         Do not prepare the build system"
+               echo "  -p         Publish mode (implies -n)"
                echo "======== Advanced DEBUGGING ONLY OPTIONS ========"
                echo "  -S         Save relocation scripts"
                echo "  -R         Do not relocate executables"
@@ -181,7 +188,7 @@ fi
 payload_offset=$(($(grep -na -m1 "^MARKER:$" $0|cut -d':' -f1) + 1))
 
 printf "Extracting SDK..."
-tail -n +$payload_offset $0| $SUDO_EXEC tar xJ -C $target_sdk_dir --checkpoint=.2500 || exit 1
+tail -n +$payload_offset $0| $SUDO_EXEC tar xJ -C $target_sdk_dir --checkpoint=.2500 $EXTRA_TAR_OPTIONS || exit 1
 echo "done"
 
 printf "Setting it up..."
index 992de1995547cebdedfe525c843a771dd529d4a6..e6cb7af861ec5eacf908935192a61721eb5f6a88 100755 (executable)
@@ -94,19 +94,17 @@ def publish(args):
 
     # Unpack the SDK
     logger.info("Unpacking SDK")
-    cleanupfiles = [dest_sdk, os.path.join(destdir, 'ext-sdk-prepare.py')]
     if not is_remote:
-        cmd = "sh %s -n -y -d %s" % (dest_sdk, destination)
+        cmd = "sh %s -p -y -d %s" % (dest_sdk, destination)
         ret = subprocess.call(cmd, shell=True)
         if ret == 0:
             logger.info('Successfully unpacked %s to %s' % (dest_sdk, destination))
-            for cleanupfile in cleanupfiles:
-                os.remove(cleanupfile)
+            os.remove(dest_sdk)
         else:
             logger.error('Failed to unpack %s to %s' % (dest_sdk, destination))
             return ret
     else:
-        cmd = "ssh %s 'sh %s -n -y -d %s && rm -f %s'" % (host, dest_sdk, destdir, ' '.join(cleanupfiles))
+        cmd = "ssh %s 'sh %s -p -y -d %s && rm -f %s'" % (host, dest_sdk, destdir, dest_sdk)
         ret = subprocess.call(cmd, shell=True)
         if ret == 0:
             logger.info('Successfully unpacked %s to %s' % (dest_sdk, destdir))