tools/catalyst-auto: change datestamp->timestamp

Prepare for doing multiple automated runs in a single day on
newer/faster build systems.

Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
This commit is contained in:
Robin H. Johnson 2017-12-07 23:40:09 -08:00
parent 10953c3a11
commit ed258c751b
No known key found for this signature in database
GPG key ID: 19395F23C58826C4
3 changed files with 26 additions and 12 deletions

View file

@ -70,7 +70,7 @@ copy_arch_to_outgoing() {
fi fi
# Copying # Copying
for i in $(find ${indir} -type f | grep -- '-20[0123][0-9]\{5\}' | sed -e 's:^.*-\(20[^.]\+\).*$:\1:' | sort -ur); do for i in $(find ${indir} -type f | egrep -- '-20[0123][0-9]{5}(([0-9]{6})|(T[0-9]{6}Z))?' | sed -e 's:^.*-\(20[^.]\+\).*$:\1:' | sort -ur); do
#echo "Doing $i" #echo "Doing $i"
t="${outdir}/${i}" t="${outdir}/${i}"
mkdir -p ${t} 2>/dev/null mkdir -p ${t} 2>/dev/null
@ -154,7 +154,7 @@ process_arch() {
# New variant preserve code # New variant preserve code
find_variants=( '(' -iname '*.iso' -o -name 'netboot-*' -o "${EXTENSIONS[@]}" ')' ) find_variants=( '(' -iname '*.iso' -o -name 'netboot-*' -o "${EXTENSIONS[@]}" ')' )
variants=$(find 20* "${find_variants[@]}" -printf '%f\n' 2>/dev/null | sed -e 's,-20[012][0-9]\{5\}.*,,g' -r | sort -u) variants=$(find 20* "${find_variants[@]}" -printf '%f\n' 2>/dev/null | sed -e 's,-20[012][0-9]\{5\}.*,,g' -r | sort -u)
echo -n '' >"${tmpdir}"/.keep.${ARCH}.txt echo -n '' >"${tmpdir}"/.keep.${ARCH}.txt
for v in $variants ; do for v in $variants ; do
variant_path=$(find 20* -iname "${v}-20*" "${find_variants[@]}" -print 2>/dev/null | sed -e "s,.*/$a/autobuilds/,,g" | sort -k1,1 -t/ | tail -n1 ) variant_path=$(find 20* -iname "${v}-20*" "${find_variants[@]}" -print 2>/dev/null | sed -e "s,.*/$a/autobuilds/,,g" | sort -k1,1 -t/ | tail -n1 )

View file

@ -207,8 +207,9 @@ if [[ ${lastrun} -ne 0 ]]; then
fi fi
fi fi
DATESTAMP=$(date +%Y%m%d) DATESTAMP=$(date -u +%Y%m%d)
TMPDIR=$(mktemp -d --tmpdir="${TMP_PATH:-/tmp}" "catalyst-auto.${DATESTAMP}.XXXXXX") TIMESTAMP=$(date -u +%Y%m%dT%H%M%SZ)
TMPDIR=$(mktemp -d --tmpdir="${TMP_PATH:-/tmp}" "catalyst-auto.${TIMESTAMP}.XXXXXX")
# Nuke any previous tmpdirs to keep them from accumulating. # Nuke any previous tmpdirs to keep them from accumulating.
if [[ ${preclean} -eq 1 ]]; then if [[ ${preclean} -eq 1 ]]; then
@ -219,6 +220,7 @@ fi
if [ ${verbose} = 1 ]; then if [ ${verbose} = 1 ]; then
echo "TMPDIR = ${TMPDIR}" echo "TMPDIR = ${TMPDIR}"
echo "DATESTAMP = ${DATESTAMP}" echo "DATESTAMP = ${DATESTAMP}"
echo "TIMESTAMP = ${TIMESTAMP}"
fi fi
if ! mkdir -p "${TMPDIR}"/{specs,kconfig,log}; then if ! mkdir -p "${TMPDIR}"/{specs,kconfig,log}; then
@ -257,11 +259,11 @@ for i in $(find -name '*.spec'); do
old_version_stamp=$(grep version_stamp "${i}" | sed -e 's|^version_stamp: *||') old_version_stamp=$(grep version_stamp "${i}" | sed -e 's|^version_stamp: *||')
old_source_subpath=$(grep source_subpath "${i}" | sed -e 's|^source_subpath: *||') old_source_subpath=$(grep source_subpath "${i}" | sed -e 's|^source_subpath: *||')
new_version_stamp=$(echo "${old_version_stamp}" | sed -e "s|^\(.*-\)\?.*$|\1${DATESTAMP}|") new_version_stamp=$(echo "${old_version_stamp}" | sed -e "s|^\(.*-\)\?.*$|\1${TIMESTAMP}|")
new_source_subpath=$(echo "${old_source_subpath}" | sed -e "s|${old_version_stamp}|${new_version_stamp}|") new_source_subpath=$(echo "${old_source_subpath}" | sed -e "s|${old_version_stamp}|${new_version_stamp}|")
sed -i "s|^version_stamp:.*$|version_stamp: ${new_version_stamp}|" "${i}" sed -i "s|^version_stamp:.*$|version_stamp: ${new_version_stamp}|" "${i}"
sed -i "s|^snapshot:.*$|snapshot: ${DATESTAMP}|" "${i}" sed -i "s|^snapshot:.*$|snapshot: ${TIMESTAMP}|" "${i}"
# We don't want to mangle the source_subpath for our stage1 spec # We don't want to mangle the source_subpath for our stage1 spec
if ! grep -q '^target: *stage[14]$' "${i}"; then if ! grep -q '^target: *stage[14]$' "${i}"; then
@ -283,6 +285,7 @@ for i in $(find -name '*.spec'); do
# Expand vars that the spec expects us to. # Expand vars that the spec expects us to.
sed -i \ sed -i \
-e "s:@DATESTAMP@:${DATESTAMP}:g" \ -e "s:@DATESTAMP@:${DATESTAMP}:g" \
-e "s:@TIMESTAMP@:${TIMESTAMP}:g" \
-e "s:@REPO_DIR@:${REPO_DIR}:g" \ -e "s:@REPO_DIR@:${REPO_DIR}:g" \
"${i}" "${i}"
done done
@ -305,7 +308,7 @@ if [[ ${preclean} -eq 1 ]]; then
fi fi
# Create snapshot # Create snapshot
if ! run_cmd "${TMPDIR}/log/snapshot.log" catalyst -c "${CATALYST_CONFIG}" -s "${DATESTAMP}"; then if ! run_cmd "${TMPDIR}/log/snapshot.log" catalyst -c "${CATALYST_CONFIG}" -s "${TIMESTAMP}"; then
send_email "Catalyst build error - snapshot" "" "${TMPDIR}/log/snapshot.log" send_email "Catalyst build error - snapshot" "" "${TMPDIR}/log/snapshot.log"
exit 1 exit 1
fi fi

View file

@ -60,9 +60,16 @@ update_symlinks() {
for d in ${BUILD_SRCDIR_BASE}/{default,hardened} ; do for d in ${BUILD_SRCDIR_BASE}/{default,hardened} ; do
pushd $d >/dev/null pushd $d >/dev/null
for f in $(ls stage3*${EXTENSIONS} | grep -v latest | give_latest_from_dates ) ; do for f in $(ls stage3*${EXTENSIONS} | grep -v latest | give_latest_from_dates ) ; do
of=${f/20[0-9][0-9].[0-9]/latest} # for 20XX.Y stuff # 20yymmddThhmmssZ
of=${of/20[0-9][0-9][0-1][0-9][0-9][0-9]/latest} # for 20YYMMDD stuff # 20yymmddhhmmss
ln -sf $f $of # 20yymmdd
# 20yy.n
of=$(perl -p \
-e 's/20\d{6}T\d{6}Z/latest/g;' \
-e 's/20\d{6}\d{6}/latest/g;' \
-e 's/20\d{2}\.\d{2}/latest/g;' \
<<<"$f")
ln -sf "$f" "$of"
done done
popd >/dev/null popd >/dev/null
done done
@ -78,25 +85,29 @@ pre_build() {
post_build() { post_build() {
pushd ${BUILD_SRCDIR_BASE}/default >/dev/null pushd ${BUILD_SRCDIR_BASE}/default >/dev/null
mkdir -p ${BUILD_DESTDIR_BASE} mkdir -p ${BUILD_DESTDIR_BASE}
for file in $(ls stage{3,4}*${DATESTAMP}*${EXTENSIONS} ); do for file in $(ls stage{3,4}*${DATESTAMP}*${EXTENSIONS} stage{3,4}*${TIMESTAMP}*${EXTENSIONS} ); do
if [ -f $file ]; then if [ -f $file ]; then
cp $file* ${BUILD_DESTDIR_BASE} cp $file* ${BUILD_DESTDIR_BASE}
fi fi
done done
if [ -f *${DATESTAMP}*.iso ]; then if [ -f *${DATESTAMP}*.iso ]; then
cp *${DATESTAMP}*.iso* ${BUILD_DESTDIR_BASE} cp *${DATESTAMP}*.iso* ${BUILD_DESTDIR_BASE}
elif [ -f *${TIMESTAMP}*.iso ]; then
cp *${TIMESTAMP}*.iso* ${BUILD_DESTDIR_BASE}
fi fi
popd >/dev/null popd >/dev/null
pushd ${BUILD_SRCDIR_BASE}/hardened >/dev/null pushd ${BUILD_SRCDIR_BASE}/hardened >/dev/null
mkdir -p ${BUILD_DESTDIR_BASE}/hardened mkdir -p ${BUILD_DESTDIR_BASE}/hardened
for file in $(ls stage{3,4}*${DATESTAMP}*${EXTENSIONS} ); do for file in $(ls stage{3,4}*${DATESTAMP}*${EXTENSIONS} stage{3,4}*${TIMESTAMP}*${EXTENSIONS} ); do
if [ -f $file ]; then if [ -f $file ]; then
cp $file* ${BUILD_DESTDIR_BASE}/hardened cp $file* ${BUILD_DESTDIR_BASE}/hardened
fi fi
done done
if [ -f *${DATESTAMP}*.iso ]; then if [ -f *${DATESTAMP}*.iso ]; then
cp *${DATESTAMP}*.iso* ${BUILD_DESTDIR_BASE}/hardened cp *${DATESTAMP}*.iso* ${BUILD_DESTDIR_BASE}/hardened
elif [ -f *${TIMESTAMP}*.iso ]; then
cp *${TIMESTAMP}*.iso* ${BUILD_DESTDIR_BASE}/hardened
fi fi
} }