Browse Source

* remote and local repository cleanup
* development hack added to use ~/repository as default
remote repository
* tfppakcage.filename added for file location instead offical
repository
* tfppackage.url renamed to externalurl for 3rd party

git-svn-id: trunk@6478 -

peter 18 years ago
parent
commit
cf8f48fc5f

+ 130 - 113
utils/fppkg/fppkg.lpi

@@ -12,7 +12,7 @@
       <MainUnit Value="0"/>
       <MainUnit Value="0"/>
       <IconPath Value=".\"/>
       <IconPath Value=".\"/>
       <TargetFileExt Value=""/>
       <TargetFileExt Value=""/>
-      <ActiveEditorIndexAtStart Value="10"/>
+      <ActiveEditorIndexAtStart Value="3"/>
     </General>
     </General>
     <VersionInfo>
     <VersionInfo>
       <ProjectVersion Value=""/>
       <ProjectVersion Value=""/>
@@ -28,18 +28,19 @@
     <RunParams>
     <RunParams>
       <local>
       <local>
         <FormatVersion Value="1"/>
         <FormatVersion Value="1"/>
+        <CommandLineParams Value="build hash"/>
         <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="35">
+    <Units Count="36">
       <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="85"/>
-        <TopLine Value="58"/>
+        <CursorPos X="41" Y="147"/>
+        <TopLine Value="171"/>
         <EditorIndex Value="0"/>
         <EditorIndex Value="0"/>
-        <UsageCount Value="68"/>
+        <UsageCount Value="73"/>
         <Loaded Value="True"/>
         <Loaded Value="True"/>
       </Unit0>
       </Unit0>
       <Unit1>
       <Unit1>
@@ -48,14 +49,14 @@
         <UnitName Value="pkgoptions"/>
         <UnitName Value="pkgoptions"/>
         <CursorPos X="41" Y="18"/>
         <CursorPos X="41" Y="18"/>
         <TopLine Value="1"/>
         <TopLine Value="1"/>
-        <UsageCount Value="68"/>
+        <UsageCount Value="73"/>
       </Unit1>
       </Unit1>
       <Unit2>
       <Unit2>
         <Filename Value="fpmkcnst.inc"/>
         <Filename Value="fpmkcnst.inc"/>
         <IsPartOfProject Value="True"/>
         <IsPartOfProject Value="True"/>
         <CursorPos X="64" Y="8"/>
         <CursorPos X="64" Y="8"/>
         <TopLine Value="1"/>
         <TopLine Value="1"/>
-        <UsageCount Value="68"/>
+        <UsageCount Value="73"/>
       </Unit2>
       </Unit2>
       <Unit3>
       <Unit3>
         <Filename Value="fpmktype.pp"/>
         <Filename Value="fpmktype.pp"/>
@@ -63,8 +64,8 @@
         <UnitName Value="fpmktype"/>
         <UnitName Value="fpmktype"/>
         <CursorPos X="3" Y="41"/>
         <CursorPos X="3" Y="41"/>
         <TopLine Value="1"/>
         <TopLine Value="1"/>
-        <EditorIndex Value="9"/>
-        <UsageCount Value="68"/>
+        <EditorIndex Value="6"/>
+        <UsageCount Value="73"/>
         <Loaded Value="True"/>
         <Loaded Value="True"/>
       </Unit3>
       </Unit3>
       <Unit4>
       <Unit4>
@@ -73,32 +74,36 @@
         <UnitName Value="fpmkunit"/>
         <UnitName Value="fpmkunit"/>
         <CursorPos X="1" Y="1"/>
         <CursorPos X="1" Y="1"/>
         <TopLine Value="1"/>
         <TopLine Value="1"/>
-        <UsageCount Value="68"/>
+        <UsageCount Value="73"/>
       </Unit4>
       </Unit4>
       <Unit5>
       <Unit5>
         <Filename Value="fprepos.pp"/>
         <Filename Value="fprepos.pp"/>
         <IsPartOfProject Value="True"/>
         <IsPartOfProject Value="True"/>
         <UnitName Value="fprepos"/>
         <UnitName Value="fprepos"/>
-        <CursorPos X="1" Y="1"/>
-        <TopLine Value="1"/>
-        <UsageCount Value="68"/>
+        <CursorPos X="21" Y="368"/>
+        <TopLine Value="356"/>
+        <EditorIndex Value="8"/>
+        <UsageCount Value="73"/>
+        <Loaded Value="True"/>
       </Unit5>
       </Unit5>
       <Unit6>
       <Unit6>
         <Filename Value="fpxmlrep.pp"/>
         <Filename Value="fpxmlrep.pp"/>
         <IsPartOfProject Value="True"/>
         <IsPartOfProject Value="True"/>
         <UnitName Value="fpxmlrep"/>
         <UnitName Value="fpxmlrep"/>
-        <CursorPos X="1" Y="1"/>
-        <TopLine Value="1"/>
-        <UsageCount Value="68"/>
+        <CursorPos X="33" Y="259"/>
+        <TopLine Value="245"/>
+        <EditorIndex Value="9"/>
+        <UsageCount Value="73"/>
+        <Loaded Value="True"/>
       </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="125" Y="197"/>
-        <TopLine Value="175"/>
+        <CursorPos X="10" Y="167"/>
+        <TopLine Value="153"/>
         <EditorIndex Value="1"/>
         <EditorIndex Value="1"/>
-        <UsageCount Value="68"/>
+        <UsageCount Value="73"/>
         <Loaded Value="True"/>
         <Loaded Value="True"/>
       </Unit7>
       </Unit7>
       <Unit8>
       <Unit8>
