[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[tyndur-devel] [PATCH 3/9] lpt: pkglist-Format fuer Paketinformationen verwenden
* lpt: pkglist-Format fuer Paketinformationen verwenden
Signed-off-by: Antoine Kaufmann <toni@xxxxxxxxxx>
---
src/modules/pas/lpt/lang/lang_en.c | 4 --
src/modules/pas/lpt/lang/resstr.h | 1 -
src/modules/pas/lpt/repository_single.pas | 52 +++++++---------------------
3 files changed, 13 insertions(+), 44 deletions(-)
diff --git a/src/modules/pas/lpt/lang/lang_en.c b/src/modules/pas/lpt/lang/lang_en.c
index 177089f..74d7c1d 100644
--- a/src/modules/pas/lpt/lang/lang_en.c
+++ b/src/modules/pas/lpt/lang/lang_en.c
@@ -132,10 +132,6 @@ static const struct tms_strings dict[] = {
&RESSTR_REPOSITORY_HTTP_RSDOWNLOADINGPKGLIST,
"Downloading package list %s from %s",
- // Keine (lokale Datei)
- &RESSTR_REPOSITORY_SINGLE_RSLOCALPKGDESC,
- "None (local file)",
-
0,
0,
};
diff --git a/src/modules/pas/lpt/lang/resstr.h b/src/modules/pas/lpt/lang/resstr.h
index 3ddace7..7b9b3ca 100644
--- a/src/modules/pas/lpt/lang/resstr.h
+++ b/src/modules/pas/lpt/lang/resstr.h
@@ -52,6 +52,5 @@ extern void* RESSTR_REPOSITORIES_RSUNKNOWNREPOTYPE;
extern void* RESSTR_REPOSITORIES_RSINVALIDPKGSRC;
extern void* RESSTR_REPOSITORY_BASE_RSNOPACKAGELIST;
extern void* RESSTR_REPOSITORY_HTTP_RSDOWNLOADINGPKGLIST;
-extern void* RESSTR_REPOSITORY_SINGLE_RSLOCALPKGDESC;
#endif
diff --git a/src/modules/pas/lpt/repository_single.pas b/src/modules/pas/lpt/repository_single.pas
index 8ab1e2b..d1f100c 100644
--- a/src/modules/pas/lpt/repository_single.pas
+++ b/src/modules/pas/lpt/repository_single.pas
@@ -2,7 +2,7 @@ unit repository_single;
{$MODE ObjFPC}
interface
-uses sysutils, classes, tar, packages, helpers, repository_base;
+uses sysutils, classes, tar, packages, helpers, repository_base, pkglist;
type
TSFRepository = class(TRepository)
@@ -16,9 +16,6 @@ type
implementation
-resourcestring
- rsLocalPkgDesc = 'Keine (lokale Datei)';
-
constructor TSFRepository.create(parent : TCollection);
begin
inherited;
@@ -49,56 +46,33 @@ var
package: TTarArchive;
line: String;
i: integer;
- size: integer;
package_file_string: String;
- pkg_name, pkg_version, pkg_section, pkg_arch: String;
+ plp: TPkglistParser;
pkg: TPackage;
section: TPackageSection;
version: TPackageVersion;
begin
+ plp := TPkglistParser.create(pkgset);
package := TTarArchive.create(self.url);
while package.hasNext do begin
line := package.nextFilename;
- size := package.nextSize;
i := Pos('packageinfo', line);
- if i > 0 then begin
+ if (i > 0) then begin
(* Metadaten laden *)
package_file_string := package.ExtractString();
- (* Newline-getrennte Infos auslesen. *)
- (* In Reihenfolge: Name, Version, Sektion, Architektur *)
- i := Pos(#10, package_file_string);
- pkg_name := Copy(package_file_string, 1, i - 1);
- package_file_string :=
- Copy(package_file_string, i + 1, Length(package_file_string));
-
- i := Pos(#10, package_file_string);
- pkg_version := Copy(package_file_string, 1, i - 1);
- package_file_string :=
- Copy(package_file_string, i + 1, Length(package_file_string));
-
- i := Pos(#10, package_file_string);
- pkg_section := Copy(package_file_string, 1, i - 1);
- package_file_string :=
- Copy(package_file_string, i + 1, Length(package_file_string));
-
- i := Pos(#10, package_file_string);
- pkg_arch := Copy(package_file_string, 1, i - 1);
- package_file_string :=
- Copy(package_file_string, i + 1, Length(package_file_string));
+ while Length(package_file_string) > 0 do begin
+ i := Pos(#10, package_file_string);
+ if i <= 0 then begin
+ i := Length(package_file_string);
+ end;
- (* Prüfen ob Metadaten zu Paket passen *)
- if (line = 'packages/'+pkg_name+'/'+pkg_version+'/packageinfo-'+pkg_section) then begin
- pkg := pkgset.add(pkg_name);
- pkg.desc := rsLocalPkgDesc;
- section := pkg.add(pkg_section);
- version := section.add(pkg_version);
- version.pkg := pkg;
- version.section := section;
- version.repository := self.name;
- break;
+ line := Copy(package_file_string, 1, i - 1);
+ plp.ProcessLine(line, self.name);
+ package_file_string := Copy(package_file_string, i + 1,
+ Length(package_file_string));
end;
end else begin
package.skipFile();
--
1.6.3.3