* Moved global procedure to metod of TpkgFPpkg

git-svn-id: trunk@35482 -
This commit is contained in:
joost 2017-02-25 20:46:42 +00:00
parent f353416fd4
commit 10dfda977c
2 changed files with 34 additions and 27 deletions

View File

@ -41,6 +41,7 @@ type
procedure InitializeGlobalOptions(CfgFile: string);
procedure InitializeCompilerOptions;
procedure LoadLocalAvailableMirrors;
procedure ScanAvailablePackages;
procedure ScanPackages;
@ -76,6 +77,7 @@ implementation
uses
fpmkunit,
fpxmlrep,
pkgrepos;
{ TpkgFPpkg }
@ -240,6 +242,37 @@ begin
FFPMakeCompilerOptions.LogValues(llDebug,'fpmake-building');
end;
procedure TpkgFPpkg.LoadLocalAvailableMirrors;
var
S : String;
X : TFPXMLMirrorHandler;
begin
if assigned(AvailableMirrors) then
AvailableMirrors.Free;
AvailableMirrors:=TFPMirrors.Create(TFPMirror);
// Repository
S:=Options.GlobalSection.LocalMirrorsFile;
log(llDebug,SLogLoadingMirrorsFile,[S]);
if not FileExists(S) then
exit;
try
X:=TFPXMLMirrorHandler.Create;
With X do
try
LoadFromXml(AvailableMirrors,S);
finally
Free;
end;
except
on E : Exception do
begin
Log(llError,E.Message);
Error(SErrCorruptMirrorsFile,[S]);
end;
end;
end;
procedure TpkgFPpkg.ScanAvailablePackages;
var
Repo: TFPRepository;

View File

@ -60,34 +60,8 @@ end;
*****************************************************************************}
procedure LoadLocalAvailableMirrors;
var
S : String;
X : TFPXMLMirrorHandler;
begin
if assigned(AvailableMirrors) then
AvailableMirrors.Free;
AvailableMirrors:=TFPMirrors.Create(TFPMirror);
// Repository
S:=GFPpkg.Options.GlobalSection.LocalMirrorsFile;
log(llDebug,SLogLoadingMirrorsFile,[S]);
if not FileExists(S) then
exit;
try
X:=TFPXMLMirrorHandler.Create;
With X do
try
LoadFromXml(AvailableMirrors,S);
finally
Free;
end;
except
on E : Exception do
begin
Log(llError,E.Message);
Error(SErrCorruptMirrorsFile,[S]);
end;
end;
GFPpkg.LoadLocalAvailableMirrors;
end;