@@ -107,28 +112,26 @@
         <UnitName Value="pkgmkconv"/>
         <UnitName Value="pkgmkconv"/>
         <CursorPos X="14" Y="53"/>
         <CursorPos X="14" Y="53"/>
         <TopLine Value="29"/>
         <TopLine Value="29"/>
-        <EditorIndex Value="3"/>
-        <UsageCount Value="68"/>
-        <Loaded Value="True"/>
+        <UsageCount Value="73"/>
       </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="14" Y="44"/>
-        <TopLine Value="28"/>
-        <EditorIndex Value="4"/>
-        <UsageCount Value="68"/>
+        <CursorPos X="18" Y="88"/>
+        <TopLine Value="71"/>
+        <EditorIndex Value="2"/>
+        <UsageCount Value="73"/>
         <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="55" Y="14"/>
-        <TopLine Value="1"/>
-        <EditorIndex Value="8"/>
-        <UsageCount Value="68"/>
+        <CursorPos X="1" Y="29"/>
+        <TopLine Value="27"/>
+        <EditorIndex Value="5"/>
+        <UsageCount Value="73"/>
         <Loaded Value="True"/>
         <Loaded Value="True"/>
       </Unit10>
       </Unit10>
       <Unit11>
       <Unit11>
@@ -174,20 +177,18 @@
       <Unit17>
       <Unit17>
         <Filename Value="pkgcommands.pp"/>
         <Filename Value="pkgcommands.pp"/>
         <UnitName Value="pkgcommands"/>
         <UnitName Value="pkgcommands"/>
-        <CursorPos X="28" Y="50"/>
-        <TopLine Value="1"/>
-        <EditorIndex Value="7"/>
-        <UsageCount Value="32"/>
+        <CursorPos X="1" Y="73"/>
+        <TopLine Value="54"/>
+        <EditorIndex Value="4"/>
+        <UsageCount Value="35"/>
         <Loaded Value="True"/>
         <Loaded Value="True"/>
       </Unit17>
       </Unit17>
       <Unit18>
       <Unit18>
         <Filename Value="pkgwget.pp"/>
         <Filename Value="pkgwget.pp"/>
         <UnitName Value="pkgwget"/>
         <UnitName Value="pkgwget"/>
-        <CursorPos X="14" Y="26"/>
+        <CursorPos X="18" Y="25"/>
         <TopLine Value="15"/>
         <TopLine Value="15"/>
-        <EditorIndex Value="2"/>
-        <UsageCount Value="27"/>
-        <Loaded Value="True"/>
+        <UsageCount Value="29"/>
       </Unit18>
       </Unit18>
       <Unit19>
       <Unit19>
         <Filename Value="pkglnet.pas"/>
         <Filename Value="pkglnet.pas"/>
@@ -213,10 +214,10 @@
       <Unit22>
       <Unit22>
         <Filename Value="pkgarchive.pp"/>
         <Filename Value="pkgarchive.pp"/>
         <UnitName Value="pkgarchive"/>
         <UnitName Value="pkgarchive"/>
-        <CursorPos X="14" Y="27"/>
-        <TopLine Value="1"/>
-        <EditorIndex Value="5"/>
-        <UsageCount Value="23"/>
+        <CursorPos X="1" Y="70"/>
+        <TopLine Value="56"/>
+        <EditorIndex Value="3"/>
+        <UsageCount Value="26"/>
         <Loaded Value="True"/>
         <Loaded Value="True"/>
       </Unit22>
       </Unit22>
       <Unit23>
       <Unit23>
@@ -277,158 +278,163 @@
         <UnitName Value="pkgfpmake"/>
         <UnitName Value="pkgfpmake"/>
         <CursorPos X="48" Y="58"/>
         <CursorPos X="48" Y="58"/>
         <TopLine Value="47"/>
         <TopLine Value="47"/>
-        <EditorIndex Value="6"/>
-        <UsageCount Value="12"/>
-        <Loaded Value="True"/>
+        <UsageCount Value="14"/>
       </Unit31>
       </Unit31>
       <Unit32>
       <Unit32>
         <Filename Value="pkglnet.pp"/>
         <Filename Value="pkglnet.pp"/>
         <UnitName Value="pkglnet"/>
         <UnitName Value="pkglnet"/>
-        <CursorPos X="45" Y="16"/>
+        <CursorPos X="1" Y="1"/>
         <TopLine Value="1"/>
         <TopLine Value="1"/>
-        <EditorIndex Value="12"/>
-        <UsageCount Value="11"/>
+        <EditorIndex Value="11"/>
+        <UsageCount Value="13"/>
         <Loaded Value="True"/>
         <Loaded Value="True"/>
       </Unit32>
       </Unit32>
       <Unit33>
       <Unit33>
         <Filename Value="pkgoptions.pp"/>
         <Filename Value="pkgoptions.pp"/>
         <UnitName Value="pkgoptions"/>
         <UnitName Value="pkgoptions"/>
-        <CursorPos X="1" Y="300"/>
-        <TopLine Value="286"/>
-        <EditorIndex Value="10"/>
-        <UsageCount Value="11"/>
+        <CursorPos X="2" Y="193"/>
+        <TopLine Value="187"/>
+        <EditorIndex Value="7"/>
+        <UsageCount Value="13"/>
         <Loaded Value="True"/>
         <Loaded Value="True"/>
       </Unit33>
       </Unit33>
       <Unit34>
       <Unit34>
         <Filename Value="pkgglobals.pp"/>
         <Filename Value="pkgglobals.pp"/>
         <UnitName Value="pkgglobals"/>
         <UnitName Value="pkgglobals"/>
