From 2dde3d060aa21ff9d4a0612b991bd300b7704bdc Mon Sep 17 00:00:00 2001
From: Axel Naumann <Axel.Naumann@cern.ch>
Date: Fri, 22 Jul 2022 15:54:03 +0200
Subject: [PATCH] [cmake,test] Get rid of `lsb_release`:
It is available less and less often, and we do not actually
benefit a lot from printing the distro (stress) or we can get
the same info from /etc/os-release (cmake).
---
cmake/modules/RootCPack.cmake | 11 +++++++++--
math/mathcore/test/stressGoFTest.cxx | 4 ----
test/bench.cxx | 4 ----
test/stress.cxx | 4 ----
test/stressFit.cxx | 4 ----
test/stressGUI.cxx | 4 ----
test/stressGeometry.cxx | 4 ----
test/stressGraphics.cxx | 4 ----
test/stressHepix.cxx | 4 ----
test/stressHistFactory.cxx | 4 ----
test/stressLinear.cxx | 4 ----
test/stressRooFit.cxx | 4 ----
test/stressRooStats.cxx | 4 ----
test/stressTMVA.cxx | 4 ----
14 files changed, 9 insertions(+), 54 deletions(-)
diff --git a/cmake/modules/RootCPack.cmake b/cmake/modules/RootCPack.cmake
index a960eb81fd..807eac6ef2 100644
--- a/cmake/modules/RootCPack.cmake
+++ b/cmake/modules/RootCPack.cmake
@@ -107,8 +107,15 @@ elseif(WIN32)
set(OS_NAME_VERSION win32)
endif()
else()
- execute_process(COMMAND lsb_release -is OUTPUT_VARIABLE osid OUTPUT_STRIP_TRAILING_WHITESPACE)
- execute_process(COMMAND lsb_release -rs OUTPUT_VARIABLE osvers OUTPUT_STRIP_TRAILING_WHITESPACE)
+ if(EXISTS "/etc/os-release")
+ file(STRINGS /etc/os-release osid REGEX "^NAME=")
+ string(REGEX REPLACE "NAME=\"(.*)\"" "\\1" osid "${osid}")
+ file(STRINGS /etc/os-release osvers REGEX "^VERSION_ID=")
+ string(REGEX REPLACE "NAME=\"(.*)\"" "\\1" osvers "${osvers}")
+ else()
+ execute_process(COMMAND lsb_release -is OUTPUT_VARIABLE osid OUTPUT_STRIP_TRAILING_WHITESPACE)
+ execute_process(COMMAND lsb_release -rs OUTPUT_VARIABLE osvers OUTPUT_STRIP_TRAILING_WHITESPACE)
+ endif()
if(osid MATCHES Ubuntu)
string(REGEX REPLACE "([0-9]+)[.].*" "\\1" osvers "${osvers}")
set(OS_NAME_VERSION Linux-ubuntu${osvers}-${arch})
diff --git a/math/mathcore/test/stressGoFTest.cxx b/math/mathcore/test/stressGoFTest.cxx
index a78ca99c90..5aa1b4ef70 100644
--- a/math/mathcore/test/stressGoFTest.cxx
+++ b/math/mathcore/test/stressGoFTest.cxx
@@ -56,10 +56,6 @@ struct GoFTStress {
TString sp = gSystem->GetFromPipe("uname -a");
sp.Resize(60);
printf("* SYS: %s\n",sp.Data());
- if (strstr(gSystem->GetBuildNode(),"Linux")) {
- sp = gSystem->GetFromPipe("lsb_release -d -s");
- printf("* SYS: %s\n",sp.Data());
- }
if (strstr(gSystem->GetBuildNode(),"Darwin")) {
sp = gSystem->GetFromPipe("sw_vers -productVersion");
sp += " Mac OS X ";
diff --git a/test/bench.cxx b/test/bench.cxx
index 82bc537e05..e89024e9d9 100644
--- a/test/bench.cxx
+++ b/test/bench.cxx
@@ -295,10 +295,6 @@ int main(int argc, char **argv)
TString sp = gSystem->GetFromPipe("uname -a");
sp.Resize(60);
printf("* SYS: %s\n",sp.Data());
- if (strstr(gSystem->GetBuildNode(),"Linux")) {
- sp = gSystem->GetFromPipe("lsb_release -d -s");
- printf("* SYS: %s\n",sp.Data());
- }
if (strstr(gSystem->GetBuildNode(),"Darwin")) {
sp = gSystem->GetFromPipe("sw_vers -productVersion");
sp += " Mac OS X ";
diff --git a/test/stress.cxx b/test/stress.cxx
index d3087fdd56..29dba1625d 100644
--- a/test/stress.cxx
+++ b/test/stress.cxx
@@ -200,10 +200,6 @@ void stress(Int_t nevent, Int_t style = 1,
TString sp = gSystem->GetFromPipe("uname -a");
sp.Resize(60);
printf("* SYS: %s\n",sp.Data());
- if (strstr(gSystem->GetBuildNode(),"Linux")) {
- sp = gSystem->GetFromPipe("lsb_release -d -s");
- printf("* SYS: %s\n",sp.Data());
- }
if (strstr(gSystem->GetBuildNode(),"Darwin")) {
sp = gSystem->GetFromPipe("sw_vers -productVersion");
sp += " Mac OS X ";
diff --git a/test/stressFit.cxx b/test/stressFit.cxx
index 667142eff9..80bbd0200f 100644
--- a/test/stressFit.cxx
+++ b/test/stressFit.cxx
@@ -646,10 +646,6 @@ Int_t stressFit(const char *type, const char *algo, Int_t N)
TString sp = gSystem->GetFromPipe("uname -a");
sp.Resize(60);
printf("* SYS: %s\n",sp.Data());
- if (strstr(gSystem->GetBuildNode(),"Linux")) {
- sp = gSystem->GetFromPipe("lsb_release -d -s");
- printf("* SYS: %s\n",sp.Data());
- }
if (strstr(gSystem->GetBuildNode(),"Darwin")) {
sp = gSystem->GetFromPipe("sw_vers -productVersion");
sp += " Mac OS X ";
diff --git a/test/stressGUI.cxx b/test/stressGUI.cxx
index 1a92df5341..9daae5f5fe 100644
--- a/test/stressGUI.cxx
+++ b/test/stressGUI.cxx
@@ -307,10 +307,6 @@ void stressGUI()
TString sp = gSystem->GetFromPipe("uname -a");
sp.Resize(60);
printf("* SYS: %s\n",sp.Data());
- if (strstr(gSystem->GetBuildNode(),"Linux")) {
- sp = gSystem->GetFromPipe("lsb_release -d -s");
- printf("* SYS: %s\n",sp.Data());
- }
if (strstr(gSystem->GetBuildNode(),"Darwin")) {
sp = gSystem->GetFromPipe("sw_vers -productVersion");
sp += " Mac OS X ";
diff --git a/test/stressGeometry.cxx b/test/stressGeometry.cxx
index 5e81f5f2ca..2dc366cbf8 100644
--- a/test/stressGeometry.cxx
+++ b/test/stressGeometry.cxx
@@ -295,10 +295,6 @@ void stressGeometry(const char *exp="*", Bool_t generate_ref=kFALSE, Bool_t vecg
TString sp = gSystem->GetFromPipe("uname -a");
sp.Resize(60);
printf("* SYS: %s\n",sp.Data());
- if (strstr(gSystem->GetBuildNode(),"Linux")) {
- sp = gSystem->GetFromPipe("lsb_release -d -s");
- printf("* SYS: %s\n",sp.Data());
- }
if (strstr(gSystem->GetBuildNode(),"Darwin")) {
sp = gSystem->GetFromPipe("sw_vers -productVersion");
sp += " Mac OS X ";
diff --git a/test/stressGraphics.cxx b/test/stressGraphics.cxx
index 5fe958774d..8b6aa9af9a 100644
--- a/test/stressGraphics.cxx
+++ b/test/stressGraphics.cxx
@@ -419,10 +419,6 @@ void stressGraphics(Int_t verbose = 0)
TString sp = gSystem->GetFromPipe("uname -a");
sp.Resize(60);
printf("* SYS: %s\n",sp.Data());
- if (strstr(gSystem->GetBuildNode(),"Linux")) {
- sp = gSystem->GetFromPipe("lsb_release -d -s");
- printf("* SYS: %s\n",sp.Data());
- }
if (strstr(gSystem->GetBuildNode(),"Darwin")) {
sp = gSystem->GetFromPipe("sw_vers -productVersion");
sp += " Mac OS X ";
diff --git a/test/stressHepix.cxx b/test/stressHepix.cxx
index d8d2a65a64..01dfc67a54 100644
--- a/test/stressHepix.cxx
+++ b/test/stressHepix.cxx
@@ -143,10 +143,6 @@ int main(int argc, char **argv)
TString sp = gSystem->GetFromPipe("uname -a");
sp.Resize(60);
printf("* SYS: %s\n",sp.Data());
- if (strstr(gSystem->GetBuildNode(),"Linux")) {
- sp = gSystem->GetFromPipe("lsb_release -d -s");
- printf("* SYS: %s\n",sp.Data());
- }
if (strstr(gSystem->GetBuildNode(),"Darwin")) {
sp = gSystem->GetFromPipe("sw_vers -productVersion");
sp += " Mac OS X ";
diff --git a/test/stressHistFactory.cxx b/test/stressHistFactory.cxx
index b84fa70f86..ec6deac031 100644
--- a/test/stressHistFactory.cxx
+++ b/test/stressHistFactory.cxx
@@ -139,10 +139,6 @@ Int_t stressHistFactory(const char* refFile, Bool_t writeRef, Int_t verbose, Boo
if (UNIX) {
TString sp = gSystem->GetFromPipe("uname -a");
cout << "* SYS: " << sp << endl;
- if (strstr(gSystem->GetBuildNode(), "Linux")) {
- sp = gSystem->GetFromPipe("lsb_release -d -s");
- cout << "* SYS: " << sp << endl;
- }
if (strstr(gSystem->GetBuildNode(), "Darwin")) {
sp = gSystem->GetFromPipe("sw_vers -productVersion");
sp += " Mac OS X ";
diff --git a/test/stressLinear.cxx b/test/stressLinear.cxx
index ce2e1af23d..e34ddf85a2 100644
--- a/test/stressLinear.cxx
+++ b/test/stressLinear.cxx
@@ -296,10 +296,6 @@ void stressLinear(Int_t maxSizeReq,Int_t verbose)
TString sp = gSystem->GetFromPipe("uname -a");
sp.Resize(60);
printf("* SYS: %s\n",sp.Data());
- if (strstr(gSystem->GetBuildNode(),"Linux")) {
- sp = gSystem->GetFromPipe("lsb_release -d -s");
- printf("* SYS: %s\n",sp.Data());
- }
if (strstr(gSystem->GetBuildNode(),"Darwin")) {
sp = gSystem->GetFromPipe("sw_vers -productVersion");
sp += " Mac OS X ";
diff --git a/test/stressRooFit.cxx b/test/stressRooFit.cxx
index 18e214ec0c..4f7c5a3d83 100644
--- a/test/stressRooFit.cxx
+++ b/test/stressRooFit.cxx
@@ -197,10 +197,6 @@ Int_t stressRooFit(const char* refFile, Bool_t writeRef, Int_t doVerbose, Int_t
TString sp = gSystem->GetFromPipe("uname -a");
sp.Resize(60);
printf("* SYS: %s\n",sp.Data());
- if (strstr(gSystem->GetBuildNode(),"Linux")) {
- sp = gSystem->GetFromPipe("lsb_release -d -s");
- printf("* SYS: %s\n",sp.Data());
- }
if (strstr(gSystem->GetBuildNode(),"Darwin")) {
sp = gSystem->GetFromPipe("sw_vers -productVersion");
sp += " Mac OS X ";
diff --git a/test/stressRooStats.cxx b/test/stressRooStats.cxx
index 35598b5919..adb3dc4cd8 100644
--- a/test/stressRooStats.cxx
+++ b/test/stressRooStats.cxx
@@ -232,10 +232,6 @@ Int_t stressRooStats(const char* refFile, Bool_t writeRef, Int_t verbose, Bool_t
if (UNIX) {
TString sp = gSystem->GetFromPipe("uname -a");
cout << "* SYS: " << sp << endl;
- if (strstr(gSystem->GetBuildNode(), "Linux")) {
- sp = gSystem->GetFromPipe("lsb_release -d -s");
- cout << "* SYS: " << sp << endl;
- }
if (strstr(gSystem->GetBuildNode(), "Darwin")) {
sp = gSystem->GetFromPipe("sw_vers -productVersion");
sp += " Mac OS X ";
diff --git a/test/stressTMVA.cxx b/test/stressTMVA.cxx
index f7638a73f6..22e3feaf65 100644
--- a/test/stressTMVA.cxx
+++ b/test/stressTMVA.cxx
@@ -3193,10 +3193,6 @@ int main(int argc, char **argv)
TString sp = gSystem->GetFromPipe("uname -a");
sp.Resize(60);
printf("* SYS: %s\n",sp.Data());
- if (strstr(gSystem->GetBuildNode(),"Linux")) {
- sp = gSystem->GetFromPipe("lsb_release -d -s");
- printf("* SYS: %s\n",sp.Data());
- }
if (strstr(gSystem->GetBuildNode(),"Darwin")) {
sp = gSystem->GetFromPipe("sw_vers -productVersion");
sp += " Mac OS X ";
--
2.37.1