2
0
Эх сурвалжийг харах

+ added tar creation

git-svn-id: trunk@5046 -
florian 19 жил өмнө
parent
commit
bfeae0c5f1
1 өөрчлөгдсөн 33 нэмэгдсэн , 10 устгасан
  1. 33 10
      tests/utils/prepup.pp

+ 33 - 10
tests/utils/prepup.pp

@@ -18,19 +18,30 @@
 program prepup;
 
 uses
-  sysutils;
+  sysutils,libtar,zstream;
 
+var
+  tarwriter : ttarwriter;
+  c : tgzfilestream;
 
 procedure dosearch(const dir : string);
 
   procedure domask(const s : string);
-    Var Info : TSearchRec;
+    Var
+      Info : TSearchRec;
+      hs : string;
+      i : integer;
     begin
       If FindFirst (dir+DirectorySeparator+s,faAnyFile,Info)=0 then
         begin
         Repeat
           With Info do
-            writeln (dir+DirectorySeparator+Name);
+            begin
+              hs:=dir+DirectorySeparator+Name;
+              { strip leading ./ }
+              delete(hs,1,2);
+              tarwriter.addfile(hs);
+            end;
         Until FindNext(info)<>0;
         end;
       FindClose(Info);
@@ -41,13 +52,13 @@ Var Info : TSearchRec;
 Begin
   If FindFirst (dir+DirectorySeparator+'*',faDirectory,Info)=0 then
     begin
-    Repeat
-      With Info do
-        begin
-          If ((Attr and faDirectory) = faDirectory) and (name<>'.') and (name<>'..') then
-            dosearch(dir+DirectorySeparator+name);
-        end;
-    Until FindNext(info)<>0;
+      Repeat
+        With Info do
+          begin
+            If ((Attr and faDirectory) = faDirectory) and (name<>'.') and (name<>'..') then
+              dosearch(dir+DirectorySeparator+name);
+          end;
+      Until FindNext(info)<>0;
     end;
   FindClose(Info);
   domask('*.elg');
@@ -55,7 +66,19 @@ Begin
 End;
 
 begin
+  if paramcount<>1 then
+    begin
+      writeln('Usage: prepup <name of .tar.gz>');
+      halt(1);
+    end;
+    C:=TGZFileStream.Create(paramstr(1),gzOpenWrite);
+    TarWriter := TTarWriter.Create (C);
   dosearch('.');
+  TarWriter.AddFile('dbdigest.cfg');
+  TarWriter.AddFile('log');
+
+  TarWriter.free;
+  c.free;
 end.