[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[tyndur-devel] [PATCH] lpt: Optimierungen & Vorbereitungen



! lpt: Zuordnung der Paketlisten erfolgt nicht mehr Datei -> Repository sondern umgekehrt
+ lpt: Es können "Pseudo-ScanFile"-Funktionen für weitere Repository-Typen gebastelt werden
---
 trunk/src/modules/pas/lpt/lpt.pas          |   22 +++++++---------------
 trunk/src/modules/pas/lpt/repositories.pas |    7 ++++++-
 2 files changed, 13 insertions(+), 16 deletions(-)

diff --git a/trunk/src/modules/pas/lpt/lpt.pas b/trunk/src/modules/pas/lpt/lpt.pas
index 37ba90a..56d8b09 100644
--- a/trunk/src/modules/pas/lpt/lpt.pas
+++ b/trunk/src/modules/pas/lpt/lpt.pas
@@ -162,23 +162,16 @@ end;
 
 procedure ReadPkglists(pkgset: TPackageSet);
 var
-    srec: SearchRec;
-    name: String;
     repo: TRepository;
+    repos: TCollection;
+    i: integer;
 begin
-    dos.FindFirst(configRoot + 'pkglist.*', 0, srec);
-    while DosError = 0 do begin
-        WriteLn('Lese Paketliste ein: ' + srec.name);
-
-        name := Copy(srec.name, length('pkglist.*'), length(srec.name));
-        repo := GetRepository(name);
-        if repo = nil then begin
-            TextColor(6);
-            WriteLn('Warnung: "', name, '" nicht in pkgsrc gefunden. Ueberspringe Quelle.');
-            TextColor(7);
-        end else begin
+    repos := GetAllRepositories();
+    for i := 0 to repos.count - 1 do begin
+        repo := TRepository(repos.items[i]);
+        if (repo.repostype = 'http') or (repo.repostype = 'file') then begin
             try
-                pkgset.ScanFile(configRoot + srec.name, repo);
+                pkgset.ScanFile(configRoot + 'pkglist.' + repo.name, repo);
             except
                 on e: Exception do begin
                     TextColor(12);
@@ -187,7 +180,6 @@ begin
                 end;
             end;
         end;
-        dos.FindNext(srec);
     end;
 end;
 
diff --git a/trunk/src/modules/pas/lpt/repositories.pas b/trunk/src/modules/pas/lpt/repositories.pas
index 6d998bd..33aa286 100644
--- a/trunk/src/modules/pas/lpt/repositories.pas
+++ b/trunk/src/modules/pas/lpt/repositories.pas
@@ -15,13 +15,18 @@ type
 
 procedure ReadPkgsrc(filename: String);
 function GetRepository(name: String): TRepository;
-
+function GetAllRepositories(): TCollection;
 
 implementation
 
 var
     repos: TCollection;
 
+function GetAllRepositories(): TCollection;
+begin
+    exit(repos);
+end;
+
 procedure ReadPkgsrc(filename: String);
 var
     repo: TRepository;
-- 
1.5.6.3