Browse Source

* check if the minimum required fpmkunit is installed, if not
installed or too old then fallback to internal source

git-svn-id: trunk@9305 -

peter 17 years ago
parent
commit
b72cb5f4b8

+ 102 - 102
utils/fppkg/fppkg.lpi

@@ -2,7 +2,7 @@
 <CONFIG>
 <CONFIG>
   <ProjectOptions>
   <ProjectOptions>
     <PathDelim Value="/"/>
     <PathDelim Value="/"/>
-    <Version Value="5"/>
+    <Version Value="6"/>
     <General>
     <General>
       <Flags>
       <Flags>
         <MainUnitHasUsesSectionForAllUnits Value="False"/>
         <MainUnitHasUsesSectionForAllUnits Value="False"/>
@@ -12,7 +12,7 @@
       <MainUnit Value="0"/>
       <MainUnit Value="0"/>
       <IconPath Value=".\"/>
       <IconPath Value=".\"/>
       <TargetFileExt Value=""/>
       <TargetFileExt Value=""/>
-      <ActiveEditorIndexAtStart Value="3"/>
+      <ActiveEditorIndexAtStart Value="4"/>
     </General>
     </General>
     <VersionInfo>
     <VersionInfo>
       <ProjectVersion Value=""/>
       <ProjectVersion Value=""/>
@@ -32,15 +32,15 @@
         <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="37">
+    <Units Count="38">
       <Unit0>
       <Unit0>
         <Filename Value="fppkg.pp"/>
         <Filename Value="fppkg.pp"/>
         <IsPartOfProject Value="True"/>
         <IsPartOfProject Value="True"/>
         <UnitName Value="fppkg"/>
         <UnitName Value="fppkg"/>
-        <CursorPos X="131" Y="33"/>
-        <TopLine Value="18"/>
-        <EditorIndex Value="0"/>
-        <UsageCount Value="82"/>
+        <CursorPos X="49" Y="280"/>
+        <TopLine Value="270"/>
+        <EditorIndex Value="6"/>
+        <UsageCount Value="86"/>
         <Loaded Value="True"/>
         <Loaded Value="True"/>
       </Unit0>
       </Unit0>
       <Unit1>
       <Unit1>
@@ -49,7 +49,7 @@
         <UnitName Value="pkgoptions"/>
         <UnitName Value="pkgoptions"/>
         <CursorPos X="41" Y="18"/>
         <CursorPos X="41" Y="18"/>
         <TopLine Value="1"/>
         <TopLine Value="1"/>
-        <UsageCount Value="82"/>
+        <UsageCount Value="86"/>
       </Unit1>
       </Unit1>
       <Unit2>
       <Unit2>
         <Filename Value="fpmkcnst.inc"/>
         <Filename Value="fpmkcnst.inc"/>
@@ -76,9 +76,9 @@
         <IsPartOfProject Value="True"/>
         <IsPartOfProject Value="True"/>
         <UnitName Value="fprepos"/>
         <UnitName Value="fprepos"/>
         <CursorPos X="1" Y="187"/>
         <CursorPos X="1" Y="187"/>
-        <TopLine Value="165"/>
-        <EditorIndex Value="9"/>
-        <UsageCount Value="82"/>
+        <TopLine Value="163"/>
+        <EditorIndex Value="7"/>
+        <UsageCount Value="86"/>
         <Loaded Value="True"/>
         <Loaded Value="True"/>
       </Unit5>
       </Unit5>
       <Unit6>
       <Unit6>
@@ -87,9 +87,7 @@
         <UnitName Value="fpxmlrep"/>
         <UnitName Value="fpxmlrep"/>
         <CursorPos X="1" Y="43"/>
         <CursorPos X="1" Y="43"/>
         <TopLine Value="43"/>
         <TopLine Value="43"/>
-        <EditorIndex Value="10"/>
-        <UsageCount Value="82"/>
-        <Loaded Value="True"/>
+        <UsageCount Value="86"/>
       </Unit6>
       </Unit6>
       <Unit7>
       <Unit7>
         <Filename Value="pkghandler.pp"/>
         <Filename Value="pkghandler.pp"/>
@@ -97,9 +95,7 @@
         <UnitName Value="pkghandler"/>
         <UnitName Value="pkghandler"/>
         <CursorPos X="56" Y="170"/>
         <CursorPos X="56" Y="170"/>
         <TopLine Value="156"/>
         <TopLine Value="156"/>
-        <EditorIndex Value="1"/>
-        <UsageCount Value="82"/>
-        <Loaded Value="True"/>
+        <UsageCount Value="86"/>
       </Unit7>
       </Unit7>
       <Unit8>
       <Unit8>
         <Filename Value="pkgmkconv.pp"/>
         <Filename Value="pkgmkconv.pp"/>
@@ -107,26 +103,24 @@
         <UnitName Value="pkgmkconv"/>
         <UnitName Value="pkgmkconv"/>
         <CursorPos X="14" Y="53"/>
         <CursorPos X="14" Y="53"/>
         <TopLine Value="29"/>
         <TopLine Value="29"/>
-        <UsageCount Value="82"/>
+        <UsageCount Value="86"/>
       </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="27" Y="144"/>
         <CursorPos X="27" Y="144"/>
         <TopLine Value="129"/>
         <TopLine Value="129"/>
-        <EditorIndex Value="2"/>
-        <UsageCount Value="82"/>
-        <Loaded Value="True"/>
+        <UsageCount Value="86"/>
       </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="34" Y="45"/>
-        <TopLine Value="25"/>
-        <EditorIndex Value="6"/>
-        <UsageCount Value="82"/>
+        <CursorPos X="96" Y="73"/>
+        <TopLine Value="43"/>
+        <EditorIndex Value="2"/>
+        <UsageCount Value="86"/>
         <Loaded Value="True"/>
         <Loaded Value="True"/>
       </Unit10>
       </Unit10>
       <Unit11>
       <Unit11>
@@ -172,10 +166,10 @@
       <Unit17>
       <Unit17>
         <Filename Value="pkgcommands.pp"/>
         <Filename Value="pkgcommands.pp"/>
         <UnitName Value="pkgcommands"/>
         <UnitName Value="pkgcommands"/>
