Skip to content
This repository has been archived by the owner on Apr 19, 2019. It is now read-only.

Commit

Permalink
swupd-image.bbclass: remove assumption about OS version numbering
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
pohly committed Mar 30, 2016
1 parent 53f7731 commit 7ea69b0
Showing 1 changed file with 6 additions and 20 deletions.
26 changes: 6 additions & 20 deletions meta-swupd/classes/swupd-image.bbclass
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,6 @@ SWUPD_GENERATE ??= "1"
SWUPD_DELTAPACKS ??= "1"
# Create delta packs for N versions back — default 2
SWUPD_N_DELTAPACK ??= "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
SWUPD_VERSION_STEP ??= "10"

# This version number *must* map to VERSION_ID in /etc/os-release and *must* be
# a non-negative integer that fits in an int.
Expand Down Expand Up @@ -503,25 +499,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
bndlcnt=0
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
done
done
fi
Expand Down

0 comments on commit 7ea69b0

Please sign in to comment.