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 ... ",
122 pack,
gROOT->GetVersion(),
v.Data()));
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!!! ",
161 pack,
gROOT->GetVersion(),
v.Data()));
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));
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));
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) {
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);
776 Error(
"Install",
"%s is invalid", par.
Data());
783 TMD5 *sums = 0, *md5 = 0, *md5d = 0;
790 Error(
"Install",
"could not create/get download directory");
801 Warning(
"Install",
"could not retrieve %s", parsum.
Data());
817 Error(
"Install",
"could not remove existing version of '%s'", pack.
Data());
828 Error(
"Install",
"could not retrieve %s", par.
Data());
837 if (sums && md5 && (*sums != *md5)) install =
kTRUE;
840 if (sums)
delete sums;
845 Error(
"Install",
"could not copy %s to %s", psrc.
Data(),
dest.Data());
852 if (md5 && *md5 != *md5d)
853 Warning(
"Install",
"checksums do not match:\n\tdownloaded:\t%s\n\texpected:\t%s",
854 md5d->AsString(), md5->AsString());
855 if (
Unpack(pack, md5d) != 0) {
856 Error(
"Install",
"could not unpack %s",
dest.Data());
860 if (md5d)
delete md5d;
877 if (globpack.
Length() > 0) {
880 while (globpack.
Tokenize(ldir, from,
":")) {
882 ::Warning(
"TPackMgr::RegisterGlobalPath",
883 "directory for global packages %s does not"
884 " exist or is not readable", ldir.
Data());
888 key.
Form(
"G%d", ng++);
896 ::Info(
"TPackMgr::RegisterGlobalPath",
897 "manager for global packages directory %s added to the list",
914 if (packmgr && packmgr->
Has(pack))
return packmgr;
921 if (pm->
Has(pack))
return pm;
937 if (packmgr && packmgr->
GetParPath(pack, par) == 0)
return 1;
951 if (par.
Length() > 0)
return 0;
static void DefaultLogger(const char *msg)
const char *const kUNTAR3
const char *const kGUNZIP
void Printf(const char *fmt,...)
R__EXTERN TSystem * gSystem
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
virtual TObject * Clone(const char *newname="") const
Make a clone of an collection using the Streamer facility.
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
static EFileType GetType(const char *name, Option_t *option="", TString *prefix=nullptr)
Resolve the file type as a function of the protocol field in 'name'.
virtual Bool_t Cp(const char *dst, Bool_t progressbar=kTRUE, UInt_t buffersize=1000000)
Allows to copy this file to the dst URL.
Global functions class (global functions are obtained from CINT).
Int_t GetNargs() const
Number of function arguments.
TList * GetListOfMethodArgs()
Return list containing the TMethodArgs of a TFunction.
THashList implements a hybrid collection class consisting of a hash table and a list to store TObject...
virtual void Add(TObject *obj)
virtual TObject * Remove(TObject *obj)
Remove object from the list.
virtual TObject * FindObject(const char *name) const
Find an object in this list using its name.
virtual TObject * First() const
Return the first object in the list. Returns 0 when list is empty.
void SetName(const char *path)
Int_t Lock(Bool_t shared=kFALSE)
Int_t Unlock()
Unlock the directory.
This code implements the MD5 message-digest algorithm.
static TMD5 * FileChecksum(const char *file)
Returns checksum of specified file.
static TMD5 * ReadChecksum(const char *file)
Returns checksum stored in ASCII in specified file.
static Int_t WriteChecksum(const char *file, const TMD5 *md5)
Writes checksum in ASCII format to specified file.
Class supporting a collection of lines with C++ code.
virtual Bool_t Load() const
Load the macro into the interpreter.
virtual Int_t ReadFile(const char *filename)
Read lines in filename in this macro.
TList * GetListOfLines() const
virtual TObjString * GetLineWith(const char *text) const
Search the first line containing text.
Each ROOT method (see TMethod) has a linked list of its arguments.
Method or function calling interface.
void ResetParam()
Reset parameter list. To be used before the first call the SetParam().
void Init(const TFunction *func)
Initialize the method invocation environment based on the TFunction object.
void Execute(const char *, const char *, int *=0)
Execute method on this object with the given parameter string, e.g.
void SetParam(Long_t l)
Add a long method parameter.
virtual ULong_t Hash() const
Return hash value for this object.
virtual const char * GetTitle() const
Returns title of object.
Collectable string class.
const char * GetName() const
Returns name of object.
const TString & GetString() const
void SetString(const char *s)
Mother of all ROOT objects.
virtual const char * GetName() const
Returns name of object.
virtual const char * ClassName() const
Returns name of class to which the object belongs.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
The PROOF package manager contains tools to manage packages.
Bool_t IsInDir(const char *path)
Method to check if 'path' is in the managed directory Return kTRUE or kFALSE.
void SetName(const char *name)
Set the name of the TNamed.
void Show(const char *title=0)
Show available packages.
void GetEnabledPackages(TString &packlist)
Method to get a semi-colon separated list with the names of the enabled packages.
static Bool_t IsEnabled(const char *pack, TPackMgr *packmgr=nullptr)
Check if the package is enabled; priority is given to packmgr, if defined.
Int_t GetPackDir(const char *pack, TString &pdir)
Method to get the path of the dir for package 'pack'.
const char * GetName() const
Returns name of object.
static THashList * fgGlobalPackMgrList
Int_t Build(const char *pack, Int_t opt=TPackMgr::kCheckROOT)
Method to build a package.
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.
Int_t GetParPath(const char *pack, TString &path)
Method to get the path of the PAR file for package 'pack'.
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...
Bool_t Has(const char *pack)
Method to check if this package manager has package 'pack'.
Int_t Unpack(const char *pack, TMD5 *sum=0)
Read MD5 checksum of the PAR file from the PROOF-INF/md5.txt file.
TMD5 * GetMD5(const char *pack)
Get MD5 checksum of the PAR file corresponding to given package Returns a pointer to a TMD5 object,...
void ShowEnabled(const char *title=0)
Show enabled packages.
void Log(const char *msg)
Wrapper to notofuer / logger.
static Int_t FindParPath(TPackMgr *packmgr, const char *pack, TString &par)
Get the full path to PAR, looking also in the global dirs.
TList * GetList() const
Get list of available packages Returns a pointer to a TList object, transferring ownership to the cal...
TPackMgr(const TPackMgr &)
Int_t Clean(const char *pack)
Clean dir for package 'pack' Return -1 in case of error, 0 otherwise.
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 IsPackageEnabled(const char *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.
Int_t Unload(const char *pack)
Method to unload a package.
TList * GetListOfEnabled() const
Get list of enabled packages Returns a pointer to a TList object, transferring ownership to the calle...
static TPackMgr * GetPackMgr(const char *pack, TPackMgr *packmgr=nullptr)
Get the package manager having 'pack'; priority is given to packmgr, if defined.
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 ~TPackMgr()
Destroy a TPackMgr instance.
TMD5 * ReadMD5(const char *pack)
Read MD5 checksum of the PAR file from the PROOF-INF/md5.txt file.
const char * GetTitle() const
Returns title of object.
Class used by TMap to store (key,value) pairs.
const char * GetName() const
Returns name of object.
Named parameter, streamable and storable.
const AParamType & GetVal() const
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
const char * Data() const
TString & ReplaceAll(const TString &s1, const TString &s2)
Ssiz_t Last(char c) const
Find last occurrence of a character c.
TObjArray * Tokenize(const TString &delim) const
This function is used to isolate sequential tokens in a TString.
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
TString & Remove(Ssiz_t pos)
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
virtual int Symlink(const char *from, const char *to)
Create a symbolic link from file1 to file2.
virtual Bool_t ExpandPathName(TString &path)
Expand a pathname getting rid of special shell characters like ~.
virtual void AddIncludePath(const char *includePath)
Add includePath to the already set include path.
virtual void FreeDirectory(void *dirp)
Free a directory.
virtual void * OpenDirectory(const char *name)
Open a directory. Returns 0 if directory does not exist.
virtual int GetPid()
Get process id.
virtual const char * Getenv(const char *env)
Get environment variable.
virtual const char * GetIncludePath()
Get the list of include path.
virtual int mkdir(const char *name, Bool_t recursive=kFALSE)
Make a file system directory.
virtual Int_t Exec(const char *shellcmd)
Execute a command.
virtual void SetIncludePath(const char *includePath)
IncludePath should contain the list of compiler flags to indicate where to find user defined header f...
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
virtual const char * GetDirEntry(void *dirp)
Get a directory entry. Returns 0 if no more entries.
virtual Bool_t ChangeDirectory(const char *path)
Change directory.
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
virtual const char * HostName()
Return the system's host name.
virtual const char * WorkingDirectory()
Return working directory.
virtual char * Which(const char *search, const char *file, EAccessMode mode=kFileExists)
Find location of file in a search path.
virtual int Unlink(const char *name)
Unlink, i.e.
virtual const char * TempDirectory() const
Return a user configured or systemwide directory to create temporary files in.
static long int sum(long int i)
#define dest(otri, vertexptr)