-        <CursorPos X="3" Y="73"/>
-        <TopLine Value="59"/>
-        <EditorIndex Value="5"/>
-        <UsageCount Value="39"/>
+        <CursorPos X="39" Y="265"/>
+        <TopLine Value="242"/>
+        <EditorIndex Value="1"/>
+        <UsageCount Value="41"/>
         <Loaded Value="True"/>
         <Loaded Value="True"/>
       </Unit17>
       </Unit17>
       <Unit18>
       <Unit18>
@@ -209,10 +203,10 @@
       <Unit22>
       <Unit22>
         <Filename Value="pkgrepos.pp"/>
         <Filename Value="pkgrepos.pp"/>
         <UnitName Value="pkgrepos"/>
         <UnitName Value="pkgrepos"/>
-        <CursorPos X="30" Y="60"/>
-        <TopLine Value="42"/>
-        <EditorIndex Value="8"/>
-        <UsageCount Value="30"/>
+        <CursorPos X="104" Y="109"/>
+        <TopLine Value="82"/>
+        <EditorIndex Value="4"/>
+        <UsageCount Value="32"/>
         <Loaded Value="True"/>
         <Loaded Value="True"/>
       </Unit22>
       </Unit22>
       <Unit23>
       <Unit23>
@@ -271,36 +265,36 @@
       <Unit31>
       <Unit31>
         <Filename Value="pkgfpmake.pp"/>
         <Filename Value="pkgfpmake.pp"/>
         <UnitName Value="pkgfpmake"/>
         <UnitName Value="pkgfpmake"/>
-        <CursorPos X="25" Y="100"/>
-        <TopLine Value="88"/>
-        <EditorIndex Value="4"/>
-        <UsageCount Value="18"/>
+        <CursorPos X="35" Y="218"/>
+        <TopLine Value="188"/>
+        <EditorIndex Value="0"/>
+        <UsageCount Value="20"/>
         <Loaded Value="True"/>
         <Loaded Value="True"/>
       </Unit31>
       </Unit31>
       <Unit32>
       <Unit32>
         <Filename Value="pkglnet.pp"/>
         <Filename Value="pkglnet.pp"/>
         <UnitName Value="pkglnet"/>
         <UnitName Value="pkglnet"/>
-        <CursorPos X="1" Y="1"/>
+        <CursorPos X="45" Y="32"/>
         <TopLine Value="1"/>
         <TopLine Value="1"/>
-        <EditorIndex Value="12"/>
+        <EditorIndex Value="8"/>
         <UsageCount Value="17"/>
         <UsageCount Value="17"/>
         <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="53" Y="84"/>
-        <TopLine Value="59"/>
-        <EditorIndex Value="7"/>
-        <UsageCount Value="17"/>
+        <CursorPos X="49" Y="230"/>
+        <TopLine Value="210"/>
+        <EditorIndex Value="3"/>
+        <UsageCount Value="19"/>
         <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="1" Y="29"/>
-        <TopLine Value="29"/>
-        <EditorIndex Value="11"/>
+        <CursorPos X="1" Y="51"/>
+        <TopLine Value="19"/>
+        <EditorIndex Value="5"/>
         <UsageCount Value="17"/>
         <UsageCount Value="17"/>
         <Loaded Value="True"/>
         <Loaded Value="True"/>
       </Unit34>
       </Unit34>
@@ -316,138 +310,144 @@
         <UnitName Value="pkgarchive"/>
         <UnitName Value="pkgarchive"/>
         <CursorPos X="1" Y="74"/>
         <CursorPos X="1" Y="74"/>
         <TopLine Value="69"/>
         <TopLine Value="69"/>
-        <EditorIndex Value="3"/>
         <UsageCount Value="12"/>
         <UsageCount Value="12"/>
-        <Loaded Value="True"/>
       </Unit36>
       </Unit36>
+      <Unit37>
+        <Filename Value="/tmp/testcompileroptions.pas"/>
+        <UnitName Value="testcompileroptions"/>
+        <CursorPos X="1" Y="1"/>
+        <TopLine Value="1"/>
+        <UsageCount Value="10"/>
+      </Unit37>
     </Units>
     </Units>
     <JumpHistory Count="30" HistoryIndex="29">
     <JumpHistory Count="30" HistoryIndex="29">
       <Position1>
       <Position1>
-        <Filename Value="fppkg.pp"/>
-        <Caret Line="1" Column="1" TopLine="1"/>
+        <Filename Value="fprepos.pp"/>
+        <Caret Line="706" Column="21" TopLine="688"/>
       </Position1>
       </Position1>
       <Position2>
       <Position2>
-        <Filename Value="fppkg.pp"/>
-        <Caret Line="80" Column="13" TopLine="74"/>
+        <Filename Value="fprepos.pp"/>
+        <Caret Line="751" Column="28" TopLine="733"/>
       </Position2>
       </Position2>
       <Position3>
       <Position3>
-        <Filename Value="pkgoptions.pp"/>
-        <Caret Line="181" Column="1" TopLine="169"/>
+        <Filename Value="fprepos.pp"/>
+        <Caret Line="768" Column="25" TopLine="748"/>
       </Position3>
       </Position3>
       <Position4>
       <Position4>
-        <Filename Value="pkgoptions.pp"/>
-        <Caret Line="38" Column="27" TopLine="15"/>
+        <Filename Value="fprepos.pp"/>
+        <Caret Line="842" Column="25" TopLine="824"/>
       </Position4>
       </Position4>
       <Position5>
       <Position5>
-        <Filename Value="pkgoptions.pp"/>
-        <Caret Line="76" Column="35" TopLine="62"/>
+        <Filename Value="fprepos.pp"/>
+        <Caret Line="883" Column="17" TopLine="850"/>
       </Position5>
       </Position5>
       <Position6>
       <Position6>
-        <Filename Value="pkgoptions.pp"/>
-        <Caret Line="185" Column="14" TopLine="158"/>
+        <Filename Value="fprepos.pp"/>
+        <Caret Line="894" Column="32" TopLine="876"/>
       </Position6>
       </Position6>
       <Position7>
       <Position7>
