From 6a2b51c15548e5501a97a8c03eb944d3de937196 Mon Sep 17 00:00:00 2001 From: Nicola Corna Date: Wed, 31 May 2017 15:24:33 +0200 Subject: [PATCH] Fix the zip date when the build has started the day before --- src/build.sh | 13 +++++++++++++ src/fix_date.sh | 3 +++ 2 files changed, 16 insertions(+) create mode 100755 src/fix_date.sh diff --git a/src/build.sh b/src/build.sh index 5e3d6ee..c4270c5 100755 --- a/src/build.sh +++ b/src/build.sh @@ -94,6 +94,14 @@ if ! [ -z "$DEVICE_LIST" ]; then # Cycle DEVICE_LIST environment variable, to know which one may be executed next IFS=',' for codename in $DEVICE_LIST; do + currentdate=$(date +%Y%m%d) + if [ "$builddate" != "$currentdate" ]; then + # Sync the source code + echo ">> [$(date)] Syncing repository" >> $DOCKER_LOG + builddate=$currentdate + repo sync 2>&1 >&$DEBUG_LOG + fi + if ! [ -z "$codename" ]; then if [ "$ZIP_SUBDIR" = true ]; then zipsubdir=$codename @@ -104,6 +112,11 @@ if ! [ -z "$DEVICE_LIST" ]; then # Start the build echo ">> [$(date)] Starting build for $codename" >> $DOCKER_LOG if brunch $codename 2>&1 >&$DEBUG_LOG; then + currentdate=$(date +%Y%m%d) + if [ "$builddate" != "$currentdate" ]; then + find out/target/product/$codename -name "lineage-*-$currentdate-*.zip*" -exec sh /root/fix_build_date.sh {} $currentdate $builddate \; + fi + if [ "$BUILD_DELTA" = true ]; then if [ -d "$SRC_DIR/delta_last/$codename/" ]; then # If not the first build, create delta files diff --git a/src/fix_date.sh b/src/fix_date.sh new file mode 100755 index 0000000..405c73f --- /dev/null +++ b/src/fix_date.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +mv "$1" $(echo "$1" | sed "s|$2|$3|")