-        <CursorPos X="23" Y="81"/>
-        <TopLine Value="118"/>
-        <EditorIndex Value="11"/>
-        <UsageCount Value="11"/>
+        <CursorPos X="1" Y="87"/>
+        <TopLine Value="73"/>
+        <EditorIndex Value="10"/>
+        <UsageCount Value="13"/>
         <Loaded Value="True"/>
         <Loaded Value="True"/>
       </Unit34>
       </Unit34>
+      <Unit35>
+        <Filename Value="../../../fpc20/packages/base/netdb/uriparser.pp"/>
+        <UnitName Value="URIParser"/>
+        <CursorPos X="1" Y="193"/>
+        <TopLine Value="189"/>
+        <UsageCount Value="10"/>
+      </Unit35>
     </Units>
     </Units>
     <JumpHistory Count="30" HistoryIndex="29">
     <JumpHistory Count="30" HistoryIndex="29">
       <Position1>
       <Position1>
         <Filename Value="pkghandler.pp"/>
         <Filename Value="pkghandler.pp"/>
-        <Caret Line="10" Column="1" TopLine="1"/>
+        <Caret Line="163" Column="5" TopLine="126"/>
       </Position1>
       </Position1>
       <Position2>
       <Position2>
-        <Filename Value="pkghandler.pp"/>
-        <Caret Line="59" Column="36" TopLine="45"/>
+        <Filename Value="pkgdownload.pp"/>
+        <Caret Line="130" Column="16" TopLine="116"/>
       </Position2>
       </Position2>
       <Position3>
       <Position3>
-        <Filename Value="pkgmkconv.pp"/>
-        <Caret Line="131" Column="36" TopLine="97"/>
+        <Filename Value="pkgarchive.pp"/>
+        <Caret Line="27" Column="14" TopLine="46"/>
       </Position3>
       </Position3>
       <Position4>
       <Position4>
-        <Filename Value="pkgmkconv.pp"/>
-        <Caret Line="584" Column="7" TopLine="569"/>
+        <Filename Value="pkgcommands.pp"/>
+        <Caret Line="60" Column="36" TopLine="50"/>
       </Position4>
       </Position4>
       <Position5>
       <Position5>
-        <Filename Value="pkgdownload.pp"/>
-        <Caret Line="1" Column="1" TopLine="1"/>
+        <Filename Value="pkgcommands.pp"/>
+        <Caret Line="58" Column="1" TopLine="44"/>
       </Position5>
       </Position5>
       <Position6>
       <Position6>
-        <Filename Value="pkgarchive.pp"/>
-        <Caret Line="61" Column="32" TopLine="50"/>
+        <Filename Value="pkgoptions.pp"/>
+        <Caret Line="64" Column="22" TopLine="41"/>
       </Position6>
       </Position6>
       <Position7>
       <Position7>
-        <Filename Value="pkgarchive.pp"/>
-        <Caret Line="67" Column="28" TopLine="54"/>
+        <Filename Value="pkgoptions.pp"/>
+        <Caret Line="110" Column="27" TopLine="96"/>
       </Position7>
       </Position7>
       <Position8>
       <Position8>
-        <Filename Value="pkgfpmake.pp"/>
-        <Caret Line="89" Column="1" TopLine="59"/>
+        <Filename Value="pkgoptions.pp"/>
+        <Caret Line="137" Column="39" TopLine="123"/>
       </Position8>
       </Position8>
       <Position9>
       <Position9>
-        <Filename Value="pkgcommands.pp"/>
-        <Caret Line="88" Column="21" TopLine="68"/>
+        <Filename Value="pkgoptions.pp"/>
+        <Caret Line="159" Column="31" TopLine="145"/>
       </Position9>
       </Position9>
       <Position10>
       <Position10>
-        <Filename Value="pkgcommands.pp"/>
-        <Caret Line="45" Column="14" TopLine="39"/>
+        <Filename Value="pkgoptions.pp"/>
+        <Caret Line="232" Column="25" TopLine="218"/>
       </Position10>
       </Position10>
       <Position11>
       <Position11>
-        <Filename Value="pkgcommands.pp"/>
-        <Caret Line="64" Column="1" TopLine="46"/>
+        <Filename Value="pkgoptions.pp"/>
+        <Caret Line="96" Column="16" TopLine="90"/>
       </Position11>
       </Position11>
       <Position12>
       <Position12>
-        <Filename Value="pkgcommands.pp"/>
-        <Caret Line="46" Column="14" TopLine="41"/>
+        <Filename Value="pkgoptions.pp"/>
+        <Caret Line="45" Column="41" TopLine="44"/>
       </Position12>
       </Position12>
       <Position13>
       <Position13>
-        <Filename Value="pkghandler.pp"/>
-        <Caret Line="185" Column="39" TopLine="172"/>
+        <Filename Value="pkgcommands.pp"/>
+        <Caret Line="53" Column="72" TopLine="50"/>
       </Position13>
       </Position13>
       <Position14>
       <Position14>
         <Filename Value="pkgcommands.pp"/>
         <Filename Value="pkgcommands.pp"/>
-        <Caret Line="80" Column="50" TopLine="66"/>
+        <Caret Line="47" Column="15" TopLine="39"/>
       </Position14>
       </Position14>
       <Position15>
       <Position15>
         <Filename Value="pkgcommands.pp"/>
         <Filename Value="pkgcommands.pp"/>
-        <Caret Line="87" Column="3" TopLine="66"/>
+        <Caret Line="59" Column="33" TopLine="45"/>
       </Position15>
       </Position15>
       <Position16>
       <Position16>
-        <Filename Value="pkgcommands.pp"/>
-        <Caret Line="81" Column="35" TopLine="72"/>
+        <Filename Value="fppkg.pp"/>
+        <Caret Line="85" Column="1" TopLine="58"/>
       </Position16>
       </Position16>
       <Position17>
       <Position17>
