/etc/root/plugins/TGrid/P010_TAlien.C is in root-system-common 5.34.14-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | #include <iostream>
void SetAliEnSettings()
{
// Routine to load settings from an AliEn environment file.
ifstream fileIn;
fileIn.open(Form("%s/gclient_env_%d", gSystem->TempDirectory(), gSystem->GetUid()));
if (gDebug>0) {printf("P010_TAlien.C: parsing %s/gclient_env_$UID\n", gSystem->TempDirectory());}
TString lineS,tmp;
char line[4096];
while (fileIn.good()){
fileIn.getline(line,4096,'\n');
lineS = line;
if (lineS.IsNull()) continue;
if (lineS.Contains("export ")) {
lineS.ReplaceAll("export ","");
TObjArray* array = lineS.Tokenize("=");
if (array->GetEntries() == 2) {
TObjString *strVar = (TObjString *) array->At(0);
TObjString *strVal = (TObjString *) array->At(1);
if ((strVar)&&(strVal)) {
tmp = strVal->GetString();
tmp.ReplaceAll("\"","");
tmp.ReplaceAll("$LD_LIBRARY_PATH",gSystem->Getenv("LD_LIBRARY_PATH"));
tmp.ReplaceAll("$DYLD_LIBRARY_PATH",gSystem->Getenv("DYLD_LIBRARY_PATH"));
tmp.ReplaceAll(" ","");
gSystem->Unsetenv(strVar->GetString());
gSystem->Setenv(strVar->GetString(), tmp);
if (gDebug>0) {
Info("P010_TAlien", "setting environment %s=\"%s\"", strVar->GetString().Data(), tmp.Data());
}
if (!strVar->GetString().CompareTo("GCLIENT_SERVER_LIST")) {
gSystem->Unsetenv("alien_API_SERVER_LIST");
gSystem->Setenv("alien_API_SERVER_LIST", tmp);
}
}
if (array) {
delete array;
array = 0 ;
}
} else {
// parse the MONA_ stuff
TObjArray* array = lineS.Tokenize("\" ");
TString key="";
TString val="";
for (int i=0; i< array->GetEntries(); i++) {
if ( ((TObjString*) array->At(i))->GetString().Contains("=")) {
if (key.Length() && val.Length()) {
val.Resize(val.Length()-1);
if (gDebug>0) {
Info("P010_TAlien", "setting environment %s=\"%s\"", key.Data(), val.Data());
}
gSystem->Unsetenv(key);
gSystem->Setenv(key, val);
key="";
val="";
}
key = ((TObjString*) array->At(i))->GetString();
key.ReplaceAll("=","");
} else {
val+=((TObjString*) array->At(i))->GetString();
val+=" ";
}
}
if (key.Length() && val.Length()) {
if (gDebug>0) {
Info("P010_TAlien", "setting environment %s=\"%s\"", key.Data(), val.Data());
}
gSystem->Unsetenv(key);
gSystem->Setenv(key, val);
}
}
}
}
}
void P010_TAlien()
{
TString configfeatures = gROOT->GetConfigFeatures();
TString ralienpath = gSystem->Getenv("ROOTSYS");
ralienpath += "/lib/"; ralienpath += "libRAliEn.so";
// only if ROOT was compiled with enable-alien we do library setup and configure a handler
if ((!gSystem->AccessPathName(ralienpath))) || (configfeatures.contains("alien"))) {
// you can enforce
if ((!gSystem->Getenv("GBBOX_ENVFILE")) ||
( gSystem->Getenv("ALIEN_SOURCE_GCLIENT_ENV")) ||
(!gSystem->Getenv("ALIEN_SKIP_GCLIENT_ENV")) ) {
SetAliEnSettings();
}
if ( ((gSystem->Load("libgapiUI.so")>=0) && (gSystem->Load("libRAliEn.so")>=0))) {
gPluginMgr->AddHandler("TGrid", "^alien", "TAlien",
"RAliEn", "TAlien(const char*,const char*,const char*,const char*)");
} else {
Error("P010_TAlien","Please fix your loader path environment variable to be able to load libRAliEn.so");
}
}
}
|