prepup.pp 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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. const
  17. use_longlog : boolean = false;
  18. var
  19. tarwriter : ttarwriter;
  20. c : tgzfilestream;
  21. procedure dosearch(const dir : string);
  22. procedure domask(const s : string);
  23. Var
  24. Info : TSearchRec;
  25. hs : string;
  26. begin
  27. If FindFirst (dir+DirectorySeparator+s,faAnyFile,Info)=0 then
  28. begin
  29. Repeat
  30. With Info do
  31. begin
  32. hs:=dir+DirectorySeparator+Name;
  33. { strip leading ./ }
  34. delete(hs,1,2);
  35. tarwriter.addfile(hs);
  36. end;
  37. Until FindNext(info)<>0;
  38. end;
  39. FindClose(Info);
  40. end;
  41. Var Info : TSearchRec;
  42. Begin
  43. If FindFirst (dir+DirectorySeparator+'*',faDirectory,Info)=0 then
  44. begin
  45. Repeat
  46. With Info do
  47. begin
  48. If ((Attr and faDirectory) = faDirectory) and (name<>'.') and (name<>'..') then
  49. dosearch(dir+DirectorySeparator+name);
  50. end;
  51. Until FindNext(info)<>0;
  52. end;
  53. FindClose(Info);
  54. domask('*.elg');
  55. domask('*.log');
  56. End;
  57. var
  58. index : longint;
  59. begin
  60. index:=1;
  61. if paramcount<>1 then
  62. begin
  63. if paramstr(1)='-ll' then
  64. begin
  65. use_longlog:=true;
  66. index:=2;
  67. end
  68. else
  69. begin
  70. writeln('Usage: prepup [-ll] <name of .tar.gz>');
  71. Writeln('Optional -ll parameter is used to specify use of longlog');
  72. halt(1);
  73. end
  74. end;
  75. C:=TGZFileStream.Create(paramstr(index),gzOpenWrite);
  76. TarWriter := TTarWriter.Create (C);
  77. if not use_longlog then
  78. dosearch('.');
  79. TarWriter.AddFile('dbdigest.cfg');
  80. TarWriter.AddFile('log');
  81. if use_longlog then
  82. TarWriter.AddFile('longlog');
  83. TarWriter.free;
  84. c.free;
  85. end.