Skip to content

Commit

Permalink
Adding MoreRecentThanOrEqualTo case (#257)
Browse files Browse the repository at this point in the history
* Adding MoreRecentThanOrEqualTo case

* Bug fix and improvement when checking ">="
  • Loading branch information
chiarazampolli authored Mar 20, 2019
1 parent e1b4884 commit 6698bc8
Showing 1 changed file with 43 additions and 2 deletions.
45 changes: 43 additions & 2 deletions Utils/CheckAliRootVersion.C
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(ver<vvv) return kFALSE;
else if(ver>vvv) return kTRUE;
else if(ver==vvv){
if(n1<nnn1) return kFALSE;
else if(n1>nnn1) 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
Expand Down

0 comments on commit 6698bc8

Please sign in to comment.