aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorprettyboy <prettyboy@yandex-team.com>2023-03-27 08:38:19 +0300
committerprettyboy <prettyboy@yandex-team.com>2023-03-27 08:38:19 +0300
commitcd17556f6887bcd2ff85b0071f82f27ef193b619 (patch)
treee80a54180ad3cb295a812cd26953514dd22d220d
parent8f9b3c6be615e45788ac1917ad5dec0c66ae66b1 (diff)
downloadydb-cd17556f6887bcd2ff85b0071f82f27ef193b619.tar.gz
[devtools/ya/package] Populate custom-version to vcs info
-rw-r--r--build/scripts/c_templates/svn_interface.c8
-rw-r--r--build/scripts/c_templates/svnversion.h1
-rw-r--r--build/scripts/vcs_info.py3
-rw-r--r--library/cpp/svnversion/test/main.cpp1
-rw-r--r--library/go/core/buildinfo/buildinfo.go2
5 files changed, 15 insertions, 0 deletions
diff --git a/build/scripts/c_templates/svn_interface.c b/build/scripts/c_templates/svn_interface.c
index d8bdd1a70d..9c4414afd2 100644
--- a/build/scripts/c_templates/svn_interface.c
+++ b/build/scripts/c_templates/svn_interface.c
@@ -142,6 +142,14 @@ const char* GetProgramBuildDate() {
#endif
}
+const char* GetCustomVersion() {
+#if defined(CUSTOM_VERSION)
+ return CUSTOM_VERSION;
+#else
+ return "";
+#endif
+}
+
int GetProgramBuildTimestamp() {
#if defined(BUILD_TIMESTAMP)
return BUILD_TIMESTAMP;
diff --git a/build/scripts/c_templates/svnversion.h b/build/scripts/c_templates/svnversion.h
index 7aece931aa..8c90323d09 100644
--- a/build/scripts/c_templates/svnversion.h
+++ b/build/scripts/c_templates/svnversion.h
@@ -27,6 +27,7 @@ const char* GetProgramCommitId() Y_HIDDEN;
void PrintSvnVersionAndExit(int argc, char* argv[]) Y_HIDDEN;
void PrintSvnVersionAndExitEx(int argc, char* argv[], const char* opts) Y_HIDDEN;
void PrintSvnVersionAndExit0() Y_HIDDEN;
+const char* GetCustomVersion() Y_HIDDEN; // Currently returns <str> specified with --custom-version <str> in ya package
const char* GetProgramScmData() Y_HIDDEN; // verbose multiline message
const char* GetProgramShortVersionData() Y_HIDDEN;
const char* GetProgramBuildUser() Y_HIDDEN;
diff --git a/build/scripts/vcs_info.py b/build/scripts/vcs_info.py
index 6a57c19807..801713d138 100644
--- a/build/scripts/vcs_info.py
+++ b/build/scripts/vcs_info.py
@@ -72,6 +72,7 @@ def get_default_json():
"BUILD_TIMESTAMP": 0,
"BUILD_HOST": "localhost",
"BUILD_USER": "nobody",
+ "CUSTOM_VERSION": "",
"PROGRAM_VERSION": "Arc info:\\n Branch: unknown-vcs-branch\\n Commit: 0000000000000000000000000000000000000000\\n Author: <UNKNOWN>\\n Summary: No VCS\\n\\n",
"SCM_DATA": "Arc info:\\n Branch: unknown-vcs-branch\\n Commit: 0000000000000000000000000000000000000000\\n Author: <UNKNOWN>\\n Summary: No VCS\\n",
"VCS": "arc",
@@ -220,6 +221,8 @@ def print_java_mf(info):
lines += wrap('Build-Date: ', info['BUILD_DATE'])
if 'BUILD_TIMESTAMP' in info:
lines += wrap('Build-Timestamp: ', str(info['BUILD_TIMESTAMP']))
+ if 'CUSTOM_VERSION' in info:
+ lines += wrap('Custom-Version-String: ', base64.b64encode(info['CUSTOM_VERSION'].encode('utf-8')).decode('utf-8'))
return lines, names
diff --git a/library/cpp/svnversion/test/main.cpp b/library/cpp/svnversion/test/main.cpp
index 3c8209047f..830686d5b3 100644
--- a/library/cpp/svnversion/test/main.cpp
+++ b/library/cpp/svnversion/test/main.cpp
@@ -7,6 +7,7 @@
// ./library/svnversion/test/test[.exe]
int main() {
Cout << "GetProgramSvnVersion(): " << GetProgramSvnVersion() << Endl;
+ Cout << "GetCustomVersion(): " << GetCustomVersion() << Endl;
Cout << "PrintProgramSvnVersion(): " << Endl; PrintProgramSvnVersion();
Cout << "GetArcadiaSourcePath(): " << GetArcadiaSourcePath() << Endl;
Cout << "GetArcadiaSourceUrl(): " << GetArcadiaSourceUrl() << Endl;
diff --git a/library/go/core/buildinfo/buildinfo.go b/library/go/core/buildinfo/buildinfo.go
index cad0805d4f..88b7d52c9e 100644
--- a/library/go/core/buildinfo/buildinfo.go
+++ b/library/go/core/buildinfo/buildinfo.go
@@ -20,6 +20,7 @@ type BuildInfo struct {
// Host information:
// 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
ProgramVersion string
+ CustomVersion string
User string
Host string
@@ -51,6 +52,7 @@ var Info BuildInfo
// This function is called from the main package by the code generated in build/scripts/vcs_info.py
func InitBuildInfo(buildinfo map[string]string) {
Info.ProgramVersion = strings.TrimRight(buildinfo["PROGRAM_VERSION"], " ")
+ Info.CustomVersion = strings.TrimRight(buildinfo["CUSTOM_VERSION"], " ")
Info.User = buildinfo["BUILD_USER"]
Info.Host = buildinfo["BUILD_HOST"]
Info.Date = buildinfo["BUILD_DATE"]