diff options
authorPatrick Ohly <patrick.ohly@intel.com>2016-03-30 17:01:12 +0200
committerJoshua Lock <joshua.g.lock@intel.com>2016-03-30 21:36:58 +0100
commitc1ec3ee83d90cc5aac43e920d14dce34ab8ca039 (patch)
parentb8858968fe846dba40a86e7e61ffe209c4a45334 (diff)
swupd-image.bbclass: remove assumption about OS version numbering
It is not guaranteed that OS versions always increment in steps of 10 and that deltas are desired for "current version - 10, -20, etc.". For example, previous versions might be 10, 20, and the current one 21 because it is a minor update. In such a case no delta packs would be generated because OS versions 11 and 1 do not exist. Ostro OS outside of the CI derives the OS version from datetime, which leads to high version numbers like 33014500. Counting down from that in steps of ten in shell under pseudo was surprisingly slow and unusable, running for minutes without even getting close to completion when it does not hit existing version numbers. So now the simplified approach is to generate delta packs for exactly the last SWUPD_N_DELTAPACK older versions, regardless what their numbering is. If a more sophisticated approach is needed, it can still be added later on, for example as part of YOCTO #9321. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
1 files changed, 6 insertions, 20 deletions
diff --git a/classes/swupd-image.bbclass b/classes/swupd-image.bbclass
index 1eeb0c7..b1244cc 100644
--- a/classes/swupd-image.bbclass
+++ b/classes/swupd-image.bbclass
@@ -25,10 +25,6 @@ SWUPD_GENERATE ??= "1"
# Create delta packs for N versions back — default 2
-# Amount the OS_VERSION should be increased by for each release, used by the
-# delta pack looping to generate delta packs going back up toSWUPD_N_DELTAPACK
-# releases
# This version number *must* map to VERSION_ID in /etc/os-release and *must* be
# a non-negative integer that fits in an int.
@@ -472,25 +468,15 @@ END
# Generate delta-packs going back SWUPD_N_DELTAPACK versions
if [ ${SWUPD_DELTAPACKS} -eq 1 -a ${SWUPD_N_DELTAPACK} -gt 0 -a $PREVREL -gt 0 ]; then
- bbdebug 1 "Generating delta pack with previous release $PREVREL"
bundles="os-core ${SWUPD_BUNDLES}"
for bndl in $bundles; do
- prevver=$PREVREL
- while [ $bndlcnt -lt ${SWUPD_N_DELTAPACK} -a $prevver -gt 0 ]; do
- if [ -e ${DEPLOY_DIR_SWUPD}/image/$prevver/$bndl ]; then
- bbdebug 2 "Generating delta pack from $prevver to ${OS_VERSION} for $bndl"
- ${STAGING_BINDIR_NATIVE}/swupd_make_pack -S ${DEPLOY_DIR_SWUPD} $prevver ${OS_VERSION} $bndl
- bndlcnt=`expr $bndlcnt + 1`
- fi
- # Both let and expr return 1 if the expression evaluates to 0,
- # bitbake catches the non-zero exit code from a shell command
- # end exits with an error - special case to work around this.
- if [ $prevver -eq ${SWUPD_VERSION_STEP} ]; then
- prevver=0
- else
- prevver=`expr $prevver - ${SWUPD_VERSION_STEP}`
- fi
+ # Build list of previous versions and pick the last n ones to build
+ # deltas against. Ignore the latest one, which is the one we build
+ # right now.
+ ls -d -1 ${DEPLOY_DIR_SWUPD}/image/*/$bndl | sed -e 's;${DEPLOY_DIR_SWUPD}/image/\([^/]*\)/.*;\1;' | grep -e '^[0-9]*$' | sort -n | head -n -1 | tail -n ${SWUPD_N_DELTAPACK} | while read prevver; do
+ bbdebug 2 "Generating delta pack from $prevver to ${OS_VERSION} for $bndl"
+ ${STAGING_BINDIR_NATIVE}/swupd_make_pack -S ${DEPLOY_DIR_SWUPD} $prevver ${OS_VERSION} $bndl