-        <Filename Value="pkgcommands.pp"/>
-        <Caret Line="83" Column="14" TopLine="69"/>
+        <Filename Value="fppkg.pp"/>
+        <Caret Line="149" Column="20" TopLine="135"/>
       </Position17>
       </Position17>
       <Position18>
       <Position18>
-        <Filename Value="pkghandler.pp"/>
-        <Caret Line="73" Column="1" TopLine="73"/>
+        <Filename Value="pkgmessages.pp"/>
+        <Caret Line="41" Column="18" TopLine="26"/>
       </Position18>
       </Position18>
       <Position19>
       <Position19>
-        <Filename Value="pkghandler.pp"/>
-        <Caret Line="197" Column="5" TopLine="164"/>
+        <Filename Value="pkgdownload.pp"/>
+        <Caret Line="91" Column="13" TopLine="78"/>
       </Position19>
       </Position19>
       <Position20>
       <Position20>
-        <Filename Value="pkgwget.pp"/>
-        <Caret Line="1" Column="1" TopLine="1"/>
+        <Filename Value="pkgdownload.pp"/>
+        <Caret Line="86" Column="1" TopLine="78"/>
       </Position20>
       </Position20>
       <Position21>
       <Position21>
-        <Filename Value="fppkg.pp"/>
-        <Caret Line="6" Column="38" TopLine="1"/>
+        <Filename Value="pkghandler.pp"/>
+        <Caret Line="106" Column="21" TopLine="93"/>
       </Position21>
       </Position21>
       <Position22>
       <Position22>
-        <Filename Value="fppkg.pp"/>
-        <Caret Line="14" Column="1" TopLine="7"/>
+        <Filename Value="pkgarchive.pp"/>
+        <Caret Line="62" Column="1" TopLine="48"/>
       </Position22>
       </Position22>
       <Position23>
       <Position23>
-        <Filename Value="fppkg.pp"/>
-        <Caret Line="45" Column="1" TopLine="31"/>
+        <Filename Value="pkgarchive.pp"/>
+        <Caret Line="73" Column="67" TopLine="50"/>
       </Position23>
       </Position23>
       <Position24>
       <Position24>
-        <Filename Value="fppkg.pp"/>
-        <Caret Line="312" Column="18" TopLine="298"/>
+        <Filename Value="pkgarchive.pp"/>
+        <Caret Line="67" Column="30" TopLine="54"/>
       </Position24>
       </Position24>
       <Position25>
       <Position25>
-        <Filename Value="pkgoptions.pp"/>
-        <Caret Line="299" Column="14" TopLine="286"/>
+        <Filename Value="pkgglobals.pp"/>
+        <Caret Line="87" Column="1" TopLine="73"/>
       </Position25>
       </Position25>
       <Position26>
       <Position26>
-        <Filename Value="fppkg.pp"/>
-        <Caret Line="313" Column="34" TopLine="298"/>
+        <Filename Value="pkgarchive.pp"/>
+        <Caret Line="62" Column="1" TopLine="48"/>
       </Position26>
       </Position26>
       <Position27>
       <Position27>
-        <Filename Value="pkgoptions.pp"/>
-        <Caret Line="62" Column="97" TopLine="46"/>
+        <Filename Value="pkgarchive.pp"/>
+        <Caret Line="64" Column="1" TopLine="50"/>
       </Position27>
       </Position27>
       <Position28>
       <Position28>
-        <Filename Value="pkgoptions.pp"/>
-        <Caret Line="369" Column="24" TopLine="349"/>
+        <Filename Value="pkgarchive.pp"/>
+        <Caret Line="67" Column="1" TopLine="53"/>
       </Position28>
       </Position28>
       <Position29>
       <Position29>
-        <Filename Value="pkgoptions.pp"/>
-        <Caret Line="308" Column="68" TopLine="286"/>
+        <Filename Value="pkgarchive.pp"/>
+        <Caret Line="68" Column="1" TopLine="54"/>
       </Position29>
       </Position29>
       <Position30>
       <Position30>
-        <Filename Value="pkgoptions.pp"/>
-        <Caret Line="301" Column="43" TopLine="286"/>
+        <Filename Value="pkgarchive.pp"/>
+        <Caret Line="69" Column="1" TopLine="55"/>
       </Position30>
       </Position30>
     </JumpHistory>
     </JumpHistory>
   </ProjectOptions>
   </ProjectOptions>
@@ -463,6 +469,17 @@
     </Other>
     </Other>
   </CompilerOptions>
   </CompilerOptions>
   <Debugging>
   <Debugging>
+    <BreakPoints Count="1">
+      <Item1>
+        <Source Value="pkgarchive.pp"/>
+        <Line Value="62"/>
+      </Item1>
+    </BreakPoints>
+    <Watches Count="1">
+      <Item1>
+        <Expression Value="builddir"/>
+      </Item1>
+    </Watches>
     <Exceptions Count="2">
     <Exceptions Count="2">
       <Item1>
       <Item1>
         <Name Value="ECodetoolError"/>
         <Name Value="ECodetoolError"/>

+ 5 - 5
utils/fppkg/fppkg.pp

@@ -134,20 +134,20 @@ var
 begin
 begin
   FRepository:=TFPRepository.Create(Nil);
   FRepository:=TFPRepository.Create(Nil);
   // Repository
   // Repository
-  Log(vDebug,SLogLoadingRepository,[Defaults.LocalRepository]);
-  if FileExists(Defaults.LocalRepository) then
+  Log(vDebug,SLogLoadingPackagesFile,[Defaults.LocalPackagesFile]);
+  if FileExists(Defaults.LocalPackagesFile) then
     begin
     begin
       X:=TFPXMLRepositoryHandler.Create;
       X:=TFPXMLRepositoryHandler.Create;
       With X do
       With X do
         try
         try
