Explorar el Código

use faketime to build with fixed timestamp

Helge Jung hace 9 años
padre
commit
1be1f9e9e4
Se han modificado 3 ficheros con 17 adiciones y 12 borrados
  1. 4 5
      ReadMe.md
  2. 7 4
      build-version.sh
  3. 6 3
      build.sh

+ 4 - 5
ReadMe.md

@@ -5,11 +5,10 @@
 
 ## Vorbereitung / Umgebung
 
-Die Firmware wird auf Debian/Ubuntu gebaut. Als Requirements sind üblicherweise nur die allgemeinen Build-Tools nötig:
-
-```
-sudo apt-get install build-essential
-```
+Die Firmware wird auf Debian/Ubuntu gebaut. Als Requirements sind üblicherweise nur die allgemeinen Build-Tools sowie libfaketime nötig:
+`
+sudo apt-get install build-essential libfaketime
+`
 
 ## Bauen
 

+ 7 - 4
build-version.sh

@@ -11,19 +11,22 @@ version=$1
 versionfile="${MY_DIR}/versions/${version}"
 [ -r $versionfile ] || abort "Failed to find the version '$version'."
 
-base=`awk 'BEGIN { FS="=" } /^gluon=([a-f0-9]+)$/ { print $2; }' $versionfile`
-branch=`awk 'BEGIN { FS="=" } /^branch=([a-z]+)$/ { print $2; }' $versionfile`
-site=`awk 'BEGIN { FS="=" } /^site=([a-f0-9]+)$/ { print $2; }' $versionfile`
+base=`awk 'BEGIN { FS="=" } /^GLUON=([a-f0-9]+)$/ { print $2; }' $versionfile`
+branch=`awk 'BEGIN { FS="=" } /^BRANCH=([a-z]+)$/ { print $2; }' $versionfile`
+site=`awk 'BEGIN { FS="=" } /^SITE=([a-f0-9]+)$/ { print $2; }' $versionfile`
+ts=`awk 'BEGIN { FS="=" } /^TS=.+$/ { print $2; }' $versionfile`
 
 [ -z "$base" ] && abort "Failed to parse Gluon base commit-id from version file."
 [ -z "$branch" ] && abort "Failed to parse branch name from version file."
 [ -z "$site" ] && abort "Failed to parse site repo commit-id from version file."
+[ -z "$ts" ] && abort "Failed to parse timestamp from version file."
 
 info Building $branch version '$version' again ...
 echo " * Gluon base = $base"
 echo " * Site repo  = $site"
+echo " * Timestamp  = $ts"
 echo
 
 # invoke build script
-BASE=$base BRANCH=$branch SITE=$site VERSION=$version ./build.sh
+BASE="$base" BRANCH="$branch" SITE="$site" VERSION="$version" BUILD_TS="$ts" ./build.sh
 

+ 6 - 3
build.sh

@@ -8,6 +8,7 @@
 # BRANCH    = Firmware Branch (stable/testing/experimental)
 # SITE      = specific site repository commit-id (leave blank to use HEAD)
 # VERSION   = the version tag (can only be empty if BRANCH=experimental)
+# BUILD_TS  = build timestamp (format: %Y-%m-%d %H:%M:%S)
 #
 
 if [ "_$BRANCH" == "_" ]; then
@@ -29,6 +30,7 @@ MY_DIR=$(dirname $0)
 MY_DIR=$(readlink -f "$MY_DIR")
 CODE_DIR="src"
 pushd $MY_DIR > /dev/null
+[ "_$BUILD_TS" == "_" ] && export BUILD_TS=$(date +"%Y-%m-%d %H:%M:%S")
 
 . functions.sh
 
@@ -84,14 +86,14 @@ make update
 
 ### BUILD TOOLCHAIN
 progress "Building toolchain if necessary (this is not possible on a fresh build) ..."
-make toolchain -j 1
+faketime "$BUILD_TS" make toolchain -j 1
 
 ### BUILD FIRMWARE
 progress "Building the firmware - please stand by!"
 if [ "$BRANCH" != "experimental" ]; then
-	GLUON_BRANCH=$BRANCH GLUON_RELEASE=$VERSION make -j 4
+	GLUON_BRANCH=$BRANCH GLUON_RELEASE=$VERSION faketime "$BUILD_TS" make -j 4
 else
-	GLUON_BRANCH=experimental make -j 4
+	GLUON_BRANCH=experimental faketime "$BUILD_TS" make -j 4
 fi
 
 [ "$?" -eq "0" ] || abort "Failed to build the firmware, mimimi."
@@ -106,6 +108,7 @@ echo "VERSION=${VERSION}" >> "output/${BRANCH}/build_info.txt"
 echo "GLUON=${GLUON_COMMIT} # ${BASE}" >> "output/${BRANCH}/build_info.txt"
 echo "BRANCH=${BRANCH}" >> "output/${BRANCH}/build_info.txt"
 echo "SITE=${SITE_COMMIT} # ${VERSION}" >> "output/${BRANCH}/build_info.txt"
+echo "TS=${BUILD_TS}" >> "output/${BRANCH}/build_info.txt"
 
 # compress all binaries into 7z archive
 progress "Assembling images.7z ..."