Erster Patch der Reihe, Rest ist in Reihenfolge -- Alexander Siol alex@xxxxxxxxxx dunklermeuchler@xxxxxxxxx
From 59851d860924bfa9a5f3601b88b870ff565a96a1 Mon Sep 17 00:00:00 2001 From: Alexander Siol <alex@xxxxxxxxxx> Date: Fri, 8 May 2009 16:03:38 +0200 Subject: [PATCH 1/9] + lpt: Erweiterung um Repository-Typ (z.B. http, file) --- trunk/src/modules/pas/lpt/lpt.pas | 4 ++-- trunk/src/modules/pas/lpt/packages.pas | 8 ++++---- trunk/src/modules/pas/lpt/repositories.pas | 10 ++++++++++ 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/trunk/src/modules/pas/lpt/lpt.pas b/trunk/src/modules/pas/lpt/lpt.pas index 62e0980..37ba90a 100644 --- a/trunk/src/modules/pas/lpt/lpt.pas +++ b/trunk/src/modules/pas/lpt/lpt.pas @@ -178,7 +178,7 @@ begin TextColor(7); end else begin try - pkgset.ScanFile(configRoot + srec.name, repo.url); + pkgset.ScanFile(configRoot + srec.name, repo); except on e: Exception do begin TextColor(12); @@ -220,7 +220,7 @@ procedure Get(pkgname: String; reinstall: boolean); TextColor(7); filename := version.pkg.name + '-' + version.section.section + '-' + version.version + '-' + arch + '.tar'; - url := version.repository + filename; + url := version.repository.url + filename; if not Download(url, '', true) then begin TextColor(12); WriteLn('Download fehlgeschlagen'); diff --git a/trunk/src/modules/pas/lpt/packages.pas b/trunk/src/modules/pas/lpt/packages.pas index eac8471..67ca831 100644 --- a/trunk/src/modules/pas/lpt/packages.pas +++ b/trunk/src/modules/pas/lpt/packages.pas @@ -2,7 +2,7 @@ unit packages; {$MODE ObjFPC} interface -uses sysutils, classes; +uses sysutils, classes, repositories; type EPackageFileFormat = class(Exception) end; @@ -23,7 +23,7 @@ type constructor create; destructor destroy; override; - procedure ScanFile(filename, repository: String); + procedure ScanFile(filename: String; repository: TRepository); function add(name: String): TPackage; procedure AddAll(pkgset: TPackageSet); procedure AddVersion(ver: TPackageVersion); @@ -77,7 +77,7 @@ type property preinstDependencies: TCollection read instDep; property runDependencies: TCollection read runDep; - repository: String; + repository: TRepository; version: String; size: dword; pkg: TPackage; @@ -96,7 +96,7 @@ begin packages.free; end; -procedure TPackageSet.ScanFile(filename, repository: String); +procedure TPackageSet.ScanFile(filename: String; repository: TRepository); var f: Text; line: String; diff --git a/trunk/src/modules/pas/lpt/repositories.pas b/trunk/src/modules/pas/lpt/repositories.pas index 7484ab6..6d998bd 100644 --- a/trunk/src/modules/pas/lpt/repositories.pas +++ b/trunk/src/modules/pas/lpt/repositories.pas @@ -9,6 +9,7 @@ type public name: String; url: String; + repostype: String; end; @@ -27,7 +28,9 @@ var f: Text; name: String; url: String; + repostype: String; space: integer; + protofinder: integer; begin Assign(f, filename); Reset(f); @@ -44,6 +47,12 @@ begin if space > 0 then begin name := Copy(url, 1, space - 1); url := Copy(url, space + 1, length(url)); + protofinder := Pos('http://', url); + if protofinder > 0 then begin + repostype := 'http'; + end else begin + repostype := 'file'; + end end else begin WriteLn('Ungueltige Paketquelle: ' + url); continue; @@ -53,6 +62,7 @@ begin repo := TRepository(repos.add()); repo.name := name; repo.url := url; + repo.repostype := repostype; end; Close(f); end; -- 1.5.6.3
Attachment:
signature.asc
Description: Digital signature