Saving packages in cache even when failing or interrupting a build (Closes: #586929).

This commit is contained in:
Daniel Baumann 2011-07-19 11:13:17 +02:00
parent 691b06f7a6
commit eb2a305a5f
2 changed files with 16 additions and 1 deletions

View File

@ -36,7 +36,9 @@ Save_cache ()
if [ "${LB_CACHE}" = "true" ] && [ "${LB_CACHE_PACKAGES}" = "true" ]
then
# Cleaning current cache
Chroot chroot "apt-get autoclean"
# In case of interrupted or incomplete builds, this may return an error,
# but we still do want to save the cache.
Chroot chroot "apt-get autoclean" || true
if ls chroot/var/cache/apt/archives/*.deb > /dev/null 2>&1
then

View File

@ -35,6 +35,19 @@ Exit ()
done
fi
Echo_message "Saving chaches..."
# We can't really know at which part we're failing,
# but let's assume that if there's any binary stage file arround
# we are in binary stage.
if ls .stage/binary* > /dev/null 2>&1
then
Save_cache cache/packages_binary
else
Save_cache cache/packages_chroot
fi
return ${VALUE}
}