prepup.pp 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. i : integer;
  25. begin
  26. If FindFirst (dir+DirectorySeparator+s,faAnyFile,Info)=0 then
  27. begin
  28. Repeat
  29. With Info do
  30. begin
  31. hs:=dir+DirectorySeparator+Name;
  32. { strip leading ./ }
  33. delete(hs,1,2);
  34. tarwriter.addfile(hs);
  35. end;
  36. Until FindNext(info)<>0;
  37. end;
  38. FindClose(Info);
  39. end;
  40. Var Info : TSearchRec;
  41. Begin
  42. If FindFirst (dir+DirectorySeparator+'*',faDirectory,Info)=0 then
  43. begin
  44. Repeat
  45. With Info do
  46. begin
  47. If ((Attr and faDirectory) = faDirectory) and (name<>'.') and (name<>'..') then
  48. dosearch(dir+DirectorySeparator+name);
  49. end;
  50. Until FindNext(info)<>0;
  51. end;
  52. FindClose(Info);
  53. domask('*.elg');
  54. domask('*.log');
  55. End;
  56. begin
  57. if paramcount<>1 then
  58. begin
  59. writeln('Usage: prepup <name of .tar.gz>');
  60. halt(1);
  61. end;
  62. C:=TGZFileStream.Create(paramstr(1),gzOpenWrite);
  63. TarWriter := TTarWriter.Create (C);
  64. dosearch('.');
  65. TarWriter.AddFile('dbdigest.cfg');
  66. TarWriter.AddFile('log');
  67. TarWriter.free;
  68. c.free;
  69. end.