Browse Source

* Changed CheckFPMakeDependencies from global function to method

git-svn-id: trunk@35395 -
joost 8 years ago
parent
commit
f0ebae94a7
2 changed files with 46 additions and 39 deletions
  1. 45 1
      packages/fppkg/src/pkgfppkg.pp
  2. 1 38
      packages/fppkg/src/pkgrepos.pp

+ 45 - 1
packages/fppkg/src/pkgfppkg.pp

@@ -59,6 +59,7 @@ type
     function PackageRemoteArchive(APackage:TFPPackage): String;
 
     procedure ScanInstalledPackagesForAvailablePackages;
+    procedure CheckFPMakeDependencies;
 
     property Options: TFppkgOptions read FOptions;
     property CompilerOptions: TCompilerOptions read FCompilerOptions;
@@ -72,6 +73,7 @@ type
 implementation
 
 uses
+  fpmkunit,
   pkgrepos;
 
 { TpkgFPpkg }
@@ -437,7 +439,7 @@ var
   InstRepositoryName: string;
   Repo: TFPRepository;
 begin
-  Result := GFPpkg.RepositoryByName(GFPpkg.Options.CommandLineSection.InstallRepository);
+  Result := RepositoryByName(Options.CommandLineSection.InstallRepository);
   if Assigned(APackage) and Assigned(APackage.Repository) and Assigned(APackage.Repository.DefaultPackagesStructure) then
     begin
       InstRepositoryName := APackage.Repository.DefaultPackagesStructure.InstallRepositoryName;
@@ -481,6 +483,48 @@ begin
     end;
 end;
 
+procedure TpkgFPpkg.CheckFPMakeDependencies;
+var
+  i : Integer;
+  P,AvailP : TFPPackage;
+  AvailVerStr : string;
+  ReqVer : TFPVersion;
+begin
+  // Reset availability
+  for i:=0 to high(FPMKUnitDeps) do
+    FPMKUnitDeps[i].available:=false;
+  // Not version check needed in Recovery mode, we always need to use
+  // the internal bootstrap procedure
+  if Options.CommandLineSection.RecoveryMode then
+    exit;
+  // Check for fpmkunit dependencies
+  for i:=0 to high(FPMKUnitDeps) do
+    begin
+      P:=FPMakeRepoFindPackage(FPMKUnitDeps[i].package, pkgpkInstalled);
+      if P<>nil then
+        begin
+          AvailP:=FindPackage(FPMKUnitDeps[i].package, pkgpkAvailable);
+          if AvailP<>nil then
+            AvailVerStr:=AvailP.Version.AsString
+          else
+            AvailVerStr:='<not available>';
+          ReqVer:=TFPVersion.Create;
+          try
+            ReqVer.AsString:=FPMKUnitDeps[i].ReqVer;
+            log(llDebug,SLogFPMKUnitDepVersion,[P.Name,ReqVer.AsString,P.Version.AsString,AvailVerStr]);
+            if ReqVer.CompareVersion(P.Version)<=0 then
+              FPMKUnitDeps[i].available:=true
+            else
+              log(llDebug,SLogFPMKUnitDepTooOld,[FPMKUnitDeps[i].package]);
+          finally
+            ReqVer.Free;
+          end;
+        end
+      else
+        log(llDebug,SLogFPMKUnitDepTooOld,[FPMKUnitDeps[i].package]);
+    end;
+end;
+
 function TpkgFPpkg.PackageBuildPath(APackage: TFPPackage): String;
 begin
   if (APackage.Name=CmdLinePackageName) or (APackage.Name=URLPackageName) then

+ 1 - 38
packages/fppkg/src/pkgrepos.pp

@@ -216,45 +216,8 @@ end;
 
 
 procedure CheckFPMakeDependencies;
-var
-  i : Integer;
-  P,AvailP : TFPPackage;
-  AvailVerStr : string;
-  ReqVer : TFPVersion;
 begin
-  // Reset availability
-  for i:=0 to high(FPMKUnitDeps) do
-    FPMKUnitDeps[i].available:=false;
-  // Not version check needed in Recovery mode, we always need to use
-  // the internal bootstrap procedure
-  if GFPpkg.Options.CommandLineSection.RecoveryMode then
-    exit;
-  // Check for fpmkunit dependencies
-  for i:=0 to high(FPMKUnitDeps) do
-    begin
-      P:=GFPpkg.FPMakeRepoFindPackage(FPMKUnitDeps[i].package, pkgpkInstalled);
-      if P<>nil then
-        begin
-          AvailP:=GFPpkg.FindPackage(FPMKUnitDeps[i].package, pkgpkAvailable);
-          if AvailP<>nil then
-            AvailVerStr:=AvailP.Version.AsString
-          else
-            AvailVerStr:='<not available>';
-          ReqVer:=TFPVersion.Create;
-          try
-            ReqVer.AsString:=FPMKUnitDeps[i].ReqVer;
-            log(llDebug,SLogFPMKUnitDepVersion,[P.Name,ReqVer.AsString,P.Version.AsString,AvailVerStr]);
-            if ReqVer.CompareVersion(P.Version)<=0 then
-              FPMKUnitDeps[i].available:=true
-            else
-              log(llDebug,SLogFPMKUnitDepTooOld,[FPMKUnitDeps[i].package]);
-          finally
-            ReqVer.Free;
-          end;
-        end
-      else
-        log(llDebug,SLogFPMKUnitDepTooOld,[FPMKUnitDeps[i].package]);
-    end;
+  GFPpkg.ScanAvailablePackages;
 end;