|
@@ -23,9 +23,6 @@ type
|
|
|
|
|
|
TFppkgUninstalledSourceRepositoryOptionSection = class(TFppkgRepositoryOptionSection)
|
|
TFppkgUninstalledSourceRepositoryOptionSection = class(TFppkgRepositoryOptionSection)
|
|
public
|
|
public
|
|
- constructor Create(AnOptionParser: TTemplateParser); override;
|
|
|
|
- function InitRepository(AParent: TComponent; ACompilerOptions: TCompilerOptions): TFPRepository; override;
|
|
|
|
-
|
|
|
|
function GetRepositoryType: TFPRepositoryType; override;
|
|
function GetRepositoryType: TFPRepositoryType; override;
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -33,6 +30,9 @@ type
|
|
|
|
|
|
TFPUninstalledSourcesAvailablePackagesStructure = class(TFPCustomFileSystemPackagesStructure)
|
|
TFPUninstalledSourcesAvailablePackagesStructure = class(TFPCustomFileSystemPackagesStructure)
|
|
public
|
|
public
|
|
|
|
+ class function GetRepositoryOptionSectionClass: TFppkgRepositoryOptionSectionClass; override;
|
|
|
|
+ procedure InitializeWithOptions(ARepoOptionSection: TFppkgRepositoryOptionSection; AnOptions: TFppkgOptions; ACompilerOptions: TCompilerOptions); override;
|
|
|
|
+
|
|
function AddPackagesToRepository(ARepository: TFPRepository): Boolean; override;
|
|
function AddPackagesToRepository(ARepository: TFPRepository): Boolean; override;
|
|
function GetBuildPathDirectory(APackage: TFPPackage): string; override;
|
|
function GetBuildPathDirectory(APackage: TFPPackage): string; override;
|
|
end;
|
|
end;
|
|
@@ -44,8 +44,6 @@ type
|
|
private
|
|
private
|
|
FSourceRepositoryName: string;
|
|
FSourceRepositoryName: string;
|
|
public
|
|
public
|
|
- function InitRepository(AParent: TComponent; ACompilerOptions: TCompilerOptions): TFPRepository; override;
|
|
|
|
-
|
|
|
|
procedure AddKeyValue(const AKey, AValue: string); override;
|
|
procedure AddKeyValue(const AKey, AValue: string); override;
|
|
procedure LogValues(ALogLevel: TLogLevel); override;
|
|
procedure LogValues(ALogLevel: TLogLevel); override;
|
|
function GetRepositoryType: TFPRepositoryType; override;
|
|
function GetRepositoryType: TFPRepositoryType; override;
|
|
@@ -58,6 +56,9 @@ type
|
|
private
|
|
private
|
|
FSourceRepositoryName: string;
|
|
FSourceRepositoryName: string;
|
|
public
|
|
public
|
|
|
|
+ class function GetRepositoryOptionSectionClass: TFppkgRepositoryOptionSectionClass; override;
|
|
|
|
+ procedure InitializeWithOptions(ARepoOptionSection: TFppkgRepositoryOptionSection; AnOptions: TFppkgOptions; ACompilerOptions: TCompilerOptions); override;
|
|
|
|
+
|
|
function AddPackagesToRepository(ARepository: TFPRepository): Boolean; override;
|
|
function AddPackagesToRepository(ARepository: TFPRepository): Boolean; override;
|
|
function IsInstallationNeeded(APackage: TFPPackage): TFPInstallationNeeded; override;
|
|
function IsInstallationNeeded(APackage: TFPPackage): TFPInstallationNeeded; override;
|
|
function GetBaseInstallDir: string; override;
|
|
function GetBaseInstallDir: string; override;
|
|
@@ -77,6 +78,23 @@ const
|
|
|
|
|
|
{ TFPUninstalledSourcesPackagesStructure }
|
|
{ TFPUninstalledSourcesPackagesStructure }
|
|
|
|
|
|
|
|
+class function TFPUninstalledSourcesPackagesStructure.GetRepositoryOptionSectionClass: TFppkgRepositoryOptionSectionClass;
|
|
|
|
+begin
|
|
|
|
+ Result := TFppkgUninstalledRepositoryOptionSection;
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+procedure TFPUninstalledSourcesPackagesStructure.InitializeWithOptions(
|
|
|
|
+ ARepoOptionSection: TFppkgRepositoryOptionSection; AnOptions: TFppkgOptions;
|
|
|
|
+ ACompilerOptions: TCompilerOptions);
|
|
|
|
+var
|
|
|
|
+ RepoOptionSection: TFppkgUninstalledRepositoryOptionSection;
|
|
|
|
+begin
|
|
|
|
+ inherited InitializeWithOptions(ARepoOptionSection, AnOptions, ACompilerOptions);
|
|
|
|
+ RepoOptionSection := ARepoOptionSection as TFppkgUninstalledRepositoryOptionSection;
|
|
|
|
+ path := RepoOptionSection.Path;
|
|
|
|
+ SourceRepositoryName := RepoOptionSection.SourceRepositoryName;
|
|
|
|
+end;
|
|
|
|
+
|
|
function TFPUninstalledSourcesPackagesStructure.AddPackagesToRepository(ARepository: TFPRepository): Boolean;
|
|
function TFPUninstalledSourcesPackagesStructure.AddPackagesToRepository(ARepository: TFPRepository): Boolean;
|
|
|
|
|
|
procedure LoadPackagefpcFromFile(APackage:TFPPackage;const AFileName: String);
|
|
procedure LoadPackagefpcFromFile(APackage:TFPPackage;const AFileName: String);
|
|
@@ -101,12 +119,12 @@ var
|
|
UF,UD : String;
|
|
UF,UD : String;
|
|
begin
|
|
begin
|
|
Result:=false;
|
|
Result:=false;
|
|
- log(llDebug,SLogFindInstalledPackages,[FPath]);
|
|
|
|
- if FindFirst(FPath+AllFiles,faDirectory,SRD)=0 then
|
|
|
|
|
|
+ log(llDebug,SLogFindInstalledPackages,[Path]);
|
|
|
|
+ if FindFirst(Path+AllFiles,faDirectory,SRD)=0 then
|
|
begin
|
|
begin
|
|
repeat
|
|
repeat
|
|
// Try new .fpm-file
|
|
// Try new .fpm-file
|
|
- UD:=FPath+SRD.Name+PathDelim;
|
|
|
|
|
|
+ UD:=Path+SRD.Name+PathDelim;
|
|
|
|
|
|
if FindFirst(UD+'*'+FpmkExt,faAnyFile,SRF)=0 then
|
|
if FindFirst(UD+'*'+FpmkExt,faAnyFile,SRF)=0 then
|
|
begin
|
|
begin
|
|
@@ -137,7 +155,7 @@ end;
|
|
|
|
|
|
function TFPUninstalledSourcesPackagesStructure.GetBaseInstallDir: string;
|
|
function TFPUninstalledSourcesPackagesStructure.GetBaseInstallDir: string;
|
|
begin
|
|
begin
|
|
- Result := FPath;
|
|
|
|
|
|
+ Result := Path;
|
|
end;
|
|
end;
|
|
|
|
|
|
function TFPUninstalledSourcesPackagesStructure.GetConfigFileForPackage(APackage: TFPPackage): string;
|
|
function TFPUninstalledSourcesPackagesStructure.GetConfigFileForPackage(APackage: TFPPackage): string;
|
|
@@ -152,24 +170,6 @@ end;
|
|
|
|
|
|
{ TFppkgUninstalledRepositoryOptionSection }
|
|
{ TFppkgUninstalledRepositoryOptionSection }
|
|
|
|
|
|
-function TFppkgUninstalledRepositoryOptionSection.InitRepository(AParent: TComponent;
|
|
|
|
- ACompilerOptions: TCompilerOptions): TFPRepository;
|
|
|
|
-var
|
|
|
|
- InstPackages: TFPUninstalledSourcesPackagesStructure;
|
|
|
|
-begin
|
|
|
|
- if Path <> '' then
|
|
|
|
- begin
|
|
|
|
- Result := TFPRepository.Create(AParent);
|
|
|
|
- Result.RepositoryType := GetRepositoryType;
|
|
|
|
- Result.RepositoryName := RepositoryName;
|
|
|
|
- Result.Description := Description;
|
|
|
|
- InstPackages := TFPUninstalledSourcesPackagesStructure.Create(AParent, Path, ACompilerOptions);
|
|
|
|
- InstPackages.InstallRepositoryName := InstallRepositoryName;
|
|
|
|
- InstPackages.SourceRepositoryName := SourceRepositoryName;
|
|
|
|
- Result.DefaultPackagesStructure := InstPackages;
|
|
|
|
- end;
|
|
|
|
-end;
|
|
|
|
-
|
|
|
|
procedure TFppkgUninstalledRepositoryOptionSection.AddKeyValue(const AKey, AValue: string);
|
|
procedure TFppkgUninstalledRepositoryOptionSection.AddKeyValue(const AKey, AValue: string);
|
|
begin
|
|
begin
|
|
if SameText(AKey,KeySourceRepository) then
|
|
if SameText(AKey,KeySourceRepository) then
|
|
@@ -191,35 +191,26 @@ end;
|
|
|
|
|
|
{ TFppkgUninstalledSourceRepositoryOptionSection }
|
|
{ TFppkgUninstalledSourceRepositoryOptionSection }
|
|
|
|
|
|
-constructor TFppkgUninstalledSourceRepositoryOptionSection.Create(AnOptionParser: TTemplateParser);
|
|
|
|
|
|
+function TFppkgUninstalledSourceRepositoryOptionSection.GetRepositoryType: TFPRepositoryType;
|
|
begin
|
|
begin
|
|
- inherited Create(AnOptionParser);
|
|
|
|
|
|
+ Result := fprtAvailable;
|
|
end;
|
|
end;
|
|
|
|
|
|
-function TFppkgUninstalledSourceRepositoryOptionSection.InitRepository(AParent: TComponent;
|
|
|
|
- ACompilerOptions: TCompilerOptions): TFPRepository;
|
|
|
|
-var
|
|
|
|
- InstPackages: TFPUninstalledSourcesAvailablePackagesStructure;
|
|
|
|
|
|
+{ TFPUninstalledSourcesPackagesStructure }
|
|
|
|
+
|
|
|
|
+class function TFPUninstalledSourcesAvailablePackagesStructure.GetRepositoryOptionSectionClass: TFppkgRepositoryOptionSectionClass;
|
|
begin
|
|
begin
|
|
- if Path <> '' then
|
|
|
|
- begin
|
|
|
|
- Result := TFPRepository.Create(AParent);
|
|
|
|
- Result.RepositoryType := GetRepositoryType;
|
|
|
|
- Result.RepositoryName := RepositoryName;
|
|
|
|
- Result.Description := Description;
|
|
|
|
- InstPackages := TFPUninstalledSourcesAvailablePackagesStructure.Create(AParent, Path, ACompilerOptions);
|
|
|
|
- InstPackages.InstallRepositoryName := InstallRepositoryName;
|
|
|
|
- Result.DefaultPackagesStructure := InstPackages;
|
|
|
|
- end;
|
|
|
|
|
|
+ Result := TFppkgUninstalledSourceRepositoryOptionSection;
|
|
end;
|
|
end;
|
|
|
|
|
|
-function TFppkgUninstalledSourceRepositoryOptionSection.GetRepositoryType: TFPRepositoryType;
|
|
|
|
|
|
+procedure TFPUninstalledSourcesAvailablePackagesStructure.InitializeWithOptions(
|
|
|
|
+ ARepoOptionSection: TFppkgRepositoryOptionSection; AnOptions: TFppkgOptions;
|
|
|
|
+ ACompilerOptions: TCompilerOptions);
|
|
begin
|
|
begin
|
|
- Result := fprtAvailable;
|
|
|
|
|
|
+ inherited InitializeWithOptions(ARepoOptionSection, AnOptions, ACompilerOptions);
|
|
|
|
+ path := TFppkgUninstalledSourceRepositoryOptionSection(ARepoOptionSection).Path;
|
|
end;
|
|
end;
|
|
|
|
|
|
-{ TFPUninstalledSourcesPackagesStructure }
|
|
|
|
-
|
|
|
|
function TFPUninstalledSourcesAvailablePackagesStructure.AddPackagesToRepository(ARepository: TFPRepository): Boolean;
|
|
function TFPUninstalledSourcesAvailablePackagesStructure.AddPackagesToRepository(ARepository: TFPRepository): Boolean;
|
|
|
|
|
|
var
|
|
var
|
|
@@ -232,7 +223,8 @@ var
|
|
begin
|
|
begin
|
|
Result:=false;
|
|
Result:=false;
|
|
|
|
|
|
- TempPackagesStructure := TFPTemporaryDirectoryPackagesStructure.Create(Owner, '', FCompilerOptions);
|
|
|
|
|
|
+ TempPackagesStructure := TFPTemporaryDirectoryPackagesStructure.Create(Owner);
|
|
|
|
+ TempPackagesStructure.InitializeWithOptions(nil, FOptions, FCompilerOptions);
|
|
TempRepo := TFPRepository.Create(Owner);
|
|
TempRepo := TFPRepository.Create(Owner);
|
|
TempRepo.RepositoryName := 'TempScanUninstPackages';
|
|
TempRepo.RepositoryName := 'TempScanUninstPackages';
|
|
TempRepo.Description := 'Temp list of packages during scanning of source-packages';
|
|
TempRepo.Description := 'Temp list of packages during scanning of source-packages';
|
|
@@ -242,21 +234,21 @@ begin
|
|
GFPpkg.RepositoryList.Add(TempRepo);
|
|
GFPpkg.RepositoryList.Add(TempRepo);
|
|
|
|
|
|
try
|
|
try
|
|
- log(llDebug,SLogFindInstalledPackages,[FPath]);
|
|
|
|
- if FindFirst(FPath+AllFiles,faDirectory,SR)=0 then
|
|
|
|
|
|
+ log(llDebug,SLogFindInstalledPackages,[Path]);
|
|
|
|
+ if FindFirst(Path+AllFiles,faDirectory,SR)=0 then
|
|
begin
|
|
begin
|
|
repeat
|
|
repeat
|
|
if ((SR.Attr and faDirectory)=faDirectory) and (SR.Name<>'.') and (SR.Name<>'..') then
|
|
if ((SR.Attr and faDirectory)=faDirectory) and (SR.Name<>'.') and (SR.Name<>'..') then
|
|
begin
|
|
begin
|
|
- AFPMakeFile := FPath+SR.Name+PathDelim+FPMakePPFile;
|
|
|
|
|
|
+ AFPMakeFile := Path+SR.Name+PathDelim+FPMakePPFile;
|
|
if FileExistsLog(AFPMakeFile) then
|
|
if FileExistsLog(AFPMakeFile) then
|
|
begin
|
|
begin
|
|
- AManifestFile := FPath+SR.Name+PathDelim+ManifestFile;
|
|
|
|
|
|
+ AManifestFile := Path+SR.Name+PathDelim+ManifestFile;
|
|
if not FileExists(AManifestFile) or (FileAge(AManifestFile) < FileAge(AFPMakeFile)) then
|
|
if not FileExists(AManifestFile) or (FileAge(AManifestFile) < FileAge(AFPMakeFile)) then
|
|
begin
|
|
begin
|
|
// (Re-)create manifest
|
|
// (Re-)create manifest
|
|
try
|
|
try
|
|
- TempPackagesStructure.SetTempPath(FPath+SR.Name);
|
|
|
|
|
|
+ TempPackagesStructure.SetTempPath(Path+SR.Name);
|
|
PackageName := SR.Name + '_create_manifest';
|
|
PackageName := SR.Name + '_create_manifest';
|
|
TempPackagesStructure.TempPackageName := PackageName;
|
|
TempPackagesStructure.TempPackageName := PackageName;
|
|
pkghandler.ExecuteAction(PackageName,'fpmakemanifest',GFPpkg);
|
|
pkghandler.ExecuteAction(PackageName,'fpmakemanifest',GFPpkg);
|
|
@@ -291,10 +283,12 @@ end;
|
|
function TFPUninstalledSourcesAvailablePackagesStructure.GetBuildPathDirectory(APackage: TFPPackage): string;
|
|
function TFPUninstalledSourcesAvailablePackagesStructure.GetBuildPathDirectory(APackage: TFPPackage): string;
|
|
begin
|
|
begin
|
|
if APackage.SourcePath<>'' then
|
|
if APackage.SourcePath<>'' then
|
|
- Result := FPath+APackage.SourcePath
|
|
|
|
|
|
+ Result := Path+APackage.SourcePath
|
|
else
|
|
else
|
|
- Result := FPath+APackage.Name
|
|
|
|
|
|
+ Result := Path+APackage.Name
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+initialization
|
|
|
|
+ TFPCustomPackagesStructure.RegisterPackagesStructureClass(TFPUninstalledSourcesAvailablePackagesStructure);
|
|
end.
|
|
end.
|
|
|
|
|