[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [tyndur-devel] [PATCH] + lpt: Repository-Typen
Am Donnerstag, 14. Mai 2009 19:05 schrieb Alexander Siol:
> 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;
Toni wollte hier ja auch schon lieber einen Aufzählungstyp haben. Ich würde
ehrlichgesagt noch einen Schritt weitergehen und Unterklassen FileRepository
und HTTPRepository machen. Die könnten dann vielleicht manche Sachen durch
Vererbung wegabstrahieren, die du so mit einer if-Kette abfangen mußt.