Browse Source

* log packages installed both global and local

git-svn-id: trunk@10241 -
peter 17 years ago
parent
commit
aafabe4bb2
4 changed files with 17 additions and 7 deletions
  1. 2 2
      utils/fppkg/fppkg.pp
  2. 2 1
      utils/fppkg/pkgcommands.pp
  3. 1 0
      utils/fppkg/pkgmessages.pp
  4. 12 4
      utils/fppkg/pkgrepos.pp

+ 2 - 2
utils/fppkg/fppkg.pp

@@ -293,12 +293,12 @@ begin
       end;
       end;
     LoadLocalMirrors;
     LoadLocalMirrors;
     LoadLocalRepository;
     LoadLocalRepository;
-    FindInstalledPackages(FPMakeCompilerOptions);
+    FindInstalledPackages(FPMakeCompilerOptions,true);
     CheckFPMakeDependencies;
     CheckFPMakeDependencies;
     // We only need to reload the status when we use a different
     // We only need to reload the status when we use a different
     // configuration for compiling fpmake
     // configuration for compiling fpmake
     if GlobalOptions.CompilerConfig<>GlobalOptions.FPMakeCompilerConfig then
     if GlobalOptions.CompilerConfig<>GlobalOptions.FPMakeCompilerConfig then
-      FindInstalledPackages(CompilerOptions);
+      FindInstalledPackages(CompilerOptions,true);
 
 
     if ParaPackages.Count=0 then
     if ParaPackages.Count=0 then
       begin
       begin

+ 2 - 1
utils/fppkg/pkgcommands.pp

@@ -129,7 +129,8 @@ begin
   DownloadFile(PackagesURL,GlobalOptions.LocalPackagesFile);
   DownloadFile(PackagesURL,GlobalOptions.LocalPackagesFile);
   // Read the repository again
   // Read the repository again
   LoadLocalRepository;
   LoadLocalRepository;
-  FindInstalledPackages(CompilerOptions);
+  // no need to log errors again
+  FindInstalledPackages(CompilerOptions,False);
   Result:=true;
   Result:=true;
 end;
 end;
 
 

+ 1 - 0
utils/fppkg/pkgmessages.pp

@@ -72,6 +72,7 @@ Resourcestring
   SLogFPMKUnitDepTooOld      = 'Minimum version of %s is not installed, using internal fpmkunit with limited functionality';
   SLogFPMKUnitDepTooOld      = 'Minimum version of %s is not installed, using internal fpmkunit with limited functionality';
   SLogSelectedMirror         = 'Selected mirror "%s"';
   SLogSelectedMirror         = 'Selected mirror "%s"';
   SLogUpgradingConfig        = 'Configuration file "%s" is updated with new configuration settings';
   SLogUpgradingConfig        = 'Configuration file "%s" is updated with new configuration settings';
+  SLogPackageMultipleLocations = 'Multiple installations found for package %s, using installation "%s"';
 
 
   SDbgFound                  = 'Found';
   SDbgFound                  = 'Found';
   SDbgNotFound               = 'Not Found';
   SDbgNotFound               = 'Not Found';

+ 12 - 4
utils/fppkg/pkgrepos.pp

@@ -12,7 +12,7 @@ function GetRemoteRepositoryURL(const AFileName:string):string;
 
 
 procedure LoadLocalMirrors;
 procedure LoadLocalMirrors;
 procedure LoadLocalRepository;
 procedure LoadLocalRepository;
-procedure FindInstalledPackages(ACompilerOptions:TCompilerOptions);
+procedure FindInstalledPackages(ACompilerOptions:TCompilerOptions;showdups:boolean=true);
 procedure CheckFPMakeDependencies;
 procedure CheckFPMakeDependencies;
 procedure ListLocalRepository(all:boolean=false);
 procedure ListLocalRepository(all:boolean=false);
 
 
@@ -189,7 +189,7 @@ begin
 end;
 end;
 
 
 
 
-procedure FindInstalledPackages(ACompilerOptions:TCompilerOptions);
+procedure FindInstalledPackages(ACompilerOptions:TCompilerOptions;showdups:boolean=true);
 
 
   function LoadOrCreatePackage(const AName:string):TFPPackage;
   function LoadOrCreatePackage(const AName:string):TFPPackage;
   begin
   begin
@@ -213,6 +213,12 @@ procedure FindInstalledPackages(ACompilerOptions:TCompilerOptions);
 {$warning TODO Add date to check recompile}
 {$warning TODO Add date to check recompile}
       V:=L.Values['version'];
       V:=L.Values['version'];
       APackage.InstalledVersion.AsString:=V;
       APackage.InstalledVersion.AsString:=V;
+      // Log packages found in multiple locations (local and global) ?
+      if not APackage.InstalledVersion.Empty then
+        begin
+          if showdups then
+            Log(vlInfo,SLogPackageMultipleLocations,[APackage.Name,ExtractFilePath(AFileName)]);
+        end;
     Finally
     Finally
       L.Free;
       L.Free;
     end;
     end;
@@ -271,10 +277,12 @@ procedure FindInstalledPackages(ACompilerOptions:TCompilerOptions);
 
 
 begin
 begin
   CurrentRepository.ClearStatus;
   CurrentRepository.ClearStatus;
-  if ACompilerOptions.LocalUnitDir<>'' then
-    CheckUnitDir(ACompilerOptions.LocalUnitDir);
+  // First scan the global directory
+  // The local directory will overwrite the versions
   if ACompilerOptions.GlobalUnitDir<>'' then
   if ACompilerOptions.GlobalUnitDir<>'' then
     CheckUnitDir(ACompilerOptions.GlobalUnitDir);
     CheckUnitDir(ACompilerOptions.GlobalUnitDir);
+  if ACompilerOptions.LocalUnitDir<>'' then
+    CheckUnitDir(ACompilerOptions.LocalUnitDir);
 end;
 end;