-        <Filename Value="pkgoptions.pp"/>
-        <Caret Line="256" Column="49" TopLine="242"/>
+        <Filename Value="fprepos.pp"/>
+        <Caret Line="907" Column="59" TopLine="889"/>
       </Position7>
       </Position7>
       <Position8>
       <Position8>
-        <Filename Value="fppkg.pp"/>
-        <Caret Line="23" Column="22" TopLine="15"/>
+        <Filename Value="fprepos.pp"/>
+        <Caret Line="909" Column="18" TopLine="891"/>
       </Position8>
       </Position8>
       <Position9>
       <Position9>
-        <Filename Value="fppkg.pp"/>
-        <Caret Line="91" Column="1" TopLine="78"/>
+        <Filename Value="fprepos.pp"/>
+        <Caret Line="914" Column="23" TopLine="896"/>
       </Position9>
       </Position9>
       <Position10>
       <Position10>
         <Filename Value="pkgrepos.pp"/>
         <Filename Value="pkgrepos.pp"/>
-        <Caret Line="46" Column="42" TopLine="32"/>
+        <Caret Line="99" Column="1" TopLine="80"/>
       </Position10>
       </Position10>
       <Position11>
       <Position11>
-        <Filename Value="pkgoptions.pp"/>
-        <Caret Line="306" Column="58" TopLine="293"/>
+        <Filename Value="fppkg.pp"/>
+        <Caret Line="55" Column="1" TopLine="37"/>
       </Position11>
       </Position11>
       <Position12>
       <Position12>
         <Filename Value="pkgrepos.pp"/>
         <Filename Value="pkgrepos.pp"/>
-        <Caret Line="46" Column="42" TopLine="32"/>
+        <Caret Line="69" Column="26" TopLine="55"/>
       </Position12>
       </Position12>
       <Position13>
       <Position13>
         <Filename Value="pkgrepos.pp"/>
         <Filename Value="pkgrepos.pp"/>
-        <Caret Line="58" Column="35" TopLine="40"/>
+        <Caret Line="79" Column="21" TopLine="57"/>
       </Position13>
       </Position13>
       <Position14>
       <Position14>
         <Filename Value="fprepos.pp"/>
         <Filename Value="fprepos.pp"/>
-        <Caret Line="295" Column="46" TopLine="275"/>
+        <Caret Line="992" Column="39" TopLine="967"/>
       </Position14>
       </Position14>
       <Position15>
       <Position15>
         <Filename Value="pkgrepos.pp"/>
         <Filename Value="pkgrepos.pp"/>
-        <Caret Line="58" Column="27" TopLine="40"/>
+        <Caret Line="75" Column="21" TopLine="57"/>
       </Position15>
       </Position15>
       <Position16>
       <Position16>
-        <Filename Value="pkgrepos.pp"/>
-        <Caret Line="61" Column="52" TopLine="40"/>
+        <Filename Value="fppkg.pp"/>
+        <Caret Line="280" Column="5" TopLine="253"/>
       </Position16>
       </Position16>
       <Position17>
       <Position17>
-        <Filename Value="pkgcommands.pp"/>
-        <Caret Line="55" Column="11" TopLine="45"/>
+        <Filename Value="pkgrepos.pp"/>
+        <Caret Line="91" Column="1" TopLine="57"/>
       </Position17>
       </Position17>
       <Position18>
       <Position18>
-        <Filename Value="pkgcommands.pp"/>
-        <Caret Line="22" Column="16" TopLine="8"/>
+        <Filename Value="pkgrepos.pp"/>
+        <Caret Line="16" Column="17" TopLine="1"/>
       </Position18>
       </Position18>
       <Position19>
       <Position19>
-        <Filename Value="pkgcommands.pp"/>
-        <Caret Line="114" Column="43" TopLine="90"/>
+        <Filename Value="pkgfpmake.pp"/>
+        <Caret Line="266" Column="30" TopLine="252"/>
       </Position19>
       </Position19>
       <Position20>
       <Position20>
-        <Filename Value="pkgrepos.pp"/>
-        <Caret Line="12" Column="1" TopLine="4"/>
+        <Filename Value="pkgcommands.pp"/>
+        <Caret Line="223" Column="1" TopLine="205"/>
       </Position20>
       </Position20>
       <Position21>
       <Position21>
         <Filename Value="fppkg.pp"/>
         <Filename Value="fppkg.pp"/>
-        <Caret Line="67" Column="1" TopLine="56"/>
+        <Caret Line="278" Column="26" TopLine="260"/>
       </Position21>
       </Position21>
       <Position22>
       <Position22>
-        <Filename Value="fppkg.pp"/>
-        <Caret Line="113" Column="49" TopLine="99"/>
+        <Filename Value="pkgmessages.pp"/>
+        <Caret Line="65" Column="29" TopLine="41"/>
       </Position22>
       </Position22>
       <Position23>
       <Position23>
-        <Filename Value="fppkg.pp"/>
-        <Caret Line="211" Column="25" TopLine="197"/>
+        <Filename Value="pkgglobals.pp"/>
+        <Caret Line="36" Column="22" TopLine="29"/>
       </Position23>
       </Position23>
       <Position24>
       <Position24>
-        <Filename Value="pkgrepos.pp"/>
-        <Caret Line="55" Column="1" TopLine="27"/>
+        <Filename Value="pkgmessages.pp"/>
+        <Caret Line="65" Column="87" TopLine="43"/>
       </Position24>
       </Position24>
       <Position25>
       <Position25>
         <Filename Value="pkgrepos.pp"/>
         <Filename Value="pkgrepos.pp"/>
-        <Caret Line="9" Column="11" TopLine="1"/>
+        <Caret Line="110" Column="29" TopLine="84"/>
       </Position25>
       </Position25>
       <Position26>
       <Position26>
         <Filename Value="pkgrepos.pp"/>
         <Filename Value="pkgrepos.pp"/>
-        <Caret Line="32" Column="16" TopLine="18"/>
+        <Caret Line="96" Column="23" TopLine="85"/>
       </Position26>
       </Position26>
       <Position27>
       <Position27>
