50 : fLogger(
DefaultLogger), fName(key), fDir(dir), fLock(dir), fEnabledPackages(0)
94 Info(
"Build",
"building package %s ...", pack);
110 FILE *f = fopen(
"PROOF-INF/proofvers.txt",
"r");
117 if (!f || !goodver) {
121 " (current: %s, build: %s): cleaning ... ",
138 Error(
"Build",
"failure executing: %s", cmd.
Data());
143 TString md5f = pdir +
"/PROOF-INF/md5.txt";
150 Warning(
"Build",
"failure calculating/saving MD5sum for '%s'", par.
Data());
160 " directory not writable: cannot re-build!!! ",
174 cmd.
Form(
"export ROOTINCLUDEPATH=\"%s\" ; PROOF-INF/BUILD.sh", ipath.Data());
177 Error(
"Build",
"failure executing: %s", cmd.
Data());
181 f = fopen(
"PROOF-INF/proofvers.txt",
"w");
183 fputs(
gROOT->GetVersion(), f);
193 Info(
"Build",
"no PROOF-INF/BUILD.sh found for package %s", pack);
241 return packmgr->
Load(pack, optls);
252 Log(
TString::Format(
"info: TPackMgr::Load: checking dependencies for package %s ...", pack));
257 if (
Load(os->GetName(), optls) < 0) {
259 Log(
TString::Format(
"error: TPackMgr::Load: failure loading dep %s ...", os->GetName()));
272 chkveropt = pcv->
GetVal();
277 if (
Build(pack, chkveropt) < 0) {
295 TMacro setupmc(
"PROOF-INF/SETUP.C");
303 Log(
TString::Format(
"warning: macro '%s/PROOF-INF/SETUP.C' does not contain a SETUP()" 308 if (!setupmc.
Load()) {
311 " cannot continue", pack));
318 Log(
TString::Format(
"error: function SETUP() not found in macro '%s/PROOF-INF/SETUP.C':" 319 " cannot continue", pack));
327 if (optls && optls->
GetSize() > 0) {
329 " the specified argument will be ignored", pack));
337 if (argsig.BeginsWith(
"TList")) {
340 }
else if (argsig.BeginsWith(
"const char")) {
346 if (optls && optls->
First()) {
348 " SETUP expects 'const char *': ignoring",
356 " cannot continue", arg->
GetTitle()));
361 Log(
"error: cannot get information about the SETUP() argument:" 367 Log(
"error: function SETUP() can have at most a 'TList *' argument:" 372 Long_t setuprc = (rc == 0) ? 0 : -1;
375 if (setuprc < 0) rc = -1;
417 if (pack && strlen(pack) > 0) {
443 while ((ppack = (
TPair *) nxp())) {
491 if (strstr(pack,
".par")) pn.
Remove(pn.
Last(
'.'));
508 while ((pck = (
TPair *)nxp())) {
509 if (packlist.
Length() <= 0)
524 const char *fm = (strstr(pack,
".par")) ?
"%s/%s" :
"%s/%s.par";
560 if (title && strlen(title) > 0)
561 printf(
"%s\n", title);
581 if (pack && strlen(pack)) {
597 Int_t rc1 = 0, rc2 = 0, rc3 = 0;
598 if (pack && strlen(pack)) {
614 return (rc1 + rc2 + rc3);
627 while (pac.Length() > 0) {
628 if (pac.EndsWith(
".par")) {
646 TList *epl =
nullptr;
651 while ((o = nxp())) {
676 if (title && strlen(title) > 0)
677 printf(
"%s\n", title);
684 printf(
"%s\n", pck->GetName());
697 const char *fm = (strstr(pack,
".par")) ?
"%s/%s" :
"%s/%s.par";
727 if (!fn.EndsWith(
".par")) fn +=
".par";
738 Error(
"Unpack",
"failure executing: %s (rc: %d)", cmd.
Data(), rc);
748 Error(
"Unpack",
"package %s did not unpack into %s", fn.Data(), pn.
Data());
770 Info(
"Install",
"installing %s ...", parpath);
775 Error(
"Install",
"%s is invalid", par);
782 TMD5 *sums = 0, *md5 = 0, *md5d = 0;
789 Error(
"Install",
"could not create/get download directory");
800 Warning(
"Install",
"could not retrieve %s", parsum.
Data());
816 Error(
"Install",
"could not remove existing version of '%s'", pack.
Data());
825 psrc.Form(
"%s/%s", dldir.
Data(), parname.
Data());
827 Error(
"Install",
"could not retrieve %s", par);
836 if (sums && md5 && (*sums != *md5)) install =
kTRUE;
839 if (sums)
delete sums;
844 Error(
"Install",
"could not copy %s to %s", psrc.Data(), dest.Data());
851 if (md5 && *md5 != *md5d)
852 Warning(
"Install",
"checksums do not match:\n\tdownloaded:\t%s\n\texpected:\t%s",
853 md5d->AsString(), md5->AsString());
854 if (
Unpack(pack, md5d) != 0) {
855 Error(
"Install",
"could not unpack %s", dest.Data());
859 if (md5d)
delete md5d;
876 if (globpack.
Length() > 0) {
879 while (globpack.
Tokenize(ldir, from,
":")) {
881 ::Warning(
"TPackMgr::RegisterGlobalPath",
882 "directory for global packages %s does not" 883 " exist or is not readable", ldir.
Data());
887 key.
Form(
"G%d", ng++);
895 ::Info(
"TPackMgr::RegisterGlobalPath",
896 "manager for global packages directory %s added to the list",
913 if (packmgr && packmgr->
Has(pack))
return packmgr;
920 if (pm->
Has(pack))
return pm;
936 if (packmgr && packmgr->
GetParPath(pack, par) == 0)
return 1;
950 if (par.
Length() > 0)
return 0;
static Int_t FindParPath(TPackMgr *packmgr, const char *pack, TString &par)
Get the full path to PAR, looking also in the global dirs.
static THashList * fgGlobalPackMgrList
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
TList * GetListOfLines() const
Bool_t IsPackageEnabled(const char *pack)
TMD5 * ReadMD5(const char *pack)
Read MD5 checksum of the PAR file from the PROOF-INF/md5.txt file.
The PROOF package manager contains tools to manage packages.
static long int sum(long int i)
void GetEnabledPackages(TString &packlist)
Method to get a semi-colon separated list with the names of the enabled packages. ...
Int_t Unlock()
Unlock the directory.
virtual int GetPid()
Get process id.
Int_t Lock(Bool_t shared=kFALSE)
static Bool_t IsEnabled(const char *pack, TPackMgr *packmgr=nullptr)
Check if the package is enabled; priority is given to packmgr, if defined.
const char *const kGUNZIP
const char * GetName() const
Returns name of object.
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
virtual const char * WorkingDirectory()
Return working directory.
static TMD5 * FileChecksum(const char *file)
Returns checksum of specified file.
Collectable string class.
virtual ~TPackMgr()
Destroy a TPackMgr instance.
TString & ReplaceAll(const TString &s1, const TString &s2)
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
Int_t Unload(const char *pack)
Method to unload a package.
Int_t GetParPath(const char *pack, TString &path)
Method to get the path of the PAR file for package 'pack'.
virtual Bool_t ChangeDirectory(const char *path)
Change directory.
static TPackMgr * GetPackMgr(const char *pack, TPackMgr *packmgr=nullptr)
Get the package manager having 'pack'; priority is given to packmgr, if defined.
Class supporting a collection of lines with C++ code.
Int_t Clean(const char *pack)
Clean dir for package 'pack' Return -1 in case of error, 0 otherwise.
Int_t GetPackDir(const char *pack, TString &pdir)
Method to get the path of the dir for package 'pack'.
Int_t Load(const char *pack, TList *optls=0)
Method to load a package taking an option list Return -1 on error, 0 otherwise.
virtual char * Which(const char *search, const char *file, EAccessMode mode=kFileExists)
Find location of file in a search path.
Each ROOT method (see TMethod) has a linked list of its arguments.
TPackMgr(const TPackMgr &)
void Show(const char *title=0)
Show available packages.
Int_t Unpack(const char *pack, TMD5 *sum=0)
Read MD5 checksum of the PAR file from the PROOF-INF/md5.txt file.
virtual TObject * Clone(const char *newname="") const
Make a clone of an collection using the Streamer facility.
UInt_t Hash(ECaseCompare cmp=kExact) const
Return hash value.
virtual int mkdir(const char *name, Bool_t recursive=kFALSE)
Make a file system directory.
virtual TObject * FindObject(const char *name) const
Delete a TObjLink object.
virtual Bool_t Cp(const char *dst, Bool_t progressbar=kTRUE, UInt_t buffersize=1000000)
Allows to copy this file to the dst URL.
Int_t Install(const char *par, Bool_t rmold=kFALSE)
Install package from par (unpack the file in the directory); par can be an URL for remote retrieval...
TList * GetListOfEnabled() const
Get list of enabled packages Returns a pointer to a TList object, transferring ownership to the calle...
virtual const char * GetDirEntry(void *dirp)
Get a directory entry. Returns 0 if no more entries.
virtual int Unlink(const char *name)
Unlink, i.e. remove, a file.
virtual const char * ClassName() const
Returns name of class to which the object belongs.
virtual TObjString * GetLineWith(const char *text) const
Search the first line containing text.
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString...
THashList implements a hybrid collection class consisting of a hash table and a list to store TObject...
This code implements the MD5 message-digest algorithm.
static EFileType GetType(const char *name, Option_t *option="", TString *prefix=0)
Resolve the file type as a function of the protocol field in 'name'.
void SetName(const char *name)
Set the name of the TNamed.
void ShowEnabled(const char *title=0)
Show enabled packages.
void Init(const TFunction *func)
Initialize the method invocation environment based on the TFunction object.
virtual const char * Getenv(const char *env)
Get environment variable.
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
virtual const char * TempDirectory() const
Return a user configured or systemwide directory to create temporary files in.
Method or function calling interface.
const char * GetTitle() const
Returns title of object.
virtual Bool_t Load() const
Load the macro into the interpreter.
TList * GetList() const
Get list of available packages Returns a pointer to a TList object, transferring ownership to the cal...
const char * GetName() const
Returns name of object.
Named parameter, streamable and storable.
const TString & GetString() const
Int_t Build(const char *pack, Int_t opt=TPackMgr::kCheckROOT)
Method to build a package.
Bool_t IsInDir(const char *path)
Method to check if 'path' is in the managed directory Return kTRUE or kFALSE.
Int_t GetNargs() const
Number of function arguments.
void SetName(const char *path)
virtual TObject * First() const
Return the first object in the list. Returns 0 when list is empty.
R__EXTERN TSystem * gSystem
static Int_t WriteChecksum(const char *file, const TMD5 *md5)
Writes checksum in ASCII format to specified file.
virtual TObject * Remove(TObject *obj)
Remove object from the list.
Bool_t Gets(FILE *fp, Bool_t chop=kTRUE)
Read one line from the stream, including the , or until EOF.
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
const char * GetName() const
Returns name of object.
virtual Int_t ReadFile(const char *filename)
Read lines in filename in this macro.
virtual Int_t Exec(const char *shellcmd)
Execute a command.
virtual void FreeDirectory(void *dirp)
Free a directory.
TString & Remove(Ssiz_t pos)
Class used by TMap to store (key,value) pairs.
TObjArray * Tokenize(const TString &delim) const
This function is used to isolate sequential tokens in a TString.
virtual const char * GetIncludePath()
Get the list of include path.
void ResetParam()
Reset parameter list. To be used before the first call the SetParam().
TList * GetListOfMethodArgs()
Return list containing the TMethodArgs of a TFunction.
virtual const char * HostName()
Return the system's host name.
virtual int Symlink(const char *from, const char *to)
Create a symbolic link from file1 to file2.
Ssiz_t Last(char c) const
Find last occurrence of a character c.
static Int_t RegisterGlobalPath(const char *paths)
Parse one or more paths as possible sources of packages Returns number of paths added; or -1 in case ...
Bool_t Has(const char *pack)
Method to check if this package manager has package 'pack'.
Mother of all ROOT objects.
Global functions class (global functions are obtained from CINT).
Int_t GetDownloadDir(TString &dldir)
Method to get the download dir; create if not existing Return -1 in case of error (not found; not cre...
virtual void Add(TObject *obj)
void Execute(const char *, const char *, int *=0)
Execute method on this object with the given parameter string, e.g.
#define dest(otri, vertexptr)
const char *const kUNTAR3
void SetParam(Long_t l)
Add a long method parameter.
void Log(const char *msg)
Wrapper to notofuer / logger.
virtual void * OpenDirectory(const char *name)
Open a directory. Returns 0 if directory does not exist.
Int_t Remove(const char *pack=0, Bool_t dolock=kTRUE)
Remove package 'pack' If 'pack' is null or empty all packages are cleared.
virtual void AddIncludePath(const char *includePath)
Add includePath to the already set include path.
const AParamType & GetVal() const
TMD5 * GetMD5(const char *pack)
Get MD5 checksum of the PAR file corresponding to given package Returns a pointer to a TMD5 object...
virtual Bool_t ExpandPathName(TString &path)
Expand a pathname getting rid of special shell characters like ~.
virtual const char * GetName() const
Returns name of object.
virtual Int_t GetSize() const
static TMD5 * ReadChecksum(const char *file)
Returns checksum stored in ASCII in specified file.
void SetString(const char *s)
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
static void DefaultLogger(const char *msg)
virtual void SetIncludePath(const char *includePath)
IncludePath should contain the list of compiler flags to indicate where to find user defined header f...
virtual const char * GetTitle() const
Returns title of object.
const char * Data() const