27b00c712fdfaca449efbe96c9025d501a8c5409
[armband.git] / 0000-build-Use-OPNFV_GIT_SHA-for-ISO-preparer-ID.patch
1 From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
2 Date: Wed, 17 Aug 2016 21:56:22 +0200
3 Subject: [PATCH] build: Use OPNFV_GIT_SHA for ISO preparer ID
4
5 isoinfo -i lists the following information for Fuel@OPNFV ISO:
6 "Data preparer id: 86aafaf5454a846c417848bb94f264c4420160f3"
7 where the SHA hash is Fuel git repo HEAD SHA.
8
9 For Armband's build system, using only the Fuel commit ID is not
10 enough to fully describe the state of the source code, as patches
11 are also applied to other fuel modules (as git submodules).
12 Instead, a pointer to a valid Armband commit ID should be used.
13
14 However, Armband overrides OPNFV_GIT_SHA to the Armband git repo
15 commit hash, so the ISO metadata should also reflect this.
16
17 While at it, allow product name to be overriden, to signal the
18 commit ID should be looked up inside the Armband repository.
19
20 Change-Id: I33ad490f1afe28c1d439dda40e39cee1955e0ac2
21 Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
22 ---
23  build/Makefile           | 4 ++--
24  build/docker/runcontext  | 2 +-
25  build/install/install.sh | 6 +++++-
26  3 files changed, 8 insertions(+), 4 deletions(-)
27
28 diff --git a/build/Makefile b/build/Makefile
29 index 56acb40..ac85498 100644
30 --- a/build/Makefile
31 +++ b/build/Makefile
32 @@ -21,11 +21,11 @@ SHELL = /bin/bash
33  export MOSVERSION = 9.0
34  export ISOSRC = file:$(shell pwd)/fuel-$(MOSVERSION).iso
35  export ISOCACHE = $(shell pwd)/$(shell basename $(ISOSRC))
36 -export PRODNO = "OPNFV_FUEL"
37 +export PRODNO ?= "OPNFV_FUEL"
38  export REVSTATE = "P0000"
39  export USER ?= $(shell whoami)
40  export BUILD_DATE = $(shell date --utc +%Y-%m-%d:%H:%M)
41 -export OPNFV_GIT_SHA = $(shell git rev-parse HEAD)
42 +export OPNFV_GIT_SHA ?= $(shell git rev-parse HEAD)
43  # Store in /etc/fuel_build_id on fuel master
44  export BUILD_ID := $(PRODNO)_$(BUILD_DATE)_$(OPNFV_GIT_SHA)
45
46 diff --git a/build/docker/runcontext b/build/docker/runcontext
47 index daad663..2d13562 100755
48 --- a/build/docker/runcontext
49 +++ b/build/docker/runcontext
50 @@ -115,7 +115,7 @@ RUN_CONTEXT_OPT="--cidfile $CID_FILE --privileged=true --rm \
51      -e HOME=$HOME -e CACHEDEBUG -e CACHETRANSPORT -e CACHEMAXAGE -e CACHEBASE \
52      -e BUILD_FUEL_PLUGINS -e MIRROR_UBUNTU -e MIRROR_UBUNTU_ROOT \
53      -e MIRROR_MOS_UBUNTU -e MIRROR_MOS_UBUNTU_ROOT -e MIRROR_FUEL \
54 -    -e LATEST_TARGET_UBUNTU -e UBUNTU_ARCH \
55 +    -e LATEST_TARGET_UBUNTU -e UBUNTU_ARCH -e OPNFV_GIT_SHA \
56      -u $USER_ID:$GROUP_ID -w $PWD \
57      -v $GITROOT:$GITROOT -v /sys/fs/cgroup:/sys/fs/cgroup:ro $CACHEMOUNT"
58
59 diff --git a/build/install/install.sh b/build/install/install.sh
60 index c632419..866d304 100755
61 --- a/build/install/install.sh
62 +++ b/build/install/install.sh
63 @@ -196,8 +196,12 @@ make_iso_image() {
64      find . -name TRANS.TBL -exec rm {} \;
65      rm -rf rr_moved
66
67 +    if [[ -z "$OPNFV_GIT_SHA" ]]; then
68 +        OPNFV_GIT_SHA=$(git rev-parse --verify HEAD)
69 +    fi
70 +
71      mkisofs --quiet -r -V "$VOLUMEID" -publisher "$PUBLISHER" \
72 -        -p `git rev-parse --verify HEAD` -J -R -b isolinux/isolinux.bin \
73 +        -p "$OPNFV_GIT_SHA" -J -R -b isolinux/isolinux.bin \
74          -no-emul-boot \
75          -boot-load-size 4 -boot-info-table \
76          --hide-rr-moved \