-        <Filename Value="fppkg.pp"/>
-        <Caret Line="254" Column="1" TopLine="240"/>
+        <Filename Value="pkgrepos.pp"/>
+        <Caret Line="104" Column="32" TopLine="87"/>
       </Position27>
       </Position27>
       <Position28>
       <Position28>
-        <Filename Value="fppkg.pp"/>
-        <Caret Line="13" Column="49" TopLine="1"/>
+        <Filename Value="pkgfpmake.pp"/>
+        <Caret Line="220" Column="1" TopLine="204"/>
       </Position28>
       </Position28>
       <Position29>
       <Position29>
-        <Filename Value="pkgarchive.pp"/>
-        <Caret Line="170" Column="26" TopLine="153"/>
+        <Filename Value="pkgrepos.pp"/>
+        <Caret Line="98" Column="19" TopLine="82"/>
       </Position29>
       </Position29>
       <Position30>
       <Position30>
-        <Filename Value="pkgarchive.pp"/>
-        <Caret Line="91" Column="33" TopLine="72"/>
+        <Filename Value="pkgfpmake.pp"/>
+        <Caret Line="169" Column="51" TopLine="151"/>
       </Position30>
       </Position30>
     </JumpHistory>
     </JumpHistory>
   </ProjectOptions>
   </ProjectOptions>
   <CompilerOptions>
   <CompilerOptions>
     <Version Value="5"/>
     <Version Value="5"/>
     <SearchPaths>
     <SearchPaths>
-      <OtherUnitFiles Value="fcl20/"/>
+      <IncludeFiles Value="lnet/sys/"/>
+      <OtherUnitFiles Value="lnet/"/>
     </SearchPaths>
     </SearchPaths>
     <CodeGeneration>
     <CodeGeneration>
       <Checks>
       <Checks>

+ 5 - 1
utils/fppkg/fppkg.pp

@@ -275,7 +275,11 @@ begin
     if not FileExists(GlobalOptions.LocalPackagesFile) then
     if not FileExists(GlobalOptions.LocalPackagesFile) then
       pkghandler.ExecuteAction(nil,'update');
       pkghandler.ExecuteAction(nil,'update');
     LoadLocalRepository;
     LoadLocalRepository;
-    LoadLocalStatus;
+    LoadFPMakeLocalStatus;
+    // We only need to reload the status when we use a different
+    // configuration for compiling fpmake
+    if GlobalOptions.CompilerConfig<>GlobalOptions.FPMakeCompilerConfig then
+      LoadLocalStatus;
 
 
     if ParaPackages.Count=0 then
     if ParaPackages.Count=0 then
       begin
       begin

+ 71 - 54
utils/fppkg/fprepos.pp

@@ -53,6 +53,7 @@ Type
     function GetEmpty: Boolean;
     function GetEmpty: Boolean;
     procedure SetAsString(const AValue: String);
     procedure SetAsString(const AValue: String);
   Public
   Public
+   Procedure Clear;
    Procedure Assign(Source : TPersistent); override;
    Procedure Assign(Source : TPersistent); override;
    Property AsString : String Read GetAsString Write SetAsString;
    Property AsString : String Read GetAsString Write SetAsString;
    Function CompareVersion(AVersion : TFPVersion) : Integer;
    Function CompareVersion(AVersion : TFPVersion) : Integer;
@@ -90,7 +91,7 @@ Type
     function GetDependency(Index : Integer): TFPDependency;
     function GetDependency(Index : Integer): TFPDependency;
     procedure SetDependency(Index : Integer; const AValue: TFPDependency);
     procedure SetDependency(Index : Integer; const AValue: TFPDependency);
   public
   public
-    Function AddDependency(Const APackageName : String; AMinVersion : String = '') : TFPDependency;
+    Function AddDependency(const APackageName : String; const AMinVersion : String = '') : TFPDependency;
     Property Dependencies[Index : Integer] : TFPDependency Read GetDependency Write SetDependency;default;
     Property Dependencies[Index : Integer] : TFPDependency Read GetDependency Write SetDependency;default;
   end;
   end;
 
 
@@ -150,10 +151,10 @@ Type
   Protected
   Protected
     Function CurrentStreamVersion : Integer; override;
     Function CurrentStreamVersion : Integer; override;
   Public
   Public
-    Function IndexOfPackage(PackageName : String) : Integer;
-    Function FindPackage(PackageName : String) : TFPPackage;
-    Function PackageByName(PackageName : String) : TFPPackage;
-    Function AddPackage(PackageName : string) : TFPPackage;
+    Function IndexOfPackage(const APackageName : String) : Integer;
+    Function FindPackage(const APackageName : String) : TFPPackage;
+    Function PackageByName(const APackageName : String) : TFPPackage;
+    Function AddPackage(const APackageName : string) : TFPPackage;
     Property StreamVersion : Integer Read FVersion Write FVersion;
     Property StreamVersion : Integer Read FVersion Write FVersion;
     Property Packages [Index : Integer] : TFPPackage Read GetPackage Write SetPackage; default;
     Property Packages [Index : Integer] : TFPPackage Read GetPackage Write SetPackage; default;
   end;
   end;
@@ -170,31 +171,32 @@ Type
     function GetPackageCount: Integer;
     function GetPackageCount: Integer;
   Protected
   Protected
     procedure CreatePackages; virtual;
     procedure CreatePackages; virtual;
-    Procedure BackupFile(AFileName : String); virtual;
-    Procedure DoGetPackageDependencies(PackageName : String; List : TStringList; Level : Integer); virtual;
+    Procedure BackupFile(const AFileName : String); virtual;
+    Procedure DoGetPackageDependencies(const APackageName : String; List : TStringList; Level : Integer); virtual;
   Public
   Public
     Constructor Create(AOwner : TComponent); override;
     Constructor Create(AOwner : TComponent); override;
     Destructor Destroy; override;
     Destructor Destroy; override;
     // Loading and Saving repository. Own format.
     // Loading and Saving repository. Own format.
     Procedure LoadFromStream(Stream : TStream); Virtual;
     Procedure LoadFromStream(Stream : TStream); Virtual;
     Procedure SaveToStream(Stream : TStream); Virtual;
     Procedure SaveToStream(Stream : TStream); Virtual;