-          LoadFromXml(FRepository,Defaults.LocalRepository);
+          LoadFromXml(FRepository,Defaults.LocalPackagesFile);
         finally
         finally
           Free;
           Free;
         end;
         end;
     end;
     end;
   // Versions
   // Versions
-  S:=Defaults.LocalVersions(FCompilerConfig);
-  Log(vDebug,SLogLoadingVersions,[S]);
+  S:=Defaults.LocalVersionsFile(FCompilerConfig);
+  Log(vDebug,SLogLoadingVersionsFile,[S]);
   if FileExists(S) then
   if FileExists(S) then
     FRepository.LoadStatusFromFile(S);
     FRepository.LoadStatusFromFile(S);
 end;
 end;

+ 27 - 6
utils/fppkg/fprepos.pp

@@ -91,7 +91,8 @@ Type
     FEmail: String;
     FEmail: String;
     FLicense: String;
     FLicense: String;
     FName: String;
     FName: String;
-    FURL: String;
+    FExternalURL: String;
+    FFileName: String;
     FVersion: TFPVersion;
     FVersion: TFPVersion;
     FInstalledVersion: TFPVersion;
     FInstalledVersion: TFPVersion;
     FDependencies : TFPDependencies;
     FDependencies : TFPDependencies;
@@ -99,6 +100,7 @@ Type
     FCPUs : TCPUS;
     FCPUs : TCPUS;
     function GetDependencies: TFPDependencies;
     function GetDependencies: TFPDependencies;
     function GetHasDependencies: Boolean;
     function GetHasDependencies: Boolean;
+    function GetFileName: String;
     procedure SetName(const AValue: String);
     procedure SetName(const AValue: String);
     procedure SetVersion(const AValue: TFPVersion);
     procedure SetVersion(const AValue: TFPVersion);
   Protected
   Protected
@@ -119,7 +121,8 @@ Type
     Property InstalledVersion : TFPVersion Read FInstalledVersion Write FInstalledVersion;
     Property InstalledVersion : TFPVersion Read FInstalledVersion Write FInstalledVersion;
     Property License : String Read FLicense Write FLicense;
     Property License : String Read FLicense Write FLicense;
     Property Description : String Read FDescription Write FDescription;
     Property Description : String Read FDescription Write FDescription;
-    Property URL : String Read FURL Write FURL;
+    Property ExternalURL : String Read FExternalURL Write FExternalURL;
+    Property FileName : String Read GetFileName Write FFileName;
     Property Email : String Read FEmail Write FEmail;
     Property Email : String Read FEmail Write FEmail;
     Property OSes : TOSes Read FOSes Write FOses;
     Property OSes : TOSes Read FOSes Write FOses;
     Property CPUs : TCPUs Read FCPUs Write FCPUs;
     Property CPUs : TCPUs Read FCPUs Write FCPUs;
@@ -198,7 +201,9 @@ Const
 
 
 Implementation
 Implementation
 
 
-uses typinfo;
+uses
+  typinfo,
+  uriparser;
 
 
 ResourceString
 ResourceString
 
 
@@ -356,6 +361,19 @@ begin
   Result:=Assigned(FDependencies) and (FDependencies.Count>0);
   Result:=Assigned(FDependencies) and (FDependencies.Count>0);
 end;
 end;
 
 
+function TFPPackage.GetFileName: String;
+var
+  URI : TURI;
+begin
+  if FFileName='' then
+    begin
+      URI:=ParseURI(ExternalURL);
+      Result:=URI.Document;
+    end
+  else
+    Result:=FFileName;
+end;
+
 procedure TFPPackage.LoadFromStream(Stream: TStream; Streamversion : Integer);
 procedure TFPPackage.LoadFromStream(Stream: TStream; Streamversion : Integer);
 
 
 Var
 Var
@@ -370,7 +388,8 @@ begin
   Author:=ReadString(Stream);
   Author:=ReadString(Stream);
   License:=ReadString(Stream);
   License:=ReadString(Stream);
   Description:=ReadString(Stream);
   Description:=ReadString(Stream);
-  URL:=ReadString(Stream);
+  ExternalURL:=ReadString(Stream);
+  FileName:=ReadString(Stream);
   Email:=ReadString(Stream);
   Email:=ReadString(Stream);
   Count:=ReadInteger(Stream);
   Count:=ReadInteger(Stream);
   O:=[];
   O:=[];
@@ -412,7 +431,8 @@ begin
   WriteString(Stream,Author);
   WriteString(Stream,Author);
   WriteString(Stream,License);
   WriteString(Stream,License);
   WriteString(Stream,Description);
   WriteString(Stream,Description);
-  WriteString(Stream,URL);
+  WriteString(Stream,ExternalURL);
+  WriteString(Stream,FileName);
   WriteString(Stream,Email);
   WriteString(Stream,Email);
   { Write it like this, makes error checking easier when reading. }
   { Write it like this, makes error checking easier when reading. }
   // OSes
   // OSes
@@ -453,7 +473,8 @@ begin
     Author:=P.Author;
     Author:=P.Author;
     Version:=P.Version;
     Version:=P.Version;
     Description:=P.Description;
     Description:=P.Description;
-    URL:=P.URL;
+    ExternalURL:=P.ExternalURL;
+    FileName:=P.FileName;
     InstalledVersion:=P.Installedversion;
     InstalledVersion:=P.Installedversion;
     If P.HasDependencies then
     If P.HasDependencies then
       Dependencies.Assign(P.Dependencies)
       Dependencies.Assign(P.Dependencies)

+ 8 - 4
utils/fppkg/fpxmlrep.pp

