mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-19 20:19:25 +02:00
* fix unzipping
git-svn-id: trunk@6484 -
This commit is contained in:
parent
429f66b4ee
commit
0a4e18b37d
@ -41,7 +41,10 @@ begin
|
||||
try
|
||||
repeat
|
||||
if (Info.Attr and faDirectory)=faDirectory then
|
||||
DeleteDir(ADir+PathDelim+Info.Name)
|
||||
begin
|
||||
if (Info.Name<>'.') and (Info.Name<>'..') then
|
||||
DeleteDir(ADir+PathDelim+Info.Name)
|
||||
end
|
||||
else
|
||||
DeleteFile(ADir+PathDelim+Info.Name);
|
||||
until FindNext(Info)<>0;
|
||||
@ -60,12 +63,15 @@ Var
|
||||
begin
|
||||
ArchiveFile:=PackageLocalArchive;
|
||||
BuildDir:=PackageBuildPath;
|
||||
{ Remove existing builddir }
|
||||
{ Download file if it doesn't exists yet }
|
||||
if not FileExists(ArchiveFile) then
|
||||
ExecuteAction(CurrentPackage,'downloadpackage');
|
||||
{ Create builddir, remove it first if needed }
|
||||
if DirectoryExists(BuildDir) then
|
||||
DeleteDir(BuildDir);
|
||||
{ Unzip Archive }
|
||||
ForceDirectories(BuildDir);
|
||||
SetCurrentDir(BuildDir);
|
||||
{ Unzip Archive }
|
||||
With TUnZipper.Create do
|
||||
try
|
||||
Log(vCommands,SLogUnzippping,[ArchiveFile]);
|
||||
|
@ -22,6 +22,13 @@ type
|
||||
Function Execute(const Args:TActionArgs):boolean;override;
|
||||
end;
|
||||
|
||||
{ TCommandUnzip }
|
||||
|
||||
TCommandUnzip = Class(TPackagehandler)
|
||||
Public
|
||||
Function Execute(const Args:TActionArgs):boolean;override;
|
||||
end;
|
||||
|
||||
{ TCommandBuild }
|
||||
|
||||
TCommandBuild = Class(TPackagehandler)
|
||||
@ -61,17 +68,22 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
function TCommandUnzip.Execute(const Args:TActionArgs):boolean;
|
||||
begin
|
||||
if not assigned(CurrentPackage) then
|
||||
Error(SErrNoPackageSpecified);
|
||||
ExecuteAction(CurrentPackage,'unziparchive',Args);
|
||||
end;
|
||||
|
||||
|
||||
function TCommandBuild.Execute(const Args:TActionArgs):boolean;
|
||||
begin
|
||||
if assigned(CurrentPackage) then
|
||||
begin
|
||||
if not FileExists(PackageLocalArchive) then
|
||||
ExecuteAction(CurrentPackage,'downloadpackage',Args);
|
||||
if not DirectoryExists(PackageBuildPath) then
|
||||
ExecuteAction(CurrentPackage,'unziparchive',Args);
|
||||
end;
|
||||
ExecuteAction(CurrentPackage,'fpmakebuild',Args);
|
||||
ExecuteAction(CurrentPackage,'compilefpmake',Args);
|
||||
end;
|
||||
|
||||
|
||||
@ -85,6 +97,7 @@ end;
|
||||
initialization
|
||||
RegisterPkgHandler('update',TCommandUpdate);
|
||||
RegisterPkgHandler('download',TCommandDownload);
|
||||
RegisterPkgHandler('unzip',TCommandUnzip);
|
||||
RegisterPkgHandler('build',TCommandBuild);
|
||||
RegisterPkgHandler('install',TCommandInstall);
|
||||
end.
|
||||
|
@ -101,6 +101,9 @@ Var
|
||||
I : integer;
|
||||
FPMakeBin : string;
|
||||
begin
|
||||
{ Maybe compile fpmake executable? }
|
||||
ExecuteAction(CurrentPackage,'compilefpmake');
|
||||
{ Run FPMake }
|
||||
FPMakeBin:='fpmake'+ExeExt;
|
||||
SetCurrentDir(PackageBuildPath);
|
||||
Result:=ExecuteProcess(FPMakeBin,Command);
|
||||
|
@ -44,7 +44,7 @@ type
|
||||
Procedure Log(Level: TVerbosity;Fmt : String; const Args : array of const);
|
||||
Procedure Error(Msg : String);
|
||||
Procedure Error(Fmt : String; const Args : array of const);
|
||||
procedure ExecuteAction(APackage:TFPPackage;const AAction:string;const Args:TActionArgs);
|
||||
procedure ExecuteAction(APackage:TFPPackage;const AAction:string;const Args:TActionArgs=nil);
|
||||
Function ExecuteProcess(Const Prog,Args:String):Integer;
|
||||
Procedure SetCurrentDir(Const ADir:String);
|
||||
function PackageBuildPath:String;
|
||||
@ -63,7 +63,7 @@ type
|
||||
// Actions/PkgHandler
|
||||
procedure RegisterPkgHandler(const AAction:string;pkghandlerclass:TPackageHandlerClass);
|
||||
function GetPkgHandler(const AAction:string):TPackageHandlerClass;
|
||||
procedure ExecuteAction(APackage:TFPPackage;const AAction:string;const Args:TActionArgs);
|
||||
procedure ExecuteAction(APackage:TFPPackage;const AAction:string;const Args:TActionArgs=nil);
|
||||
|
||||
|
||||
Implementation
|
||||
@ -96,7 +96,7 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
procedure ExecuteAction(APackage:TFPPackage;const AAction:string;const Args:TActionArgs);
|
||||
procedure ExecuteAction(APackage:TFPPackage;const AAction:string;const Args:TActionArgs=nil);
|
||||
var
|
||||
pkghandlerclass : TPackageHandlerClass;
|
||||
i : integer;
|
||||
@ -203,7 +203,7 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
procedure TPackageHandler.ExecuteAction(APackage: TFPPackage; const AAction: string; const Args: TActionArgs);
|
||||
procedure TPackageHandler.ExecuteAction(APackage: TFPPackage; const AAction: string; const Args: TActionArgs=nil);
|
||||
begin
|
||||
pkghandler.ExecuteAction(APackage,AAction,Args);
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user