mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-08 16:28:24 +02:00
* Fixed the ability to build packages in .source.zip files
from the command-line. +test git-svn-id: trunk@36715 -
This commit is contained in:
parent
13e76ccc01
commit
19b60c0cf3
@ -62,6 +62,17 @@ type
|
||||
function GetBuildPathDirectory(APackage: TFPPackage): string; override;
|
||||
end;
|
||||
|
||||
{ TFPArchiveFilenamePackagesStructure }
|
||||
|
||||
TFPArchiveFilenamePackagesStructure = class(TFPCustomPackagesStructure)
|
||||
private
|
||||
FArchiveFileName: string;
|
||||
public
|
||||
function AddPackagesToRepository(ARepository: TFPRepository): Boolean; override;
|
||||
function UnzipBeforeUse: Boolean; override;
|
||||
property ArchiveFileName: string read FArchiveFileName write FArchiveFileName;
|
||||
end;
|
||||
|
||||
{ TFPOriginalSourcePackagesStructure }
|
||||
|
||||
TFPOriginalSourcePackagesStructure = class(TFPCustomPackagesStructure)
|
||||
@ -95,6 +106,23 @@ uses
|
||||
pkgrepos,
|
||||
pkgglobals;
|
||||
|
||||
{ TFPArchiveFilenamePackagesStructure }
|
||||
|
||||
function TFPArchiveFilenamePackagesStructure.AddPackagesToRepository(ARepository: TFPRepository): Boolean;
|
||||
var
|
||||
Package: TFPPackage;
|
||||
begin
|
||||
Result := True;
|
||||
Package := ARepository.AddPackage(CmdLinePackageName);
|
||||
Package.LocalFileName := FArchiveFileName;
|
||||
Package.PackagesStructure := Self;
|
||||
end;
|
||||
|
||||
function TFPArchiveFilenamePackagesStructure.UnzipBeforeUse: Boolean;
|
||||
begin
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
{ TFPCustomFileSystemPackagesStructure }
|
||||
|
||||
function TFPCustomFileSystemPackagesStructure.GetPath: string;
|
||||
|
@ -50,6 +50,7 @@ type
|
||||
procedure TestUninstalledRepository;
|
||||
procedure TestBrokenPackagesBetweenRepos;
|
||||
procedure TestPackageDependenciesBetweenRepos;
|
||||
procedure TestBuildOfArchiveFile;
|
||||
end;
|
||||
|
||||
{ TFullFPCInstallationSetup }
|
||||
@ -582,6 +583,27 @@ begin
|
||||
Check(pos('(B)',s) = 0, 'There are no broken packages, fppkg should report so.');
|
||||
end;
|
||||
|
||||
procedure TFullFPCInstallationTests.TestBuildOfArchiveFile;
|
||||
var
|
||||
ArchiveFileName, s: String;
|
||||
begin
|
||||
TFullFPCInstallationSetup.SyncPackageIntoCurrentTest('packagea');
|
||||
// Build and install package
|
||||
RunFppkgIndir(TFullFPCInstallationSetup.GetCurrentTestBasePackagesPath + 'packagea', ['archive'], 'Create archive for PackageA');
|
||||
ArchiveFileName := ConcatPaths([TFullFPCInstallationSetup.GetCurrentTestBasePackagesPath, 'packagea', 'packagea-1.2.3.source.zip']);
|
||||
Check(FileExists(ArchiveFileName), 'Archive packagea-1.2.3.source.zip does exist');
|
||||
|
||||
RunFppkgIndir(TFullFPCInstallationSetup.GetCurrentTestPath, ['build', ArchiveFileName], 'Build packagea-1.2.3.source.zip');
|
||||
RunFppkgIndir(TFullFPCInstallationSetup.GetCurrentTestPath, ['install', ArchiveFileName], 'install packagea-1.2.3.source.zip');
|
||||
|
||||
// Test installation
|
||||
s := RunFppkgIndir(TFullFPCInstallationSetup.GetCurrentTestPath, ['list'], 'list packages');
|
||||
Check(pos('packagea', s) > 0, 'Just installed PackageA is not in package-list');
|
||||
Check(FileExists(ConcatPaths([TFullFPCInstallationSetup.GetCurrentTestPath,'user','lib','fpc', TFullFPCInstallationSetup.GetCompilerVersion, 'units',TFullFPCInstallationSetup.GetTargetString,'packagea','PackageAUnitA.ppu'])), 'PackageAUnitA.ppu not found');
|
||||
Check(FileExists(ConcatPaths([TFullFPCInstallationSetup.GetCurrentTestPath,'user','lib','fpc', TFullFPCInstallationSetup.GetCompilerVersion, 'units',TFullFPCInstallationSetup.GetTargetString,'packagea','PackageAUnitA.o'])), 'PackageAUnitA.o not found');
|
||||
Check(FileExists(ConcatPaths([TFullFPCInstallationSetup.GetCurrentTestPath,'user','lib','fpc', TFullFPCInstallationSetup.GetCompilerVersion, 'fpmkinst',TFullFPCInstallationSetup.GetTargetString,'packagea.fpm'])), 'PackageAUnitA.fpm not found');
|
||||
end;
|
||||
|
||||
procedure TFullFPCInstallationTests.TestCleanupOfTemporaryBuildpath;
|
||||
var
|
||||
SR: TSearchRec;
|
||||
|
@ -288,6 +288,7 @@ var
|
||||
SL : TStringList;
|
||||
Repo: TFPRepository;
|
||||
InstPackages: TFPCurrentDirectoryPackagesStructure;
|
||||
ArchivePackages: TFPArchiveFilenamePackagesStructure;
|
||||
begin
|
||||
OldCurrDir:=GetCurrentDir;
|
||||
Try
|
||||
@ -386,6 +387,18 @@ begin
|
||||
begin
|
||||
if sametext(ExtractFileExt(ParaPackages[i]),'.zip') and FileExists(ParaPackages[i]) then
|
||||
begin
|
||||
Repo := TFPRepository.Create(GFPpkg);
|
||||
GFPpkg.RepositoryList.Add(Repo);
|
||||
Repo.RepositoryType := fprtAvailable;
|
||||
Repo.RepositoryName := 'ArchiveFile';
|
||||
Repo.Description := 'Package in archive-file';
|
||||
ArchivePackages := TFPArchiveFilenamePackagesStructure.Create(GFPpkg);
|
||||
ArchivePackages.InitializeWithOptions(nil, GFPpkg.Options, GFPpkg.CompilerOptions);
|
||||
ArchivePackages.ArchiveFileName := ParaPackages[i];
|
||||
ArchivePackages.AddPackagesToRepository(Repo);
|
||||
Repo.DefaultPackagesStructure := ArchivePackages;
|
||||
|
||||
pkgglobals.Log(llDebug,SLogCommandLineAction,['['+CmdLinePackageName+']',ParaAction]);
|
||||
pkghandler.ExecuteAction(CmdLinePackageName,ParaAction,GFPpkg);
|
||||
end
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user