mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-23 02:29:19 +02:00
* basic framework for actions
git-svn-id: trunk@6306 -
This commit is contained in:
parent
0e54433c75
commit
f2747f1e40
3
.gitattributes
vendored
3
.gitattributes
vendored
@ -8204,6 +8204,7 @@ utils/fpmc/test.mc -text
|
|||||||
utils/fppkg/Makefile svneol=native#text/plain
|
utils/fppkg/Makefile svneol=native#text/plain
|
||||||
utils/fppkg/Makefile.fpc svneol=native#text/plain
|
utils/fppkg/Makefile.fpc svneol=native#text/plain
|
||||||
utils/fppkg/README svneol=native#text/plain
|
utils/fppkg/README svneol=native#text/plain
|
||||||
|
utils/fppkg/contnrs20.pp svneol=native#text/plain
|
||||||
utils/fppkg/fpmkcnst.inc svneol=native#text/plain
|
utils/fppkg/fpmkcnst.inc svneol=native#text/plain
|
||||||
utils/fppkg/fpmktype.pp svneol=native#text/plain
|
utils/fppkg/fpmktype.pp svneol=native#text/plain
|
||||||
utils/fppkg/fpmkunit.pp svneol=native#text/plain
|
utils/fppkg/fpmkunit.pp svneol=native#text/plain
|
||||||
@ -8240,6 +8241,7 @@ utils/fppkg/lnet/sys/lspawnfcgiunix.inc svneol=native#text/plain
|
|||||||
utils/fppkg/lnet/sys/lspawnfcgiwin.inc svneol=native#text/plain
|
utils/fppkg/lnet/sys/lspawnfcgiwin.inc svneol=native#text/plain
|
||||||
utils/fppkg/lnet/sys/osunits.inc svneol=native#text/plain
|
utils/fppkg/lnet/sys/osunits.inc svneol=native#text/plain
|
||||||
utils/fppkg/pkgdownload.pp svneol=native#text/plain
|
utils/fppkg/pkgdownload.pp svneol=native#text/plain
|
||||||
|
utils/fppkg/pkgfpmake.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/pkglibcurl.pp svneol=native#text/plain
|
||||||
utils/fppkg/pkglnet.pas svneol=native#text/plain
|
utils/fppkg/pkglnet.pas svneol=native#text/plain
|
||||||
@ -8252,6 +8254,7 @@ utils/fppkg/pkgwget.pp svneol=native#text/plain
|
|||||||
utils/fppkg/rep2xml.lpi svneol=native#text/plain
|
utils/fppkg/rep2xml.lpi svneol=native#text/plain
|
||||||
utils/fppkg/rep2xml.lpr svneol=native#text/plain
|
utils/fppkg/rep2xml.lpr svneol=native#text/plain
|
||||||
utils/fppkg/reptest.pp svneol=native#text/plain
|
utils/fppkg/reptest.pp svneol=native#text/plain
|
||||||
|
utils/fppkg/streamcoll20.pp svneol=native#text/plain
|
||||||
utils/fppkg/testdownload.pp svneol=native#text/plain
|
utils/fppkg/testdownload.pp svneol=native#text/plain
|
||||||
utils/fprcp/Makefile svneol=native#text/plain
|
utils/fprcp/Makefile svneol=native#text/plain
|
||||||
utils/fprcp/Makefile.fpc svneol=native#text/plain
|
utils/fprcp/Makefile.fpc svneol=native#text/plain
|
||||||
|
2344
utils/fppkg/contnrs20.pp
Executable file
2344
utils/fppkg/contnrs20.pp
Executable file
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<CONFIG>
|
<CONFIG>
|
||||||
<ProjectOptions>
|
<ProjectOptions>
|
||||||
<PathDelim Value="/"/>
|
<PathDelim Value="\"/>
|
||||||
<Version Value="5"/>
|
<Version Value="5"/>
|
||||||
<General>
|
<General>
|
||||||
<Flags>
|
<Flags>
|
||||||
@ -10,7 +10,7 @@
|
|||||||
<MainUnitHasTitleStatement Value="False"/>
|
<MainUnitHasTitleStatement Value="False"/>
|
||||||
</Flags>
|
</Flags>
|
||||||
<MainUnit Value="0"/>
|
<MainUnit Value="0"/>
|
||||||
<IconPath Value="./"/>
|
<IconPath Value=".\"/>
|
||||||
<TargetFileExt Value=""/>
|
<TargetFileExt Value=""/>
|
||||||
<ActiveEditorIndexAtStart Value="0"/>
|
<ActiveEditorIndexAtStart Value="0"/>
|
||||||
</General>
|
</General>
|
||||||
@ -21,6 +21,7 @@
|
|||||||
</VersionInfo>
|
</VersionInfo>
|
||||||
<PublishOptions>
|
<PublishOptions>
|
||||||
<Version Value="2"/>
|
<Version Value="2"/>
|
||||||
|
<DestinationDirectory Value="$(TestDir)\publishedproject\"/>
|
||||||
<IgnoreBinaries Value="False"/>
|
<IgnoreBinaries Value="False"/>
|
||||||
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
|
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
|
||||||
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
|
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
|
||||||
@ -28,35 +29,36 @@
|
|||||||
<RunParams>
|
<RunParams>
|
||||||
<local>
|
<local>
|
||||||
<FormatVersion Value="1"/>
|
<FormatVersion Value="1"/>
|
||||||
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
|
<LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/>
|
||||||
</local>
|
</local>
|
||||||
</RunParams>
|
</RunParams>
|
||||||
<Units Count="11">
|
<Units Count="20">
|
||||||
<Unit0>
|
<Unit0>
|
||||||
<Filename Value="fppkg.pp"/>
|
<Filename Value="fppkg.pp"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="fppkg"/>
|
<UnitName Value="fppkg"/>
|
||||||
<CursorPos X="1" Y="244"/>
|
<CursorPos X="32" Y="231"/>
|
||||||
<TopLine Value="215"/>
|
<TopLine Value="212"/>
|
||||||
<EditorIndex Value="0"/>
|
<EditorIndex Value="0"/>
|
||||||
<UsageCount Value="21"/>
|
<UsageCount Value="33"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit0>
|
</Unit0>
|
||||||
<Unit1>
|
<Unit1>
|
||||||
<Filename Value="pkgropts.pp"/>
|
<Filename Value="pkgropts.pp"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="pkgropts"/>
|
<UnitName Value="pkgropts"/>
|
||||||
<CursorPos X="3" Y="25"/>
|
<CursorPos X="19" Y="25"/>
|
||||||
<TopLine Value="1"/>
|
<TopLine Value="22"/>
|
||||||
<EditorIndex Value="1"/>
|
<EditorIndex Value="6"/>
|
||||||
<UsageCount Value="21"/>
|
<UsageCount Value="33"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit1>
|
</Unit1>
|
||||||
<Unit2>
|
<Unit2>
|
||||||
<Filename Value="fpmkcnst.inc"/>
|
<Filename Value="fpmkcnst.inc"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UsageCount Value="21"/>
|
<CursorPos X="64" Y="8"/>
|
||||||
<SyntaxHighlighter Value="Text"/>
|
<TopLine Value="1"/>
|
||||||
|
<UsageCount Value="33"/>
|
||||||
</Unit2>
|
</Unit2>
|
||||||
<Unit3>
|
<Unit3>
|
||||||
<Filename Value="fpmktype.pp"/>
|
<Filename Value="fpmktype.pp"/>
|
||||||
@ -64,197 +66,290 @@
|
|||||||
<UnitName Value="fpmktype"/>
|
<UnitName Value="fpmktype"/>
|
||||||
<CursorPos X="3" Y="41"/>
|
<CursorPos X="3" Y="41"/>
|
||||||
<TopLine Value="1"/>
|
<TopLine Value="1"/>
|
||||||
<EditorIndex Value="3"/>
|
<EditorIndex Value="9"/>
|
||||||
<UsageCount Value="21"/>
|
<UsageCount Value="33"/>
|
||||||
<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="21"/>
|
<UnitName Value="fpmkunit"/>
|
||||||
<SyntaxHighlighter Value="Text"/>
|
<CursorPos X="1" Y="1"/>
|
||||||
|
<TopLine Value="1"/>
|
||||||
|
<EditorIndex Value="1"/>
|
||||||
|
<UsageCount Value="33"/>
|
||||||
|
<Loaded Value="True"/>
|
||||||
</Unit4>
|
</Unit4>
|
||||||
<Unit5>
|
<Unit5>
|
||||||
<Filename Value="fprepos.pp"/>
|
<Filename Value="fprepos.pp"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UsageCount Value="21"/>
|
<UnitName Value="fprepos"/>
|
||||||
<SyntaxHighlighter Value="Text"/>
|
<CursorPos X="27" Y="28"/>
|
||||||
|
<TopLine Value="2"/>
|
||||||
|
<EditorIndex Value="5"/>
|
||||||
|
<UsageCount Value="33"/>
|
||||||
|
<Loaded Value="True"/>
|
||||||
</Unit5>
|
</Unit5>
|
||||||
<Unit6>
|
<Unit6>
|
||||||
<Filename Value="fpxmlrep.pp"/>
|
<Filename Value="fpxmlrep.pp"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UsageCount Value="21"/>
|
<UsageCount Value="33"/>
|
||||||
<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="19" Y="60"/>
|
<CursorPos X="52" Y="51"/>
|
||||||
<TopLine Value="17"/>
|
<TopLine Value="32"/>
|
||||||
<EditorIndex Value="6"/>
|
<EditorIndex Value="13"/>
|
||||||
<UsageCount Value="21"/>
|
<UsageCount Value="33"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit7>
|
</Unit7>
|
||||||
<Unit8>
|
<Unit8>
|
||||||
<Filename Value="pkgmkconv.pp"/>
|
<Filename Value="pkgmkconv.pp"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="pkgmkconv"/>
|
<UnitName Value="pkgmkconv"/>
|
||||||
<CursorPos X="20" Y="7"/>
|
<CursorPos X="1" Y="46"/>
|
||||||
<TopLine Value="1"/>
|
<TopLine Value="20"/>
|
||||||
<EditorIndex Value="5"/>
|
<EditorIndex Value="11"/>
|
||||||
<UsageCount Value="21"/>
|
<UsageCount Value="33"/>
|
||||||
<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="13" Y="96"/>
|
<CursorPos X="32" Y="18"/>
|
||||||
<TopLine Value="56"/>
|
<TopLine Value="5"/>
|
||||||
<EditorIndex Value="4"/>
|
<EditorIndex Value="10"/>
|
||||||
<UsageCount Value="21"/>
|
<UsageCount Value="33"/>
|
||||||
<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="26" Y="9"/>
|
<CursorPos X="69" Y="12"/>
|
||||||
<TopLine Value="1"/>
|
<TopLine Value="1"/>
|
||||||
<EditorIndex Value="2"/>
|
<EditorIndex Value="8"/>
|
||||||
<UsageCount Value="21"/>
|
<UsageCount Value="33"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit10>
|
</Unit10>
|
||||||
|
<Unit11>
|
||||||
|
<Filename Value="streamcoll.pp"/>
|
||||||
|
<UnitName Value="streamcoll"/>
|
||||||
|
<CursorPos X="66" Y="88"/>
|
||||||
|
<TopLine Value="65"/>
|
||||||
|
<UsageCount Value="9"/>
|
||||||
|
</Unit11>
|
||||||
|
<Unit12>
|
||||||
|
<Filename Value="streamcoll20.pp"/>
|
||||||
|
<UnitName Value="streamcoll"/>
|
||||||
|
<CursorPos X="3" Y="15"/>
|
||||||
|
<TopLine Value="1"/>
|
||||||
|
<UsageCount Value="9"/>
|
||||||
|
</Unit12>
|
||||||
|
<Unit13>
|
||||||
|
<Filename Value="..\..\..\fpc20\rtl\objpas\classes\classesh.inc"/>
|
||||||
|
<CursorPos X="17" Y="1345"/>
|
||||||
|
<TopLine Value="1326"/>
|
||||||
|
<EditorIndex Value="2"/>
|
||||||
|
<UsageCount Value="16"/>
|
||||||
|
<Loaded Value="True"/>
|
||||||
|
</Unit13>
|
||||||
|
<Unit14>
|
||||||
|
<Filename Value="..\..\..\fpc20\rtl\inc\objpash.inc"/>
|
||||||
|
<CursorPos X="38" Y="277"/>
|
||||||
|
<TopLine Value="269"/>
|
||||||
|
<EditorIndex Value="12"/>
|
||||||
|
<UsageCount Value="16"/>
|
||||||
|
<Loaded Value="True"/>
|
||||||
|
</Unit14>
|
||||||
|
<Unit15>
|
||||||
|
<Filename Value="..\..\..\fpc20\fcl\inc\contnrs.pp"/>
|
||||||
|
<UnitName Value="contnrs"/>
|
||||||
|
<CursorPos X="1" Y="19"/>
|
||||||
|
<TopLine Value="1"/>
|
||||||
|
<UsageCount Value="9"/>
|
||||||
|
</Unit15>
|
||||||
|
<Unit16>
|
||||||
|
<Filename Value="contnrs20.pp"/>
|
||||||
|
<UnitName Value="contnrs"/>
|
||||||
|
<CursorPos X="43" Y="32"/>
|
||||||
|
<TopLine Value="1"/>
|
||||||
|
<EditorIndex Value="3"/>
|
||||||
|
<UsageCount Value="10"/>
|
||||||
|
<Loaded Value="True"/>
|
||||||
|
</Unit16>
|
||||||
|
<Unit17>
|
||||||
|
<Filename Value="pkgfpmake.pp"/>
|
||||||
|
<UnitName Value="pkgfpmake"/>
|
||||||
|
<CursorPos X="45" Y="85"/>
|
||||||
|
<TopLine Value="1"/>
|
||||||
|
<EditorIndex Value="7"/>
|
||||||
|
<UsageCount Value="15"/>
|
||||||
|
<Loaded Value="True"/>
|
||||||
|
</Unit17>
|
||||||
|
<Unit18>
|
||||||
|
<Filename Value="pkgwget.pp"/>
|
||||||
|
<UnitName Value="pkgwget"/>
|
||||||
|
<CursorPos X="23" Y="6"/>
|
||||||
|
<TopLine Value="1"/>
|
||||||
|
<EditorIndex Value="4"/>
|
||||||
|
<UsageCount Value="10"/>
|
||||||
|
<Loaded Value="True"/>
|
||||||
|
</Unit18>
|
||||||
|
<Unit19>
|
||||||
|
<Filename Value="pkglnet.pas"/>
|
||||||
|
<UnitName Value="pkglnet"/>
|
||||||
|
<CursorPos X="5" Y="140"/>
|
||||||
|
<TopLine Value="103"/>
|
||||||
|
<UsageCount Value="10"/>
|
||||||
|
</Unit19>
|
||||||
</Units>
|
</Units>
|
||||||
<JumpHistory Count="30" HistoryIndex="29">
|
<JumpHistory Count="30" HistoryIndex="29">
|
||||||
<Position1>
|
<Position1>
|
||||||
<Filename Value="fppkg.pp"/>
|
<Filename Value="fppkg.pp"/>
|
||||||
<Caret Line="245" Column="5" TopLine="222"/>
|
<Caret Line="218" Column="42" TopLine="206"/>
|
||||||
</Position1>
|
</Position1>
|
||||||
<Position2>
|
<Position2>
|
||||||
<Filename Value="fppkg.pp"/>
|
<Filename Value="pkgfpmake.pp"/>
|
||||||
<Caret Line="278" Column="1" TopLine="245"/>
|
<Caret Line="70" Column="18" TopLine="56"/>
|
||||||
</Position2>
|
</Position2>
|
||||||
<Position3>
|
<Position3>
|
||||||
<Filename Value="fppkg.pp"/>
|
<Filename Value="pkgfpmake.pp"/>
|
||||||
<Caret Line="245" Column="5" TopLine="222"/>
|
<Caret Line="10" Column="5" TopLine="1"/>
|
||||||
</Position3>
|
</Position3>
|
||||||
<Position4>
|
<Position4>
|
||||||
<Filename Value="fppkg.pp"/>
|
<Filename Value="pkgmkconv.pp"/>
|
||||||
<Caret Line="249" Column="12" TopLine="222"/>
|
<Caret Line="679" Column="46" TopLine="666"/>
|
||||||
</Position4>
|
</Position4>
|
||||||
<Position5>
|
<Position5>
|
||||||
<Filename Value="pkghandler.pp"/>
|
<Filename Value="pkgfpmake.pp"/>
|
||||||
<Caret Line="58" Column="65" TopLine="35"/>
|
<Caret Line="67" Column="1" TopLine="39"/>
|
||||||
</Position5>
|
</Position5>
|
||||||
<Position6>
|
<Position6>
|
||||||
<Filename Value="pkghandler.pp"/>
|
<Filename Value="pkgfpmake.pp"/>
|
||||||
<Caret Line="47" Column="51" TopLine="24"/>
|
<Caret Line="28" Column="1" TopLine="8"/>
|
||||||
</Position6>
|
</Position6>
|
||||||
<Position7>
|
<Position7>
|
||||||
<Filename Value="pkghandler.pp"/>
|
<Filename Value="pkgfpmake.pp"/>
|
||||||
<Caret Line="54" Column="1" TopLine="31"/>
|
<Caret Line="43" Column="26" TopLine="24"/>
|
||||||
</Position7>
|
</Position7>
|
||||||
<Position8>
|
<Position8>
|
||||||
<Filename Value="pkghandler.pp"/>
|
<Filename Value="pkgmessages.pp"/>
|
||||||
<Caret Line="47" Column="1" TopLine="47"/>
|
<Caret Line="11" Column="20" TopLine="1"/>
|
||||||
</Position8>
|
</Position8>
|
||||||
<Position9>
|
<Position9>
|
||||||
<Filename Value="pkghandler.pp"/>
|
<Filename Value="pkgfpmake.pp"/>
|
||||||
<Caret Line="54" Column="3" TopLine="31"/>
|
<Caret Line="51" Column="11" TopLine="32"/>
|
||||||
</Position9>
|
</Position9>
|
||||||
<Position10>
|
<Position10>
|
||||||
<Filename Value="pkghandler.pp"/>
|
<Filename Value="pkgfpmake.pp"/>
|
||||||
<Caret Line="59" Column="3" TopLine="36"/>
|
<Caret Line="35" Column="3" TopLine="20"/>
|
||||||
</Position10>
|
</Position10>
|
||||||
<Position11>
|
<Position11>
|
||||||
<Filename Value="pkghandler.pp"/>
|
<Filename Value="fppkg.pp"/>
|
||||||
<Caret Line="53" Column="6" TopLine="30"/>
|
<Caret Line="99" Column="19" TopLine="76"/>
|
||||||
</Position11>
|
</Position11>
|
||||||
<Position12>
|
<Position12>
|
||||||
<Filename Value="pkghandler.pp"/>
|
<Filename Value="pkgfpmake.pp"/>
|
||||||
<Caret Line="40" Column="47" TopLine="30"/>
|
<Caret Line="56" Column="6" TopLine="37"/>
|
||||||
</Position12>
|
</Position12>
|
||||||
<Position13>
|
<Position13>
|
||||||
<Filename Value="pkghandler.pp"/>
|
<Filename Value="fppkg.pp"/>
|
||||||
<Caret Line="53" Column="6" TopLine="30"/>
|
<Caret Line="86" Column="26" TopLine="76"/>
|
||||||
</Position13>
|
</Position13>
|
||||||
<Position14>
|
<Position14>
|
||||||
<Filename Value="pkghandler.pp"/>
|
<Filename Value="pkghandler.pp"/>
|
||||||
<Caret Line="55" Column="10" TopLine="30"/>
|
<Caret Line="47" Column="1" TopLine="22"/>
|
||||||
</Position14>
|
</Position14>
|
||||||
<Position15>
|
<Position15>
|
||||||
<Filename Value="pkghandler.pp"/>
|
<Filename Value="pkgfpmake.pp"/>
|
||||||
<Caret Line="50" Column="14" TopLine="9"/>
|
<Caret Line="56" Column="23" TopLine="37"/>
|
||||||
</Position15>
|
</Position15>
|
||||||
<Position16>
|
<Position16>
|
||||||
<Filename Value="pkghandler.pp"/>
|
<Filename Value="pkgfpmake.pp"/>
|
||||||
<Caret Line="53" Column="6" TopLine="30"/>
|
<Caret Line="58" Column="16" TopLine="39"/>
|
||||||
</Position16>
|
</Position16>
|
||||||
<Position17>
|
<Position17>
|
||||||
<Filename Value="pkghandler.pp"/>
|
<Filename Value="pkgfpmake.pp"/>
|
||||||
<Caret Line="40" Column="10" TopLine="17"/>
|
<Caret Line="74" Column="1" TopLine="55"/>
|
||||||
</Position17>
|
</Position17>
|
||||||
<Position18>
|
<Position18>
|
||||||
<Filename Value="fppkg.pp"/>
|
<Filename Value="pkgfpmake.pp"/>
|
||||||
<Caret Line="46" Column="1" TopLine="23"/>
|
<Caret Line="25" Column="1" TopLine="1"/>
|
||||||
</Position18>
|
</Position18>
|
||||||
<Position19>
|
<Position19>
|
||||||
<Filename Value="fppkg.pp"/>
|
<Filename Value="pkgfpmake.pp"/>
|
||||||
<Caret Line="289" Column="1" TopLine="266"/>
|
<Caret Line="105" Column="23" TopLine="75"/>
|
||||||
</Position19>
|
</Position19>
|
||||||
<Position20>
|
<Position20>
|
||||||
<Filename Value="fppkg.pp"/>
|
<Filename Value="pkgfpmake.pp"/>
|
||||||
<Caret Line="254" Column="1" TopLine="241"/>
|
<Caret Line="89" Column="17" TopLine="70"/>
|
||||||
</Position20>
|
</Position20>
|
||||||
<Position21>
|
<Position21>
|
||||||
<Filename Value="fppkg.pp"/>
|
<Filename Value="pkgfpmake.pp"/>
|
||||||
<Caret Line="46" Column="42" TopLine="23"/>
|
<Caret Line="100" Column="34" TopLine="71"/>
|
||||||
</Position21>
|
</Position21>
|
||||||
<Position22>
|
<Position22>
|
||||||
<Filename Value="fppkg.pp"/>
|
<Filename Value="pkgfpmake.pp"/>
|
||||||
<Caret Line="33" Column="28" TopLine="23"/>
|
<Caret Line="86" Column="13" TopLine="70"/>
|
||||||
</Position22>
|
</Position22>
|
||||||
<Position23>
|
<Position23>
|
||||||
<Filename Value="fppkg.pp"/>
|
<Filename Value="fppkg.pp"/>
|
||||||
<Caret Line="47" Column="42" TopLine="23"/>
|
<Caret Line="29" Column="1" TopLine="20"/>
|
||||||
</Position23>
|
</Position23>
|
||||||
<Position24>
|
<Position24>
|
||||||
<Filename Value="fppkg.pp"/>
|
<Filename Value="pkgfpmake.pp"/>
|
||||||
<Caret Line="253" Column="42" TopLine="230"/>
|
<Caret Line="90" Column="23" TopLine="71"/>
|
||||||
</Position24>
|
</Position24>
|
||||||
<Position25>
|
<Position25>
|
||||||
<Filename Value="fppkg.pp"/>
|
<Filename Value="pkgfpmake.pp"/>
|
||||||
<Caret Line="254" Column="37" TopLine="231"/>
|
<Caret Line="88" Column="1" TopLine="72"/>
|
||||||
</Position25>
|
</Position25>
|
||||||
<Position26>
|
<Position26>
|
||||||
<Filename Value="fppkg.pp"/>
|
<Filename Value="fppkg.pp"/>
|
||||||
<Caret Line="259" Column="9" TopLine="236"/>
|
<Caret Line="42" Column="25" TopLine="17"/>
|
||||||
</Position26>
|
</Position26>
|
||||||
<Position27>
|
<Position27>
|
||||||
<Filename Value="fppkg.pp"/>
|
<Filename Value="pkghandler.pp"/>
|
||||||
<Caret Line="234" Column="16" TopLine="203"/>
|
<Caret Line="51" Column="19" TopLine="42"/>
|
||||||
</Position27>
|
</Position27>
|
||||||
<Position28>
|
<Position28>
|
||||||
<Filename Value="fppkg.pp"/>
|
<Filename Value="pkghandler.pp"/>
|
||||||
<Caret Line="278" Column="63" TopLine="255"/>
|
<Caret Line="214" Column="24" TopLine="181"/>
|
||||||
</Position28>
|
</Position28>
|
||||||
<Position29>
|
<Position29>
|
||||||
<Filename Value="fppkg.pp"/>
|
<Filename Value="fppkg.pp"/>
|
||||||
<Caret Line="283" Column="1" TopLine="255"/>
|
<Caret Line="233" Column="19" TopLine="199"/>
|
||||||
</Position29>
|
</Position29>
|
||||||
<Position30>
|
<Position30>
|
||||||
<Filename Value="fppkg.pp"/>
|
<Filename Value="fppkg.pp"/>
|
||||||
<Caret Line="282" Column="9" TopLine="259"/>
|
<Caret Line="231" Column="39" TopLine="214"/>
|
||||||
</Position30>
|
</Position30>
|
||||||
</JumpHistory>
|
</JumpHistory>
|
||||||
</ProjectOptions>
|
</ProjectOptions>
|
||||||
<CompilerOptions>
|
<CompilerOptions>
|
||||||
<Version Value="5"/>
|
<Version Value="5"/>
|
||||||
|
<PathDelim Value="\"/>
|
||||||
<CodeGeneration>
|
<CodeGeneration>
|
||||||
<Generate Value="Faster"/>
|
<Checks>
|
||||||
|
<IOChecks Value="True"/>
|
||||||
|
<RangeChecks Value="True"/>
|
||||||
|
<OverflowChecks Value="True"/>
|
||||||
|
<StackChecks Value="True"/>
|
||||||
|
</Checks>
|
||||||
|
<Optimizations>
|
||||||
|
<OptimizationLevel Value="0"/>
|
||||||
|
</Optimizations>
|
||||||
</CodeGeneration>
|
</CodeGeneration>
|
||||||
|
<Linking>
|
||||||
|
<Debugging>
|
||||||
|
<GenerateDebugInfo Value="True"/>
|
||||||
|
</Debugging>
|
||||||
|
</Linking>
|
||||||
<Other>
|
<Other>
|
||||||
<CompilerPath Value="$(CompPath)"/>
|
<CompilerPath Value="$(CompPath)"/>
|
||||||
</Other>
|
</Other>
|
||||||
|
@ -11,41 +11,23 @@ uses
|
|||||||
// Repository handler objects
|
// Repository handler objects
|
||||||
fprepos, fpxmlrep,fpmktype, pkgropts,
|
fprepos, fpxmlrep,fpmktype, pkgropts,
|
||||||
// Package Handler components
|
// Package Handler components
|
||||||
pkghandler, pkgmkconv, pkgdownload, pkgmessages;
|
pkghandler, pkgmkconv, pkgdownload, pkgfpmake, pkgmessages;
|
||||||
|
|
||||||
Type
|
Type
|
||||||
|
|
||||||
TRunMode = (rmHelp,rmCompile,rmBuild,rmInstall,rmArchive,rmClean,rmDownload,rmUpdate);
|
|
||||||
|
|
||||||
{ TMakeTool }
|
{ TMakeTool }
|
||||||
|
|
||||||
TMakeTool = Class(TCustomApplication)
|
TMakeTool = Class(TCustomApplication)
|
||||||
Private
|
Private
|
||||||
FDefaults: TPackagerOptions;
|
FDefaults: TPackagerOptions;
|
||||||
FConvertOnly,
|
|
||||||
FLogging : Boolean;
|
|
||||||
FCompiler : String;
|
FCompiler : String;
|
||||||
FRunMode : TRunMode;
|
|
||||||
FHaveMakefile : Boolean;
|
|
||||||
FHaveFpmake : Boolean;
|
|
||||||
FFPMakeSrc : String;
|
|
||||||
FFPMakeBin : String;
|
|
||||||
FVerbose: TVerbosities;
|
|
||||||
FPackages : TStrings;
|
|
||||||
Procedure Log(Msg : String);
|
|
||||||
Procedure Error(Msg : String);
|
|
||||||
Procedure Error(Fmt : String; Args : Array of const);
|
|
||||||
Function GetCompiler : String;
|
Function GetCompiler : String;
|
||||||
|
procedure ShowUsage;
|
||||||
Public
|
Public
|
||||||
Procedure DownloadFile(Const URL,Dest : String);
|
|
||||||
Function GetConfigFileName : String;
|
Function GetConfigFileName : String;
|
||||||
Procedure LoadDefaults;
|
Procedure LoadDefaults;
|
||||||
Procedure ProcessCommandLine;
|
Procedure ProcessCommandLine;
|
||||||
procedure CreateFPMake;
|
|
||||||
procedure CompileFPMake(Extra : Boolean);
|
|
||||||
Function RunFPMake : Integer;
|
|
||||||
Procedure DoRun; Override;
|
Procedure DoRun; Override;
|
||||||
Property Verbose : TVerbosities Read FVerbose Write FVerbose;
|
procedure ExecuteAction(const AAction:string;const Args:TActionArgs);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
EMakeToolError = Class(Exception);
|
EMakeToolError = Class(Exception);
|
||||||
@ -53,78 +35,6 @@ Type
|
|||||||
|
|
||||||
{ TMakeTool }
|
{ TMakeTool }
|
||||||
|
|
||||||
procedure TMakeTool.CompileFPMake(Extra: Boolean);
|
|
||||||
|
|
||||||
Var
|
|
||||||
O,C : String;
|
|
||||||
|
|
||||||
begin
|
|
||||||
C:=GetCompiler;
|
|
||||||
O:=FFPmakeSrc;
|
|
||||||
If Extra then
|
|
||||||
O:='-Fafpmkext '+O;
|
|
||||||
Log(SLogCompilingFPMake+C+' '+O);
|
|
||||||
If ExecuteProcess(C,O)<>0 then
|
|
||||||
Error(SErrFailedToCompileFPCMake)
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TMakeTool.CreateFPMake;
|
|
||||||
begin
|
|
||||||
Log(SLogGeneratingFPMake);
|
|
||||||
With TMakeFileConverter.Create(Nil) do
|
|
||||||
try
|
|
||||||
ConvertFile('Makefile.fpc','fpmake.pp');
|
|
||||||
finally
|
|
||||||
Free;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
Function TMakeTool.RunFPMake : Integer;
|
|
||||||
|
|
||||||
Function MaybeQuote(Const S : String) : String;
|
|
||||||
|
|
||||||
begin
|
|
||||||
If Pos(' ',S)=0 then
|
|
||||||
Result:=S
|
|
||||||
else
|
|
||||||
Result:='"'+S+'"';
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
Var
|
|
||||||
I : integer;
|
|
||||||
D,O : String;
|
|
||||||
|
|
||||||
begin
|
|
||||||
Log(SLogRunningFPMake);
|
|
||||||
D:=IncludeTrailingPathDelimiter(GetCurrentDir);
|
|
||||||
O:='';
|
|
||||||
For I:=1 to ParamCount do
|
|
||||||
begin
|
|
||||||
If (O<>'') then
|
|
||||||
O:=O+' ';
|
|
||||||
O:=O+MaybeQuote(ParamStr(I));
|
|
||||||
end;
|
|
||||||
Result:=ExecuteProcess(D+FFPMakeBin,O);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TMakeTool.Log(Msg: String);
|
|
||||||
begin
|
|
||||||
If FLogging then
|
|
||||||
Writeln(stdErr,Msg);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TMakeTool.Error(Msg: String);
|
|
||||||
begin
|
|
||||||
Raise EMakeToolError.Create(Msg);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TMakeTool.Error(Fmt: String; Args: array of const);
|
|
||||||
begin
|
|
||||||
Raise EMakeToolError.CreateFmt(Fmt,Args);
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TMakeTool.GetCompiler: String;
|
function TMakeTool.GetCompiler: String;
|
||||||
begin
|
begin
|
||||||
If (FCompiler='') then
|
If (FCompiler='') then
|
||||||
@ -151,22 +61,16 @@ begin
|
|||||||
Result:=FCompiler
|
Result:=FCompiler
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
Result:=FileSearch(FCompiler,GetEnvironmentVariable('PATH'));
|
Result:=FileSearch(FCompiler+ExeExt,GetEnvironmentVariable('PATH'));
|
||||||
If (Result='') then
|
If (Result='') then
|
||||||
Result:=FCompiler;
|
Result:=FCompiler+ExeExt;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMakeTool.DownloadFile(const URL, Dest: String);
|
|
||||||
begin
|
|
||||||
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TMakeTool.GetConfigFileName: String;
|
function TMakeTool.GetConfigFileName: String;
|
||||||
|
|
||||||
var
|
var
|
||||||
G : Boolean;
|
G : Boolean;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if HasOption('C','config-file') then
|
if HasOption('C','config-file') then
|
||||||
Result:=GetOptionValue('C','config-file')
|
Result:=GetOptionValue('C','config-file')
|
||||||
@ -181,13 +85,32 @@ begin
|
|||||||
end
|
end
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TMakeTool.LoadDefaults;
|
procedure TMakeTool.LoadDefaults;
|
||||||
begin
|
begin
|
||||||
|
Verbosity:=[vError,vInfo,vCommands,vDebug];
|
||||||
FDefaults:=TPackagerOptions.Create;
|
FDefaults:=TPackagerOptions.Create;
|
||||||
FDefaults.LoadFromFile(GetConfigFileName);
|
FDefaults.LoadFromFile(GetConfigFileName);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure TMakeTool.ShowUsage;
|
||||||
|
begin
|
||||||
|
Writeln('Usage: ',Paramstr(0),' [options] <action> <package>');
|
||||||
|
Writeln('Options:');
|
||||||
|
Writeln(' -r --compiler Set compiler');
|
||||||
|
Writeln(' -h --help This help');
|
||||||
|
Writeln(' -v --verbose Set verbosity');
|
||||||
|
Writeln('Actions:');
|
||||||
|
Writeln(' update Update available packages');
|
||||||
|
Writeln(' listpackages List available packages');
|
||||||
|
Writeln(' build Build package');
|
||||||
|
Writeln(' install Install package');
|
||||||
|
Writeln(' download Download package');
|
||||||
|
Writeln(' convertmk Convert Makefile.fpc to fpmake.pp');
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TMakeTool.ProcessCommandLine;
|
procedure TMakeTool.ProcessCommandLine;
|
||||||
|
|
||||||
Function CheckOption(Index : Integer;Short,Long : String): Boolean;
|
Function CheckOption(Index : Integer;Short,Long : String): Boolean;
|
||||||
@ -208,122 +131,133 @@ procedure TMakeTool.ProcessCommandLine;
|
|||||||
begin
|
begin
|
||||||
if (Length(ParamStr(Index))>1) and (Paramstr(Index)[2]<>'-') then
|
if (Length(ParamStr(Index))>1) and (Paramstr(Index)[2]<>'-') then
|
||||||
begin
|
begin
|
||||||
If Index<ParamCount then
|
If Index<ParamCount then
|
||||||
begin
|
begin
|
||||||
Inc(Index);
|
Inc(Index);
|
||||||
Result:=Paramstr(Index);
|
Result:=Paramstr(Index);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
Error(SErrNeedArgument,[Index,ParamStr(Index)]);
|
Error(SErrNeedArgument,[Index,ParamStr(Index)]);
|
||||||
end
|
end
|
||||||
else If length(ParamStr(Index))>2 then
|
else If length(ParamStr(Index))>2 then
|
||||||
begin
|
begin
|
||||||
P:=Pos('=',Paramstr(Index));
|
P:=Pos('=',Paramstr(Index));
|
||||||
If (P=0) then
|
If (P=0) then
|
||||||
Error(SErrNeedArgument,[Index,ParamStr(Index)])
|
Error(SErrNeedArgument,[Index,ParamStr(Index)])
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
Result:=Paramstr(Index);
|
Result:=Paramstr(Index);
|
||||||
Delete(Result,1,P);
|
Delete(Result,1,P);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Var
|
Var
|
||||||
I : Integer;
|
I : Integer;
|
||||||
GlobalOpts : Boolean;
|
Action : string;
|
||||||
cmd : string;
|
ParaPackages : TStringList;
|
||||||
|
HasAction : Boolean;
|
||||||
begin
|
begin
|
||||||
I:=0;
|
try
|
||||||
FLogging:=False;
|
I:=0;
|
||||||
FRunMode:=rmhelp;
|
HasAction:=false;
|
||||||
FConvertOnly:=False;
|
ParaPackages:=TStringList.Create;
|
||||||
GlobalOpts:=True;
|
// We can't use the TCustomApplication option handling,
|
||||||
FPackages:=TStringList.Create;
|
// because they cannot handle [general opts] [command] [cmd-opts] [args]
|
||||||
// We can't use the TCustomApplication option handling,
|
While (I<ParamCount) do
|
||||||
// because they cannot handle [general opts] [command] [cmd-opts] [args]
|
begin
|
||||||
While (I<ParamCount) do
|
Inc(I);
|
||||||
begin
|
// Check options.
|
||||||
Inc(I);
|
if CheckOption(I,'r','compiler') then
|
||||||
// Check options.
|
FDefaults.Compiler:=OptionArg(I)
|
||||||
if CheckOption(I,'r','compiler') then
|
else if CheckOption(I,'v','verbose') then
|
||||||
FDefaults.Compiler:=OptionArg(I)
|
Include(Verbosity,StringToVerbosity(OptionArg(I)))
|
||||||
else if CheckOption(I,'v','verbose') then
|
else if CheckOption(I,'h','help') then
|
||||||
Include(FVerbose,StringToVerbosity(OptionArg(I)))
|
begin
|
||||||
else if CheckOption(I,'h','help') then
|
ShowUsage;
|
||||||
FRunMode:=rmhelp
|
halt(0);
|
||||||
else if (Length(Paramstr(i))>0) and (Paramstr(I)[1]='-') then
|
end
|
||||||
Raise EMakeToolError.CreateFmt(SErrInvalidArgument,[I,ParamStr(i)])
|
else if (Length(Paramstr(i))>0) and (Paramstr(I)[1]='-') then
|
||||||
else
|
Raise EMakeToolError.CreateFmt(SErrInvalidArgument,[I,ParamStr(i)])
|
||||||
If GlobalOpts then
|
|
||||||
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
|
else
|
||||||
Raise EMakeToolError.CreateFmt(SErrInvalidCommand,[Cmd]);
|
// It's a command or target.
|
||||||
end
|
begin
|
||||||
else // It's a package name.
|
if HasAction then
|
||||||
|
ParaPackages.Add(Paramstr(i))
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
Action:=Paramstr(i);
|
||||||
|
HasAction:=true;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
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;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure TMakeTool.ExecuteAction(const AAction:string;const Args:TActionArgs);
|
||||||
|
var
|
||||||
|
pkghandlerclass : TPackageHandlerClass;
|
||||||
|
i : integer;
|
||||||
|
logargs : string;
|
||||||
|
begin
|
||||||
|
if vDebug in Verbosity then
|
||||||
|
begin
|
||||||
|
logargs:='';
|
||||||
|
for i:=Low(Args) to High(Args) do
|
||||||
begin
|
begin
|
||||||
FPackages.Add(Paramstr(i));
|
if logargs='' then
|
||||||
|
logargs:=Args[i]
|
||||||
|
else
|
||||||
|
logargs:=logargs+','+Args[i];
|
||||||
end;
|
end;
|
||||||
|
Log(vDebug,SLogRunAction,[AAction,logargs]);
|
||||||
|
end;
|
||||||
|
pkghandlerclass:=GetPkgHandler(AAction);
|
||||||
|
With pkghandlerclass.Create(FDefaults) do
|
||||||
|
try
|
||||||
|
Execute(Args);
|
||||||
|
finally
|
||||||
|
Free;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TMakeTool.DoRun;
|
procedure TMakeTool.DoRun;
|
||||||
|
var
|
||||||
|
Action : string;
|
||||||
|
Args : TActionArgs;
|
||||||
begin
|
begin
|
||||||
LoadDefaults;
|
LoadDefaults;
|
||||||
Try
|
Try
|
||||||
ProcessCommandLine;
|
ProcessCommandLine;
|
||||||
If FConvertOnly then
|
|
||||||
CreateFPMake
|
repeat
|
||||||
else
|
if not ActionStack.Pop(Action,Args) then
|
||||||
begin
|
break;
|
||||||
FHaveMakefile:=FileExists('Makefile.fpc');
|
ExecuteAction(Action,Args);
|
||||||
FFPMakeSrc:='fpmake.pp';
|
until false;
|
||||||
FHaveFpmake:=FileExists(FFPMakeSrc);
|
Terminate;
|
||||||
If Not FHaveFPMake then
|
|
||||||
begin
|
|
||||||
FHaveFPMake:=FileExists('fpmake.pas');
|
|
||||||
If FHaveFPMake then
|
|
||||||
FFPMakeSrc:='fpmake.pas';
|
|
||||||
end;
|
|
||||||
if Not (FHaveFPMake or FHaveMakeFile) then
|
|
||||||
Error(SErrMissingConfig);
|
|
||||||
If (Not FHaveFPMake) or (FileAge(FFPMakeSrc)<FileAge('Makefile.fpc')) then
|
|
||||||
CreateFPMake;
|
|
||||||
{$ifndef unix}
|
|
||||||
FFPMakeBin:='fpmake.exe';
|
|
||||||
{$else}
|
|
||||||
FFPMakeBin:='fpmake';
|
|
||||||
{$endif}
|
|
||||||
if FileAge(FFPMakeBin)<FileAge(FFPMakeSrc) then
|
|
||||||
CompileFPMake(FRunMode in [rmArchive,rmDownload]);
|
|
||||||
Halt(RunFPMake);
|
|
||||||
end;
|
|
||||||
except
|
except
|
||||||
On E : Exception do
|
On E : Exception do
|
||||||
begin
|
begin
|
||||||
Writeln(StdErr,Format(SErrRunning,[E.Message]));
|
Writeln(StdErr,Format(SErrRunning,[E.Message]));
|
||||||
Halt(1);
|
Halt(1);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
@ -16,7 +16,15 @@ unit fprepos;
|
|||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
uses classes,sysutils,streamcoll,contnrs,fpmktype;
|
uses
|
||||||
|
classes,sysutils,
|
||||||
|
contnrs,
|
||||||
|
{$ifdef ver2_0}
|
||||||
|
streamcoll20,
|
||||||
|
{$else}
|
||||||
|
streamcoll,
|
||||||
|
{$endif}
|
||||||
|
fpmktype;
|
||||||
|
|
||||||
Const
|
Const
|
||||||
StreamVersion : Integer = 1;
|
StreamVersion : Integer = 1;
|
||||||
|
@ -234,7 +234,7 @@ const
|
|||||||
'RenameTo', 'System', 'Features',
|
'RenameTo', 'System', 'Features',
|
||||||
'PWD', 'HELP', 'LAST');
|
'PWD', 'HELP', 'LAST');
|
||||||
|
|
||||||
procedure Writedbg(const ar: array of const);
|
procedure Writedbg(const ar: array of string);
|
||||||
{$ifdef debug}
|
{$ifdef debug}
|
||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
|
110
utils/fppkg/pkgfpmake.pp
Executable file
110
utils/fppkg/pkgfpmake.pp
Executable file
@ -0,0 +1,110 @@
|
|||||||
|
unit pkgfpmake;
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
Classes, SysUtils,pkghandler;
|
||||||
|
|
||||||
|
type
|
||||||
|
{ TFPMakeCompiler }
|
||||||
|
|
||||||
|
TFPMakeCompiler = Class(TPackagehandler)
|
||||||
|
Private
|
||||||
|
Procedure CompileFPMake;
|
||||||
|
Public
|
||||||
|
Function Execute(const Args:array of string):boolean;override;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{ TFPMakeRunner }
|
||||||
|
|
||||||
|
TFPMakeRunner = Class(TPackagehandler)
|
||||||
|
Private
|
||||||
|
Function RunFPMake : Integer;
|
||||||
|
Public
|
||||||
|
Function Execute(const Args:array of string):boolean;override;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
uses
|
||||||
|
pkgmessages;
|
||||||
|
|
||||||
|
{ TFPMakeCompiler }
|
||||||
|
|
||||||
|
Procedure TFPMakeCompiler.CompileFPMake;
|
||||||
|
Var
|
||||||
|
O,C : String;
|
||||||
|
FPMakeSrc : string;
|
||||||
|
HaveFpmake : boolean;
|
||||||
|
begin
|
||||||
|
{ Check for fpmake source }
|
||||||
|
FPMakeSrc:='fpmake.pp';
|
||||||
|
HaveFpmake:=FileExists(FPMakeSrc);
|
||||||
|
If Not HaveFPMake then
|
||||||
|
begin
|
||||||
|
HaveFPMake:=FileExists('fpmake.pas');
|
||||||
|
If HaveFPMake then
|
||||||
|
FPMakeSrc:='fpmake.pas';
|
||||||
|
end;
|
||||||
|
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;
|
||||||
|
|
||||||
|
|
||||||
|
function TFPMakeCompiler.Execute(const Args:array of string):boolean;
|
||||||
|
begin
|
||||||
|
{$warning TODO Check arguments}
|
||||||
|
CompileFPMake;
|
||||||
|
result:=true;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{ TFPMakeRunner }
|
||||||
|
|
||||||
|
Function TFPMakeRunner.RunFPMake : Integer;
|
||||||
|
|
||||||
|
Function MaybeQuote(Const S : String) : String;
|
||||||
|
begin
|
||||||
|
If Pos(' ',S)=0 then
|
||||||
|
Result:=S
|
||||||
|
else
|
||||||
|
Result:='"'+S+'"';
|
||||||
|
end;
|
||||||
|
|
||||||
|
Var
|
||||||
|
I : integer;
|
||||||
|
FPMakeBin,
|
||||||
|
D,O : String;
|
||||||
|
begin
|
||||||
|
FPMakeBin:='fpmake'+ExeExt;
|
||||||
|
D:=IncludeTrailingPathDelimiter(GetCurrentDir);
|
||||||
|
O:='';
|
||||||
|
For I:=1 to ParamCount do
|
||||||
|
begin
|
||||||
|
If (O<>'') then
|
||||||
|
O:=O+' ';
|
||||||
|
O:=O+MaybeQuote(ParamStr(I));
|
||||||
|
end;
|
||||||
|
Log(vCommands,SLogRunningFPMake+D+FPMakeBin+' '+O);
|
||||||
|
Result:=ExecuteProcess(D+FPMakeBin,O);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function TFPMakeRunner.Execute(const Args:array of string):boolean;
|
||||||
|
begin
|
||||||
|
{$warning TODO Check arguments}
|
||||||
|
result:=(RunFPMake=0);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
end.
|
@ -4,51 +4,115 @@ unit pkghandler;
|
|||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
uses Classes,SysUtils, fpmktype;
|
uses Classes,SysUtils, fpmktype, pkgropts;
|
||||||
|
|
||||||
|
Const
|
||||||
|
{$ifdef unix}
|
||||||
|
ExeExt = '';
|
||||||
|
{$else unix}
|
||||||
|
ExeExt = '.exe';
|
||||||
|
{$endif unix}
|
||||||
|
|
||||||
Type
|
Type
|
||||||
|
|
||||||
TVerbosity = (vError,vInfo,vCommands,vDebug);
|
TVerbosity = (vError,vInfo,vCommands,vDebug);
|
||||||
TVerbosities = Set of TVerbosity;
|
TVerbosities = Set of TVerbosity;
|
||||||
TMessageEvent = Procedure (Sender : TObject; Const Msg : String) of object;
|
|
||||||
|
{ TActionStack }
|
||||||
|
|
||||||
|
TActionArgs = array of string;
|
||||||
|
|
||||||
|
TActionStackItem = record
|
||||||
|
Action : string;
|
||||||
|
Args : TActionArgs;
|
||||||
|
end;
|
||||||
|
PActionStackItem = ^TActionStackItem;
|
||||||
|
|
||||||
|
TActionStack = class
|
||||||
|
private
|
||||||
|
FList : TFPList;
|
||||||
|
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;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{ TPackageHandler }
|
{ TPackageHandler }
|
||||||
|
|
||||||
TPackageHandler = Class(TComponent)
|
TPackageHandler = Class(TComponent)
|
||||||
private
|
private
|
||||||
FBackupFile: Boolean;
|
FBackupFile : Boolean;
|
||||||
FOnMessage: TMessageEvent;
|
FDefaults : TPackagerOptions;
|
||||||
FVerbosity: TVerbosities;
|
|
||||||
Protected
|
Protected
|
||||||
Procedure Error(Const Msg : String);
|
|
||||||
Procedure Error(Const Fmt : String; Args : Array of const);
|
|
||||||
Public
|
|
||||||
Procedure BackupFile(Const FileName : String);
|
Procedure BackupFile(Const FileName : String);
|
||||||
Constructor Create(AOwner : TComponent); override;
|
Public
|
||||||
Procedure Verbose(Msg : String);
|
Constructor Create(ADefaults:TPackagerOptions);
|
||||||
Procedure Verbose(Fmt : String; Args : Array of const);
|
Function Execute(const Args:array of string):boolean; virtual; abstract;
|
||||||
Procedure Verbose(Level : TVerbosity; Msg : String);
|
|
||||||
Procedure Verbose(Level : TVerbosity; Fmt : String; Args : Array of const);
|
|
||||||
Property BackupFiles : Boolean Read FBackupFile Write FBackupFile;
|
Property BackupFiles : Boolean Read FBackupFile Write FBackupFile;
|
||||||
Property OnMessage : TMessageEvent Read FOnMessage Write FOnMessage;
|
Property Defaults:TPackagerOptions Read FDefaults;
|
||||||
Property Verbosity : TVerbosities Read FVerbosity Write FVerbosity;
|
|
||||||
end;
|
end;
|
||||||
|
TPackageHandlerClass = class(TPackageHandler);
|
||||||
|
|
||||||
EPackageHandler = Class(EInstallerError);
|
EPackageHandler = Class(EInstallerError);
|
||||||
|
|
||||||
|
// Actions/PkgHandler
|
||||||
|
procedure RegisterPkgHandler(const AAction:string;pkghandlerclass:TPackageHandlerClass);
|
||||||
|
function GetPkgHandler(const AAction:string):TPackageHandlerClass;
|
||||||
|
|
||||||
|
// Logging
|
||||||
Function StringToVerbosity (S : String) : TVerbosity;
|
Function StringToVerbosity (S : String) : TVerbosity;
|
||||||
Function VerbosityToString (V : TVerbosity): String;
|
Function VerbosityToString (V : TVerbosity): String;
|
||||||
|
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);
|
||||||
|
|
||||||
|
// Utils
|
||||||
|
function maybequoted(const s:ansistring):ansistring;
|
||||||
|
|
||||||
|
var
|
||||||
|
Verbosity : TVerbosities;
|
||||||
|
ActionStack : TActionStack;
|
||||||
|
|
||||||
|
|
||||||
Implementation
|
Implementation
|
||||||
|
|
||||||
uses pkgmessages,typinfo;
|
uses
|
||||||
|
typinfo,
|
||||||
|
{$ifdef ver2_0}
|
||||||
|
contnrs20,
|
||||||
|
{$else ver2_0}
|
||||||
|
contnrs,
|
||||||
|
{$endif ver2_0}
|
||||||
|
pkgmessages;
|
||||||
|
|
||||||
|
var
|
||||||
|
PkgHandlerList : TFPHashObjectList;
|
||||||
|
|
||||||
|
procedure RegisterPkgHandler(const AAction:string;pkghandlerclass:TPackageHandlerClass);
|
||||||
|
begin
|
||||||
|
if PkgHandlerList.Find(AAction)<>nil then
|
||||||
|
begin
|
||||||
|
Raise EPackageHandler.CreateFmt(SErrActionAlreadyRegistered,[AAction]);
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
PkgHandlerList.Add(AAction,pkghandlerclass);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function GetPkgHandler(const AAction:string):TPackageHandlerClass;
|
||||||
|
begin
|
||||||
|
result:=TPackageHandlerClass(PkgHandlerList.Find(AAction));
|
||||||
|
if result=nil then
|
||||||
|
Raise EPackageHandler.CreateFmt(SErrActionNotFound,[AAction]);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
function StringToVerbosity(S: String): TVerbosity;
|
function StringToVerbosity(S: String): TVerbosity;
|
||||||
|
|
||||||
Var
|
Var
|
||||||
I : integer;
|
I : integer;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
I:=GetEnumValue(TypeInfo(TVerbosity),'v'+S);
|
I:=GetEnumValue(TypeInfo(TVerbosity),'v'+S);
|
||||||
If (I<>-1) then
|
If (I<>-1) then
|
||||||
@ -63,58 +127,157 @@ begin
|
|||||||
Delete(Result,1,1);// Delete 'v'
|
Delete(Result,1,1);// Delete 'v'
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure Log(Level:TVerbosity;Msg: String);
|
||||||
|
begin
|
||||||
|
if Level in Verbosity then
|
||||||
|
Writeln(stdErr,Msg);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
Procedure Log(Level:TVerbosity; Fmt:String; const Args:array of const);
|
||||||
|
begin
|
||||||
|
Log(Level,Format(Fmt,Args));
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure Error(Msg: String);
|
||||||
|
begin
|
||||||
|
Raise EPackageHandler.Create(Msg);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure Error(Fmt: String; const Args: array of const);
|
||||||
|
begin
|
||||||
|
Raise EPackageHandler.CreateFmt(Fmt,Args);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function maybequoted(const s:ansistring):ansistring;
|
||||||
|
const
|
||||||
|
{$IFDEF MSWINDOWS}
|
||||||
|
FORBIDDEN_CHARS = ['!', '@', '#', '$', '%', '^', '&', '*', '(', ')',
|
||||||
|
'{', '}', '''', '`', '~'];
|
||||||
|
{$ELSE}
|
||||||
|
FORBIDDEN_CHARS = ['!', '@', '#', '$', '%', '^', '&', '*', '(', ')',
|
||||||
|
'{', '}', '''', ':', '\', '`', '~'];
|
||||||
|
{$ENDIF}
|
||||||
|
var
|
||||||
|
s1 : ansistring;
|
||||||
|
i : integer;
|
||||||
|
quoted : boolean;
|
||||||
|
begin
|
||||||
|
quoted:=false;
|
||||||
|
s1:='"';
|
||||||
|
for i:=1 to length(s) do
|
||||||
|
begin
|
||||||
|
case s[i] of
|
||||||
|
'"' :
|
||||||
|
begin
|
||||||
|
quoted:=true;
|
||||||
|
s1:=s1+'\"';
|
||||||
|
end;
|
||||||
|
' ',
|
||||||
|
#128..#255 :
|
||||||
|
begin
|
||||||
|
quoted:=true;
|
||||||
|
s1:=s1+s[i];
|
||||||
|
end;
|
||||||
|
else begin
|
||||||
|
if s[i] in FORBIDDEN_CHARS then
|
||||||
|
quoted:=True;
|
||||||
|
s1:=s1+s[i];
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
if quoted then
|
||||||
|
maybequoted:=s1+'"'
|
||||||
|
else
|
||||||
|
maybequoted:=s;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{ TPackageHandler }
|
{ TPackageHandler }
|
||||||
|
|
||||||
procedure TPackageHandler.Error(const Msg: String);
|
|
||||||
begin
|
|
||||||
Raise EPackageHandler.CreateFmt('%s : %s',[ClassName,Msg]);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TPackageHandler.Error(const Fmt: String; Args: Array of const);
|
|
||||||
begin
|
|
||||||
Error(Format(Fmt,Args));
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TPackageHandler.BackupFile(const FileName: String);
|
procedure TPackageHandler.BackupFile(const FileName: String);
|
||||||
|
|
||||||
Var
|
Var
|
||||||
BFN : String;
|
BFN : String;
|
||||||
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
BFN:=FileName+'.bak';
|
BFN:=FileName+'.bak';
|
||||||
If not RenameFile(FileName,BFN) then
|
If not RenameFile(FileName,BFN) then
|
||||||
Error(SErrBackupFailed,[FileName,BFN]);
|
Error(SErrBackupFailed,[FileName,BFN]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TPackageHandler.Create(AOwner: TComponent);
|
constructor TPackageHandler.Create(ADefaults:TPackagerOptions);
|
||||||
begin
|
begin
|
||||||
inherited Create(AOwner);
|
inherited Create(nil);
|
||||||
FVerbosity:=[vError];
|
FDefaults:=ADefaults;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TPackageHandler.Verbose(Msg: String);
|
|
||||||
|
{ TActionStack }
|
||||||
|
|
||||||
|
constructor TActionStack.Create;
|
||||||
begin
|
begin
|
||||||
Verbose(vInfo,Msg);
|
FList:=TFPList.Create;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TPackageHandler.Verbose(Fmt: String; Args: array of const);
|
|
||||||
|
destructor TActionStack.Destroy;
|
||||||
begin
|
begin
|
||||||
Verbose(vInfo,Fmt,Args);
|
FreeAndNil(FList);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TPackageHandler.Verbose(Level: TVerbosity; Msg: String);
|
|
||||||
|
procedure TActionStack.Push(const AAction:string;const Args:TActionArgs);
|
||||||
|
var
|
||||||
|
ActionItem : PActionStackItem;
|
||||||
begin
|
begin
|
||||||
If (Level in FVerbosity) and Assigned(FOnMessage) then
|
New(ActionItem);
|
||||||
FOnMessage(Self,Msg);
|
ActionItem^.Action:=AAction;
|
||||||
|
ActionItem^.Args:=Args;
|
||||||
|
FList.Add(ActionItem);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TPackageHandler.Verbose(Level: TVerbosity; Fmt: String;
|
|
||||||
Args: array of const);
|
procedure TActionStack.Push(const AAction:string;const Args:array of string);
|
||||||
|
var
|
||||||
|
ActionArgs : TActionArgs;
|
||||||
|
i : integer;
|
||||||
begin
|
begin
|
||||||
// Save a format call
|
SetLength(ActionArgs,high(Args)+1);
|
||||||
If (Level in FVerbosity) and Assigned(FOnMessage) then
|
for i:=low(Args) to high(Args) do
|
||||||
Verbose(Level,Format(Fmt,Args));
|
ActionArgs[i]:=Args[i];
|
||||||
|
Push(AAction,ActionArgs);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function TActionStack.Pop(out AAction:string;out Args:TActionArgs):boolean;
|
||||||
|
var
|
||||||
|
ActionItem : PActionStackItem;
|
||||||
|
Idx : integer;
|
||||||
|
begin
|
||||||
|
Result:=false;
|
||||||
|
if FList.Count=0 then
|
||||||
|
exit;
|
||||||
|
// Retrieve Item from stack
|
||||||
|
Idx:=FList.Count-1;
|
||||||
|
ActionItem:=PActionStackItem(FList[Idx]);
|
||||||
|
FList.Delete(Idx);
|
||||||
|
// Copy contents and dispose stack item
|
||||||
|
AAction:=ActionItem^.Action;
|
||||||
|
Args:=ActionItem^.Args;
|
||||||
|
dispose(ActionItem);
|
||||||
|
Result:=true;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
initialization
|
||||||
|
PkgHandlerList:=TFPHashObjectList.Create(true);
|
||||||
|
ActionStack:=TActionStack.Create;
|
||||||
|
finalization
|
||||||
|
FreeAndNil(PkgHandlerList);
|
||||||
|
FreeAndNil(ActionStack);
|
||||||
end.
|
end.
|
||||||
|
@ -39,7 +39,7 @@ Type
|
|||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
pkgmessages, uriparser;
|
pkghandler,pkgmessages, uriparser;
|
||||||
|
|
||||||
{ TLNetDownloader }
|
{ TLNetDownloader }
|
||||||
|
|
||||||
|
@ -8,8 +8,11 @@ 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';
|
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: %s';
|
||||||
|
SErrActionAlreadyRegistered= 'Action "%s" is already registered';
|
||||||
|
SErrActionNotFound = 'Action "%s" is not supported';
|
||||||
SErrFailedToCompileFPCMake = 'Could not compile fpmake driver program';
|
SErrFailedToCompileFPCMake = 'Could not compile fpmake driver program';
|
||||||
SErrNoFTPDownload = 'This binary has no support for FTP downloads.';
|
SErrNoFTPDownload = 'This binary has no support for FTP downloads.';
|
||||||
SErrNoHTTPDownload = 'This binary has no support for HTTP downloads.';
|
SErrNoHTTPDownload = 'This binary has no support for HTTP downloads.';
|
||||||
@ -25,9 +28,11 @@ Resourcestring
|
|||||||
SErrLoginFailed = 'FTP LOGIN command failed.';
|
SErrLoginFailed = 'FTP LOGIN command failed.';
|
||||||
SErrCWDFailed = 'FTP CWD "%s" command failed.';
|
SErrCWDFailed = 'FTP CWD "%s" command failed.';
|
||||||
SErrGETFailed = 'FTP GET "%s" command failed.';
|
SErrGETFailed = 'FTP GET "%s" command failed.';
|
||||||
|
|
||||||
SLogGeneratingFPMake = 'Generating fpmake.pp';
|
SLogGeneratingFPMake = 'Generating fpmake.pp';
|
||||||
SLogCompilingFPMake = 'Compiling fpmake.pp: ';
|
SLogCompilingFPMake = 'Compiling fpmake.pp: ';
|
||||||
SLogRunningFPMake = 'Running fpmake';
|
SLogRunningFPMake = 'Running fpmake';
|
||||||
|
SLogRunAction = 'Action: %s %s';
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
@ -39,14 +39,16 @@ Type
|
|||||||
Procedure StartInstaller(Src : TStrings);
|
Procedure StartInstaller(Src : TStrings);
|
||||||
Procedure EndInstaller(Src : TStrings);
|
Procedure EndInstaller(Src : TStrings);
|
||||||
Function GetLine (L : TStrings; Var I : Integer) : String;
|
Function GetLine (L : TStrings; Var I : Integer) : String;
|
||||||
Public
|
|
||||||
procedure ConvertFile(const AFileName: String; Src: TStrings; Dir,OS : String);
|
procedure ConvertFile(const AFileName: String; Src: TStrings; Dir,OS : String);
|
||||||
Procedure ConvertFile(Const Source,Dest: String);
|
Procedure ConvertFile(Const Source,Dest: String);
|
||||||
|
Public
|
||||||
|
Function Execute(const Args:array of string):boolean;override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses typinfo;
|
uses typinfo,pkgmessages;
|
||||||
|
|
||||||
Function GetWord(var S : String; Sep : Char) : String;
|
Function GetWord(var S : String; Sep : Char) : String;
|
||||||
|
|
||||||
@ -680,6 +682,7 @@ Var
|
|||||||
L : TStrings;
|
L : TStrings;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
Log(vInfo,SLogGeneratingFPMake);
|
||||||
L:=TStringList.Create;
|
L:=TStringList.Create;
|
||||||
Try
|
Try
|
||||||
StartInstaller(L);
|
StartInstaller(L);
|
||||||
@ -691,5 +694,11 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end.
|
function TMakeFileConverter.Execute(const Args:array of string):boolean;
|
||||||
|
begin
|
||||||
|
{$warning TODO Check arguments}
|
||||||
|
ConvertFile(Args[1],Args[2]);
|
||||||
|
result:=true;
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
||||||
|
@ -21,7 +21,7 @@ Type
|
|||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses process,pkgmessages;
|
uses process,pkghandler,pkgmessages;
|
||||||
|
|
||||||
Constructor TWGetDownloader.Create(AOWner : TComponent);
|
Constructor TWGetDownloader.Create(AOWner : TComponent);
|
||||||
|
|
||||||
|
363
utils/fppkg/streamcoll20.pp
Executable file
363
utils/fppkg/streamcoll20.pp
Executable file
@ -0,0 +1,363 @@
|
|||||||
|
{
|
||||||
|
This file is part of the Free Component Library (FCL)
|
||||||
|
Copyright (c) 1999-2000 by the Free Pascal development team
|
||||||
|
|
||||||
|
See the file COPYING.FPC, included in this distribution,
|
||||||
|
for details about the copyright.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
**********************************************************************}
|
||||||
|
|
||||||
|
{$ifndef ver2_0}
|
||||||
|
{$fatal This unit is only for compiling with 2.0.x, use the streamcoll from the FCL}
|
||||||
|
{$endif}
|
||||||
|
|
||||||
|
{$mode objfpc}
|
||||||
|
{$h+}
|
||||||
|
unit streamcoll20;
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
Classes,SysUtils;
|
||||||
|
|
||||||
|
type
|
||||||
|
TStreamCollectionItem = Class(TCollectionItem)
|
||||||
|
Protected
|
||||||
|
Procedure WriteInteger(S : TStream; AValue : Integer);
|
||||||
|
Procedure WriteBoolean(S : TStream; AValue : Boolean);
|
||||||
|
Procedure WriteString(S : TStream; AValue : String);
|
||||||
|
Procedure WriteCurrency(S : TStream; AValue : Currency);
|
||||||
|
Procedure WriteDateTime(S : TStream; AValue : TDateTime);
|
||||||
|
Procedure WriteFloat(S : TStream; AValue : Double);
|
||||||
|
Function ReadInteger(S : TStream) : Integer;
|
||||||
|
Function ReadBoolean(S : TStream) : Boolean;
|
||||||
|
Function ReadString(S : TStream) : String;
|
||||||
|
Function ReadCurrency(S : TStream) : Currency;
|
||||||
|
Function ReadDateTime(S : TStream) : TDateTime;
|
||||||
|
Function ReadFloat(S : TStream) : Double;
|
||||||
|
Procedure LoadFromStream(S : TStream; Streamversion : Integer); virtual; abstract;
|
||||||
|
Procedure SaveToStream(S : TStream); virtual; abstract;
|
||||||
|
end;
|
||||||
|
|
||||||
|
TStreamCollection = Class(TCollection)
|
||||||
|
Private
|
||||||
|
FStreaming : Boolean;
|
||||||
|
Protected
|
||||||
|
Procedure WriteInteger(S : TStream; AValue : Integer);
|
||||||
|
Procedure WriteBoolean(S : TStream; AValue : Boolean);
|
||||||
|
Procedure WriteString(S : TStream; AValue : String);
|
||||||
|
Procedure WriteCurrency(S : TStream; AValue : Currency);
|
||||||
|
Procedure WriteDateTime(S : TStream; AValue : TDateTime);
|
||||||
|
Procedure WriteFloat(S : TStream; AValue : Double);
|
||||||
|
Function ReadInteger(S : TStream) : Integer;
|
||||||
|
Function ReadBoolean(S : TStream) : Boolean;
|
||||||
|
Function ReadString(S : TStream) : String;
|
||||||
|
Function ReadCurrency(S : TStream) : Currency;
|
||||||
|
Function ReadDateTime(S : TStream) : TDateTime;
|
||||||
|
Function ReadFloat(S : TStream) : Double;
|
||||||
|
Procedure DoSaveToStream(S : TStream); virtual;
|
||||||
|
Function CurrentStreamVersion : Integer; Virtual;
|
||||||
|
Procedure DoLoadFromStream(S : TStream; Streamversion : Integer); virtual;
|
||||||
|
Public
|
||||||
|
Procedure LoadFromStream(S : TStream);
|
||||||
|
Procedure SaveToStream(S : TStream);
|
||||||
|
Property Streaming : Boolean Read FStreaming;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
EStreamColl = Class(Exception);
|
||||||
|
|
||||||
|
Procedure ColWriteInteger(S : TStream; AValue : Integer);
|
||||||
|
Procedure ColWriteBoolean(S : TStream; AValue : Boolean);
|
||||||
|
Procedure ColWriteString(S : TStream; AValue : String);
|
||||||
|
Procedure ColWriteCurrency(S : TStream; AValue : Currency);
|
||||||
|
Procedure ColWriteDateTime(S : TStream; AValue : TDateTime);
|
||||||
|
Procedure ColWriteFloat(S : TStream; AValue : Double);
|
||||||
|
Function ColReadInteger(S : TStream) : Integer;
|
||||||
|
Function ColReadBoolean(S : TStream) : Boolean;
|
||||||
|
Function ColReadString(S : TStream) : String;
|
||||||
|
Function ColReadCurrency(S : TStream) : Currency;
|
||||||
|
Function ColReadDateTime(S : TStream) : TDateTime;
|
||||||
|
Function ColReadFloat(S : TStream) : Double;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
Resourcestring
|
||||||
|
SErrIllegalStreamVersion = 'Illegal stream version: %d > %d.';
|
||||||
|
|
||||||
|
Procedure ColWriteInteger(S : TStream; AValue : Integer);
|
||||||
|
|
||||||
|
begin
|
||||||
|
S.WriteBuffer(AValue,SizeOf(Integer));
|
||||||
|
end;
|
||||||
|
|
||||||
|
Procedure ColWriteBoolean(S : TStream; AValue : Boolean);
|
||||||
|
|
||||||
|
begin
|
||||||
|
ColWriteInteger(S,Ord(AValue));
|
||||||
|
end;
|
||||||
|
|
||||||
|
Procedure ColWriteString(S : TStream; AValue : String);
|
||||||
|
|
||||||
|
Var
|
||||||
|
L : Integer;
|
||||||
|
|
||||||
|
begin
|
||||||
|
L:=Length(AValue);
|
||||||
|
ColWriteInteger(S,L);
|
||||||
|
If (L>0) then
|
||||||
|
S.WriteBuffer(AValue[1],L);
|
||||||
|
end;
|
||||||
|
|
||||||
|
Procedure ColWriteCurrency(S : TStream; AValue : Currency);
|
||||||
|
|
||||||
|
begin
|
||||||
|
S.WriteBuffer(AValue,SizeOf(Currency));
|
||||||
|
end;
|
||||||
|
|
||||||
|
Procedure ColWriteDateTime(S : TStream; AValue : TDateTime);
|
||||||
|
|
||||||
|
begin
|
||||||
|
S.WriteBuffer(AValue,SizeOf(TDateTime));
|
||||||
|
end;
|
||||||
|
|
||||||
|
Procedure ColWriteFloat(S : TStream; AValue : Double);
|
||||||
|
|
||||||
|
begin
|
||||||
|
S.WriteBuffer(AValue,SizeOf(Double));
|
||||||
|
end;
|
||||||
|
|
||||||
|
Function ColReadInteger(S : TStream) : Integer;
|
||||||
|
|
||||||
|
begin
|
||||||
|
S.ReadBuffer(Result,SizeOf(Integer));
|
||||||
|
end;
|
||||||
|
|
||||||
|
Function ColReadBoolean(S : TStream) : Boolean;
|
||||||
|
|
||||||
|
Var
|
||||||
|
I : Integer;
|
||||||
|
|
||||||
|
begin
|
||||||
|
S.ReadBuffer(I,SizeOf(Integer));
|
||||||
|
Result:=(I<>0);
|
||||||
|
end;
|
||||||
|
|
||||||
|
Function ColReadString(S : TStream) : String;
|
||||||
|
|
||||||
|
Var
|
||||||
|
L : Integer;
|
||||||
|
|
||||||
|
begin
|
||||||
|
L:=ColReadInteger(S);
|
||||||
|
SetLength(Result,L);
|
||||||
|
If (L>0) then
|
||||||
|
S.ReadBuffer(Result[1],L);
|
||||||
|
end;
|
||||||
|
|
||||||
|
Function ColReadCurrency(S : TStream) : Currency;
|
||||||
|
|
||||||
|
begin
|
||||||
|
S.ReadBuffer(Result,SizeOf(Currency));
|
||||||
|
end;
|
||||||
|
|
||||||
|
Function ColReadDateTime(S : TStream) : TDateTime;
|
||||||
|
|
||||||
|
begin
|
||||||
|
S.ReadBuffer(Result,SizeOf(TDateTime));
|
||||||
|
end;
|
||||||
|
|
||||||
|
Function ColReadFloat(S : TStream) : Double;
|
||||||
|
|
||||||
|
begin
|
||||||
|
S.ReadBuffer(Result,SizeOf(Double));
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TStreamCollectionItem }
|
||||||
|
|
||||||
|
function TStreamCollectionItem.ReadBoolean(S: TStream): Boolean;
|
||||||
|
begin
|
||||||
|
Result:=ColReadBoolean(S);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TStreamCollectionItem.ReadCurrency(S: TStream): Currency;
|
||||||
|
begin
|
||||||
|
Result:=ColReadCurrency(S);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TStreamCollectionItem.ReadDateTime(S: TStream): TDateTime;
|
||||||
|
begin
|
||||||
|
Result:=ColReadDateTime(S);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TStreamCollectionItem.ReadFloat(S: TStream): Double;
|
||||||
|
begin
|
||||||
|
Result:=ColReadFloat(S);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TStreamCollectionItem.ReadInteger(S: TStream): Integer;
|
||||||
|
begin
|
||||||
|
Result:=ColReadinteger(S);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TStreamCollectionItem.ReadString(S: TStream): String;
|
||||||
|
begin
|
||||||
|
Result:=ColReadString(S);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TStreamCollectionItem.WriteBoolean(S: TStream; AValue: Boolean);
|
||||||
|
begin
|
||||||
|
ColWriteBoolean(S,AValue);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TStreamCollectionItem.WriteCurrency(S: TStream;
|
||||||
|
AValue: Currency);
|
||||||
|
begin
|
||||||
|
ColWriteCurrency(S,AValue);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TStreamCollectionItem.WriteDateTime(S: TStream;
|
||||||
|
AValue: TDateTime);
|
||||||
|
begin
|
||||||
|
ColWriteDateTime(S,AValue);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TStreamCollectionItem.WriteFloat(S: TStream; AValue: Double);
|
||||||
|
begin
|
||||||
|
ColWriteFloat(S,AValue);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TStreamCollectionItem.WriteInteger(S: TStream; AValue: Integer);
|
||||||
|
begin
|
||||||
|
ColWriteInteger(S,AValue);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TStreamCollectionItem.WriteString(S: TStream; AValue: String);
|
||||||
|
begin
|
||||||
|
ColWriteString(S,AValue);
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TStreamCollection }
|
||||||
|
|
||||||
|
function TStreamCollection.CurrentStreamVersion: Integer;
|
||||||
|
begin
|
||||||
|
Result:=0;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TStreamCollection.DoLoadFromStream(S: TStream;
|
||||||
|
Streamversion: Integer);
|
||||||
|
begin
|
||||||
|
If (Streamversion>CurrentStreamVersion) then
|
||||||
|
Raise EStreamColl.CreateFmt(SErrIllegalStreamVersion,[Streamversion,CurrentStreamVersion]);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TStreamCollection.DoSaveToStream(S: TStream);
|
||||||
|
begin
|
||||||
|
// Do nothing.
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TStreamCollection.LoadFromStream(S: TStream);
|
||||||
|
|
||||||
|
Var
|
||||||
|
I,V,C : Integer;
|
||||||
|
|
||||||
|
begin
|
||||||
|
FStreaming:=True;
|
||||||
|
Try
|
||||||
|
V:=ReadInteger(S);
|
||||||
|
DoLoadFromStream(S,V);
|
||||||
|
Clear;
|
||||||
|
C:=ReadInteger(S);
|
||||||
|
For I:=1 to C do
|
||||||
|
With Add as TStreamCollectionItem do
|
||||||
|
LoadFromStream(S,V);
|
||||||
|
Finally
|
||||||
|
FStreaming:=False;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TStreamCollection.ReadBoolean(S: TStream): Boolean;
|
||||||
|
begin
|
||||||
|
Result:=ColReadBoolean(S);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TStreamCollection.ReadCurrency(S: TStream): Currency;
|
||||||
|
begin
|
||||||
|
Result:=ColReadCurrency(S);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TStreamCollection.ReadDateTime(S: TStream): TDateTime;
|
||||||
|
begin
|
||||||
|
Result:=ColReadDateTime(S);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TStreamCollection.ReadFloat(S: TStream): Double;
|
||||||
|
begin
|
||||||
|
Result:=ColReadFloat(S);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TStreamCollection.ReadInteger(S: TStream): Integer;
|
||||||
|
begin
|
||||||
|
Result:=ColReadInteger(S);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TStreamCollection.ReadString(S: TStream): String;
|
||||||
|
begin
|
||||||
|
Result:=ColReadString(S);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TStreamCollection.SaveToStream(S: TStream);
|
||||||
|
|
||||||
|
Var
|
||||||
|
I : Integer;
|
||||||
|
|
||||||
|
begin
|
||||||
|
FStreaming:=True;
|
||||||
|
Try
|
||||||
|
WriteInteger(S,CurrentStreamVersion);
|
||||||
|
DoSaveToStream(S);
|
||||||
|
WriteInteger(S,Count);
|
||||||
|
For I:=0 to Count-1 do
|
||||||
|
With TStreamCollectionItem(Items[i]) do
|
||||||
|
SaveToStream(S);
|
||||||
|
Finally
|
||||||
|
FStreaming:=False;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TStreamCollection.WriteBoolean(S: TStream; AValue: Boolean);
|
||||||
|
begin
|
||||||
|
ColWriteBoolean(S,AValue);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TStreamCollection.WriteCurrency(S: TStream; AValue: Currency);
|
||||||
|
begin
|
||||||
|
ColWriteCurrency(S,AValue);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TStreamCollection.WriteDateTime(S: TStream; AValue: TDateTime);
|
||||||
|
begin
|
||||||
|
ColWriteDateTime(S,AValue);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TStreamCollection.WriteFloat(S: TStream; AValue: Double);
|
||||||
|
begin
|
||||||
|
ColWriteFloat(S,AValue);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TStreamCollection.WriteInteger(S: TStream; AValue: Integer);
|
||||||
|
begin
|
||||||
|
ColWriteInteger(S,AValue);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TStreamCollection.WriteString(S: TStream; AValue: String);
|
||||||
|
begin
|
||||||
|
ColWriteString(S,AValue);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
end.
|
Loading…
Reference in New Issue
Block a user