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

[tyndur-devel] [PATCH] =?utf-8?q?+=20lpt:=20Hilfsfunktion=20GetDownloadURL=20um=20in=20Abh=C3=A4ngigkeit=20vom=20Repository-Typ=20andere=20Download-URI=20zu=20generieren



---
 trunk/src/modules/pas/lpt/lpt.pas |   19 ++++++++++++++-----
 1 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/trunk/src/modules/pas/lpt/lpt.pas b/trunk/src/modules/pas/lpt/lpt.pas
index e8668cb..06c3e63 100644
--- a/trunk/src/modules/pas/lpt/lpt.pas
+++ b/trunk/src/modules/pas/lpt/lpt.pas
@@ -188,6 +188,17 @@ begin
     end;
 end;
 
+function GenerateDownloadURL(version: TPackageVersion): String;
+begin
+    if version.repository.repostype = 'singlefile' then begin
+        GenerateDownloadURL := version.repository.url;
+    end else begin
+        GenerateDownloadURL := version.repository.url + version.pkg.name + '-'
+            + version.section.section + '-' + version.version + '-' + arch +
+            '.tar';
+    end;
+end;
+
 procedure Get(pkgname: String; reinstall: boolean);
 
 
@@ -215,9 +226,7 @@ procedure Get(pkgname: String; reinstall: boolean);
         TextColor(15);
         WriteLn('Herunterladen und Entpacken von ' + version.pkg.name + '/' + version.section.section);
         TextColor(7);
-        filename := version.pkg.name + '-' + version.section.section + '-' + version.version
-            + '-' + arch + '.tar';
-        url := version.repository.url + filename;
+        url := GenerateDownloadURL(version);
         if not Download(url, '', true) then begin
             TextColor(12);
             WriteLn('Download fehlgeschlagen');
@@ -264,14 +273,14 @@ begin
     end;
 
     version := pkgset.GetCurrentVersion(pkgname, section);
-    
+
     if version = nil then begin
         TextColor(12);
         WriteLn('Konnte keine Version von ' + pkgname + ' finden');
         TextColor(7);
         exit;
     end;
-    
+
     instset := TPackageSet.create();
     instset.AddVersion(version);
     try
-- 
1.5.6.3