Store build_date in .tizen.build-id section to avoid unnecessary rebuilds sandbox/jh0822kim/avoid_rebuilds
authorJunghyun Kim <jh0822.kim@samsung.com>
Tue, 30 Aug 2016 11:51:45 +0000 (20:51 +0900)
committerJunghyun Kim <jh0822.kim@samsung.com>
Tue, 30 Aug 2016 11:51:45 +0000 (20:51 +0900)
- PROBLEM
We use OBS to build packages in Tizen.
There is a mechanism not to rebuild if 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.

This package uses __DATE__ and __TIME__ which make the result binary
is different everytime it is built.
To efficiently utilize OBS build mechanism and to modify the package
as little as possible, I propose to store this macro in .tizen.build-id
section. OBS build-compare tool does not check *.build-id section
in the binary.

Change-Id: I22d1498ab0ccc7d1ba1eaef2475069fdc5677b8d
Signed-off-by: Junghyun Kim <jh0822.kim@samsung.com>
libutil/op_version.c
pe_counting/ocount.cpp
pe_profiling/operf.cpp

index 99a844e42ac65837cb4ca961d8e0dafad14951fa..cf7fc9b0bbec7b5714ac0862373f73e7de260c1d 100644 (file)
 #include "op_version.h"
 #include "config.h"
 
+__attribute__((__section__(".tizen.build-id")))
+static const char BUILD_DATE[] = __DATE__;
+__attribute__((__section__(".tizen.build-id")))
+static const char BUILD_TIME[] = __TIME__;
+
 void show_version(char const * app_name)
 {
        /* Do not change the version format: it is documented in html doc */
-       printf("%s: " PACKAGE " " VERSION " compiled on "
-              __DATE__ " " __TIME__ "\n", app_name);
+       printf("%s: " PACKAGE " " VERSION " compiled on %s %s\n",
+               app_name, BUILD_DATE, BUILD_TIME);
        exit(EXIT_SUCCESS);
 }
index 07dfd0cb1c71982a264d1b1bfd419595915c4c16..b6fdc74ec23e9e462e405d647c111e24411f7ccb 100644 (file)
@@ -43,6 +43,11 @@ bool use_cpu_minus_one = false;
 std::vector<operf_event_t> events;
 op_cpu cpu_type;
 
+__attribute__((__section__(".tizen.build-id")))
+static const char BUILD_DATE[] = __DATE__;
+__attribute__((__section__(".tizen.build-id")))
+static const char BUILD_TIME[] = __TIME__;
+
 #define OCOUNT_MSECS_PER_SEC 1000
 // Current implementation supports a display interval of 100 ms
 #define OCOUNT_DSP_INTVL_MSECS 100
@@ -655,8 +660,8 @@ static int _process_ocount_and_app_args(int argc, char * const argv[])
                        __print_usage_and_exit(NULL);
                        break;
                case 'v':
-                       cout << argv[0] << ": " << PACKAGE << " " << VERSION << " compiled on " << __DATE__
-                            << " " << __TIME__ << endl;
+                       cout << argv[0] << ": " << PACKAGE << " " << VERSION << " compiled on " << BUILD_DATE
+                            << " " << BUILD_TIME << endl;
                        exit(EXIT_SUCCESS);
                        break;
                default:
index 04a25d92d244d95c0bfea0785e0cdd014d124c80..e3dc3557d2b5be8229fe49f06035908114a563c0 100644 (file)
@@ -84,6 +84,10 @@ operf_read operfRead(events);
  */
 bool track_new_forks;
 
+__attribute__((__section__(".tizen.build-id")))
+static const char BUILD_DATE[] = __DATE__;
+__attribute__((__section__(".tizen.build-id")))
+static const char BUILD_TIME[] = __TIME__;
 
 #define DEFAULT_OPERF_OUTFILE "operf.data"
 #define KERN_ADDR_SPACE_START_SYMBOL  "_text"
@@ -1323,8 +1327,8 @@ static int _process_operf_and_app_args(int argc, char * const argv[])
                        __print_usage_and_exit(NULL);
                        break;
                case 'v':
-                       cout << argv[0] << ": " << PACKAGE << " " << VERSION << " compiled on " << __DATE__
-                            << " " << __TIME__ << endl;
+                       cout << argv[0] << ": " << PACKAGE << " " << VERSION << " compiled on " << BUILD_DATE
+                            << " " << BUILD_TIME << endl;
                        exit(EXIT_SUCCESS);
                        break;
                default: