diff options
author | Robin H. Johnson <robbat2@gentoo.org> | 2019-12-06 23:16:42 -0800 |
---|---|---|
committer | Robin H. Johnson <robbat2@gentoo.org> | 2019-12-06 23:16:42 -0800 |
commit | defa5e89db0e32db4973632c1d4ba424d4afc763 (patch) | |
tree | 303f9f25acbc2187bd44774adf7c10a33baeb2b1 /snapshots-create.sh | |
parent | Revert "snapshots-create: start to implement bug 574752" (diff) | |
download | mastermirror-scripts-defa5e89db0e32db4973632c1d4ba424d4afc763.tar.gz mastermirror-scripts-defa5e89db0e32db4973632c1d4ba424d4afc763.tar.bz2 mastermirror-scripts-defa5e89db0e32db4973632c1d4ba424d4afc763.zip |
snapshots-create: refactor20191207T072430Z
Some cleanups before new functionality.
- Generate print-exclusion-list seperately before tarball
- Defer all compression until the tarball sanity check
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
Diffstat (limited to 'snapshots-create.sh')
-rwxr-xr-x | snapshots-create.sh | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/snapshots-create.sh b/snapshots-create.sh index f43990f..e0ee097 100755 --- a/snapshots-create.sh +++ b/snapshots-create.sh @@ -91,14 +91,20 @@ fi # working dir cd ${TEMP} -# 1) Create the tarball -# create the tarball and move it to the right location +# Tarball generation write_time_log "START TARBALL $(date -u)" -if [ ! -f "${FILENAME%.bz2}" ]; then - # Build exclusion list - EXCLUSION_LIST="$(mktemp -p ${TEMP} snapshot-exclude.XXXXXXXXXX)" - /usr/local/bin/mastermirror/print-exclusion-list.sh "${MASTER}" >"${EXCLUSION_LIST}" +# 1a) Tarball prep: +write_time_log "START TARBALL(prep) $(date -u)" +# Build exclusion list +EXCLUSION_LIST="$(mktemp -p ${TEMP} snapshot-exclude.XXXXXXXXXX)" +/usr/local/bin/mastermirror/print-exclusion-list.sh "${MASTER}" >"${EXCLUSION_LIST}" +write_time_log "END TARBALL(prep) $(date -u)" + +# 1b) Create the tarball +# create the tarball and move it to the right location +write_time_log "START TARBALL(tar,old) $(date -u)" +if [ ! -f "${FILENAME%.bz2}" ]; then TAR_OPTIONS=( # Force a small block size --blocking-factor=1 @@ -141,10 +147,12 @@ if [ ! -f "${FILENAME%.bz2}" ]; then echo "Tar run failed!" exit 1 fi - rm -f "${EXCLUSION_LIST}" fi +rm -f "${EXCLUSION_LIST}" # Not needed after this +write_time_log "END TARBALL(tar,old) $(date -u)" +write_time_log "START TARBALL(umd5,old) $(date -u)" [ ! -f " ${FILENAME}.umd5sum" ] && md5sum ${FILENAME%.bz2} > ${FILENAME}.umd5sum -[ ! -f "${FILENAME%.bz2}.bz2" ] && ${NICE} $BZIP2_PROG -k9 ${FILENAME%.bz2} +write_time_log "END TARBALL(umd5,old) $(date -u)" write_time_log "END TARBALL $(date -u)" # end 1) @@ -172,7 +180,14 @@ write_time_log "END SIZE SANITY $(date -u)" # end 2) # 3) create xz tarball -write_time_log "START XZ $(date -u)" +write_time_log "START COMPRESS $(date -u)" +# This happens only AFTER the sanity check +# 3a) bzip2 of old tarball +write_time_log "START COMPRESS(bzip2,old) $(date -u)" +[ ! -f "${FILENAME%.bz2}.bz2" ] && ${NICE} $BZIP2_PROG -k9 ${FILENAME%.bz2} +write_time_log "END COMPRESS(bzip2,old) $(date -u)" +# 3b) xz of old tarball +write_time_log "START COMPRESS(xz,old) $(date -u)" if [ ! -f "${FILENAME%.*}.xz" ] ; then # pixz, pxz, xz all differ in filename generation # xz: .tar -> .tar.xz @@ -182,7 +197,8 @@ if [ ! -f "${FILENAME%.*}.xz" ] ; then # To avoid this, be explicit by using IO. ${NICE} ${XZ_PROG} -9 -e <"${FILENAME%.*}" >"${FILENAME%.*}.xz" || exit $? fi -write_time_log "END XZ $(date -u)" +write_time_log "END COMPRESS(xz,old) $(date -u)" +write_time_log "END COMPRESS $(date -u)" # end 3) # 4) sign |