prepup.pp 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. {
  2. This file is part of the Free Pascal test suite.
  3. Copyright (c) 2006 by the Free Pascal development team.
  4. This program collects the results of a testsuite run
  5. and prepares things for an upload of the results to the
  6. database
  7. See the file COPYING.FPC, included in this distribution,
  8. for details about the copyright.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  12. **********************************************************************}
  13. program prepup;
  14. uses
  15. sysutils,libtar,zstream;
  16. var
  17. tarwriter : ttarwriter;
  18. c : tgzfilestream;
  19. procedure dosearch(const dir : string);
  20. procedure domask(const s : string);
  21. Var
  22. Info : TSearchRec;
  23. hs : string;
  24. begin
  25. If FindFirst (dir+DirectorySeparator+s,faAnyFile,Info)=0 then
  26. begin
  27. Repeat
  28. With Info do
  29. begin
  30. hs:=dir+DirectorySeparator+Name;
  31. { strip leading ./ }
  32. delete(hs,1,2);
  33. tarwriter.addfile(hs);
  34. end;
  35. Until FindNext(info)<>0;
  36. end;
  37. FindClose(Info);
  38. end;
  39. Var Info : TSearchRec;
  40. Begin
  41. If FindFirst (dir+DirectorySeparator+'*',faDirectory,Info)=0 then
  42. begin
  43. Repeat
  44. With Info do
  45. begin
  46. If ((Attr and faDirectory) = faDirectory) and (name<>'.') and (name<>'..') then
  47. dosearch(dir+DirectorySeparator+name);
  48. end;
  49. Until FindNext(info)<>0;
  50. end;
  51. FindClose(Info);
  52. domask('*.elg');
  53. domask('*.log');
  54. End;
  55. begin
  56. if paramcount<>1 then
  57. begin
  58. writeln('Usage: prepup <name of .tar.gz>');
  59. halt(1);
  60. end;
  61. C:=TGZFileStream.Create(paramstr(1),gzOpenWrite);
  62. TarWriter := TTarWriter.Create (C);
  63. dosearch('.');
  64. TarWriter.AddFile('dbdigest.cfg');
  65. TarWriter.AddFile('log');
  66. TarWriter.free;
  67. c.free;
  68. end.