@@ -92,7 +92,8 @@ Const
   SNodePackage      = 'package';
   SNodePackage      = 'package';
   SNodeAuthor       = 'author';
   SNodeAuthor       = 'author';
   SNodeLicense      = 'license';
   SNodeLicense      = 'license';
-  SNodeURL          = 'url';
+  SNodeExternalURL  = 'externalurl';
+  SNodeFileName     = 'filename';
   SNodeEmail        = 'email';
   SNodeEmail        = 'email';
   SNodeVersion      = 'version';
   SNodeVersion      = 'version';
   SNodeDescription  = 'description';
   SNodeDescription  = 'description';
@@ -255,7 +256,8 @@ begin
     // Version
     // Version
     VersionToXML(P.Version,XML,Result);
     VersionToXML(P.Version,XML,Result);
     AddTextNode(SNodeAuthor,P.Author,XML,Result);
     AddTextNode(SNodeAuthor,P.Author,XML,Result);
-    AddTextNode(SNodeURL,P.URL,XML,Result);
+    AddTextNode(SNodeExternalURL,P.ExternalURL,XML,Result);
+    AddTextNode(SNodeFileName,P.FileName,XML,Result);
     AddTextNode(SNodeEmail,P.Email,XML,Result);
     AddTextNode(SNodeEmail,P.Email,XML,Result);
     AddTextNode(SNodeDescription,P.Description,XML,Result);
     AddTextNode(SNodeDescription,P.Description,XML,Result);
     AddTextNode(SNodeLicense,P.License,XML,Result);
     AddTextNode(SNodeLicense,P.License,XML,Result);
@@ -601,8 +603,10 @@ begin
     begin
     begin
     if (N.NodeName=sNodeAuthor) then
     if (N.NodeName=sNodeAuthor) then
       P.Author:=NodeText(N)
       P.Author:=NodeText(N)
-    else if (N.NodeName=sNodeURl) then
-      P.URL:=NodeText(N)
+    else if (N.NodeName=sNodeExternalURL) then
+      P.ExternalURL:=NodeText(N)
+    else if (N.NodeName=sNodeFileName) then
+      P.FileName:=NodeText(N)
     else if (N.NodeName=sNodeEmail) then
     else if (N.NodeName=sNodeEmail) then
       P.Email:=NodeText(N)
       P.Email:=NodeText(N)
     else if (N.NodeName=sNodeDescription) then
     else if (N.NodeName=sNodeDescription) then

+ 3 - 2
utils/fppkg/pkgarchive.pp

@@ -58,13 +58,14 @@ Var
   BuildDir : string;
   BuildDir : string;
   ArchiveFile : String;
   ArchiveFile : String;
 begin
 begin
-  ArchiveFile:=PackageArchive;
+  ArchiveFile:=PackageLocalArchive;
   BuildDir:=PackageBuildPath;
   BuildDir:=PackageBuildPath;
   { Remove existing builddir }
   { Remove existing builddir }
   if DirectoryExists(BuildDir) then
   if DirectoryExists(BuildDir) then
     DeleteDir(BuildDir);
     DeleteDir(BuildDir);
   { Unzip Archive }
   { Unzip Archive }
-//  SetCurrentDir(PackageBuildPath);
+  ForceDirectories(BuildDir);
+  SetCurrentDir(BuildDir);
   With TUnZipper.Create do
   With TUnZipper.Create do
     try
     try
       Log(vCommands,SLogUnzippping,[ArchiveFile]);
       Log(vCommands,SLogUnzippping,[ArchiveFile]);

+ 4 - 27
utils/fppkg/pkgcommands.pp

@@ -44,34 +44,11 @@ uses
   pkgmessages,
   pkgmessages,
   pkgglobals,
   pkgglobals,
   pkgoptions,
   pkgoptions,
-  fpmktype,
-  fprepos,
-  fpxmlrep;
+  pkgdownload;
 
 
 function TCommandUpdate.Execute(const Args:TActionArgs):boolean;
 function TCommandUpdate.Execute(const Args:TActionArgs):boolean;
-Var
-  X : TFPXMLRepositoryHandler;
-  P : TFPPackage;
-  R : TFPRepository;
 begin
 begin
-{$warning TODO remove this hack}
-  R:=TFPRepository.Create(nil);
-  P:=R.AddPackage('FirstPackage');
-  P.Author:='Michael Van Canneyt';
-  P.URL:='http://www.freepascal.org/packages/firstpackage.zip';
-  P.Email:='[email protected]';
-  P.Version.AsString:='1.2.3';
-  P.Description:='First package in the repository. Provides basic information.';
-  P.OSes:=[Win32,linux];
-  P.CPUs:=[i386,x86_64];
-  X:=TFPXMLRepositoryHandler.Create;
-  With X do
-    try
-      SaveToXml(R,Defaults.LocalRepository);
-    finally
-      Free;
-    end;
-  FreeAndNil(R);
+  DownloadFile(Defaults.RemotePackagesFile,Defaults.LocalPackagesFile);
 end;
 end;
 
 
 
 
@@ -79,7 +56,7 @@ function TCommandDownload.Execute(const Args:TActionArgs):boolean;
 begin
 begin
   if not assigned(CurrentPackage) then
   if not assigned(CurrentPackage) then
     Error(SErrNoPackageSpecified);
     Error(SErrNoPackageSpecified);
-  if not FileExists(PackageArchive) then
+  if not FileExists(PackageLocalArchive) then
     ExecuteAction(CurrentPackage,'downloadpackage',Args);
     ExecuteAction(CurrentPackage,'downloadpackage',Args);
 end;
 end;
 
 
@@ -88,7 +65,7 @@ function TCommandBuild.Execute(const Args:TActionArgs):boolean;
 begin
 begin
   if assigned(CurrentPackage) then
   if assigned(CurrentPackage) then
     begin
     begin