-    Procedure LoadFromFile(AFileName : String);
-    Procedure SaveToFile(AFileName : String);
+    Procedure LoadFromFile(const AFileName : String);
+    Procedure SaveToFile(const AFileName : String);
     Procedure Save;
     Procedure Save;
     // Loading and Saving version numbers: List of Name=Value pairs.
     // Loading and Saving version numbers: List of Name=Value pairs.
+    procedure ClearStatus;
     Procedure LoadStatusFromStream(Stream : TStream); virtual;
     Procedure LoadStatusFromStream(Stream : TStream); virtual;
     Procedure SaveStatusToStream(Stream : TStream); virtual;
     Procedure SaveStatusToStream(Stream : TStream); virtual;
-    Procedure LoadStatusFromFile(AFileName : String);
-    Procedure SaveStatusToFile(AFileName : String);
+    Procedure LoadStatusFromFile(const AFileName : String);
+    Procedure SaveStatusToFile(const AFileName : String);
     // Package management
     // Package management
-    Function IndexOfPackage(PackageName : String) : Integer;
-    Function FindPackage(PackageName : String) : TFPPackage;
-    Function PackageByName(PackageName : String) : TFPPackage;
+    Function IndexOfPackage(const APackageName : String) : Integer;
+    Function FindPackage(const APackageName : String) : TFPPackage;
+    Function PackageByName(const APackageName : String) : TFPPackage;
     Procedure DeletePackage(Index : Integer);
     Procedure DeletePackage(Index : Integer);
-    Procedure RemovePackage(PackageName : string);
-    Function AddPackage(PackageName : string) : TFPPackage;
+    Procedure RemovePackage(const APackageName : string);
+    Function AddPackage(const APackageName : string) : TFPPackage;
     // Dependencies
     // Dependencies
-    Procedure GetPackageDependencies(PackageName : String; List : TObjectList; Recurse : Boolean);
+    Procedure GetPackageDependencies(const APackageName : String; List : TObjectList; Recurse : Boolean);
     // Properties
     // Properties
     Property FileName : String Read FFileName;
     Property FileName : String Read FFileName;
     Property Packages[Index : Integer] : TFPPackage Read GetPackage; default;
     Property Packages[Index : Integer] : TFPPackage Read GetPackage; default;
@@ -364,12 +366,9 @@ Var
   V : String;
   V : String;
 
 
 begin
 begin
-  Release:=0;
-  Major:=0;
-  Minor:=0;
-  Suffix:='';
+  Clear;
   // Special support for empty version string
   // Special support for empty version string
-  if AValue='<none>' then
+  if (AValue='') or (AValue='<none>') then
     exit;
     exit;
   V:=AValue;
   V:=AValue;
   Release:=NextDigit('.',V);
   Release:=NextDigit('.',V);
@@ -381,6 +380,14 @@ begin
   Suffix:=V;
   Suffix:=V;
 end;
 end;
 
 
+procedure TFPVersion.Clear;
+begin
+  Release:=0;
+  Major:=0;
+  Minor:=0;
+  Suffix:='';
+end;
+
 procedure TFPVersion.Assign(Source: TPersistent);
 procedure TFPVersion.Assign(Source: TPersistent);
 
 
 Var
 Var
@@ -620,41 +627,41 @@ begin
   Result:=FVersion;
   Result:=FVersion;
 end;
 end;
 
 
-function TFPPackages.IndexOfPackage(PackageName: String): Integer;
+function TFPPackages.IndexOfPackage(const APackageName: String): Integer;
 
 
 
 
 begin
 begin
   Result:=Count-1;
   Result:=Count-1;
-  While (Result>=0) and (CompareText(GetPackage(Result).Name,PackageName)<>0) do
+  While (Result>=0) and (CompareText(GetPackage(Result).Name,APackageName)<>0) do
     Dec(Result);
     Dec(Result);
 end;
 end;
 
 
-function TFPPackages.FindPackage(PackageName: String): TFPPackage;
+function TFPPackages.FindPackage(const APackageName: String): TFPPackage;
 
 
 Var
 Var
   I : Integer;
   I : Integer;
 
 
 begin
 begin
-  I:=IndexOfPackage(PackageName);
+  I:=IndexOfPackage(APackageName);
   If (I=-1) then
   If (I=-1) then
     Result:=Nil
     Result:=Nil
   else
   else
     Result:=GetPackage(I);
     Result:=GetPackage(I);
 end;
 end;
 
 
-function TFPPackages.PackageByName(PackageName: String): TFPPackage;
+function TFPPackages.PackageByName(const APackageName: String): TFPPackage;
 begin
 begin
-  Result:=FindPackage(PackageName);
+  Result:=FindPackage(APackageName);
   If Result=Nil then
   If Result=Nil then
-    Raise EPackage.CreateFmt(SErrPackageNotFound,[PackageName]);
+    Raise EPackage.CreateFmt(SErrPackageNotFound,[APackageName]);
 end;
 end;
 
 
-function TFPPackages.AddPackage(PackageName: string): TFPPackage;
+function TFPPackages.AddPackage(const APackageName: string): TFPPackage;
 
 
 begin
 begin
   Result:=Add as TFPPackage;
   Result:=Add as TFPPackage;
   Try
   Try
-    Result.Name:=PackageName;
+    Result.Name:=APackageName;
   Except
   Except
     Result.Free;
     Result.Free;
     Raise;
     Raise;
@@ -689,7 +696,7 @@ begin
   FPackages.StreamVersion:=StreamVersion;
   FPackages.StreamVersion:=StreamVersion;
 end;
 end;
 
 
-procedure TFPRepository.BackupFile(AFileName: String);
+procedure TFPRepository.BackupFile(const AFileName: String);
 
 
 Var
 Var
   S : String;
   S : String;
@@ -735,7 +742,7 @@ begin
   FPackages.SaveToStream(Stream);
   FPackages.SaveToStream(Stream);
 end;
 end;
 
 
-procedure TFPRepository.LoadFromFile(AFileName: String);
+procedure TFPRepository.LoadFromFile(const AFileName: String);
 
 
 Var
 Var
   F : TFileStream;
   F : TFileStream;
