From 547bd465070688e98a60e9407dae497b71f7a221 Mon Sep 17 00:00:00 2001 From: Jorge Ruesga Date: Sun, 12 Aug 2012 20:42:54 +0200 Subject: [PATCH] Vendor CM Build: Allow parallelize the optimization of framework-res.apk from: http://review.cyanogenmod.com/#/c/19170/ This change enhancement the optimization of cm ota package, allowing do the optimization of framework-res.apk in a parallel way. The current script optimize first the framework-res package and then the rest of packages with xargs in parallel. The framework-res package can be processed with xargs in parallel copying all the packages to a temporally folder to apply xargs (because opticharged need that the package is the current directory). This shortens the time of optimization process, because while framework-res package is optimized, the rest of processor cores can be optimizing other packages. Change-Id: I047f8c01b066db99e4dcc8bcb2f30c72492e1af8 --- tools/squisher | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/tools/squisher b/tools/squisher index 9a4b0bd5..250a248d 100755 --- a/tools/squisher +++ b/tools/squisher @@ -53,10 +53,25 @@ cd $REPACK/ota printf "Unpacking $OTAPACKAGE..." unzip $QUIET $OTAPACKAGE echo -cd $REPACK/ota/system/framework -$OPTICHARGER framework-res.apk -cd $REPACK/ota/system/app + +# Move all apks to the same directory so xargs can +# use also with framework-res.apk. This allow process +# framework-res.apk in parallel with other apks +mkdir -p $REPACK/parallel +cd $REPACK/parallel +cp $REPACK/ota/system/framework/framework-res.apk . +cp $REPACK/ota/system/app/*.apk . + +# Do optimization in parallel find ./ -name \*.apk | $XARGS $OPTICHARGER + +# Move optimized apks to repack directory +mv -f $REPACK/parallel/framework-res.apk $REPACK/ota/system/framework/framework-res.apk +mv -f $REPACK/parallel/*.apk $REPACK/ota/system/app/ + +# Return to directory +cd $REPACK/ota +rm -rf $REPACK/parallel ) # Fix build.prop