-      if not FileExists(PackageArchive) then
+      if not FileExists(PackageLocalArchive) then
         ExecuteAction(CurrentPackage,'downloadpackage',Args);
         ExecuteAction(CurrentPackage,'downloadpackage',Args);
       if not DirectoryExists(PackageBuildPath) then
       if not DirectoryExists(PackageBuildPath) then
         ExecuteAction(CurrentPackage,'unziparchive',Args);
         ExecuteAction(CurrentPackage,'unziparchive',Args);

+ 18 - 4
utils/fppkg/pkgdownload.pp

@@ -37,6 +37,9 @@ Type
 Var
 Var
   DownloaderClass : TBaseDownloaderClass;
   DownloaderClass : TBaseDownloaderClass;
 
 
+procedure DownloadFile(const RemoteFile,LocalFile:String);
+
+
 implementation
 implementation
 
 
 uses
 uses
@@ -44,6 +47,18 @@ uses
   pkgglobals,
   pkgglobals,
   pkgmessages;
   pkgmessages;
 
 
+
+procedure DownloadFile(const RemoteFile,LocalFile:String);
+begin
+  with DownloaderClass.Create(nil) do
+    try
+      Download(RemoteFile,LocalFile);
+    finally
+      Free;
+    end;
+end;
+
+
 { TBaseDownloader }
 { TBaseDownloader }
 
 
 procedure TBaseDownloader.BackupFile(const FileName: String);
 procedure TBaseDownloader.BackupFile(const FileName: String);
@@ -68,13 +83,11 @@ end;
 procedure TBaseDownloader.FileDownload(const URL: String; Dest: TStream);
 procedure TBaseDownloader.FileDownload(const URL: String; Dest: TStream);
 
 
 Var
 Var
-  URI : TURI;
   FN : String;
   FN : String;
   F : TFileStream;
   F : TFileStream;
 
 
 begin
 begin
-  URI:=ParseURI(URL);
-  FN:=URI.Path+'/'+URI.Document;
+  URIToFilename(URL,FN);
   If Not FileExists(FN) then
   If Not FileExists(FN) then
     Error(SErrNoSuchFile,[FN]);
     Error(SErrNoSuchFile,[FN]);
   F:=TFileStream.Create(FN,fmOpenRead);
   F:=TFileStream.Create(FN,fmOpenRead);
@@ -91,6 +104,7 @@ Var
   F : TFileStream;
   F : TFileStream;
 
 
 begin
 begin
+  Log(vCommands,SLogDownloading,[URL,DestFileName]);
   If FileExists(DestFileName) and BackupFiles then
   If FileExists(DestFileName) and BackupFiles then
     BackupFile(DestFileName);
     BackupFile(DestFileName);
   F:=TFileStream.Create(DestFileName,fmCreate);
   F:=TFileStream.Create(DestFileName,fmCreate);
@@ -127,7 +141,7 @@ function TDownloadPackage.Execute(const Args:TActionArgs):boolean;
 begin
 begin
   with DownloaderClass.Create(nil) do
   with DownloaderClass.Create(nil) do
     try
     try
-      Download(CurrentPackage.URL,PackageArchive);
+      Download(PackageRemoteArchive,PackageLocalArchive);
     finally
     finally
       Free;
       Free;
     end;
     end;

+ 16 - 7
utils/fppkg/pkghandler.pp

@@ -48,7 +48,8 @@ type
     Function ExecuteProcess(Const Prog,Args:String):Integer;
     Function ExecuteProcess(Const Prog,Args:String):Integer;
     Procedure SetCurrentDir(Const ADir:String);
     Procedure SetCurrentDir(Const ADir:String);
     function PackageBuildPath:String;
     function PackageBuildPath:String;
-    function PackageArchive:String;
+    function PackageRemoteArchive: String;
+    function PackageLocalArchive:String;
   Public
   Public
     Constructor Create(AOwner:TComponent;APackage:TFPPackage); virtual;
     Constructor Create(AOwner:TComponent;APackage:TFPPackage); virtual;
     function PackageLogPrefix:String;
     function PackageLogPrefix:String;
@@ -112,7 +113,7 @@ begin
           else
           else
             logargs:=logargs+','+Args[i];
             logargs:=logargs+','+Args[i];
         end;
         end;
-      Log(vDebug,PackageLogPrefix+SLogRunAction,[AAction,logargs]);
+      Log(vDebug,SLogRunAction,[AAction,logargs]);
       Execute(Args);
       Execute(Args);
     finally
     finally
       Free;
       Free;
@@ -151,13 +152,21 @@ begin
     Result:=Defaults.BuildDir+CurrentPackage.Name;
     Result:=Defaults.BuildDir+CurrentPackage.Name;
 end;
 end;
 
 
+function TPackageHandler.PackageRemoteArchive: String;
+begin
+  if not assigned(CurrentPackage) then
+    Error(SErrNoPackageSpecified);
+  if CurrentPackage.ExternalURL<>'' then
+    Result:=CurrentPackage.ExternalURL
+  else
+    Result:=Defaults.RemoteRepository+CurrentPackage.FileName;
+end;
 
 
-function TPackageHandler.PackageArchive:String;
-var
-  URI : TURI;
+function TPackageHandler.PackageLocalArchive: String;
 begin
 begin
-  URI:=ParseURI(CurrentPackage.URL);
-  Result:=Defaults.PackagesDir+URI.Document;
+  if not assigned(CurrentPackage) then
+    Error(SErrNoPackageSpecified);
+  Result:=Defaults.PackagesDir+CurrentPackage.FileName;
 end;
 end;
 
 
 
 

+ 3 - 2
utils/fppkg/pkgmessages.pp