@@ -750,7 +757,7 @@ begin
   end;
   end;
 end;
 end;
 
 
-procedure TFPRepository.SaveToFile(AFileName: String);
+procedure TFPRepository.SaveToFile(const AFileName: String);
 
 
 Var
 Var
   F : TFileStream;
   F : TFileStream;
@@ -774,6 +781,17 @@ begin
   SaveToFile(FFileName);
   SaveToFile(FFileName);
 end;
 end;
 
 
+
+procedure TFPRepository.ClearStatus;
+Var
+  I : Integer;
+begin
+  For I:=0 to PackageCount-1 do
+    With Packages[i] do
+      InstalledVersion.Clear;
+end;
+
+
 procedure TFPRepository.LoadStatusFromStream(Stream: TStream);
 procedure TFPRepository.LoadStatusFromStream(Stream: TStream);
 
 
 Var
 Var
@@ -815,7 +833,7 @@ begin
   end;
   end;
 end;
 end;
 
 
-procedure TFPRepository.LoadStatusFromFile(AFileName: String);
+procedure TFPRepository.LoadStatusFromFile(const AFileName: String);
 
 
 Var
 Var
   F : TFileStream;
   F : TFileStream;
@@ -829,7 +847,7 @@ begin
   end;
   end;
 end;
 end;
 
 
-procedure TFPRepository.SaveStatusToFile(AFileName: String);
+procedure TFPRepository.SaveStatusToFile(const AFileName: String);
 
 
 Var
 Var
   F : TFileStream;
   F : TFileStream;
@@ -845,24 +863,24 @@ begin
   end;
   end;
 end;
 end;
 
 
-function TFPRepository.IndexOfPackage(PackageName: String): Integer;
+function TFPRepository.IndexOfPackage(const APackageName: String): Integer;
 begin
 begin
-  Result:=FPackages.IndexOfPackage(PackageName);
+  Result:=FPackages.IndexOfPackage(APackageName);
 end;
 end;
 
 
-function TFPRepository.FindPackage(PackageName: String): TFPPackage;
+function TFPRepository.FindPackage(const APackageName: String): TFPPackage;
 begin
 begin
-  Result:=FPackages.FindPackage(PackageName);
+  Result:=FPackages.FindPackage(APackageName);
 end;
 end;
 
 
-function TFPRepository.PackageByName(PackageName: String): TFPPackage;
+function TFPRepository.PackageByName(const APackageName: String): TFPPackage;
 begin
 begin
-  Result:=FPackages.PackageByName(PackageName);
+  Result:=FPackages.PackageByName(APackageName);
 end;
 end;
 
 
-procedure TFPRepository.RemovePackage(PackageName: string);
+procedure TFPRepository.RemovePackage(const APackageName: string);
 begin
 begin
-  PackageByName(PackageName).Free;
+  PackageByName(APackageName).Free;
 end;
 end;
 
 
 procedure TFPRepository.DeletePackage(Index : Integer);
 procedure TFPRepository.DeletePackage(Index : Integer);
@@ -870,13 +888,13 @@ begin
   GetPackage(Index).Free;
   GetPackage(Index).Free;
 end;
 end;
 
 
-function TFPRepository.AddPackage(PackageName: string): TFPPackage;
+function TFPRepository.AddPackage(const APackageName: string): TFPPackage;
 
 
 begin
 begin
-  Result:=FPackages.AddPackage(PackageName);
+  Result:=FPackages.AddPackage(APackageName);
 end;
 end;
 
 
-procedure TFPRepository.DoGetPackageDependencies(PackageName: String;
+procedure TFPRepository.DoGetPackageDependencies(const APackageName: String;
   List: TStringList; Level: Integer);
   List: TStringList; Level: Integer);
 Var
 Var
   P : TFPPackage;
   P : TFPPackage;
@@ -886,14 +904,14 @@ Var
 begin
 begin
   // If too many levels, bail out
   // If too many levels, bail out
   If (Level>FMaxDependencyLevel) then
   If (Level>FMaxDependencyLevel) then
-    Raise EPackage.CreateFmt(SErrMaxLevelExceeded,[Level,PackageName]);
+    Raise EPackage.CreateFmt(SErrMaxLevelExceeded,[Level,APackageName]);
   // Check if it is a known package.
   // Check if it is a known package.
-  P:=FindPackage(PackageName);
+  P:=FindPackage(APackageName);
   If Assigned(P) and P.HasDependencies then
   If Assigned(P) and P.HasDependencies then
     For I:=0 to P.Dependencies.Count-1 do
     For I:=0 to P.Dependencies.Count-1 do
       begin
       begin
       D1:=P.Dependencies[i];
       D1:=P.Dependencies[i];
-      J:=List.IndexOf(PackageName);
+      J:=List.IndexOf(APackageName);
       If J=-1 then
       If J=-1 then
         begin
         begin
         // Dependency not yet in list.
         // Dependency not yet in list.
@@ -914,7 +932,7 @@ begin
       end;
       end;
 end;
 end;
 
 
-procedure TFPRepository.GetPackageDependencies(PackageName: String;
+procedure TFPRepository.GetPackageDependencies(const APackageName: String;
   List: TObjectList; Recurse: Boolean);
   List: TObjectList; Recurse: Boolean);
 
 
 Var
 Var
@@ -925,7 +943,7 @@ begin
   L:=TStringList.Create;
   L:=TStringList.Create;
   Try
   Try
     L.Sorted:=True;
     L.Sorted:=True;
-    DoGetPackageDependencies(PackageName,L,Ord(Recurse)-1);
+    DoGetPackageDependencies(APackageName,L,Ord(Recurse)-1);
     For I:=0 to L.Count-1 do
     For I:=0 to L.Count-1 do
       List.Add(L.Objects[i]);
       List.Add(L.Objects[i]);
   Finally
   Finally
@@ -992,8 +1010,7 @@ begin
   Items[Index]:=AValue;
   Items[Index]:=AValue;
 end;
 end;
 
 
