mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 21:33:17 +02:00
* Do not stop on invalid package-files, but show a warning + test
git-svn-id: trunk@35770 -
This commit is contained in:
parent
a9d4b17638
commit
977a82b866
@ -83,6 +83,7 @@ Resourcestring
|
|||||||
SLogLoadingMirrorsFile = 'Loading available mirrors from "%s"';
|
SLogLoadingMirrorsFile = 'Loading available mirrors from "%s"';
|
||||||
SLogFindInstalledPackages = 'Searching for installed packages in "%s"';
|
SLogFindInstalledPackages = 'Searching for installed packages in "%s"';
|
||||||
SLogFoundPackageInFile = 'Found package "%s" in file "%s"';
|
SLogFoundPackageInFile = 'Found package "%s" in file "%s"';
|
||||||
|
SLogFailedLoadingPackage = 'Failed to load package "%s" in file "%s". Package is skipped. Message: %s';
|
||||||
SLogFoundFPMakeAddin = 'Found FPMake-AddIn "%s"';
|
SLogFoundFPMakeAddin = 'Found FPMake-AddIn "%s"';
|
||||||
SLogUpdateFPMakeAddin = 'FPMake-AddIn "%s" updated';
|
SLogUpdateFPMakeAddin = 'FPMake-AddIn "%s" updated';
|
||||||
SLogSavingStatusFile = 'Saving local status to "%s"';
|
SLogSavingStatusFile = 'Saving local status to "%s"';
|
||||||
|
@ -31,6 +31,7 @@ type
|
|||||||
protected
|
protected
|
||||||
function GetPath: string; virtual;
|
function GetPath: string; virtual;
|
||||||
procedure SetPath(AValue: string); virtual;
|
procedure SetPath(AValue: string); virtual;
|
||||||
|
procedure AddPackageToRepository(ARepository: TFPRepository; APackageName: string; APackageFilename: string);
|
||||||
public
|
public
|
||||||
property Path: string read GetPath write SetPath;
|
property Path: string read GetPath write SetPath;
|
||||||
end;
|
end;
|
||||||
@ -106,6 +107,26 @@ begin
|
|||||||
FPath := AValue;
|
FPath := AValue;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TFPCustomFileSystemPackagesStructure.AddPackageToRepository(ARepository: TFPRepository; APackageName: string; APackageFilename: string);
|
||||||
|
var
|
||||||
|
P: TFPPackage;
|
||||||
|
begin
|
||||||
|
P:=ARepository.AddPackage(APackageName);
|
||||||
|
try
|
||||||
|
P.LoadUnitConfigFromFile(APackageFilename);
|
||||||
|
P.PackagesStructure:=Self;
|
||||||
|
log(llDebug,SLogFoundPackageInFile,[P.Name, APackageFilename]);
|
||||||
|
if P.IsFPMakeAddIn then
|
||||||
|
AddFPMakeAddIn(P);
|
||||||
|
except
|
||||||
|
on E: Exception do
|
||||||
|
begin
|
||||||
|
log(llWarning,SLogFailedLoadingPackage,[APackageName, APackageFilename, E.Message]);
|
||||||
|
P.Free;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
{ TFPTemporaryDirectoryPackagesStructure }
|
{ TFPTemporaryDirectoryPackagesStructure }
|
||||||
|
|
||||||
function TFPTemporaryDirectoryPackagesStructure.GetTempPackageName: string;
|
function TFPTemporaryDirectoryPackagesStructure.GetTempPackageName: string;
|
||||||
@ -290,13 +311,7 @@ begin
|
|||||||
if ((SR.Attr and faDirectory)=0) then
|
if ((SR.Attr and faDirectory)=0) then
|
||||||
begin
|
begin
|
||||||
// Try new .fpm-file
|
// Try new .fpm-file
|
||||||
UF:=FpmkDir+SR.Name;
|
AddPackageToRepository(ARepository, ChangeFileExt(SR.Name,''), FpmkDir+SR.Name);
|
||||||
P:=ARepository.AddPackage(ChangeFileExt(SR.Name,''));
|
|
||||||
P.LoadUnitConfigFromFile(UF);
|
|
||||||
P.PackagesStructure:=Self;
|
|
||||||
log(llDebug,SLogFoundPackageInFile,[P.Name, UF]);
|
|
||||||
if P.IsFPMakeAddIn then
|
|
||||||
AddFPMakeAddIn(P);
|
|
||||||
end;
|
end;
|
||||||
until FindNext(SR)<>0;
|
until FindNext(SR)<>0;
|
||||||
end;
|
end;
|
||||||
@ -317,12 +332,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
if not Assigned(ARepository.FindPackage(SR.Name)) then
|
if not Assigned(ARepository.FindPackage(SR.Name)) then
|
||||||
begin
|
begin
|
||||||
P:=ARepository.AddPackage(SR.Name);
|
AddPackageToRepository(ARepository, SR.Name, UF);
|
||||||
P.PackagesStructure:=Self;
|
|
||||||
P.LoadUnitConfigFromFile(UF);
|
|
||||||
log(llDebug,SLogFoundPackageInFile,[P.Name, UF]);
|
|
||||||
if P.IsFPMakeAddIn then
|
|
||||||
AddFPMakeAddIn(P);
|
|
||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
@ -101,7 +101,7 @@ var
|
|||||||
SRD : TSearchRec;
|
SRD : TSearchRec;
|
||||||
SRF : TSearchRec;
|
SRF : TSearchRec;
|
||||||
P : TFPPackage;
|
P : TFPPackage;
|
||||||
UF,UD : String;
|
UD : String;
|
||||||
begin
|
begin
|
||||||
Result:=false;
|
Result:=false;
|
||||||
log(llDebug,SLogFindInstalledPackages,[Path]);
|
log(llDebug,SLogFindInstalledPackages,[Path]);
|
||||||
@ -114,13 +114,7 @@ begin
|
|||||||
if FindFirst(UD+'*'+FpmkExt,faAnyFile,SRF)=0 then
|
if FindFirst(UD+'*'+FpmkExt,faAnyFile,SRF)=0 then
|
||||||
begin
|
begin
|
||||||
repeat
|
repeat
|
||||||
UF := UD+SRF.Name;
|
AddPackageToRepository(ARepository, ChangeFileExt(SRF.Name,''), UD+SRF.Name);
|
||||||
P:=ARepository.AddPackage(ChangeFileExt(SRF.Name,''));
|
|
||||||
P.LoadUnitConfigFromFile(UF);
|
|
||||||
P.PackagesStructure:=Self;
|
|
||||||
log(llDebug,SLogFoundPackageInFile,[P.Name, UF]);
|
|
||||||
if P.IsFPMakeAddIn then
|
|
||||||
AddFPMakeAddIn(P);
|
|
||||||
until FindNext(SRF)<>0;
|
until FindNext(SRF)<>0;
|
||||||
end;
|
end;
|
||||||
FindClose(SRF);
|
FindClose(SRF);
|
||||||
|
Loading…
Reference in New Issue
Block a user