@@ -38,13 +38,14 @@ Resourcestring
   SLogRunAction              = 'Action: "%s %s"';
   SLogRunAction              = 'Action: "%s %s"';
   SLogExecute                = 'Executing: "%s %s"';
   SLogExecute                = 'Executing: "%s %s"';
   SLogChangeDir              = 'CurrentDir: "%s"';
   SLogChangeDir              = 'CurrentDir: "%s"';
+  SLogDownloading            = 'Downloading "%s" to "%s"';
   SLogUnzippping             = 'Unzipping "%s"';
   SLogUnzippping             = 'Unzipping "%s"';
   SLogLoadingGlobalConfig    = 'Loading global configuration from "%s"';
   SLogLoadingGlobalConfig    = 'Loading global configuration from "%s"';
   SLogLoadingCompilerConfig  = 'Loading compiler configuration from "%s"';
   SLogLoadingCompilerConfig  = 'Loading compiler configuration from "%s"';
   SLogGeneratingGlobalConfig = 'Generating default global configuration in "%s"';
   SLogGeneratingGlobalConfig = 'Generating default global configuration in "%s"';
   SLogGeneratingCompilerConfig  = 'Generating default compiler configuration in "%s"';
   SLogGeneratingCompilerConfig  = 'Generating default compiler configuration in "%s"';
-  SLogLoadingRepository      = 'Loading repository data from "%s"';
-  SLogLoadingVersions        = 'Loading versions data from "%s"';
+  SLogLoadingPackagesFile    = 'Loading packages information from "%s"';
+  SLogLoadingVersionsFile    = 'Loading local versions information from "%s"';
 
 
 
 
 implementation
 implementation

+ 29 - 10
utils/fppkg/pkgoptions.pp

@@ -58,7 +58,9 @@ Type
     Procedure LoadCompilerFromFile(FileName : String);
     Procedure LoadCompilerFromFile(FileName : String);
     Procedure SaveCompilerToFile(FileName : String);
     Procedure SaveCompilerToFile(FileName : String);
     Property Dirty : Boolean Read FDirty;
     Property Dirty : Boolean Read FDirty;
-    function LocalVersions(CompilerConfig:String):string;
+    function RemotePackagesFile:string;
+    function LocalPackagesFile:string;
+    function LocalVersionsFile(CompilerConfig:String):string;
   Published
   Published
     Property RemoteMirrorsLocation : String Index 0 Read GetOptString Write SetOptString;
     Property RemoteMirrorsLocation : String Index 0 Read GetOptString Write SetOptString;
     Property LocalMirrorsLocation : String Index 1 Read GetOptString Write SetOptString;
     Property LocalMirrorsLocation : String Index 1 Read GetOptString Write SetOptString;
@@ -90,11 +92,16 @@ uses
   pkgmessages;
   pkgmessages;
 
 
 Const
 Const
-  DefaultMirrorsLocation  = 'http://www.freepascal.org/repository/mirrors.xml';
-  DefaultRemoteRepository = 'fpc';
-  DefaultMirrors = 'mirrors.xml';
-  DefaultRepository = 'packages.xml';
-  DefaultVersions   = 'versions-%s.dat';
+  DefaultMirrorFile       = 'mirrors.xml';
+  DefaultPackagesFile     = 'packages.xml';
+  DefaultVersionsFile     = 'versions-%s.dat';
+  DefaultMirrorsLocation  = 'http://www.freepascal.org/repository/'+DefaultMirrorFile;
+{$warning TODO use real repository}
+{$ifdef unix}
+  DefaultRemoteRepository = 'file://'+{$I %HOME%}+'/repository/';
+{$else}
+  DefaultRemoteRepository = 'c:/repository/';
+{$endif}
 
 
   // ini file keys
   // ini file keys
   SDefaults = 'Defaults';
   SDefaults = 'Defaults';
@@ -185,9 +192,21 @@ begin
 end;
 end;
 
 
 
 
-function TPackagerOptions.LocalVersions(CompilerConfig:String):string;
+function TPackagerOptions.RemotePackagesFile:string;
+begin
+  Result:=FRemoteRepository+DefaultPackagesFile;
+end;
+
+
+function TPackagerOptions.LocalPackagesFile:string;
+begin
+  Result:=FLocalRepository+DefaultPackagesFile;
+end;
+
+
+function TPackagerOptions.LocalVersionsFile(CompilerConfig:String):string;
 begin
 begin
-  Result:=ExtractFilePath(FLocalRepository)+Format(DefaultVersions,[CompilerConfig]);
+  Result:=FLocalRepository+Format(DefaultVersionsFile,[CompilerConfig]);
 end;
 end;
 
 
 
 
@@ -214,8 +233,8 @@ begin
   FBuildDir:=LocalDir+'build'+PathDelim;
   FBuildDir:=LocalDir+'build'+PathDelim;
   FPackagesDir:=LocalDir+'packages'+PathDelim;
   FPackagesDir:=LocalDir+'packages'+PathDelim;
   FCompilerConfigDir:=LocalDir+'config'+PathDelim;
   FCompilerConfigDir:=LocalDir+'config'+PathDelim;
-  FLocalMirrorsLocation:=LocalDir+DefaultMirrors;
-  FLocalRepository:=LocalDir+DefaultRepository;
+  FLocalMirrorsLocation:=LocalDir+DefaultMirrorFile;
+  FLocalRepository:=LocalDir;
   // Remote
   // Remote
   FRemoteMirrorsLocation:=DefaultMirrorsLocation;
   FRemoteMirrorsLocation:=DefaultMirrorsLocation;
   FRemoteRepository:=DefaultRemoteRepository;
   FRemoteRepository:=DefaultRemoteRepository;