-function TFPDependencies.AddDependency(const APackageName: String;
-  AMinVersion: String): TFPDependency;
+function TFPDependencies.AddDependency(const APackageName: String; const AMinVersion: String): TFPDependency;
 begin
 begin
   Result:=Add as TFPDependency;
   Result:=Add as TFPDependency;
   Result.PackageName:=APackageName;
   Result.PackageName:=APackageName;

+ 1 - 1
utils/fppkg/pkgcommands.pp

@@ -262,7 +262,7 @@ begin
         end
         end
       else
       else
         status:='OK';
         status:='OK';
-      Log(vDebug,'Dependency on package %s %s, installed %s, available %s  (%s)',
+      Log(vDebug,SDbgPackageDependency,
           [D.PackageName,D.MinVersion.AsString,DepPackage.InstalledVersion.AsString,DepPackage.Version.AsString,status]);
           [D.PackageName,D.MinVersion.AsString,DepPackage.InstalledVersion.AsString,DepPackage.Version.AsString,status]);
     end;
     end;
   // Install needed updates
   // Install needed updates

+ 17 - 22
utils/fppkg/pkgfpmake.pp

@@ -165,34 +165,32 @@ begin
     begin
     begin
       if Not HaveFPMake then
       if Not HaveFPMake then
         Error(SErrMissingFPMake);
         Error(SErrMissingFPMake);
-      // Special bootstrapping mode to compile fpmake?
-      DoBootStrap:=False;
-      NeedFPMKUnitSource:=False;
       OOptions:='-n';
       OOptions:='-n';
-      // Add FPMKUnit unit dir, if not found we use the internal fpmkunit source
-      if CheckUnitDir('fpmkunit',DepDir) then
-        OOptions:=OOptions+' -Fu'+DepDir
+      // Add FPMKUnit unit dir, if not installed we use the internal fpmkunit source
+      if HasFPMKUnitInstalled then
+        begin
+          if CheckUnitDir('fpmkunit',DepDir) then
+            OOptions:=OOptions+' -Fu'+DepDir
+          else
+            Error(SErrMissingInstallPackage,['fpmkunit']);
+        end
       else
       else
         begin
         begin
-          Log(vWarning,SWarnFPMKUnitNotFound);
-          DoBootStrap:=true;
           NeedFPMKUnitSource:=true;
           NeedFPMKUnitSource:=true;
           OOptions:=OOptions+' -Fu'+TempBuildDir;
           OOptions:=OOptions+' -Fu'+TempBuildDir;
         end;
         end;
-      // Add PaszLib and Hash units dir
-      // we need to check for the zipper.ppu that is not
-      // delivered with fpc 2.0.4
+      // Add PaszLib and Hash units dir, when internal fpmkunit is used we
+      // can suppress the use by NO_UNIT_ZIPPER
       if not CheckUnitDir('hash',DepDir) then
       if not CheckUnitDir('hash',DepDir) then
         begin
         begin
-          if DoBootStrap then
+          if NeedFPMKUnitSource then
             DepDir:=''
             DepDir:=''
           else
           else
             Error(SErrMissingInstallPackage,['hash']);
             Error(SErrMissingInstallPackage,['hash']);
         end;
         end;
-      if not CheckUnitDir('paszlib',DepDir2) or
-         not FileExists(DepDir2+'zipper.ppu') then
+      if not CheckUnitDir('paszlib',DepDir2) then
         begin
         begin
-          if DoBootStrap then
+          if NeedFPMKUnitSource then
             DepDir2:=''
             DepDir2:=''
           else
           else
             Error(SErrMissingInstallPackage,['paszlib']);
             Error(SErrMissingInstallPackage,['paszlib']);
@@ -201,12 +199,13 @@ begin
         OOptions:=OOptions+' -Fu'+DepDir+' -Fu'+DepDir2
         OOptions:=OOptions+' -Fu'+DepDir+' -Fu'+DepDir2
       else
       else
         OOptions:=OOptions+' -dNO_UNIT_ZIPPER';
         OOptions:=OOptions+' -dNO_UNIT_ZIPPER';
-      // Add Process unit
+      // Add Process unit dir, when internal fpmkunit is used we
+      // can suppress the use by NO_UNIT_PROCESS
       if CheckUnitDir('fcl-process',DepDir) then
       if CheckUnitDir('fcl-process',DepDir) then
         OOptions:=OOptions+' -Fu'+DepDir
         OOptions:=OOptions+' -Fu'+DepDir
       else
       else
         begin
         begin
-          if DoBootStrap then
+          if NeedFPMKUnitSource then
             OOptions:=OOptions+' -dNO_UNIT_PROCESS'
             OOptions:=OOptions+' -dNO_UNIT_PROCESS'
           else
           else
             Error(SErrMissingInstallPackage,['fcl-process']);
             Error(SErrMissingInstallPackage,['fcl-process']);
@@ -220,15 +219,11 @@ begin
       ForceDirectories(TempBuildDir);
       ForceDirectories(TempBuildDir);
       OOptions:=OOptions+' -FU'+TempBuildDir;
       OOptions:=OOptions+' -FU'+TempBuildDir;
       // Compile options
       // Compile options
-      //   -- bootstrapping compile with -g
       //   -- default is to optimize, smartlink and strip to reduce
       //   -- default is to optimize, smartlink and strip to reduce
       //      the executable size (there can be 100's of fpmake's on a system)
       //      the executable size (there can be 100's of fpmake's on a system)
       if vInfo in Verbosity then
       if vInfo in Verbosity then
         OOptions:=OOptions+' -vi';
         OOptions:=OOptions+' -vi';
-      if DoBootStrap then
-        OOptions:=OOptions+' -g'
-      else
-        OOptions:=OOptions+' -O2 -XXs';
+      OOptions:=OOptions+' -O2 -XXs';
       // Create fpmkunit.pp if needed
       // Create fpmkunit.pp if needed
       if NeedFPMKUnitSource then
       if NeedFPMKUnitSource then
         CreateFPMKUnitSource(TempBuildDir+PathDelim+'fpmkunit.pp');
         CreateFPMKUnitSource(TempBuildDir+PathDelim+'fpmkunit.pp');

