Skip to content

Commit 4ef1405

Browse files
author
dspushkin
committed
. Пробрасывать версию релизного бранча в ya package
Как вариант, по аналогии с custom-version опцией(custom_version полем в sandbox), пробрасывать опцию release-version(или release-message) в vcs_info. Тут представлен вариант как прокинуть его в сборку пакета. commit_hash:f3766b0f0780bd280b1a9d799bea22add4ca3880
1 parent 68e277a commit 4ef1405

File tree

4 files changed

+17
-0
lines changed

4 files changed

+17
-0
lines changed

build/scripts/c_templates/svn_interface.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,14 @@ const char* GetCustomVersion() {
150150
#endif
151151
}
152152

153+
const char* GetReleaseVersion() {
154+
#if defined(RELEASE_VERSION)
155+
return RELEASE_VERSION;
156+
#else
157+
return "";
158+
#endif
159+
}
160+
153161
int GetProgramBuildTimestamp() {
154162
#if defined(BUILD_TIMESTAMP)
155163
return BUILD_TIMESTAMP;

build/scripts/c_templates/svnversion.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ void PrintSvnVersionAndExit(int argc, char* argv[]) Y_HIDDEN;
2828
void PrintSvnVersionAndExitEx(int argc, char* argv[], const char* opts) Y_HIDDEN;
2929
void PrintSvnVersionAndExit0() Y_HIDDEN;
3030
const char* GetCustomVersion() Y_HIDDEN; // Currently returns <str> specified with --custom-version <str> in ya package
31+
const char* GetReleaseVersion() Y_HIDDEN; // Currently returns <str> specified with --release-version <str> in ya package
3132
const char* GetProgramScmData() Y_HIDDEN; // verbose multiline message
3233
const char* GetProgramShortVersionData() Y_HIDDEN;
3334
const char* GetProgramBuildUser() Y_HIDDEN;

build/scripts/vcs_info.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ def get_default_json():
7777
"BUILD_HOST": "localhost",
7878
"BUILD_USER": "nobody",
7979
"CUSTOM_VERSION": "",
80+
"RELEASE_VERSION": "",
8081
"PROGRAM_VERSION": "Arc info:\\n Branch: unknown-vcs-branch\\n Commit: 0000000000000000000000000000000000000000\\n Author: <UNKNOWN>\\n Summary: No VCS\\n\\n",
8182
"SCM_DATA": "Arc info:\\n Branch: unknown-vcs-branch\\n Commit: 0000000000000000000000000000000000000000\\n Author: <UNKNOWN>\\n Summary: No VCS\\n",
8283
"VCS": "arc",
@@ -229,6 +230,10 @@ def wrap(key, val):
229230
lines += wrap(
230231
'Custom-Version-String: ', base64.b64encode(info['CUSTOM_VERSION'].encode('utf-8')).decode('utf-8')
231232
)
233+
if 'RELEASE_VERSION' in info:
234+
lines += wrap(
235+
'Release-Version-String: ', base64.b64encode(info['RELEASE_VERSION'].encode('utf-8')).decode('utf-8')
236+
)
232237
return lines, names
233238

234239

@@ -294,6 +299,7 @@ def print_json(json_file, output_file):
294299
OPTIONAL_FIELDS_MAP = {
295300
'BUILD_TIMESTAMP': 'Build-Timestamp',
296301
'CUSTOM_VERSION': 'Custom-Version-String',
302+
'RELEASE_VERSION': 'Release-Version-String',
297303
'DIRTY': 'Working-Copy-State',
298304
}
299305

library/go/core/buildinfo/buildinfo.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ type BuildInfo struct {
2121
// Linux 77.88.18.146-red.dhcp.yndx.net 4.19.10-300.fc29.x86_64 #1 SMP Mon Dec 17 15:34:44 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
2222
ProgramVersion string
2323
CustomVersion string
24+
ReleaseVersion string
2425

2526
User string
2627
Host string
@@ -53,6 +54,7 @@ var Info BuildInfo
5354
func InitBuildInfo(buildinfo map[string]string) {
5455
Info.ProgramVersion = strings.TrimRight(buildinfo["PROGRAM_VERSION"], " ")
5556
Info.CustomVersion = strings.TrimRight(buildinfo["CUSTOM_VERSION"], " ")
57+
Info.ReleaseVersion = strings.TrimRight(buildinfo["RELEASE_VERSION"], " ")
5658
Info.User = buildinfo["BUILD_USER"]
5759
Info.Host = buildinfo["BUILD_HOST"]
5860
Info.Date = buildinfo["BUILD_DATE"]

0 commit comments

Comments
 (0)