Handle snapshot info the “modern” way, in the Version

This commit is contained in:
Benjamin A. Beasley 2022-05-01 09:55:48 -04:00
parent 6bf1caa702
commit d1b021ecaf
2 changed files with 7 additions and 6 deletions

11
gn.spec
View File

@ -26,9 +26,10 @@ Name: gn
# See https://gn.googlesource.com/gn/+log for the latest changes.
%global commit c114b7e0b3a327e854cae6b560902230436f1ac7
%global access 20220413
%global shortcommit %(echo %{commit} | cut -b -8)
Version: 2014
Release: %autorelease -s %{access}git%{shortcommit}
%global shortcommit %(echo '%{commit}' | cut -b -8)
%global position 2014
Version: %{position}^%{access}git%{shortcommit}
Release: %autorelease
Summary: Meta-build system that generates build files for Ninja
# BSD except for src/base/third_party/icu/, which is (Unicode and MIT); note
@ -160,10 +161,10 @@ out/gn_unittests
# Verify consistency of the version header with the spec file
grep -E '^#define[[:blank:]]+LAST_COMMIT_POSITION_NUM[[:blank:]]+'\
'%{version}[[:blank:]]*' \
'%{position}[[:blank:]]*' \
'out/last_commit_position.h' >/dev/null
grep -E '^#define[[:blank:]]+LAST_COMMIT_POSITION[[:blank:]]+'\
'"%{version} \(%{shortcommit}\)"[[:blank:]]*' \
'"%{position} \(%{shortcommit}\)"[[:blank:]]*' \
'out/last_commit_position.h' >/dev/null

View File

@ -83,7 +83,7 @@ sed -r -i \
-e 's/(%global[[:blank:]]+access[[:blank:]]+)[[:digit:]]{8}[[:blank:]]*$/\1'"$(
date -u '+%Y%m%d'
)/" \
-e 's/(Version:[[:blank:]]+)[[:digit:]]+[[:blank:]]*$/\1'"${POSITION}/" \
-e 's/(%global[[:blank:]]+position[[:blank:]]+)[[:digit:]]+[[:blank:]]*$/\1'"${POSITION}/" \
"${SPEC}"
# Download the new tarball