mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-19 14:19:31 +02:00
* add package to action and pkghandler
git-svn-id: trunk@6348 -
This commit is contained in:
parent
51dd839787
commit
70a0928914
@ -12,7 +12,7 @@ Type
|
||||
TFileTypes = set of TFileType;
|
||||
|
||||
TOS = (Amiga,Atari,Darwin,FreeBSD,Go32v2,Linux,MacOS,MorphOS,NetBSD,
|
||||
Netware,NetwLibc,OpenBSD,OS2,PalmOS,Solaris,Win32,wince,Emx);
|
||||
Netware,NetwLibc,OpenBSD,OS2,PalmOS,Solaris,Win32,Win64,wince,Emx);
|
||||
TOSes = Set of TOS;
|
||||
|
||||
TCPU = (Arm,I386,PPC,SPARC,X86_64,m68k);
|
||||
@ -165,4 +165,4 @@ begin
|
||||
OS:=StringToOs(Copy(S,P+1,Length(S)-P));
|
||||
end;
|
||||
|
||||
end.
|
||||
end.
|
||||
|
@ -12,7 +12,7 @@
|
||||
<MainUnit Value="0"/>
|
||||
<IconPath Value=".\"/>
|
||||
<TargetFileExt Value=""/>
|
||||
<ActiveEditorIndexAtStart Value="17"/>
|
||||
<ActiveEditorIndexAtStart Value="15"/>
|
||||
</General>
|
||||
<VersionInfo>
|
||||
<ProjectVersion Value=""/>
|
||||
@ -32,25 +32,25 @@
|
||||
<LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/>
|
||||
</local>
|
||||
</RunParams>
|
||||
<Units Count="23">
|
||||
<Units Count="25">
|
||||
<Unit0>
|
||||
<Filename Value="fppkg.pp"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="fppkg"/>
|
||||
<CursorPos X="14" Y="105"/>
|
||||
<TopLine Value="76"/>
|
||||
<CursorPos X="32" Y="319"/>
|
||||
<TopLine Value="305"/>
|
||||
<EditorIndex Value="0"/>
|
||||
<UsageCount Value="43"/>
|
||||
<UsageCount Value="49"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="pkgropts.pp"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="pkgropts"/>
|
||||
<CursorPos X="31" Y="201"/>
|
||||
<TopLine Value="184"/>
|
||||
<CursorPos X="32" Y="98"/>
|
||||
<TopLine Value="77"/>
|
||||
<EditorIndex Value="9"/>
|
||||
<UsageCount Value="43"/>
|
||||
<UsageCount Value="49"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit1>
|
||||
<Unit2>
|
||||
@ -58,66 +58,66 @@
|
||||
<IsPartOfProject Value="True"/>
|
||||
<CursorPos X="64" Y="8"/>
|
||||
<TopLine Value="1"/>
|
||||
<UsageCount Value="43"/>
|
||||
<UsageCount Value="49"/>
|
||||
</Unit2>
|
||||
<Unit3>
|
||||
<Filename Value="fpmktype.pp"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="fpmktype"/>
|
||||
<CursorPos X="3" Y="41"/>
|
||||
<CursorPos X="35" Y="9"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="13"/>
|
||||
<UsageCount Value="43"/>
|
||||
<UsageCount Value="49"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit3>
|
||||
<Unit4>
|
||||
<Filename Value="fpmkunit.pp"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="fpmkunit"/>
|
||||
<CursorPos X="1" Y="1"/>
|
||||
<CursorPos X="54" Y="18"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<UsageCount Value="43"/>
|
||||
<UsageCount Value="49"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit4>
|
||||
<Unit5>
|
||||
<Filename Value="fprepos.pp"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="fprepos"/>
|
||||
<CursorPos X="5" Y="678"/>
|
||||
<TopLine Value="666"/>
|
||||
<CursorPos X="44" Y="208"/>
|
||||
<TopLine Value="190"/>
|
||||
<EditorIndex Value="5"/>
|
||||
<UsageCount Value="43"/>
|
||||
<UsageCount Value="49"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit5>
|
||||
<Unit6>
|
||||
<Filename Value="fpxmlrep.pp"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="fpxmlrep"/>
|
||||
<CursorPos X="1" Y="831"/>
|
||||
<TopLine Value="794"/>
|
||||
<CursorPos X="26" Y="79"/>
|
||||
<TopLine Value="44"/>
|
||||
<EditorIndex Value="8"/>
|
||||
<UsageCount Value="43"/>
|
||||
<UsageCount Value="49"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit6>
|
||||
<Unit7>
|
||||
<Filename Value="pkghandler.pp"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="pkghandler"/>
|
||||
<CursorPos X="1" Y="115"/>
|
||||
<CursorPos X="55" Y="112"/>
|
||||
<TopLine Value="97"/>
|
||||
<EditorIndex Value="17"/>
|
||||
<UsageCount Value="43"/>
|
||||
<UsageCount Value="49"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit7>
|
||||
<Unit8>
|
||||
<Filename Value="pkgmkconv.pp"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="pkgmkconv"/>
|
||||
<CursorPos X="69" Y="697"/>
|
||||
<TopLine Value="660"/>
|
||||
<CursorPos X="24" Y="123"/>
|
||||
<TopLine Value="97"/>
|
||||
<EditorIndex Value="15"/>
|
||||
<UsageCount Value="43"/>
|
||||
<UsageCount Value="49"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit8>
|
||||
<Unit9>
|
||||
@ -127,17 +127,17 @@
|
||||
<CursorPos X="32" Y="18"/>
|
||||
<TopLine Value="5"/>
|
||||
<EditorIndex Value="14"/>
|
||||
<UsageCount Value="43"/>
|
||||
<UsageCount Value="49"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit9>
|
||||
<Unit10>
|
||||
<Filename Value="pkgmessages.pp"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="pkgmessages"/>
|
||||
<CursorPos X="3" Y="43"/>
|
||||
<TopLine Value="6"/>
|
||||
<CursorPos X="43" Y="29"/>
|
||||
<TopLine Value="12"/>
|
||||
<EditorIndex Value="12"/>
|
||||
<UsageCount Value="43"/>
|
||||
<UsageCount Value="49"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit10>
|
||||
<Unit11>
|
||||
@ -145,21 +145,21 @@
|
||||
<UnitName Value="streamcoll"/>
|
||||
<CursorPos X="66" Y="88"/>
|
||||
<TopLine Value="65"/>
|
||||
<UsageCount Value="8"/>
|
||||
<UsageCount Value="7"/>
|
||||
</Unit11>
|
||||
<Unit12>
|
||||
<Filename Value="streamcoll20.pp"/>
|
||||
<UnitName Value="streamcoll"/>
|
||||
<CursorPos X="3" Y="15"/>
|
||||
<TopLine Value="1"/>
|
||||
<UsageCount Value="8"/>
|
||||
<UsageCount Value="7"/>
|
||||
</Unit12>
|
||||
<Unit13>
|
||||
<Filename Value="..\..\..\fpc20\rtl\objpas\classes\classesh.inc"/>
|
||||
<CursorPos X="24" Y="518"/>
|
||||
<TopLine Value="486"/>
|
||||
<CursorPos X="17" Y="1345"/>
|
||||
<TopLine Value="1326"/>
|
||||
<EditorIndex Value="2"/>
|
||||
<UsageCount Value="21"/>
|
||||
<UsageCount Value="24"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit13>
|
||||
<Unit14>
|
||||
@ -167,7 +167,7 @@
|
||||
<CursorPos X="38" Y="277"/>
|
||||
<TopLine Value="269"/>
|
||||
<EditorIndex Value="16"/>
|
||||
<UsageCount Value="21"/>
|
||||
<UsageCount Value="24"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit14>
|
||||
<Unit15>
|
||||
@ -175,7 +175,7 @@
|
||||
<UnitName Value="contnrs"/>
|
||||
<CursorPos X="1" Y="19"/>
|
||||
<TopLine Value="1"/>
|
||||
<UsageCount Value="8"/>
|
||||
<UsageCount Value="7"/>
|
||||
</Unit15>
|
||||
<Unit16>
|
||||
<Filename Value="contnrs20.pp"/>
|
||||
@ -183,33 +183,33 @@
|
||||
<CursorPos X="1" Y="1"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="3"/>
|
||||
<UsageCount Value="15"/>
|
||||
<UsageCount Value="18"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit16>
|
||||
<Unit17>
|
||||
<Filename Value="pkgcommands.pp"/>
|
||||
<UnitName Value="pkgcommands"/>
|
||||
<CursorPos X="41" Y="62"/>
|
||||
<TopLine Value="44"/>
|
||||
<CursorPos X="49" Y="48"/>
|
||||
<TopLine Value="43"/>
|
||||
<EditorIndex Value="11"/>
|
||||
<UsageCount Value="20"/>
|
||||
<UsageCount Value="23"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit17>
|
||||
<Unit18>
|
||||
<Filename Value="pkgwget.pp"/>
|
||||
<UnitName Value="pkgwget"/>
|
||||
<CursorPos X="1" Y="1"/>
|
||||
<TopLine Value="1"/>
|
||||
<CursorPos X="38" Y="30"/>
|
||||
<TopLine Value="17"/>
|
||||
<EditorIndex Value="4"/>
|
||||
<UsageCount Value="15"/>
|
||||
<UsageCount Value="18"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit18>
|
||||
<Unit19>
|
||||
<Filename Value="pkglnet.pas"/>
|
||||
<UnitName Value="pkglnet"/>
|
||||
<CursorPos X="5" Y="140"/>
|
||||
<TopLine Value="103"/>
|
||||
<UsageCount Value="9"/>
|
||||
<CursorPos X="36" Y="19"/>
|
||||
<TopLine Value="1"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit19>
|
||||
<Unit20>
|
||||
<Filename Value="reptest.pp"/>
|
||||
@ -217,148 +217,162 @@
|
||||
<CursorPos X="1" Y="93"/>
|
||||
<TopLine Value="59"/>
|
||||
<EditorIndex Value="6"/>
|
||||
<UsageCount Value="14"/>
|
||||
<UsageCount Value="17"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit20>
|
||||
<Unit21>
|
||||
<Filename Value="rep2xml.lpr"/>
|
||||
<UnitName Value="rep2xml"/>
|
||||
<CursorPos X="26" Y="240"/>
|
||||
<TopLine Value="221"/>
|
||||
<CursorPos X="1" Y="249"/>
|
||||
<TopLine Value="217"/>
|
||||
<EditorIndex Value="7"/>
|
||||
<UsageCount Value="12"/>
|
||||
<UsageCount Value="15"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit21>
|
||||
<Unit22>
|
||||
<Filename Value="pkgfpmake.pp"/>
|
||||
<UnitName Value="pkgfpmake"/>
|
||||
<CursorPos X="5" Y="48"/>
|
||||
<TopLine Value="34"/>
|
||||
<CursorPos X="86" Y="58"/>
|
||||
<TopLine Value="50"/>
|
||||
<EditorIndex Value="10"/>
|
||||
<UsageCount Value="11"/>
|
||||
<UsageCount Value="14"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit22>
|
||||
<Unit23>
|
||||
<Filename Value="pkgocurl.pp"/>
|
||||
<UnitName Value="pkgoCurl"/>
|
||||
<CursorPos X="1" Y="1"/>
|
||||
<TopLine Value="1"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit23>
|
||||
<Unit24>
|
||||
<Filename Value="pkglibcurl.pp"/>
|
||||
<UnitName Value="pkglibcurl"/>
|
||||
<CursorPos X="1" Y="1"/>
|
||||
<TopLine Value="1"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit24>
|
||||
</Units>
|
||||
<JumpHistory Count="30" HistoryIndex="29">
|
||||
<Position1>
|
||||
<Filename Value="fprepos.pp"/>
|
||||
<Caret Line="823" Column="5" TopLine="786"/>
|
||||
<Filename Value="pkghandler.pp"/>
|
||||
<Caret Line="25" Column="36" TopLine="6"/>
|
||||
</Position1>
|
||||
<Position2>
|
||||
<Filename Value="fprepos.pp"/>
|
||||
<Caret Line="100" Column="35" TopLine="77"/>
|
||||
<Filename Value="pkghandler.pp"/>
|
||||
<Caret Line="323" Column="58" TopLine="303"/>
|
||||
</Position2>
|
||||
<Position3>
|
||||
<Filename Value="pkgropts.pp"/>
|
||||
<Caret Line="94" Column="18" TopLine="75"/>
|
||||
<Filename Value="pkgcommands.pp"/>
|
||||
<Caret Line="77" Column="20" TopLine="58"/>
|
||||
</Position3>
|
||||
<Position4>
|
||||
<Filename Value="pkgropts.pp"/>
|
||||
<Caret Line="225" Column="14" TopLine="206"/>
|
||||
<Filename Value="fppkg.pp"/>
|
||||
<Caret Line="106" Column="48" TopLine="88"/>
|
||||
</Position4>
|
||||
<Position5>
|
||||
<Filename Value="pkgropts.pp"/>
|
||||
<Caret Line="33" Column="19" TopLine="14"/>
|
||||
<Filename Value="pkgwget.pp"/>
|
||||
<Caret Line="1" Column="1" TopLine="1"/>
|
||||
</Position5>
|
||||
<Position6>
|
||||
<Filename Value="pkgropts.pp"/>
|
||||
<Caret Line="152" Column="31" TopLine="133"/>
|
||||
<Filename Value="pkgwget.pp"/>
|
||||
<Caret Line="7" Column="42" TopLine="1"/>
|
||||
</Position6>
|
||||
<Position7>
|
||||
<Filename Value="pkgropts.pp"/>
|
||||
<Caret Line="174" Column="23" TopLine="155"/>
|
||||
<Filename Value="pkghandler.pp"/>
|
||||
<Caret Line="114" Column="74" TopLine="97"/>
|
||||
</Position7>
|
||||
<Position8>
|
||||
<Filename Value="fppkg.pp"/>
|
||||
<Caret Line="94" Column="73" TopLine="75"/>
|
||||
<Filename Value="pkgropts.pp"/>
|
||||
<Caret Line="237" Column="1" TopLine="219"/>
|
||||
</Position8>
|
||||
<Position9>
|
||||
<Filename Value="pkgropts.pp"/>
|
||||
<Caret Line="224" Column="10" TopLine="206"/>
|
||||
<Caret Line="93" Column="18" TopLine="70"/>
|
||||
</Position9>
|
||||
<Position10>
|
||||
<Filename Value="pkgropts.pp"/>
|
||||
<Caret Line="1" Column="1" TopLine="1"/>
|
||||
<Caret Line="196" Column="1" TopLine="169"/>
|
||||
</Position10>
|
||||
<Position11>
|
||||
<Filename Value="pkgropts.pp"/>
|
||||
<Caret Line="33" Column="1" TopLine="14"/>
|
||||
<Filename Value="fpxmlrep.pp"/>
|
||||
<Caret Line="553" Column="2" TopLine="528"/>
|
||||
</Position11>
|
||||
<Position12>
|
||||
<Filename Value="pkgropts.pp"/>
|
||||
<Caret Line="69" Column="1" TopLine="50"/>
|
||||
<Filename Value="pkghandler.pp"/>
|
||||
<Caret Line="243" Column="76" TopLine="229"/>
|
||||
</Position12>
|
||||
<Position13>
|
||||
<Filename Value="pkgropts.pp"/>
|
||||
<Caret Line="102" Column="1" TopLine="83"/>
|
||||
<Filename Value="fppkg.pp"/>
|
||||
<Caret Line="108" Column="24" TopLine="94"/>
|
||||
</Position13>
|
||||
<Position14>
|
||||
<Filename Value="pkgropts.pp"/>
|
||||
<Caret Line="149" Column="1" TopLine="130"/>
|
||||
<Filename Value="rep2xml.lpr"/>
|
||||
<Caret Line="241" Column="48" TopLine="221"/>
|
||||
</Position14>
|
||||
<Position15>
|
||||
<Filename Value="pkgropts.pp"/>
|
||||
<Caret Line="170" Column="1" TopLine="151"/>
|
||||
<Filename Value="fppkg.pp"/>
|
||||
<Caret Line="22" Column="23" TopLine="1"/>
|
||||
</Position15>
|
||||
<Position16>
|
||||
<Filename Value="pkgropts.pp"/>
|
||||
<Caret Line="265" Column="1" TopLine="246"/>
|
||||
<Filename Value="fppkg.pp"/>
|
||||
<Caret Line="33" Column="21" TopLine="14"/>
|
||||
</Position16>
|
||||
<Position17>
|
||||
<Filename Value="pkgropts.pp"/>
|
||||
<Caret Line="279" Column="1" TopLine="260"/>
|
||||
<Filename Value="fppkg.pp"/>
|
||||
<Caret Line="229" Column="1" TopLine="201"/>
|
||||
</Position17>
|
||||
<Position18>
|
||||
<Filename Value="pkgropts.pp"/>
|
||||
<Caret Line="49" Column="5" TopLine="37"/>
|
||||
<Filename Value="fppkg.pp"/>
|
||||
<Caret Line="316" Column="32" TopLine="296"/>
|
||||
</Position18>
|
||||
<Position19>
|
||||
<Filename Value="pkgropts.pp"/>
|
||||
<Caret Line="205" Column="5" TopLine="163"/>
|
||||
<Filename Value="fppkg.pp"/>
|
||||
<Caret Line="1" Column="1" TopLine="1"/>
|
||||
</Position19>
|
||||
<Position20>
|
||||
<Filename Value="fppkg.pp"/>
|
||||
<Caret Line="94" Column="57" TopLine="75"/>
|
||||
<Caret Line="33" Column="21" TopLine="14"/>
|
||||
</Position20>
|
||||
<Position21>
|
||||
<Filename Value="pkgropts.pp"/>
|
||||
<Caret Line="64" Column="27" TopLine="45"/>
|
||||
<Filename Value="fpxmlrep.pp"/>
|
||||
<Caret Line="488" Column="44" TopLine="465"/>
|
||||
</Position21>
|
||||
<Position22>
|
||||
<Filename Value="pkgropts.pp"/>
|
||||
<Caret Line="205" Column="28" TopLine="184"/>
|
||||
<Filename Value="fpxmlrep.pp"/>
|
||||
<Caret Line="208" Column="1" TopLine="186"/>
|
||||
</Position22>
|
||||
<Position23>
|
||||
<Filename Value="fppkg.pp"/>
|
||||
<Caret Line="25" Column="36" TopLine="24"/>
|
||||
<Caret Line="117" Column="31" TopLine="112"/>
|
||||
</Position23>
|
||||
<Position24>
|
||||
<Filename Value="fppkg.pp"/>
|
||||
<Caret Line="84" Column="34" TopLine="59"/>
|
||||
<Caret Line="340" Column="1" TopLine="305"/>
|
||||
</Position24>
|
||||
<Position25>
|
||||
<Filename Value="fppkg.pp"/>
|
||||
<Caret Line="30" Column="35" TopLine="11"/>
|
||||
<Caret Line="12" Column="1" TopLine="1"/>
|
||||
</Position25>
|
||||
<Position26>
|
||||
<Filename Value="fppkg.pp"/>
|
||||
<Caret Line="84" Column="41" TopLine="65"/>
|
||||
<Caret Line="250" Column="32" TopLine="229"/>
|
||||
</Position26>
|
||||
<Position27>
|
||||
<Filename Value="fppkg.pp"/>
|
||||
<Caret Line="148" Column="36" TopLine="124"/>
|
||||
<Caret Line="304" Column="1" TopLine="267"/>
|
||||
</Position27>
|
||||
<Position28>
|
||||
<Filename Value="fppkg.pp"/>
|
||||
<Caret Line="134" Column="14" TopLine="117"/>
|
||||
<Filename Value="pkghandler.pp"/>
|
||||
<Caret Line="101" Column="49" TopLine="80"/>
|
||||
</Position28>
|
||||
<Position29>
|
||||
<Filename Value="fppkg.pp"/>
|
||||
<Caret Line="128" Column="1" TopLine="102"/>
|
||||
<Filename Value="pkgfpmake.pp"/>
|
||||
<Caret Line="12" Column="47" TopLine="1"/>
|
||||
</Position29>
|
||||
<Position30>
|
||||
<Filename Value="pkghandler.pp"/>
|
||||
<Caret Line="119" Column="27" TopLine="95"/>
|
||||
<Filename Value="pkgropts.pp"/>
|
||||
<Caret Line="330" Column="45" TopLine="314"/>
|
||||
</Position30>
|
||||
</JumpHistory>
|
||||
</ProjectOptions>
|
||||
|
@ -11,26 +11,37 @@ uses
|
||||
// Repository handler objects
|
||||
fprepos, fpxmlrep,fpmktype, pkgropts,
|
||||
// Package Handler components
|
||||
pkghandler, pkgmkconv, pkgdownload, pkgfpmake, pkgmessages;
|
||||
pkghandler, pkgmkconv, pkgdownload,
|
||||
pkgfpmake, pkgmessages, pkgcommands
|
||||
// Downloaders
|
||||
{$if defined(unix) or defined(windows)}
|
||||
,pkgwget
|
||||
{$endif}
|
||||
;
|
||||
|
||||
Type
|
||||
{ TMakeTool }
|
||||
|
||||
TMakeTool = Class(TCustomApplication)
|
||||
Private
|
||||
ParaAction : string;
|
||||
ParaPackages : TStringList;
|
||||
FDefaults: TPackagerOptions;
|
||||
FRepository : TFPRepository;
|
||||
FCompilerConfig : String;
|
||||
procedure GenerateParaActions;
|
||||
procedure LoadRepository;
|
||||
procedure MaybeCreateLocalDirs;
|
||||
procedure ShowUsage;
|
||||
Public
|
||||
Constructor Create;
|
||||
Destructor Destroy;override;
|
||||
Function GetConfigFileName : String;
|
||||
Procedure LoadGlobalDefaults;
|
||||
Procedure LoadCompilerDefaults;
|
||||
Procedure ProcessCommandLine;
|
||||
Procedure DoRun; Override;
|
||||
procedure ExecuteAction(const AAction:string;const Args:TActionArgs);
|
||||
procedure ExecuteAction(APackage:TFPPackage; const AAction:string; const Args:TActionArgs);
|
||||
end;
|
||||
|
||||
EMakeToolError = Class(Exception);
|
||||
@ -47,11 +58,11 @@ begin
|
||||
else
|
||||
begin
|
||||
{$ifdef unix}
|
||||
g:=(fpgetuid=0);
|
||||
g:=(fpgetuid=0);
|
||||
{$else}
|
||||
G:=true;
|
||||
g:=true;
|
||||
{$endif}
|
||||
Result:=GetAppConfigFile(G,False);
|
||||
Result:=GetAppConfigFile(G,False);
|
||||
end
|
||||
end;
|
||||
|
||||
@ -103,15 +114,24 @@ end;
|
||||
procedure TMakeTool.LoadRepository;
|
||||
var
|
||||
S : String;
|
||||
X : TFPXMLRepositoryHandler;
|
||||
begin
|
||||
FRepository:=TFPRepository.Create(Nil);
|
||||
// Repository
|
||||
Log(vDebug,SLogLoadingRepository,[FDefaults.LocalRepository]);
|
||||
if FileExists(FDefaults.LocalRepository) then
|
||||
FRepository.LoadFromFile(FDefaults.LocalRepository);
|
||||
begin
|
||||
X:=TFPXMLRepositoryHandler.Create;
|
||||
With X do
|
||||
try
|
||||
LoadFromXml(FRepository,FDefaults.LocalRepository);
|
||||
finally
|
||||
Free;
|
||||
end;
|
||||
end;
|
||||
// Versions
|
||||
S:=FDefaults.LocalVersions(FCompilerConfig);
|
||||
Log(vDebug,SLogLoadingRepository,[S]);
|
||||
Log(vDebug,SLogLoadingVersions,[S]);
|
||||
if FileExists(S) then
|
||||
FRepository.LoadStatusFromFile(S);
|
||||
end;
|
||||
@ -134,24 +154,33 @@ begin
|
||||
Halt(0);
|
||||
end;
|
||||
|
||||
Constructor TMakeTool.Create;
|
||||
begin
|
||||
inherited Create(nil);
|
||||
ParaPackages:=TStringList.Create;
|
||||
end;
|
||||
|
||||
|
||||
Destructor TMakeTool.Destroy;
|
||||
begin
|
||||
FreeAndNil(ParaPackages);
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
|
||||
procedure TMakeTool.ProcessCommandLine;
|
||||
|
||||
Function CheckOption(Index : Integer;Short,Long : String): Boolean;
|
||||
|
||||
var
|
||||
O : String;
|
||||
|
||||
begin
|
||||
O:=Paramstr(Index);
|
||||
Result:=(O='-'+short) or (O='--'+long) or (copy(O,1,Length(Long)+3)=('--'+long+'='));
|
||||
end;
|
||||
|
||||
Function OptionArg(Var Index : Integer) : String;
|
||||
|
||||
Var
|
||||
P : Integer;
|
||||
|
||||
begin
|
||||
if (Length(ParamStr(Index))>1) and (Paramstr(Index)[2]<>'-') then
|
||||
begin
|
||||
@ -178,72 +207,80 @@ procedure TMakeTool.ProcessCommandLine;
|
||||
|
||||
Var
|
||||
I : Integer;
|
||||
Action : string;
|
||||
ParaPackages : TStringList;
|
||||
HasAction : Boolean;
|
||||
begin
|
||||
try
|
||||
I:=0;
|
||||
HasAction:=false;
|
||||
ParaPackages:=TStringList.Create;
|
||||
// We can't use the TCustomApplication option handling,
|
||||
// because they cannot handle [general opts] [command] [cmd-opts] [args]
|
||||
While (I<ParamCount) do
|
||||
begin
|
||||
Inc(I);
|
||||
// Check options.
|
||||
if CheckOption(I,'r','compiler') then
|
||||
FDefaults.Compiler:=OptionArg(I)
|
||||
else if CheckOption(I,'v','verbose') then
|
||||
Include(Verbosity,StringToVerbosity(OptionArg(I)))
|
||||
else if CheckOption(I,'h','help') then
|
||||
begin
|
||||
ShowUsage;
|
||||
halt(0);
|
||||
end
|
||||
else if (Length(Paramstr(i))>0) and (Paramstr(I)[1]='-') then
|
||||
Raise EMakeToolError.CreateFmt(SErrInvalidArgument,[I,ParamStr(i)])
|
||||
else
|
||||
// It's a command or target.
|
||||
begin
|
||||
if HasAction then
|
||||
ParaPackages.Add(Paramstr(i))
|
||||
else
|
||||
begin
|
||||
Action:=Paramstr(i);
|
||||
HasAction:=true;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
{ Default "package" is current directory }
|
||||
if (ParaPackages.Count=0) then
|
||||
ParaPackages.Add('.');
|
||||
if HasAction then
|
||||
begin
|
||||
if GetPkgHandler(Action)<>nil then
|
||||
begin
|
||||
for i:=0 to ParaPackages.Count-1 do
|
||||
ActionStack.Push(Action,[ParaPackages[i]])
|
||||
end
|
||||
else
|
||||
Raise EMakeToolError.CreateFmt(SErrInvalidCommand,[Action]);
|
||||
end
|
||||
else
|
||||
ShowUsage;
|
||||
finally
|
||||
FreeAndNil(ParaPackages);
|
||||
end;
|
||||
I:=0;
|
||||
HasAction:=false;
|
||||
// We can't use the TCustomApplication option handling,
|
||||
// because they cannot handle [general opts] [command] [cmd-opts] [args]
|
||||
While (I<ParamCount) do
|
||||
begin
|
||||
Inc(I);
|
||||
// Check options.
|
||||
if CheckOption(I,'r','compiler') then
|
||||
FDefaults.Compiler:=OptionArg(I)
|
||||
else if CheckOption(I,'v','verbose') then
|
||||
Include(Verbosity,StringToVerbosity(OptionArg(I)))
|
||||
else if CheckOption(I,'h','help') then
|
||||
begin
|
||||
ShowUsage;
|
||||
halt(0);
|
||||
end
|
||||
else if (Length(Paramstr(i))>0) and (Paramstr(I)[1]='-') then
|
||||
Raise EMakeToolError.CreateFmt(SErrInvalidArgument,[I,ParamStr(i)])
|
||||
else
|
||||
// It's a command or target.
|
||||
begin
|
||||
if HasAction then
|
||||
ParaPackages.Add(Paramstr(i))
|
||||
else
|
||||
begin
|
||||
ParaAction:=Paramstr(i);
|
||||
HasAction:=true;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
if not HasAction then
|
||||
ShowUsage;
|
||||
end;
|
||||
|
||||
|
||||
procedure TMakeTool.ExecuteAction(const AAction:string;const Args:TActionArgs);
|
||||
procedure TMakeTool.GenerateParaActions;
|
||||
var
|
||||
ActionPackage : TFPPackage;
|
||||
i : integer;
|
||||
begin
|
||||
if GetPkgHandler(ParaAction)<>nil then
|
||||
begin
|
||||
if ParaPackages.Count=0 then
|
||||
begin
|
||||
Log(vDebug,SLogCommandLineAction,['[<currentdir>]',ParaAction]);
|
||||
ActionStack.Push(nil,ParaAction,[]);
|
||||
end
|
||||
else
|
||||
begin
|
||||
for i:=0 to ParaPackages.Count-1 do
|
||||
begin
|
||||
ActionPackage:=FRepository.PackageByName(ParaPackages[i]);
|
||||
Log(vDebug,SLogCommandLineAction,['['+ActionPackage.Name+']',ParaAction]);
|
||||
ActionStack.Push(ActionPackage,ParaAction,[]);
|
||||
end;
|
||||
end;
|
||||
end
|
||||
else
|
||||
Raise EMakeToolError.CreateFmt(SErrInvalidCommand,[ParaAction]);
|
||||
end;
|
||||
|
||||
|
||||
procedure TMakeTool.ExecuteAction(APackage:TFPPackage;const AAction:string;const Args:TActionArgs);
|
||||
var
|
||||
pkghandlerclass : TPackageHandlerClass;
|
||||
i : integer;
|
||||
logargs : string;
|
||||
begin
|
||||
if vDebug in Verbosity then
|
||||
begin
|
||||
pkghandlerclass:=GetPkgHandler(AAction);
|
||||
With pkghandlerclass.Create(Self,FDefaults,APackage) do
|
||||
try
|
||||
logargs:='';
|
||||
for i:=Low(Args) to High(Args) do
|
||||
begin
|
||||
@ -252,11 +289,7 @@ begin
|
||||
else
|
||||
logargs:=logargs+','+Args[i];
|
||||
end;
|
||||
Log(vDebug,SLogRunAction,[AAction,logargs]);
|
||||
end;
|
||||
pkghandlerclass:=GetPkgHandler(AAction);
|
||||
With pkghandlerclass.Create(Self,FDefaults) do
|
||||
try
|
||||
Log(vDebug,PackageLogPrefix+SLogRunAction,[AAction,logargs]);
|
||||
Execute(Args);
|
||||
finally
|
||||
Free;
|
||||
@ -267,34 +300,40 @@ end;
|
||||
procedure TMakeTool.DoRun;
|
||||
var
|
||||
Action : string;
|
||||
ActionPackage : TFPPackage;
|
||||
Args : TActionArgs;
|
||||
OldCurrDir : String;
|
||||
begin
|
||||
LoadGlobalDefaults;
|
||||
OldCurrDir:=GetCurrentDir;
|
||||
Try
|
||||
ProcessCommandLine;
|
||||
MaybeCreateLocalDirs;
|
||||
LoadCompilerDefaults;
|
||||
LoadRepository;
|
||||
GenerateParaActions;
|
||||
|
||||
repeat
|
||||
if not ActionStack.Pop(Action,Args) then
|
||||
if not ActionStack.Pop(ActionPackage,Action,Args) then
|
||||
break;
|
||||
ExecuteAction(Action,Args);
|
||||
ExecuteAction(ActionPackage,Action,Args);
|
||||
until false;
|
||||
Terminate;
|
||||
|
||||
except
|
||||
On E : Exception do
|
||||
begin
|
||||
Writeln(StdErr,Format(SErrRunning,[E.Message]));
|
||||
Writeln(StdErr,SErrRunning);
|
||||
Writeln(StdErr,E.Message);
|
||||
Halt(1);
|
||||
end;
|
||||
end;
|
||||
SetCurrentDir(OldCurrDir);
|
||||
end;
|
||||
|
||||
|
||||
begin
|
||||
With TMakeTool.Create(Nil) do
|
||||
With TMakeTool.Create do
|
||||
try
|
||||
run;
|
||||
finally
|
||||
|
@ -10,7 +10,7 @@ uses
|
||||
type
|
||||
{ TCommandUpdate }
|
||||
|
||||
TCommandBuild = Class(TPackagehandler)
|
||||
TCommandUpdate = Class(TPackagehandler)
|
||||
Public
|
||||
Function Execute(const Args:TActionArgs):boolean;override;
|
||||
end;
|
||||
@ -41,14 +41,20 @@ type
|
||||
implementation
|
||||
|
||||
uses
|
||||
pkgmessages;
|
||||
pkgmessages,
|
||||
fpmktype,
|
||||
fprepos,
|
||||
fpxmlrep;
|
||||
|
||||
function TCommandUpdate.Execute(const Args:TActionArgs):boolean;
|
||||
Var
|
||||
X : TFPXMLRepositoryHandler;
|
||||
P : TFPPackage;
|
||||
R : TFPRepository;
|
||||
begin
|
||||
P:=Repository.AddPackage('FirstPackage');
|
||||
{$warning TODO remove this hack}
|
||||
R:=TFPRepository.Create(nil);
|
||||
P:=R.AddPackage('FirstPackage');
|
||||
P.Author:='Michael Van Canneyt';
|
||||
P.URL:='http://www.freepascal.org/packages/firstpackage.zip';
|
||||
P.Email:='michael@freepascal.org';
|
||||
@ -59,30 +65,31 @@ begin
|
||||
X:=TFPXMLRepositoryHandler.Create;
|
||||
With X do
|
||||
try
|
||||
SaveToXml(Repository,'packages.xml');
|
||||
SaveToXml(R,Defaults.LocalRepository);
|
||||
finally
|
||||
Free;
|
||||
end;
|
||||
FreeAndNil(R);
|
||||
end;
|
||||
|
||||
|
||||
function TCommandDownload.Execute(const Args:TActionArgs):boolean;
|
||||
begin
|
||||
ActionStack.Push('downloadpackage',Args);
|
||||
ActionStack.Push(CurrentPackage,'downloadpackage',Args);
|
||||
end;
|
||||
|
||||
|
||||
function TCommandBuild.Execute(const Args:TActionArgs):boolean;
|
||||
begin
|
||||
ActionStack.Push('fpmakebuild',Args);
|
||||
ActionStack.Push('compilefpmake',Args);
|
||||
ActionStack.Push(CurrentPackage,'fpmakebuild',Args);
|
||||
ActionStack.Push(CurrentPackage,'compilefpmake',Args);
|
||||
end;
|
||||
|
||||
|
||||
function TCommandInstall.Execute(const Args:TActionArgs):boolean;
|
||||
begin
|
||||
ActionStack.Push('fpmakeinstall',Args);
|
||||
ActionStack.Push('build',Args);
|
||||
ActionStack.Push(CurrentPackage,'fpmakeinstall',Args);
|
||||
ActionStack.Push(CurrentPackage,'build',Args);
|
||||
end;
|
||||
|
||||
|
||||
|
@ -12,7 +12,7 @@ type
|
||||
|
||||
TFPMakeCompiler = Class(TPackagehandler)
|
||||
Private
|
||||
Procedure CompileFPMake(const ADir:string);
|
||||
Procedure CompileFPMake;
|
||||
Public
|
||||
Function Execute(const Args:TActionArgs):boolean;override;
|
||||
end;
|
||||
@ -21,16 +21,22 @@ type
|
||||
{ TFPMakeRunner }
|
||||
|
||||
TFPMakeRunner = Class(TPackagehandler)
|
||||
Private
|
||||
Function RunFPMake(const ADir:string) : Integer;
|
||||
Protected
|
||||
Function RunFPMake(const Command:string):Integer;
|
||||
end;
|
||||
|
||||
|
||||
{ TFPMakeRunnerBuild }
|
||||
|
||||
TFPMakeRunnerBuild = Class(TFPMakeRunner)
|
||||
Public
|
||||
Function Execute(const Args:TActionArgs):boolean;override;
|
||||
end;
|
||||
|
||||
|
||||
{ TFPMakeRunner }
|
||||
{ TFPMakeRunnerInstall }
|
||||
|
||||
TCommandBuild = Class(TPackagehandler)
|
||||
TFPMakeRunnerInstall = Class(TFPMakeRunner)
|
||||
Public
|
||||
Function Execute(const Args:TActionArgs):boolean;override;
|
||||
end;
|
||||
@ -43,33 +49,33 @@ uses
|
||||
|
||||
{ TFPMakeCompiler }
|
||||
|
||||
Procedure TFPMakeCompiler.CompileFPMake(const ADir:string);
|
||||
Procedure TFPMakeCompiler.CompileFPMake;
|
||||
Var
|
||||
D,O,C : String;
|
||||
O,C : String;
|
||||
FPMakeBin,
|
||||
FPMakeSrc : string;
|
||||
HaveFpmake : boolean;
|
||||
begin
|
||||
D:=IncludeTrailingPathDelimiter(ADir);
|
||||
SetCurrentDir(PackageBuildPath);
|
||||
{ Check for fpmake source }
|
||||
FPMakeBin:=D+'fpmake'+ExeExt;
|
||||
FPMakeSrc:=D+'fpmake.pp';
|
||||
FPMakeBin:='fpmake'+ExeExt;
|
||||
FPMakeSrc:='fpmake.pp';
|
||||
HaveFpmake:=FileExists(FPMakeSrc);
|
||||
If Not HaveFPMake then
|
||||
begin
|
||||
HaveFPMake:=FileExists(D+'fpmake.pas');
|
||||
HaveFPMake:=FileExists('fpmake.pas');
|
||||
If HaveFPMake then
|
||||
FPMakeSrc:=D+'fpmake.pas';
|
||||
FPMakeSrc:='fpmake.pas';
|
||||
end;
|
||||
{ Need to compile fpmake executable? }
|
||||
if FileAge(FPMakeBin)<FileAge(FPMakeSrc) then
|
||||
if not FileExists(FPMakeBin) or
|
||||
(FileAge(FPMakeBin)<FileAge(FPMakeSrc)) then
|
||||
begin
|
||||
if Not HaveFPMake then
|
||||
Error(SErrMissingFPMake);
|
||||
{ Call compiler }
|
||||
C:=Defaults.Compiler;
|
||||
O:=FPmakeSrc;
|
||||
Log(vCommands,SLogCompilingFPMake+C+' '+O);
|
||||
If ExecuteProcess(C,O)<>0 then
|
||||
Error(SErrFailedToCompileFPCMake)
|
||||
end
|
||||
@ -81,59 +87,40 @@ end;
|
||||
function TFPMakeCompiler.Execute(const Args:TActionArgs):boolean;
|
||||
begin
|
||||
{$warning TODO Check arguments}
|
||||
CompileFPMake(Args[0]);
|
||||
CompileFPMake;
|
||||
result:=true;
|
||||
end;
|
||||
|
||||
|
||||
{ TFPMakeRunner }
|
||||
|
||||
Function TFPMakeRunner.RunFPMake(const ADir:string) : Integer;
|
||||
|
||||
Function MaybeQuote(Const S : String) : String;
|
||||
begin
|
||||
If Pos(' ',S)=0 then
|
||||
Result:=S
|
||||
else
|
||||
Result:='"'+S+'"';
|
||||
end;
|
||||
|
||||
Function TFPMakeRunner.RunFPMake(const Command:string) : Integer;
|
||||
Var
|
||||
I : integer;
|
||||
FPMakeBin,
|
||||
D,O : String;
|
||||
FPMakeBin : string;
|
||||
begin
|
||||
D:=IncludeTrailingPathDelimiter(ADir);
|
||||
FPMakeBin:=D+'fpmake'+ExeExt;
|
||||
O:='';
|
||||
For I:=1 to ParamCount do
|
||||
begin
|
||||
If (O<>'') then
|
||||
O:=O+' ';
|
||||
O:=O+MaybeQuote(ParamStr(I));
|
||||
end;
|
||||
Log(vCommands,SLogRunningFPMake+FPMakeBin+' '+O);
|
||||
Result:=ExecuteProcess(FPMakeBin,O);
|
||||
FPMakeBin:='fpmake'+ExeExt;
|
||||
SetCurrentDir(PackageBuildPath);
|
||||
Result:=ExecuteProcess(FPMakeBin,Command);
|
||||
end;
|
||||
|
||||
|
||||
function TFPMakeRunner.Execute(const Args:TActionArgs):boolean;
|
||||
function TFPMakeRunnerBuild.Execute(const Args:TActionArgs):boolean;
|
||||
begin
|
||||
{$warning TODO Check arguments}
|
||||
result:=(RunFPMake(Args[0])=0);
|
||||
result:=(RunFPMake('--build')=0);
|
||||
end;
|
||||
|
||||
|
||||
|
||||
function TCommandBuild.Execute(const Args:TActionArgs):boolean;
|
||||
function TFPMakeRunnerInstall.Execute(const Args:TActionArgs):boolean;
|
||||
begin
|
||||
ActionStack.Push('fpmakebuild',[]);
|
||||
ActionStack.Push('compilefpmake',[]);
|
||||
result:=(RunFPMake('--install')=0);
|
||||
end;
|
||||
|
||||
|
||||
|
||||
initialization
|
||||
RegisterPkgHandler('compilefpmake',TFPMakeCompiler);
|
||||
RegisterPkgHandler('fpmakebuild',TFPMakeRunner);
|
||||
RegisterPkgHandler('build',TCommandBuild);
|
||||
RegisterPkgHandler('fpmakebuild',TFPMakeRunnerBuild);
|
||||
RegisterPkgHandler('fpmakeinstall',TFPMakeRunnerInstall);
|
||||
end.
|
||||
|
@ -22,6 +22,7 @@ Type
|
||||
TActionArgs = array of string;
|
||||
|
||||
TActionStackItem = record
|
||||
ActionPackage : TFPPackage;
|
||||
Action : string;
|
||||
Args : TActionArgs;
|
||||
end;
|
||||
@ -33,9 +34,9 @@ Type
|
||||
public
|
||||
constructor Create;
|
||||
destructor Destroy;
|
||||
procedure Push(const AAction:string;const Args:TActionArgs);
|
||||
procedure Push(const AAction:string;const Args:array of string);
|
||||
function Pop(out AAction:string;out Args:TActionArgs):boolean;
|
||||
procedure Push(APackage:TFPPackage;const AAction:string;const Args:TActionArgs);
|
||||
procedure Push(APackage:TFPPackage;const AAction:string;const Args:array of string);
|
||||
function Pop(out APackage:TFPPackage;out AAction:string;out Args:TActionArgs):boolean;
|
||||
end;
|
||||
|
||||
|
||||
@ -45,14 +46,23 @@ Type
|
||||
private
|
||||
FBackupFile : Boolean;
|
||||
FDefaults : TPackagerOptions;
|
||||
function PackageBuildPath(APackage:TFPPackage):String;
|
||||
FCurrentPackage : TFPPackage;
|
||||
Protected
|
||||
Procedure Log(Level: TVerbosity;Msg : String);
|
||||
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 BackupFile(Const FileName : String);
|
||||
Function ExecuteProcess(Const Prog,Args:String):Integer;
|
||||
Procedure SetCurrentDir(Const ADir:String);
|
||||
function PackageBuildPath:String;
|
||||
Public
|
||||
Constructor Create(AOwner: TComponent;ADefaults:TPackagerOptions); virtual;
|
||||
Constructor Create(AOwner: TComponent;ADefaults:TPackagerOptions;APackage:TFPPackage); virtual;
|
||||
function PackageLogPrefix:String;
|
||||
Function Execute(const Args:TActionArgs):boolean; virtual; abstract;
|
||||
Property BackupFiles : Boolean Read FBackupFile Write FBackupFile;
|
||||
Property Defaults:TPackagerOptions Read FDefaults;
|
||||
Property CurrentPackage:TFPPackage Read FCurrentPackage Write FCurrentPackage;
|
||||
end;
|
||||
TPackageHandlerClass = class of TPackageHandler;
|
||||
|
||||
@ -200,10 +210,11 @@ end;
|
||||
|
||||
{ TPackageHandler }
|
||||
|
||||
constructor TPackageHandler.Create(AOwner : TComponent; ADefaults:TPackagerOptions);
|
||||
constructor TPackageHandler.Create(AOwner : TComponent; ADefaults:TPackagerOptions;APackage:TFPPackage);
|
||||
begin
|
||||
inherited Create(AOwner);
|
||||
FDefaults:=ADefaults;
|
||||
FCurrentPackage:=APackage;
|
||||
end;
|
||||
|
||||
procedure TPackageHandler.BackupFile(const FileName: String);
|
||||
@ -215,12 +226,58 @@ begin
|
||||
Error(SErrBackupFailed,[FileName,BFN]);
|
||||
end;
|
||||
|
||||
function TPackageHandler.PackageBuildPath(APackage:TFPPackage):String;
|
||||
|
||||
Function TPackageHandler.ExecuteProcess(Const Prog,Args:String):Integer;
|
||||
begin
|
||||
if APackage=nil then
|
||||
Log(vCommands,SLogExecute,[Prog,Args]);
|
||||
Result:=SysUtils.ExecuteProcess(Prog,Args);
|
||||
end;
|
||||
|
||||
|
||||
Procedure TPackageHandler.SetCurrentDir(Const ADir:String);
|
||||
begin
|
||||
Log(vCommands,SLogChangeDir,[ADir]);
|
||||
if not SysUtils.SetCurrentDir(ADir) then
|
||||
Error(SErrChangeDirFailed,[ADir]);
|
||||
end;
|
||||
|
||||
|
||||
function TPackageHandler.PackageBuildPath:String;
|
||||
begin
|
||||
if CurrentPackage=nil then
|
||||
Result:='.'
|
||||
else
|
||||
Result:=Defaults.BuildDir+APackage.Name;
|
||||
Result:=Defaults.BuildDir+CurrentPackage.Name;
|
||||
end;
|
||||
|
||||
|
||||
function TPackageHandler.PackageLogPrefix:String;
|
||||
begin
|
||||
if assigned(CurrentPackage) then
|
||||
Result:='['+CurrentPackage.Name+'] '
|
||||
else
|
||||
Result:='[<currentdir>] ';
|
||||
end;
|
||||
|
||||
|
||||
Procedure TPackageHandler.Log(Level:TVerbosity; Msg:String);
|
||||
begin
|
||||
pkghandler.Log(Level,PackageLogPrefix+Msg);
|
||||
end;
|
||||
|
||||
Procedure TPackageHandler.Log(Level:TVerbosity; Fmt:String; const Args:array of const);
|
||||
begin
|
||||
pkghandler.Log(Level,PackageLogPrefix+Fmt,Args);
|
||||
end;
|
||||
|
||||
Procedure TPackageHandler.Error(Msg:String);
|
||||
begin
|
||||
pkghandler.Error(PackageLogPrefix+Msg);
|
||||
end;
|
||||
|
||||
Procedure TPackageHandler.Error(Fmt:String; const Args:array of const);
|
||||
begin
|
||||
pkghandler.Error(PackageLogPrefix+Fmt,Args);
|
||||
end;
|
||||
|
||||
|
||||
@ -238,18 +295,19 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
procedure TActionStack.Push(const AAction:string;const Args:TActionArgs);
|
||||
procedure TActionStack.Push(APackage:TFPPackage;const AAction:string;const Args:TActionArgs);
|
||||
var
|
||||
ActionItem : PActionStackItem;
|
||||
begin
|
||||
New(ActionItem);
|
||||
ActionItem^.ActionPackage:=APackage;
|
||||
ActionItem^.Action:=AAction;
|
||||
ActionItem^.Args:=Args;
|
||||
FList.Add(ActionItem);
|
||||
end;
|
||||
|
||||
|
||||
procedure TActionStack.Push(const AAction:string;const Args:array of string);
|
||||
procedure TActionStack.Push(APackage:TFPPackage;const AAction:string;const Args:array of string);
|
||||
var
|
||||
ActionArgs : TActionArgs;
|
||||
i : integer;
|
||||
@ -257,11 +315,11 @@ begin
|
||||
SetLength(ActionArgs,high(Args)+1);
|
||||
for i:=low(Args) to high(Args) do
|
||||
ActionArgs[i]:=Args[i];
|
||||
Push(AAction,ActionArgs);
|
||||
Push(APackage,AAction,ActionArgs);
|
||||
end;
|
||||
|
||||
|
||||
function TActionStack.Pop(out AAction:string;out Args:TActionArgs):boolean;
|
||||
function TActionStack.Pop(out APackage:TFPPackage;out AAction:string;out Args:TActionArgs):boolean;
|
||||
var
|
||||
ActionItem : PActionStackItem;
|
||||
Idx : integer;
|
||||
@ -274,6 +332,7 @@ begin
|
||||
ActionItem:=PActionStackItem(FList[Idx]);
|
||||
FList.Delete(Idx);
|
||||
// Copy contents and dispose stack item
|
||||
APackage:=ActionItem^.ActionPackage;
|
||||
AAction:=ActionItem^.Action;
|
||||
Args:=ActionItem^.Args;
|
||||
dispose(ActionItem);
|
||||
|
@ -6,7 +6,7 @@ interface
|
||||
|
||||
uses
|
||||
SysUtils, Classes,
|
||||
lnet, lftp, lhttp, pkgdownload,pkgropts;
|
||||
lnet, lftp, lhttp, pkgdownload,pkgropts, fprepos;
|
||||
|
||||
Type
|
||||
|
||||
@ -33,7 +33,7 @@ Type
|
||||
procedure FTPDownload(Const URL : String; Dest : TStream); override;
|
||||
procedure HTTPDownload(Const URL : String; Dest : TStream); override;
|
||||
public
|
||||
constructor Create(AOwner : TComponent;ADefaults:TPackagerOptions); override;
|
||||
constructor Create(AOwner : TComponent;ADefaults:TPackagerOptions; APackage:TFPPackage); override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
@ -151,9 +151,9 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
constructor TLNetDownloader.Create(AOwner: TComponent;ADefaults:TPackagerOptions);
|
||||
constructor TLNetDownloader.Create(AOwner: TComponent;ADefaults:TPackagerOptions; APackage:TFPPackage);
|
||||
begin
|
||||
inherited Create(AOwner,ADefaults);
|
||||
inherited Create(AOwner,ADefaults,APackage);
|
||||
|
||||
FFTP:=TLFTPClient.Create(Self);
|
||||
FFTP.Timeout:=1000;
|
||||
|
@ -11,7 +11,7 @@ Resourcestring
|
||||
SErrMissingFPC = 'Could not find a fpc executable in the PATH';
|
||||
SErrMissingFPMake = 'Missing configuration fpmake.pp';
|
||||
SErrMissingMakefilefpc = 'Missing configuration Makefile.fpc';
|
||||
SErrRunning = 'The FPC make tool encountered the following error: %s';
|
||||
SErrRunning = 'The FPC make tool encountered the following error:';
|
||||
SErrActionAlreadyRegistered= 'Action "%s" is already registered';
|
||||
SErrActionNotFound = 'Action "%s" is not supported';
|
||||
SErrFailedToCompileFPCMake = 'Could not compile fpmake driver program';
|
||||
@ -24,6 +24,7 @@ Resourcestring
|
||||
SErrDownloadFailed = 'Download failed: %s';
|
||||
SErrInvalidVerbosity = 'Invalid verbosity string: "%s"';
|
||||
SErrInvalidCommand = 'Invalid command: %s';
|
||||
SErrChangeDirFailed = 'Could not change directory to "%s"';
|
||||
|
||||
SErrHTTPGetFailed = 'HTTP Download failed.';
|
||||
SErrLoginFailed = 'FTP LOGIN command failed.';
|
||||
@ -31,10 +32,11 @@ Resourcestring
|
||||
SErrGETFailed = 'FTP GET "%s" command failed.';
|
||||
|
||||
SLogGeneratingFPMake = 'Generating fpmake.pp';
|
||||
SLogCompilingFPMake = 'Compiling fpmake.pp: ';
|
||||
SLogNotCompilingFPMake = 'Skipping compiling of fpmake.pp, fpmake executable already exists';
|
||||
SLogRunningFPMake = 'Running fpmake';
|
||||
SLogRunAction = 'Action: %s %s';
|
||||
SLogCommandLineAction = 'Adding action from commandline: "%s %s"';
|
||||
SLogRunAction = 'Action: "%s %s"';
|
||||
SLogExecute = 'Executing: "%s %s"';
|
||||
SLogChangeDir = 'CurrentDir: "%s"';
|
||||
SLogLoadingCompilerConfig = 'Loading compiler configuration from "%s"';
|
||||
SLogGeneratingCompilerConfig = 'Generating default compiler configuration in "%s"';
|
||||
SLogLoadingRepository = 'Loading repository data from "%s"';
|
||||
|
@ -117,11 +117,10 @@ begin
|
||||
begin
|
||||
Add('{$mode objfpc}{$H+}');
|
||||
Add('program fpmake;');
|
||||
|
||||
Add('');
|
||||
Add(' { Generated automatically by '+ExtractFileName(Paramstr(0))+' on '+DateToStr(Sysutils.Date)+' }');
|
||||
Add('');
|
||||
Add('uses fpmkunit;');
|
||||
Add('uses fpmktype,fpmkunit;');
|
||||
Add('');
|
||||
Add('Var');
|
||||
Add(' T : TTarget;');
|
||||
@ -596,7 +595,7 @@ Var
|
||||
B : Boolean;
|
||||
|
||||
begin
|
||||
Writeln('Converting '+AFileName);
|
||||
Log(vDebug,'Converting '+AFileName);
|
||||
T:=Nil;
|
||||
D:=Nil;
|
||||
S:=Nil;
|
||||
@ -618,8 +617,8 @@ begin
|
||||
J:=GetEnumValue(TypeInfo(TSectionType),'st'+Line);
|
||||
If (J=-1) then
|
||||
begin
|
||||
FSection:=stNone;
|
||||
Writeln(stdErr,'Unsupported section: ',Line);
|
||||
FSection:=stNone;
|
||||
Error('Unsupported section: '+Line);
|
||||
end
|
||||
else
|
||||
FSection:=TSectiontype(J);
|
||||
@ -696,9 +695,10 @@ end;
|
||||
|
||||
function TMakeFileConverter.Execute(const Args:TActionArgs):boolean;
|
||||
begin
|
||||
{$warning TODO Check arguments}
|
||||
ConvertFile(Args[1],Args[2]);
|
||||
ConvertFile('Makefile.fpc','fpmake.pp');
|
||||
result:=true;
|
||||
end;
|
||||
|
||||
begin
|
||||
RegisterPkgHandler('convertmk',TMakeFileConverter);
|
||||
end.
|
||||
|
@ -89,8 +89,8 @@ Const
|
||||
DefaultUnixPrefix = '/usr/local/lib/fpc/fppkg';
|
||||
DefaultUnixBuildDir = '/tmp/fppkg/';
|
||||
DefaultMirrors = 'mirrors.xml';
|
||||
DefaultRepository = 'repository.dat';
|
||||
DefaultVersions = 'versions.dat';
|
||||
DefaultRepository = 'packages.xml';
|
||||
DefaultVersions = 'versions-%s.dat';
|
||||
|
||||
// ini file keys
|
||||
SDefaults = 'Defaults';
|
||||
@ -202,7 +202,7 @@ end;
|
||||
|
||||
function TPackagerOptions.LocalVersions(CompilerConfig:String):string;
|
||||
begin
|
||||
Result:=ExtractFilePath(FLocalRepository)+'versions-'+CompilerConfig+'.dat';
|
||||
Result:=ExtractFilePath(FLocalRepository)+Format(DefaultVersions,[CompilerConfig]);
|
||||
end;
|
||||
|
||||
|
||||
@ -233,7 +233,7 @@ Procedure TPackagerOptions.InitCompilerDefaults;
|
||||
begin
|
||||
FCompiler:=FileSearch(DefaultCompiler+ExeExt,GetEnvironmentVariable('PATH'));
|
||||
if FCompiler='' then
|
||||
Error(SErrMissingFPC);
|
||||
Raise EPackageHandler.Create(SErrMissingFPC);
|
||||
{$warning TODO detect compiler version/target from -i options }
|
||||
FCompilerVersion:='2.0.4';
|
||||
FCompilerCPU:=StringToCPU(DefaultCPU);
|
||||
|
@ -4,14 +4,14 @@ unit pkgwget;
|
||||
|
||||
interface
|
||||
|
||||
uses Classes,pkgdownload,pkgropts;
|
||||
uses Classes,pkgdownload,pkgropts,fprepos;
|
||||
|
||||
Type
|
||||
TWGetDownloader = Class(TBasePackageDownloader)
|
||||
Private
|
||||
FWGet : String;
|
||||
Protected
|
||||
Constructor Create(AOwner: TComponent; ADefaults:TPackagerOptions); override;
|
||||
Constructor Create(AOwner: TComponent; ADefaults:TPackagerOptions; APackage: TFPPackage); override;
|
||||
Procedure WGetDownload(Const URL : String; Dest : TStream); virtual;
|
||||
Procedure FTPDownload(Const URL : String; Dest : TStream); override;
|
||||
Procedure HTTPDownload(Const URL : String; Dest : TStream); override;
|
||||
@ -23,7 +23,7 @@ implementation
|
||||
|
||||
uses process,pkghandler,pkgmessages;
|
||||
|
||||
Constructor TWGetDownloader.Create(AOwner: TComponent; ADefaults:TPackagerOptions);
|
||||
Constructor TWGetDownloader.Create(AOwner: TComponent; ADefaults:TPackagerOptions; APackage: TFPPackage);
|
||||
|
||||
begin
|
||||
Inherited;
|
||||
|
Loading…
Reference in New Issue
Block a user