build: Use commit date instead of build date to avoid unnecessary rebuilds. 73/85373/3
authorJunghyun Kim <jh0822.kim@samsung.com>
Thu, 25 Aug 2016 00:14:08 +0000 (09:14 +0900)
committerMun, Gwan-gyeong <kk.moon@samsung.com>
Fri, 26 Aug 2016 13:16:13 +0000 (22:16 +0900)
- Problem
We use OBS to build packages in Tizen.
There is a mechanism not to rebuild when the result binary is the same.
For example, there is a dependency graph: A->B->C.
If A is modified, B would be built.
If the result RPM of B is not changed, OBS does not trigger a build of C.
To effectively use this mechanism, each packages make sure that
the result binary should be the same if the input source is the same.

There is a reason we found is including build date.

In coregl, bash command 'date' is used in CMakeList.txt.
In this case, everytime we build coregl, the build result is always different.

- Solution
Use commit date instead of build date.
There was a hint in Makefile.
COMPILE_DATE = "\"`git log -1 --pretty=format:%ci`\""
I used this command in CMakeList.txt
I tested this in my test OBS server, and the build result is unchanged
when this patch is applied.

Change-Id: Iea70e74b6808aa81905eba4afc9e72b6867c097d
Signed-off-by: Junghyun Kim <jh0822.kim@samsung.com>
CMakeLists.txt

index 39bd6ad..78417b6 100644 (file)
@@ -43,7 +43,9 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include_KHR)
 
 ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"")
 
-EXEC_PROGRAM(date OUTPUT_VARIABLE COMPILE_DATE)
+EXEC_PROGRAM(git
+       ARGS log -1 --pretty=format:%ci
+       OUTPUT_VARIABLE COMPILE_DATE)
 ADD_DEFINITIONS("-D_COREGL_COMPILE_DATE=\"${COMPILE_DATE}\"")
 
 IF(USE_ADRENO)