X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=scripts%2Fdistro-manifest-generator.sh;h=0db3e132fa901b02593aa382834267edb338074f;hb=3dac145f4645e18ad551d6c44c0bcc46b5c9205d;hp=7552b994220bcb9e5274835f6fe60388c8d76754;hpb=334a20160e0c4e8119478542fdacade1f268a1c1;p=AGL%2Fmeta-agl.git diff --git a/scripts/distro-manifest-generator.sh b/scripts/distro-manifest-generator.sh index 7552b9942..0db3e132f 100755 --- a/scripts/distro-manifest-generator.sh +++ b/scripts/distro-manifest-generator.sh @@ -31,6 +31,7 @@ manifest= verbose=0 format=bash sourcefile= +timestamp="$(date -u +%Y%m%d_%H%M%S_%Z)" function info() { echo "$@" >&2; } function error() { echo "$BASH_SOURCE: $@" >&2; } @@ -155,8 +156,8 @@ function _getgitmanifest() { local gitrepo gitrev metagitdir sep="" DIST_LAYERS="" - for metagitdir in $(find $DIST_METADIR -type d -name ".git"); do - gitrepo=$($REALPATH -Ls $metagitdir/.. --relative-to=$DIST_METADIR) + for metagitdir in $(find $DIST_METADIR -maxdepth 2 -type d \( -not -path '*/.*' \) -exec test -d "{}/.git" \; -print -prune); do + gitrepo=$($REALPATH -Ls $metagitdir --relative-to=$DIST_METADIR) pushd $DIST_METADIR/$gitrepo &>/dev/null && { gitrev=$( { $GIT describe --long --dirty --always 2>/dev/null || echo "unknown_revision"; } | tr ' \t' '__' ) popd &>/dev/null @@ -186,11 +187,15 @@ function _getgitmanifest() { DIST_BUILD_HASH="F${DIST_FEATURES_MD5:0:8}-L${DIST_LAYERS_MD5:0:8}" DIST_BUILD_ID="${DIST_DISTRO_NAME}-${DIST_MACHINE}-F${DIST_FEATURES_MD5:0:8}-L${DIST_LAYERS_MD5:0:8}" + # compute setup manifest path and build TS DIST_SETUP_MANIFEST="$($REALPATH $manifest)" # Manifest build timestamp - DIST_BUILD_TS="$(date -u +%Y%m%d_%H%M%S_%Z)" + DIST_BUILD_TS="$timestamp" + + # build topic from setup topic + DIST_BUILD_TOPIC="${DIST_SETUP_TOPIC}" # what to retain from setup manifest? # to generate the full list: cat setup.manifest | grep = | cut -f1 -d"=" | awk '{printf("%s ",$1);}' @@ -201,9 +206,9 @@ function _getgitmanifest() { # extra vars not coming from setup.manifest but generated here declare -A EXTRA_VARS - EXTRA_VARS[deploy]="DIST_SETUP_MANIFEST DIST_BUILD_TS DIST_LAYERS DIST_LAYERS_MD5 DIST_BUILD_HASH DIST_BUILD_ID" - EXTRA_VARS[target]="DIST_LAYERS DIST_BUILD_HASH DIST_BUILD_ID" - EXTRA_VARS[sdk]="DIST_LAYERS DIST_BUILD_HASH DIST_BUILD_ID" + EXTRA_VARS[deploy]="DIST_SETUP_MANIFEST DIST_BUILD_TS DIST_LAYERS DIST_LAYERS_MD5 DIST_BUILD_HASH DIST_BUILD_ID DIST_BUILD_TOPIC" + EXTRA_VARS[target]="DIST_LAYERS DIST_BUILD_HASH DIST_BUILD_ID DIST_BUILD_TS DIST_BUILD_TOPIC" + EXTRA_VARS[sdk]="DIST_LAYERS DIST_BUILD_HASH DIST_BUILD_ID DIST_BUILD_TS DIST_BUILD_TOPIC" # BITBAKE_VARS may be defined from external file to source (--source arg) # this is used to dump extra vars from inside bitbake recipe @@ -234,10 +239,11 @@ function getmanifest() { function __usage() { cat <&2 -Usage: $BASH_SOURCE [-v|--verbose] [-f|--format ] [-m|--mode ] [-s|--source ] +Usage: $BASH_SOURCE [-v|--verbose] [-f|--format ] [-t|--timestamp ] [-m|--mode ] [-s|--source ] Options: -v|--verbose: generate comments in the output file -s|--source: extra file to source (get extra variables generated from bitbake recipe) + -t|--timestamp: set build timestamp (default: current date - may not be the same ts as bitbake) -f|--format: specify output format: 'bash' or 'json' -m|--mode: specify the destination for the generated manifest 'deploy' : for the tmp/deploy/images/* directories @@ -250,7 +256,7 @@ EOF set -e -tmp=$(getopt -o h,v,m:,f:,s: --long help,verbose,mode:,format:,source: -n "$BASH_SOURCE" -- "$@") || { +tmp=$(getopt -o h,v,m:,f:,t:,s: --long help,verbose,mode:,format:,timestamp:,source: -n "$BASH_SOURCE" -- "$@") || { error "Invalid arguments." __usage exit 1 @@ -263,6 +269,7 @@ while true; do -v|--verbose) verbose=1; shift ;; -f|--format) format=$2; shift 2;; -m|--mode) mode=$2; shift 2;; + -t|--timestamp) timestamp=$2; shift 2;; -s|--source) sourcefile=$2; shift 2;; --) shift; break;; *) fatal "Internal error";;