From 6698bc82f75619b98b98f9b356e9c2b1f4519a8e Mon Sep 17 00:00:00 2001 From: chiarazampolli Date: Wed, 20 Mar 2019 22:06:01 +0100 Subject: [PATCH] Adding MoreRecentThanOrEqualTo case (#257) * Adding MoreRecentThanOrEqualTo case * Bug fix and improvement when checking ">=" --- Utils/CheckAliRootVersion.C | 45 +++++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/Utils/CheckAliRootVersion.C b/Utils/CheckAliRootVersion.C index 5287e7b3..a6f4e48d 100644 --- a/Utils/CheckAliRootVersion.C +++ b/Utils/CheckAliRootVersion.C @@ -2,12 +2,13 @@ /// (extracted from ALIEN_JDL_PACKAGES ot ALIEN_PACKAGES) /// against the version passed as argument /// Example: IsAliPhysicsMoreRecentThan("v5-09-20") +/// with ALIEN_JDL_PACKAGES=VO_ALICE@AliPhysics::v5-09-41a-01-1 Bool_t IsAliPhysicsMoreRecentThan(TString version){ Int_t vvv,nnn1,nnn2; - sscanf(version,"v%d-%d-%d",&vvv,&nnn1,&nnn2); + sscanf(version.Data(),"v%d-%d-%d",&vvv,&nnn1,&nnn2); // check if ALIEN_JDL_PACKAGES exists // if not, try with ALIEN_PACKAGES @@ -44,9 +45,49 @@ Bool_t IsAliPhysicsMoreRecentThan(TString version){ } } +Bool_t IsAliPhysicsMoreRecentThanOrEqualTo(TString version){ + + Int_t vvv,nnn1,nnn2; + sscanf(version.Data(),"v%d-%d-%d",&vvv,&nnn1,&nnn2); + + // check if ALIEN_JDL_PACKAGES exists + // if not, try with ALIEN_PACKAGES + if(!gSystem->Getenv("ALIEN_JDL_PACKAGES")) + if(gSystem->Getenv("ALIEN_PACKAGES")){ + gSystem->Setenv("ALIEN_JDL_PACKAGES", gSystem->Getenv("ALIEN_PACKAGES")); + printf("Using ALIEN_PACKAGES instead of ALIEN_JDL_PACKAGES\n"); + } + + if(gSystem->Getenv("ALIEN_JDL_PACKAGES")){ + TString packg=gSystem->Getenv("ALIEN_JDL_PACKAGES"); + Int_t pos1=packg.Index("AliPhysics"); + TString subs=packg(pos1,packg.Length()-pos1); + Int_t pos2=subs.Index("VO_ALICE"); + if(pos2<=0) pos2=subs.Length(); + TString aliph=subs(0,pos2); + Int_t ver,n1,n2; + Char_t str2[20]; + sscanf(aliph.Data(),"AliPhysics::v%d-%d-%02d%s",&ver,&n1,&n2,str2); + if(vervvv) return kTRUE; + else if(ver==vvv){ + if(n1nnn1) return kTRUE; + else if(n1==nnn1){ + if (n2 < nnn2) return kFALSE; // we check if it is "<=" (here is the difference wrt line 37 + else return kTRUE; + } + } + }else{ + printf("ALIEN_PACKAGES and ALIEN_JDL_PACKAGES not defined\n"); + printf(" --> Cannot check AliPhysics version\n"); + return kTRUE; + } +} + Bool_t IsAliPhysicsEqualTo(TString version){ Int_t vvv,nnn1,nnn2; - sscanf(version,"v%d-%d-%d",&vvv,&nnn1,&nnn2); + sscanf(version.Data(),"v%d-%d-%d",&vvv,&nnn1,&nnn2); // check if ALIEN_JDL_PACKAGES exists // if not, try with ALIEN_PACKAGES