+ 2 - 0
utils/fppkg/pkgglobals.pp

@@ -18,6 +18,7 @@ Const
 {$endif unix}
 {$endif unix}
 
 
   // Dependencies for compiling the fpmkunit unit
   // Dependencies for compiling the fpmkunit unit
+  RequiredFPMKUnitVersion = '2.2.0';
   FPMKUnitDeps : array[0..4] of string[11] = ('rtl','hash','paszlib','fcl-process','fpmkunit');
   FPMKUnitDeps : array[0..4] of string[11] = ('rtl','hash','paszlib','fcl-process','fpmkunit');
 
 
 Type
 Type
@@ -47,6 +48,7 @@ function IsSuperUser:boolean;
 
 
 var
 var
   Verbosity : TVerbosities;
   Verbosity : TVerbosities;
+  HasFPMKUnitInstalled : boolean;
 
 
 
 
 Implementation
 Implementation

+ 3 - 2
utils/fppkg/pkgmessages.pp

@@ -43,8 +43,6 @@ Resourcestring
   SErrCWDFailed              = 'FTP CWD "%s" command failed.';
   SErrCWDFailed              = 'FTP CWD "%s" command failed.';
   SErrGETFailed              = 'FTP GET "%s" command failed.';
   SErrGETFailed              = 'FTP GET "%s" command failed.';
 
 
-  SWarnFPMKUnitNotFound      = 'Package "fpmkunit" is not found, using internal bootstrap procedure';
-
   SLogGeneratingFPMake       = 'Generating fpmake.pp';
   SLogGeneratingFPMake       = 'Generating fpmake.pp';
   SLogNotCompilingFPMake     = 'Skipping compiling of fpmake.pp, fpmake executable already exists';
   SLogNotCompilingFPMake     = 'Skipping compiling of fpmake.pp, fpmake executable already exists';
   SLogCommandLineAction      = 'Adding action from commandline: "%s %s"';
   SLogCommandLineAction      = 'Adding action from commandline: "%s %s"';
@@ -64,12 +62,15 @@ Resourcestring
   SLogLoadingPackagesFile    = 'Loading available packages from "%s"';
   SLogLoadingPackagesFile    = 'Loading available packages from "%s"';
   SLogLoadingStatusFile      = 'Loading local status from "%s"';
   SLogLoadingStatusFile      = 'Loading local status from "%s"';
   SLogSavingStatusFile       = 'Saving local status to "%s"';
   SLogSavingStatusFile       = 'Saving local status to "%s"';
+  SLogPackageFPMKUnitVersion = 'Checking for fpmkunit %s, installed %s, available %s';
+  SLogPackageFPMKUnitTooOld  = 'Minimum fpmkunit version not installed, using internal fpmkunit';
 
 
   SDbgFound                  = 'Found';
   SDbgFound                  = 'Found';
   SDbgNotFound               = 'Not Found';
   SDbgNotFound               = 'Not Found';
   SDbgDirectoryExists        = 'Directory "%s" %s';
   SDbgDirectoryExists        = 'Directory "%s" %s';
   SDbgFileExists             = 'File "%s" %s';
   SDbgFileExists             = 'File "%s" %s';
   SDbgBackupFile             = 'Creating Backup File "%s"';
   SDbgBackupFile             = 'Creating Backup File "%s"';
+  SDbgPackageDependency      = 'Dependency on package %s %s, installed %s, available %s  (%s)';
 
 
 
 
 implementation
 implementation

+ 31 - 0
utils/fppkg/pkgrepos.pp

@@ -11,6 +11,7 @@ uses
 procedure LoadLocalRepository;
 procedure LoadLocalRepository;
 procedure LoadLocalStatus;
 procedure LoadLocalStatus;
 procedure SaveLocalStatus;
 procedure SaveLocalStatus;
+procedure LoadFPMakeLocalStatus;
 procedure ListLocalRepository(all:boolean=false);
 procedure ListLocalRepository(all:boolean=false);
 
 
 procedure ListRemoteRepository;
 procedure ListRemoteRepository;
@@ -71,6 +72,7 @@ var
 begin
 begin
   S:=GlobalOptions.LocalVersionsFile(GlobalOptions.CompilerConfig);
   S:=GlobalOptions.LocalVersionsFile(GlobalOptions.CompilerConfig);
   Log(vDebug,SLogLoadingStatusFile,[S]);
   Log(vDebug,SLogLoadingStatusFile,[S]);
+  CurrentRepository.ClearStatus;
   if FileExists(S) then
   if FileExists(S) then
     CurrentRepository.LoadStatusFromFile(S);
     CurrentRepository.LoadStatusFromFile(S);
 end;
 end;
@@ -86,6 +88,35 @@ begin
 end;
 end;
 
 
 
 
+procedure LoadFPMakeLocalStatus;
+var
+  S : String;
+  P : TFPPackage;
+  ReqVer : TFPVersion;
+begin
+  HasFPMKUnitInstalled:=false;
+  S:=GlobalOptions.LocalVersionsFile(GlobalOptions.FPMakeCompilerConfig);
+  Log(vDebug,SLogLoadingStatusFile,[S]);
+  CurrentRepository.ClearStatus;
+  if FileExists(S) then
+    CurrentRepository.LoadStatusFromFile(S);
+  // Check for fpmkunit package
+  P:=CurrentRepository.PackageByName('fpmkunit');
+  if P<>nil then
+    begin
+      ReqVer:=TFPVersion.Create;
+      ReqVer.AsString:=RequiredFPMKUnitVersion;
+      Log(vDebug,SLogPackageFPMKUnitVersion,[ReqVer.AsString,P.InstalledVersion.AsString,P.Version.AsString]);
+      if ReqVer.CompareVersion(P.InstalledVersion)<=0 then
+        HasFPMKUnitInstalled:=true
+      else
+        Log(vDebug,SLogPackageFPMKUnitTooOld);
+    end
+  else
+    Log(vDebug,SLogPackageFPMKUnitTooOld);
+end;
+
+
 procedure ListLocalRepository(all:boolean=false);
 procedure ListLocalRepository(all:boolean=false);
 var
 var
   P : TFPPackage;
   P : TFPPackage;