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

Re: [tyndur-devel] [PATCH] lpt: Lokale Pakete



On Fri, May 29 23:41, Alexander Siol wrote:
> diff --git a/trunk/src/modules/pas/lpt/repository_single.pas b/trunk/src/modules/pas/lpt/repository_single.pas
> new file mode 100644
> index 0000000..bad6de1
> --- /dev/null
> +++ b/trunk/src/modules/pas/lpt/repository_single.pas
> ....
> +procedure TSFRepository.FetchLists(pkgset: TPackageSet);
> +var
> +    package: TTarArchive;
> +    line: String;
> +    i: integer;
> +    size: integer;
> +    pkg_counter: integer;
> +
> +    package_file_string: String;
> +    pkg_name, pkg_version, pkg_section, pkg_arch: String;
> +
> +    pkg: TPackage;
> +    section: TPackageSection;
> +    version: TPackageVersion;
> +begin
> +    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
> +            (* 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));
> +
> +            (* 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 := 'Keine (lokale Datei)';
> +                section := pkg.add(pkg_section);
> +                version := section.add(pkg_version);
> +                version.pkg := pkg;
> +                version.section := section;
> +                version.repository := self.name;
> +                pkg_counter := pkg_counter + 1;

Sollte der nicht noch initialisiert werden?

> +                break;
> +            end;
> +        end else begin
> +            package.skipFile();
> +        end;
> +    end;
> +    if pkg_counter <> 1 then begin
> +        raise EPackageList.create('Fehlerhaftes Paket (' + self.url + ')');
> +    end;
> +    package.destroy();
> +end;
> +
> +begin
> +end.

Aber ich glaube dir mal, dass du das selbst hinkriegst.
Acked-by: Antoine Kaufmann <toni@xxxxxxxxxx>
-- 
Antoine Kaufmann
<toni@xxxxxxxxxxxxxxxx>

Attachment: pgpopP54j1n7M.pgp
Description: PGP signature