mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-10 22:39:32 +01:00
* Added libcurl downloader and implemented new command style as in smart/svn/cvs
git-svn-id: trunk@5270 -
This commit is contained in:
parent
c7147a9412
commit
a6a300cbbe
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -7864,6 +7864,7 @@ utils/fppkg/fprepos.pp svneol=native#text/plain
|
|||||||
utils/fppkg/fpxmlrep.pp svneol=native#text/plain
|
utils/fppkg/fpxmlrep.pp svneol=native#text/plain
|
||||||
utils/fppkg/pkgdownload.pp svneol=native#text/plain
|
utils/fppkg/pkgdownload.pp svneol=native#text/plain
|
||||||
utils/fppkg/pkghandler.pp svneol=native#text/plain
|
utils/fppkg/pkghandler.pp svneol=native#text/plain
|
||||||
|
utils/fppkg/pkglibcurl.pp svneol=native#text/plain
|
||||||
utils/fppkg/pkglnet.pas svneol=native#text/plain
|
utils/fppkg/pkglnet.pas svneol=native#text/plain
|
||||||
utils/fppkg/pkgmessages.pp svneol=native#text/plain
|
utils/fppkg/pkgmessages.pp svneol=native#text/plain
|
||||||
utils/fppkg/pkgmkconv.pp svneol=native#text/plain
|
utils/fppkg/pkgmkconv.pp svneol=native#text/plain
|
||||||
|
|||||||
@ -10,8 +10,9 @@
|
|||||||
<MainUnitHasTitleStatement Value="False"/>
|
<MainUnitHasTitleStatement Value="False"/>
|
||||||
</Flags>
|
</Flags>
|
||||||
<MainUnit Value="0"/>
|
<MainUnit Value="0"/>
|
||||||
|
<IconPath Value="./"/>
|
||||||
<TargetFileExt Value=""/>
|
<TargetFileExt Value=""/>
|
||||||
<ActiveEditorIndexAtStart Value="3"/>
|
<ActiveEditorIndexAtStart Value="0"/>
|
||||||
</General>
|
</General>
|
||||||
<VersionInfo>
|
<VersionInfo>
|
||||||
<ProjectVersion Value=""/>
|
<ProjectVersion Value=""/>
|
||||||
@ -35,22 +36,26 @@
|
|||||||
<Filename Value="fppkg.pp"/>
|
<Filename Value="fppkg.pp"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="fppkg"/>
|
<UnitName Value="fppkg"/>
|
||||||
<CursorPos X="1" Y="13"/>
|
<CursorPos X="1" Y="244"/>
|
||||||
<TopLine Value="1"/>
|
<TopLine Value="215"/>
|
||||||
<EditorIndex Value="0"/>
|
<EditorIndex Value="0"/>
|
||||||
<UsageCount Value="20"/>
|
<UsageCount Value="21"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit0>
|
</Unit0>
|
||||||
<Unit1>
|
<Unit1>
|
||||||
<Filename Value="pkgropts.pp"/>
|
<Filename Value="pkgropts.pp"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UsageCount Value="20"/>
|
<UnitName Value="pkgropts"/>
|
||||||
<SyntaxHighlighter Value="Text"/>
|
<CursorPos X="3" Y="25"/>
|
||||||
|
<TopLine Value="1"/>
|
||||||
|
<EditorIndex Value="1"/>
|
||||||
|
<UsageCount Value="21"/>
|
||||||
|
<Loaded Value="True"/>
|
||||||
</Unit1>
|
</Unit1>
|
||||||
<Unit2>
|
<Unit2>
|
||||||
<Filename Value="fpmkcnst.inc"/>
|
<Filename Value="fpmkcnst.inc"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UsageCount Value="20"/>
|
<UsageCount Value="21"/>
|
||||||
<SyntaxHighlighter Value="Text"/>
|
<SyntaxHighlighter Value="Text"/>
|
||||||
</Unit2>
|
</Unit2>
|
||||||
<Unit3>
|
<Unit3>
|
||||||
@ -59,36 +64,36 @@
|
|||||||
<UnitName Value="fpmktype"/>
|
<UnitName Value="fpmktype"/>
|
||||||
<CursorPos X="3" Y="41"/>
|
<CursorPos X="3" Y="41"/>
|
||||||
<TopLine Value="1"/>
|
<TopLine Value="1"/>
|
||||||
<EditorIndex Value="2"/>
|
<EditorIndex Value="3"/>
|
||||||
<UsageCount Value="20"/>
|
<UsageCount Value="21"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit3>
|
</Unit3>
|
||||||
<Unit4>
|
<Unit4>
|
||||||
<Filename Value="fpmkunit.pp"/>
|
<Filename Value="fpmkunit.pp"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UsageCount Value="20"/>
|
<UsageCount Value="21"/>
|
||||||
<SyntaxHighlighter Value="Text"/>
|
<SyntaxHighlighter Value="Text"/>
|
||||||
</Unit4>
|
</Unit4>
|
||||||
<Unit5>
|
<Unit5>
|
||||||
<Filename Value="fprepos.pp"/>
|
<Filename Value="fprepos.pp"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UsageCount Value="20"/>
|
<UsageCount Value="21"/>
|
||||||
<SyntaxHighlighter Value="Text"/>
|
<SyntaxHighlighter Value="Text"/>
|
||||||
</Unit5>
|
</Unit5>
|
||||||
<Unit6>
|
<Unit6>
|
||||||
<Filename Value="fpxmlrep.pp"/>
|
<Filename Value="fpxmlrep.pp"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UsageCount Value="20"/>
|
<UsageCount Value="21"/>
|
||||||
<SyntaxHighlighter Value="Text"/>
|
<SyntaxHighlighter Value="Text"/>
|
||||||
</Unit6>
|
</Unit6>
|
||||||
<Unit7>
|
<Unit7>
|
||||||
<Filename Value="pkghandler.pp"/>
|
<Filename Value="pkghandler.pp"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="pkghandler"/>
|
<UnitName Value="pkghandler"/>
|
||||||
<CursorPos X="18" Y="41"/>
|
<CursorPos X="19" Y="60"/>
|
||||||
<TopLine Value="16"/>
|
<TopLine Value="17"/>
|
||||||
<EditorIndex Value="5"/>
|
<EditorIndex Value="6"/>
|
||||||
<UsageCount Value="20"/>
|
<UsageCount Value="21"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit7>
|
</Unit7>
|
||||||
<Unit8>
|
<Unit8>
|
||||||
@ -97,151 +102,151 @@
|
|||||||
<UnitName Value="pkgmkconv"/>
|
<UnitName Value="pkgmkconv"/>
|
||||||
<CursorPos X="20" Y="7"/>
|
<CursorPos X="20" Y="7"/>
|
||||||
<TopLine Value="1"/>
|
<TopLine Value="1"/>
|
||||||
<EditorIndex Value="4"/>
|
<EditorIndex Value="5"/>
|
||||||
<UsageCount Value="20"/>
|
<UsageCount Value="21"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit8>
|
</Unit8>
|
||||||
<Unit9>
|
<Unit9>
|
||||||
<Filename Value="pkgdownload.pp"/>
|
<Filename Value="pkgdownload.pp"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="pkgdownload"/>
|
<UnitName Value="pkgdownload"/>
|
||||||
<CursorPos X="34" Y="64"/>
|
<CursorPos X="13" Y="96"/>
|
||||||
<TopLine Value="59"/>
|
<TopLine Value="56"/>
|
||||||
<EditorIndex Value="3"/>
|
<EditorIndex Value="4"/>
|
||||||
<UsageCount Value="20"/>
|
<UsageCount Value="21"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit9>
|
</Unit9>
|
||||||
<Unit10>
|
<Unit10>
|
||||||
<Filename Value="pkgmessages.pp"/>
|
<Filename Value="pkgmessages.pp"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="pkgmessages"/>
|
<UnitName Value="pkgmessages"/>
|
||||||
<CursorPos X="1" Y="18"/>
|
<CursorPos X="26" Y="9"/>
|
||||||
<TopLine Value="1"/>
|
<TopLine Value="1"/>
|
||||||
<EditorIndex Value="1"/>
|
<EditorIndex Value="2"/>
|
||||||
<UsageCount Value="20"/>
|
<UsageCount Value="21"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit10>
|
</Unit10>
|
||||||
</Units>
|
</Units>
|
||||||
<JumpHistory Count="30" HistoryIndex="29">
|
<JumpHistory Count="30" HistoryIndex="29">
|
||||||
<Position1>
|
<Position1>
|
||||||
<Filename Value="pkgmkconv.pp"/>
|
<Filename Value="fppkg.pp"/>
|
||||||
<Caret Line="614" Column="12" TopLine="591"/>
|
<Caret Line="245" Column="5" TopLine="222"/>
|
||||||
</Position1>
|
</Position1>
|
||||||
<Position2>
|
<Position2>
|
||||||
<Filename Value="fppkg.pp"/>
|
<Filename Value="fppkg.pp"/>
|
||||||
<Caret Line="7" Column="37" TopLine="1"/>
|
<Caret Line="278" Column="1" TopLine="245"/>
|
||||||
</Position2>
|
</Position2>
|
||||||
<Position3>
|
<Position3>
|
||||||
<Filename Value="fppkg.pp"/>
|
<Filename Value="fppkg.pp"/>
|
||||||
<Caret Line="75" Column="34" TopLine="52"/>
|
<Caret Line="245" Column="5" TopLine="222"/>
|
||||||
</Position3>
|
</Position3>
|
||||||
<Position4>
|
<Position4>
|
||||||
<Filename Value="fppkg.pp"/>
|
<Filename Value="fppkg.pp"/>
|
||||||
<Caret Line="61" Column="19" TopLine="52"/>
|
<Caret Line="249" Column="12" TopLine="222"/>
|
||||||
</Position4>
|
</Position4>
|
||||||
<Position5>
|
<Position5>
|
||||||
<Filename Value="fppkg.pp"/>
|
<Filename Value="pkghandler.pp"/>
|
||||||
<Caret Line="44" Column="31" TopLine="1"/>
|
<Caret Line="58" Column="65" TopLine="35"/>
|
||||||
</Position5>
|
</Position5>
|
||||||
<Position6>
|
<Position6>
|
||||||
<Filename Value="fppkg.pp"/>
|
<Filename Value="pkghandler.pp"/>
|
||||||
<Caret Line="239" Column="23" TopLine="216"/>
|
<Caret Line="47" Column="51" TopLine="24"/>
|
||||||
</Position6>
|
</Position6>
|
||||||
<Position7>
|
<Position7>
|
||||||
<Filename Value="fppkg.pp"/>
|
<Filename Value="pkghandler.pp"/>
|
||||||
<Caret Line="282" Column="29" TopLine="243"/>
|
<Caret Line="54" Column="1" TopLine="31"/>
|
||||||
</Position7>
|
</Position7>
|
||||||
<Position8>
|
<Position8>
|
||||||
<Filename Value="pkgdownload.pp"/>
|
<Filename Value="pkghandler.pp"/>
|
||||||
<Caret Line="14" Column="3" TopLine="1"/>
|
<Caret Line="47" Column="1" TopLine="47"/>
|
||||||
</Position8>
|
</Position8>
|
||||||
<Position9>
|
<Position9>
|
||||||
<Filename Value="pkghandler.pp"/>
|
<Filename Value="pkghandler.pp"/>
|
||||||
<Caret Line="50" Column="1" TopLine="1"/>
|
<Caret Line="54" Column="3" TopLine="31"/>
|
||||||
</Position9>
|
</Position9>
|
||||||
<Position10>
|
<Position10>
|
||||||
<Filename Value="pkghandler.pp"/>
|
<Filename Value="pkghandler.pp"/>
|
||||||
<Caret Line="42" Column="62" TopLine="18"/>
|
<Caret Line="59" Column="3" TopLine="36"/>
|
||||||
</Position10>
|
</Position10>
|
||||||
<Position11>
|
<Position11>
|
||||||
<Filename Value="pkghandler.pp"/>
|
<Filename Value="pkghandler.pp"/>
|
||||||
<Caret Line="47" Column="24" TopLine="24"/>
|
<Caret Line="53" Column="6" TopLine="30"/>
|
||||||
</Position11>
|
</Position11>
|
||||||
<Position12>
|
<Position12>
|
||||||
<Filename Value="pkghandler.pp"/>
|
<Filename Value="pkghandler.pp"/>
|
||||||
<Caret Line="45" Column="73" TopLine="24"/>
|
<Caret Line="40" Column="47" TopLine="30"/>
|
||||||
</Position12>
|
</Position12>
|
||||||
<Position13>
|
<Position13>
|
||||||
<Filename Value="pkgmkconv.pp"/>
|
<Filename Value="pkghandler.pp"/>
|
||||||
<Caret Line="49" Column="14" TopLine="16"/>
|
<Caret Line="53" Column="6" TopLine="30"/>
|
||||||
</Position13>
|
</Position13>
|
||||||
<Position14>
|
<Position14>
|
||||||
<Filename Value="pkgmkconv.pp"/>
|
<Filename Value="pkghandler.pp"/>
|
||||||
<Caret Line="1" Column="1" TopLine="1"/>
|
<Caret Line="55" Column="10" TopLine="30"/>
|
||||||
</Position14>
|
</Position14>
|
||||||
<Position15>
|
<Position15>
|
||||||
<Filename Value="pkgdownload.pp"/>
|
<Filename Value="pkghandler.pp"/>
|
||||||
<Caret Line="30" Column="9" TopLine="4"/>
|
<Caret Line="50" Column="14" TopLine="9"/>
|
||||||
</Position15>
|
</Position15>
|
||||||
<Position16>
|
<Position16>
|
||||||
<Filename Value="pkgdownload.pp"/>
|
<Filename Value="pkghandler.pp"/>
|
||||||
<Caret Line="36" Column="26" TopLine="13"/>
|
<Caret Line="53" Column="6" TopLine="30"/>
|
||||||
</Position16>
|
</Position16>
|
||||||
<Position17>
|
<Position17>
|
||||||
<Filename Value="pkgdownload.pp"/>
|
<Filename Value="pkghandler.pp"/>
|
||||||
<Caret Line="26" Column="19" TopLine="3"/>
|
<Caret Line="40" Column="10" TopLine="17"/>
|
||||||
</Position17>
|
</Position17>
|
||||||
<Position18>
|
<Position18>
|
||||||
<Filename Value="pkghandler.pp"/>
|
<Filename Value="fppkg.pp"/>
|
||||||
<Caret Line="19" Column="26" TopLine="12"/>
|
<Caret Line="46" Column="1" TopLine="23"/>
|
||||||
</Position18>
|
</Position18>
|
||||||
<Position19>
|
<Position19>
|
||||||
<Filename Value="pkghandler.pp"/>
|
<Filename Value="fppkg.pp"/>
|
||||||
<Caret Line="56" Column="5" TopLine="12"/>
|
<Caret Line="289" Column="1" TopLine="266"/>
|
||||||
</Position19>
|
</Position19>
|
||||||
<Position20>
|
<Position20>
|
||||||
<Filename Value="pkghandler.pp"/>
|
<Filename Value="fppkg.pp"/>
|
||||||
<Caret Line="62" Column="11" TopLine="39"/>
|
<Caret Line="254" Column="1" TopLine="241"/>
|
||||||
</Position20>
|
</Position20>
|
||||||
<Position21>
|
<Position21>
|
||||||
<Filename Value="pkgdownload.pp"/>
|
<Filename Value="fppkg.pp"/>
|
||||||
<Caret Line="22" Column="1" TopLine="1"/>
|
<Caret Line="46" Column="42" TopLine="23"/>
|
||||||
</Position21>
|
</Position21>
|
||||||
<Position22>
|
<Position22>
|
||||||
<Filename Value="pkgdownload.pp"/>
|
<Filename Value="fppkg.pp"/>
|
||||||
<Caret Line="53" Column="1" TopLine="19"/>
|
<Caret Line="33" Column="28" TopLine="23"/>
|
||||||
</Position22>
|
</Position22>
|
||||||
<Position23>
|
<Position23>
|
||||||
<Filename Value="pkgdownload.pp"/>
|
<Filename Value="fppkg.pp"/>
|
||||||
<Caret Line="49" Column="5" TopLine="1"/>
|
<Caret Line="47" Column="42" TopLine="23"/>
|
||||||
</Position23>
|
</Position23>
|
||||||
<Position24>
|
<Position24>
|
||||||
<Filename Value="pkgdownload.pp"/>
|
<Filename Value="fppkg.pp"/>
|
||||||
<Caret Line="10" Column="1" TopLine="1"/>
|
<Caret Line="253" Column="42" TopLine="230"/>
|
||||||
</Position24>
|
</Position24>
|
||||||
<Position25>
|
<Position25>
|
||||||
<Filename Value="pkgdownload.pp"/>
|
<Filename Value="fppkg.pp"/>
|
||||||
<Caret Line="55" Column="28" TopLine="32"/>
|
<Caret Line="254" Column="37" TopLine="231"/>
|
||||||
</Position25>
|
</Position25>
|
||||||
<Position26>
|
<Position26>
|
||||||
<Filename Value="pkgdownload.pp"/>
|
<Filename Value="fppkg.pp"/>
|
||||||
<Caret Line="59" Column="1" TopLine="32"/>
|
<Caret Line="259" Column="9" TopLine="236"/>
|
||||||
</Position26>
|
</Position26>
|
||||||
<Position27>
|
<Position27>
|
||||||
<Filename Value="pkgdownload.pp"/>
|
<Filename Value="fppkg.pp"/>
|
||||||
<Caret Line="73" Column="46" TopLine="50"/>
|
<Caret Line="234" Column="16" TopLine="203"/>
|
||||||
</Position27>
|
</Position27>
|
||||||
<Position28>
|
<Position28>
|
||||||
<Filename Value="pkgdownload.pp"/>
|
<Filename Value="fppkg.pp"/>
|
||||||
<Caret Line="75" Column="19" TopLine="52"/>
|
<Caret Line="278" Column="63" TopLine="255"/>
|
||||||
</Position28>
|
</Position28>
|
||||||
<Position29>
|
<Position29>
|
||||||
<Filename Value="pkgdownload.pp"/>
|
<Filename Value="fppkg.pp"/>
|
||||||
<Caret Line="93" Column="7" TopLine="59"/>
|
<Caret Line="283" Column="1" TopLine="255"/>
|
||||||
</Position29>
|
</Position29>
|
||||||
<Position30>
|
<Position30>
|
||||||
<Filename Value="pkgdownload.pp"/>
|
<Filename Value="fppkg.pp"/>
|
||||||
<Caret Line="94" Column="11" TopLine="59"/>
|
<Caret Line="282" Column="9" TopLine="259"/>
|
||||||
</Position30>
|
</Position30>
|
||||||
</JumpHistory>
|
</JumpHistory>
|
||||||
</ProjectOptions>
|
</ProjectOptions>
|
||||||
|
|||||||
@ -4,20 +4,24 @@ program fppkg;
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
// General
|
// General
|
||||||
|
{$ifdef unix}
|
||||||
|
baseunix,
|
||||||
|
{$endif}
|
||||||
Classes, SysUtils, TypInfo, custapp,
|
Classes, SysUtils, TypInfo, custapp,
|
||||||
// Repository handler objects
|
// Repository handler objects
|
||||||
fprepos, fpxmlrep,fpmktype,
|
fprepos, fpxmlrep,fpmktype, pkgropts,
|
||||||
// Package Handler components
|
// Package Handler components
|
||||||
pkghandler, pkgmkconv, pkgdownload, pkgmessages;
|
pkghandler, pkgmkconv, pkgdownload, pkgmessages;
|
||||||
|
|
||||||
Type
|
Type
|
||||||
|
|
||||||
TRunMode = (rmHelp,rmCompile,rmBuild,rmInstall,rmArchive,rmClean,rmDownload);
|
TRunMode = (rmHelp,rmCompile,rmBuild,rmInstall,rmArchive,rmClean,rmDownload,rmUpdate);
|
||||||
|
|
||||||
{ TMakeTool }
|
{ TMakeTool }
|
||||||
|
|
||||||
TMakeTool = Class(TCustomApplication)
|
TMakeTool = Class(TCustomApplication)
|
||||||
Private
|
Private
|
||||||
|
FDefaults: TPackagerOptions;
|
||||||
FConvertOnly,
|
FConvertOnly,
|
||||||
FLogging : Boolean;
|
FLogging : Boolean;
|
||||||
FCompiler : String;
|
FCompiler : String;
|
||||||
@ -26,16 +30,22 @@ Type
|
|||||||
FHaveFpmake : Boolean;
|
FHaveFpmake : Boolean;
|
||||||
FFPMakeSrc : String;
|
FFPMakeSrc : String;
|
||||||
FFPMakeBin : String;
|
FFPMakeBin : String;
|
||||||
|
FVerbose: TVerbosities;
|
||||||
|
FPackages : TStrings;
|
||||||
Procedure Log(Msg : String);
|
Procedure Log(Msg : String);
|
||||||
Procedure Error(Msg : String);
|
Procedure Error(Msg : String);
|
||||||
Procedure Error(Fmt : String; Args : Array of const);
|
Procedure Error(Fmt : String; Args : Array of const);
|
||||||
Function GetCompiler : String;
|
Function GetCompiler : String;
|
||||||
Public
|
Public
|
||||||
|
Procedure DownloadFile(Const URL,Dest : String);
|
||||||
|
Function GetConfigFileName : String;
|
||||||
|
Procedure LoadDefaults;
|
||||||
Procedure ProcessCommandLine;
|
Procedure ProcessCommandLine;
|
||||||
procedure CreateFPMake;
|
procedure CreateFPMake;
|
||||||
procedure CompileFPMake(Extra : Boolean);
|
procedure CompileFPMake(Extra : Boolean);
|
||||||
Function RunFPMake : Integer;
|
Function RunFPMake : Integer;
|
||||||
Procedure DoRun; Override;
|
Procedure DoRun; Override;
|
||||||
|
Property Verbose : TVerbosities Read FVerbose Write FVerbose;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
EMakeToolError = Class(Exception);
|
EMakeToolError = Class(Exception);
|
||||||
@ -147,6 +157,36 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TMakeTool.DownloadFile(const URL, Dest: String);
|
||||||
|
begin
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TMakeTool.GetConfigFileName: String;
|
||||||
|
|
||||||
|
var
|
||||||
|
G : Boolean;
|
||||||
|
|
||||||
|
begin
|
||||||
|
if HasOption('C','config-file') then
|
||||||
|
Result:=GetOptionValue('C','config-file')
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
{$ifdef unix}
|
||||||
|
g:=(fpgetuid=0);
|
||||||
|
{$else}
|
||||||
|
G:=true;
|
||||||
|
{$endif}
|
||||||
|
Result:=GetAppConfigFile(G,False);
|
||||||
|
end
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMakeTool.LoadDefaults;
|
||||||
|
begin
|
||||||
|
FDefaults:=TPackagerOptions.Create;
|
||||||
|
FDefaults.LoadFromFile(GetConfigFileName);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TMakeTool.ProcessCommandLine;
|
procedure TMakeTool.ProcessCommandLine;
|
||||||
|
|
||||||
@ -191,44 +231,66 @@ procedure TMakeTool.ProcessCommandLine;
|
|||||||
|
|
||||||
Var
|
Var
|
||||||
I : Integer;
|
I : Integer;
|
||||||
|
GlobalOpts : Boolean;
|
||||||
|
cmd : string;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
I:=0;
|
I:=0;
|
||||||
FLogging:=False;
|
FLogging:=False;
|
||||||
FRunMode:=rmhelp;
|
FRunMode:=rmhelp;
|
||||||
FConvertOnly:=False;
|
FConvertOnly:=False;
|
||||||
|
GlobalOpts:=True;
|
||||||
|
FPackages:=TStringList.Create;
|
||||||
|
// We can't use the TCustomApplication option handling,
|
||||||
|
// because they cannot handle [general opts] [command] [cmd-opts] [args]
|
||||||
While (I<ParamCount) do
|
While (I<ParamCount) do
|
||||||
begin
|
begin
|
||||||
Inc(I);
|
Inc(I);
|
||||||
if Checkoption(I,'n','convert') then
|
// Check options.
|
||||||
FConvertOnly:=True
|
if CheckOption(I,'r','compiler') then
|
||||||
else if Checkoption(I,'m','compile') then
|
FDefaults.Compiler:=OptionArg(I)
|
||||||
FRunMode:=rmCompile
|
else if CheckOption(I,'v','verbose') then
|
||||||
else if Checkoption(I,'b','build') then
|
Include(FVerbose,StringToVerbosity(OptionArg(I)))
|
||||||
FRunMode:=rmBuild
|
|
||||||
else if CheckOption(I,'i','install') then
|
|
||||||
FRunMode:=rmInstall
|
|
||||||
else if CheckOption(I,'c','clean') then
|
|
||||||
FRunMode:=rmClean
|
|
||||||
else if CheckOption(I,'a','archive') then
|
|
||||||
FRunMode:=rmarchive
|
|
||||||
else if CheckOption(I,'d','download') then
|
|
||||||
FRunMode:=rmDownload
|
|
||||||
else if CheckOption(I,'h','help') then
|
else if CheckOption(I,'h','help') then
|
||||||
FRunMode:=rmhelp
|
FRunMode:=rmhelp
|
||||||
// Check.
|
else if (Length(Paramstr(i))>0) and (Paramstr(I)[1]='-') then
|
||||||
else if CheckOption(I,'r','compiler') then
|
Raise EMakeToolError.CreateFmt(SErrInvalidArgument,[I,ParamStr(i)])
|
||||||
FCompiler:=OptionArg(I)
|
else
|
||||||
else if CheckOption(I,'v','verbose') then
|
If GlobalOpts then
|
||||||
Flogging:=Pos('info',Lowercase(OptionArg(I)))<>0;
|
begin
|
||||||
|
// It's a command.
|
||||||
|
Cmd:=Paramstr(I);
|
||||||
|
if (Cmd='convert') then
|
||||||
|
FConvertOnly:=True
|
||||||
|
else if (Cmd='compile') then
|
||||||
|
FRunMode:=rmCompile
|
||||||
|
else if (Cmd='build') then
|
||||||
|
FRunMode:=rmBuild
|
||||||
|
else if (Cmd='install') then
|
||||||
|
FRunMode:=rmInstall
|
||||||
|
else if (cmd='clean') then
|
||||||
|
FRunMode:=rmClean
|
||||||
|
else if (cmd='archive') then
|
||||||
|
FRunMode:=rmarchive
|
||||||
|
else if (cmd='download') then
|
||||||
|
FRunMode:=rmDownload
|
||||||
|
else if (cmd='update') then
|
||||||
|
FRunMode:=rmUpdate
|
||||||
|
else
|
||||||
|
Raise EMakeToolError.CreateFmt(SErrInvalidCommand,[Cmd]);
|
||||||
|
end
|
||||||
|
else // It's a package name.
|
||||||
|
begin
|
||||||
|
FPackages.Add(Paramstr(i));
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TMakeTool.DoRun;
|
procedure TMakeTool.DoRun;
|
||||||
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
LoadDefaults;
|
||||||
Try
|
Try
|
||||||
ProcessCommandLine;
|
ProcessCommandLine;
|
||||||
If FConvertOnly then
|
If FConvertOnly then
|
||||||
|
|||||||
@ -35,10 +35,33 @@ Type
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
EPackageHandler = Class(EInstallerError);
|
EPackageHandler = Class(EInstallerError);
|
||||||
|
|
||||||
|
Function StringToVerbosity (S : String) : TVerbosity;
|
||||||
|
Function VerbosityToString (V : TVerbosity): String;
|
||||||
|
|
||||||
|
|
||||||
Implementation
|
Implementation
|
||||||
|
|
||||||
uses pkgmessages;
|
uses pkgmessages,typinfo;
|
||||||
|
|
||||||
|
function StringToVerbosity(S: String): TVerbosity;
|
||||||
|
|
||||||
|
Var
|
||||||
|
I : integer;
|
||||||
|
|
||||||
|
begin
|
||||||
|
I:=GetEnumValue(TypeInfo(TVerbosity),'v'+S);
|
||||||
|
If (I<>-1) then
|
||||||
|
Result:=TVerbosity(I)
|
||||||
|
else
|
||||||
|
Raise EPackageHandler.CreateFmt(SErrInvalidVerbosity,[S]);
|
||||||
|
end;
|
||||||
|
|
||||||
|
Function VerbosityToString (V : TVerbosity): String;
|
||||||
|
begin
|
||||||
|
Result:=GetEnumName(TypeInfo(TVerbosity),Integer(V));
|
||||||
|
Delete(Result,1,1);// Delete 'v'
|
||||||
|
end;
|
||||||
|
|
||||||
{ TPackageHandler }
|
{ TPackageHandler }
|
||||||
|
|
||||||
|
|||||||
65
utils/fppkg/pkglibcurl.pp
Normal file
65
utils/fppkg/pkglibcurl.pp
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
{$mode objfpc}
|
||||||
|
{$h+}
|
||||||
|
unit pkglibcurl;
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses Classes,pkgdownload;
|
||||||
|
|
||||||
|
Type
|
||||||
|
TLibCurlDownloader = Class(TBasePackageDownloader)
|
||||||
|
Protected
|
||||||
|
Procedure LibCurlDownload(Const URL : String; Dest : TStream);
|
||||||
|
Procedure FTPDownload(Const URL : String; Dest : TStream); override;
|
||||||
|
Procedure HTTPDownload(Const URL : String; Dest : TStream); override;
|
||||||
|
end;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
uses sysutils,uriparser,libcurl,pkgmessages,unixtype;
|
||||||
|
|
||||||
|
Function DoStreamWrite(Ptr : Pointer; Size : size_t; nmemb: size_t; Data : Pointer) : size_t;cdecl;
|
||||||
|
|
||||||
|
begin
|
||||||
|
Result:=TStream(Data).Write(Ptr^,Size*nmemb);
|
||||||
|
end;
|
||||||
|
|
||||||
|
Procedure TLibCurlDownloader.LibCurlDownload(Const URL : String; Dest : TStream);
|
||||||
|
|
||||||
|
Var
|
||||||
|
HCurl : PCurl;
|
||||||
|
ErrorBuffer : Array[0..CURL_ERROR_SIZE] of char;
|
||||||
|
|
||||||
|
begin
|
||||||
|
hCurl:= curl_easy_init;
|
||||||
|
if Assigned(hCurl) then
|
||||||
|
Try
|
||||||
|
curl_easy_setopt(hCurl,CURLOPT_ERRORBUFFER, [@ErrorBuffer]);
|
||||||
|
curl_easy_setopt(hCurl,CURLOPT_URL,[Pchar(URL)]);
|
||||||
|
curl_easy_setopt(hCurl,CURLOPT_WRITEFUNCTION,[@DoStreamWrite]);
|
||||||
|
curl_easy_setopt(hCurl,CURLOPT_WRITEDATA,[Pointer(Dest)]);
|
||||||
|
if Ord(curl_easy_perform(hCurl))<>0 then
|
||||||
|
Error(SErrDownloadFailed,[StrPas(@ErrorBuffer)])
|
||||||
|
Finally
|
||||||
|
curl_easy_cleanup(hCurl);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Raise Exception.Create('Failed to initialize Curl');
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
Procedure TLibCurlDownloader.FTPDownload(Const URL : String; Dest : TStream);
|
||||||
|
|
||||||
|
begin
|
||||||
|
LibCurlDownload(URL,Dest);
|
||||||
|
end;
|
||||||
|
|
||||||
|
Procedure TLibCurlDownloader.HTTPDownload(Const URL : String; Dest : TStream);
|
||||||
|
|
||||||
|
begin
|
||||||
|
LibCurlDownload(URL,Dest);
|
||||||
|
end;
|
||||||
|
|
||||||
|
initialization
|
||||||
|
DownloaderClass:=TLibCurlDownloader;
|
||||||
|
end.
|
||||||
@ -6,7 +6,7 @@ interface
|
|||||||
|
|
||||||
|
|
||||||
Resourcestring
|
Resourcestring
|
||||||
// SErrInValidArgument = 'Invalid command-line argument at position %d : %s';
|
SErrInValidArgument = 'Invalid command-line argument at position %d : %s';
|
||||||
SErrNeedArgument = 'Option at position %d (%s) needs an argument';
|
SErrNeedArgument = 'Option at position %d (%s) needs an argument';
|
||||||
SErrMissingConfig = 'Missing configuration Makefile.fpc or fpmake.pp';
|
SErrMissingConfig = 'Missing configuration Makefile.fpc or fpmake.pp';
|
||||||
SErrRunning = 'The FPC make tool encountered the following error: %s';
|
SErrRunning = 'The FPC make tool encountered the following error: %s';
|
||||||
@ -18,6 +18,8 @@ Resourcestring
|
|||||||
SErrNoSuchFile = 'File "%s" does not exist.';
|
SErrNoSuchFile = 'File "%s" does not exist.';
|
||||||
SErrWGetDownloadFailed = 'Download failed: wget reported exit status %d.';
|
SErrWGetDownloadFailed = 'Download failed: wget reported exit status %d.';
|
||||||
SErrDownloadFailed = 'Download failed: %s';
|
SErrDownloadFailed = 'Download failed: %s';
|
||||||
|
SErrInvalidVerbosity = 'Invalid verbosity string: "%s"';
|
||||||
|
SErrInvalidCommand = 'Invalid command: %s';
|
||||||
|
|
||||||
SErrHTTPGetFailed = 'HTTP Download failed.';
|
SErrHTTPGetFailed = 'HTTP Download failed.';
|
||||||
SErrLoginFailed = 'FTP LOGIN command failed.';
|
SErrLoginFailed = 'FTP LOGIN command failed.';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user