summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaan De Meyer <daan.j.demeyer@gmail.com>2020-07-20 20:41:48 +0100
committerLennart Poettering <lennart@poettering.net>2020-07-23 08:38:30 +0200
commitbd190899bba3f1d24663168f2e15e8697b7c4db9 (patch)
tree8620568fba4dfa53228682071c44c7b1f3e2b9fd
parent00b868e857baf974b6cfc913e142319a0d1d6002 (diff)
downloadsystemd-bd190899bba3f1d24663168f2e15e8697b7c4db9.tar.gz
Get SOURCE_EPOCH from the latest git tag instead of NEWS
Currently, each change to NEWS triggers a meson reconfigure that changes SOURCE_EPOCH which causes a full rebuild. Since NEWS changes relatively often, we have a full rebuild each time we pull from master even if we pull semi-regularly. This is further compounded when using branches since NEWS has a relatively high chance to differ between branches which causes git to update the modification time, leading to a full rebuild when switching between branches. We fix this by using the creation time of the latest git tag instead.
-rw-r--r--meson.build4
1 files changed, 4 insertions, 0 deletions
diff --git a/meson.build b/meson.build
index 020a7e55ce..0c0e1343c1 100644
--- a/meson.build
+++ b/meson.build
@@ -679,6 +679,10 @@ if time_epoch == -1
source_date_epoch = run_command('sh', ['-c', 'echo "$SOURCE_DATE_EPOCH"']).stdout().strip()
if source_date_epoch != ''
time_epoch = source_date_epoch.to_int()
+ elif git.found() and run_command('test', '-e', '.git').returncode() == 0
+ # If we're in a git repository, use the creation time of the latest git tag.
+ latest_tag = run_command('git', 'describe', '--abbrev=0', '--tags').stdout().strip()
+ time_epoch = run_command('git', 'log', '-1', '--format=%at', latest_tag).stdout().to_int()
else
NEWS = files('NEWS')
time_epoch = run_command(stat, '-c', '%Y', NEWS).stdout().to_int()