Farben sind drin, pkglist.[name] ist rausgeflogen. Ansonsten paar Anpassungen an den neuen Hauptpatch. -- Alexander Siol alex@xxxxxxxxxx dunklermeuchler@xxxxxxxxx
diff --git a/trunk/src/modules/pas/lpt/repositories.pas b/trunk/src/modules/pas/lpt/repositories.pas index 5d2d7f4..bb49412 100644 --- a/trunk/src/modules/pas/lpt/repositories.pas +++ b/trunk/src/modules/pas/lpt/repositories.pas @@ -2,7 +2,7 @@ unit repositories; {$MODE ObjFPC} interface -uses crt, sysutils, classes, helpers, repository_base, repository_http, repository_single; +uses crt, sysutils, classes, helpers, repository_base, repository_http, repository_single, repository_file; procedure ReadPkgsrc(filename: String); procedure AddRepository(name, url: String; repostype: Trepostype); @@ -22,6 +22,8 @@ begin repo := THTTPRepository.create(repos); end else if repostype = singlefile then begin repo := TSFRepository.create(repos); + end else if repostype = files then begin + repo := TFileRepository.create(repos); end else begin WriteLn('ACHTUNG - Repository unbekannten Typs erzeugen geht nicht!'); exit; @@ -61,6 +63,8 @@ begin url := Copy(url, space + 1, length(url)); if Pos('http://', url) > 0 then begin repostype := http; + end else if Pos('file:/', url) > 0 then begin + repostype := files; end else begin TextColor(6); WriteLn('Ungueltige Paketquelle: ' + url); diff --git a/trunk/src/modules/pas/lpt/repository_base.pas b/trunk/src/modules/pas/lpt/repository_base.pas index 52b159f..6f32ec8 100644 --- a/trunk/src/modules/pas/lpt/repository_base.pas +++ b/trunk/src/modules/pas/lpt/repository_base.pas @@ -5,7 +5,7 @@ interface uses sysutils, classes, tar, packages, helpers; type - Trepostype = ( none, http, singlefile ); + Trepostype = ( none, http, singlefile, files ); TRepository = class(TCollectionItem) public diff --git a/trunk/src/modules/pas/lpt/repository_file.pas b/trunk/src/modules/pas/lpt/repository_file.pas new file mode 100644 index 0000000..0c2d885 --- /dev/null +++ b/trunk/src/modules/pas/lpt/repository_file.pas @@ -0,0 +1,68 @@ +unit repository_file; +{$MODE ObjFPC} + +interface +uses crt, sysutils, classes, tar, packages, helpers, repository_base; + +type + TFileRepository = class(TRepository) + public + constructor create(parent : TCollection); + function repostype: Trepostype; override; + function Download(version: TPackageVersion): TTarArchive; override; + function PrepareLists: boolean; override; + function FetchLists(pkgset: TPackageSet): boolean; override; + end; + +implementation + +constructor TFileRepository.create(parent : TCollection); +begin + inherited; +end; + +function TFileRepository.repostype: Trepostype; +begin + exit(files); +end; + +function TFileRepository.Download(version: TPackageVersion): TTarArchive; +var + archiveURI: String; +begin + archiveURI := self.url + version.pkg.name + '-' + + version.section.section + '-' + version.version + '-' + getArch + + '.tar'; + exit(TTarArchive.create(archiveURI)); +end; + +function TFileRepository.PrepareLists: boolean; +var + pkglisturl: String; +begin + (* Die Paketliste liegt bereits lokal, wozu also kopieren? *) + exit(true); +end; + +function TFileRepository.FetchLists(pkgset: TPackageSet): boolean; +begin + if FileExists(self.url + 'packages.' + getArch) then begin + try + ScanFile(pkgset, self.url + 'packages.' + getArch, self.name); + exit(true); + except + on e: Exception do begin + TextColor(12); + WriteLn('Fehler beim Einlesen der Paketliste: ', e.message); + TextColor(7); + end; + end; + end else begin + TextColor(12); + WriteLn('Fehler: Keine Paketliste für ' + self.name + ' vorhanden!'); + TextColor(7); + end; + exit(false); +end; + +end.
Attachment:
signature.asc
Description: Digital signature