Browse Source

* Added command listsettings to values for all settings

git-svn-id: trunk@16925 -
joost 14 years ago
parent
commit
fa58935cfe
4 changed files with 60 additions and 37 deletions
  1. 4 3
      utils/fppkg/fppkg.pp
  2. 17 0
      utils/fppkg/pkgcommands.pp
  3. 11 10
      utils/fppkg/pkgmessages.pp
  4. 28 24
      utils/fppkg/pkgoptions.pp

+ 4 - 3
utils/fppkg/fppkg.pp

@@ -107,7 +107,7 @@ begin
   else
     pkgglobals.Log(vlDebug,SLogLoadingGlobalConfig,[cfgfile]);
   // Log configuration
-  GlobalOptions.LogValues;
+  GlobalOptions.LogValues(vlDebug);
 end;
 
 
@@ -146,7 +146,7 @@ begin
         Error(SErrMissingCompilerConfig,[S]);
     end;
   // Log compiler configuration
-  CompilerOptions.LogValues('');
+  CompilerOptions.LogValues(vlDebug,'');
   // Load FPMake compiler config, this is normally the same config as above
   S:=GlobalOptions.CompilerConfigDir+GlobalOptions.FPMakeCompilerConfig;
   FPMakeCompilerOptions.UpdateLocalRepositoryOption;
@@ -160,7 +160,7 @@ begin
   else
     Error(SErrMissingCompilerConfig,[S]);
   // Log compiler configuration
-  FPMakeCompilerOptions.LogValues('fpmake-building ');
+  FPMakeCompilerOptions.LogValues(vlDebug,'fpmake-building ');
 end;
 
 
@@ -195,6 +195,7 @@ begin
   Writeln('  download          Download package');
   Writeln('  convertmk         Convert Makefile.fpc to fpmake.pp');
   Writeln('  fixbroken         Recompile all (broken) packages with changed dependencies');
+  Writeln('  listsettings      Show the values for all fppkg settings');
 //  Writeln('  addconfig          Add a compiler configuration for the supplied compiler');
   Halt(0);
 end;

+ 17 - 0
utils/fppkg/pkgcommands.pp

@@ -110,6 +110,22 @@ type
     Procedure Execute;override;
   end;
 
+  { TCommandListSettings }
+
+  TCommandListSettings = Class(TPackagehandler)
+  Public
+    Procedure Execute;override;
+  end;
+
+{ TCommandListSettings }
+
+procedure TCommandListSettings.Execute;
+begin
+  GlobalOptions.LogValues(vlProgres);
+  CompilerOptions.LogValues(vlProgres,'');
+  FPMakeCompilerOptions.LogValues(vlProgres,'fpmake-building ');
+end;
+
 
 procedure TCommandAddConfig.Execute;
 begin
@@ -441,4 +457,5 @@ initialization
   RegisterPkgHandler('archive',TCommandArchive);
   RegisterPkgHandler('installdependencies',TCommandInstallDependencies);
   RegisterPkgHandler('fixbroken',TCommandFixBroken);
+  RegisterPkgHandler('listsettings',TCommandListSettings);
 end.

+ 11 - 10
utils/fppkg/pkgmessages.pp

@@ -81,24 +81,25 @@ Resourcestring
   SLogPackageChecksumChanged = 'Package %s needs to be rebuild, dependency %s is modified';
   SLogCheckBrokenDependenvies= 'Checking for broken dependencies';
 
-  SLogGlobalCfgHeader        = 'Using global configuration:';
+  SLogGlobalCfgHeader        = 'Using global configuration from file "%s":';
   SLogGlobalCfgRemoteMirrorsURL = ' RemoteMirrorsURL: "%s"';
   SLogGlobalCfgRemoteRepository = ' RemoteRepository: "%s"';
-  SLogGlobalCfgLocalRepository = ' LocalRepository: "%s"';
-  SLogGlobalCfgBuildDir      = ' BuildDir: "%s"';
-  SLogGlobalCfgArchivesDir   = ' ArchivesDir: "%s"';
-  SLogGlobalCfgCompilerConfigDir = ' CompilerConfigDir: "%s"';
+  SLogGlobalCfgLocalRepository = ' LocalRepository: "%s" -> "%s"';
+  SLogGlobalCfgBuildDir      = ' BuildDir: "%s" -> "%s"';
+  SLogGlobalCfgArchivesDir   = ' ArchivesDir: "%s" -> "%s"';
+  SLogGlobalCfgCompilerConfigDir = ' CompilerConfigDir: "%s" -> "%s"';
   SLogGlobalCfgDefaultCompilerConfig = ' DefaultCompilerConfig: "%s"';
   SLogGlobalCfgFPMakeCompilerConfig = ' FPMakeCompilerConfig: "%s"';
   SLogGlobalCfgDownloader    = ' Downloader: "%s"';
-  SLogCompilerCfgHeader      = 'Using %scompiler configuration:';
+  SLogCompilerCfgHeader      = 'Using %scompiler configuration file "%s":';
   SLogCompilerCfgCompiler    = ' Compiler: "%s"';
   SLogCompilerCfgTarget      = ' Target: "%s"';
+  SLogCompilerCfgOptions     = ' Options: "%s"';
   SLogCompilerCfgVersion     = ' Version: "%s"';
-  SLogCompilerCfgGlobalInstallDir = ' GlobalInstallDir: "%s"';
-  SLogCompilerCfgLocalInstallDir = ' LocalInstallDir: "%s"';
-  SLogCompilerCfgGlobalPrefix = ' GlobalPrefix: "%s"';
-  SLogCompilerCfgLocalPrefix = ' LocalPrefix: "%s"';
+  SLogCompilerCfgGlobalInstallDir = ' GlobalInstallDir: "%s" -> "%S"';
+  SLogCompilerCfgLocalInstallDir = ' LocalInstallDir: "%s" -> "%s"';
+  SLogCompilerCfgGlobalPrefix = ' GlobalPrefix: "%s" -> "%s"';
+  SLogCompilerCfgLocalPrefix = ' LocalPrefix: "%s" -> "%s"';
 
   SDbgFound                  = 'Found';
   SDbgNotFound               = 'Not Found';

+ 28 - 24
utils/fppkg/pkgoptions.pp

@@ -16,7 +16,7 @@ unit pkgoptions;
 
 interface
 
-uses Classes, Sysutils, Inifiles, fprepos, fpTemplate;
+uses Classes, Sysutils, Inifiles, fprepos, fpTemplate, pkgglobals;
 
 Const
   UnitConfigFileName   = 'fpunits.conf';
@@ -32,6 +32,7 @@ Type
 
   TGlobalOptions = Class(TPersistent)
   private
+    FConfigFilename: string;
     FSaveInifileChanges : Boolean;
     FConfigVersion : Integer;
     FRemoteMirrorsURL,
@@ -62,7 +63,7 @@ Type
     Procedure InitGlobalDefaults;
     Procedure LoadGlobalFromFile(const AFileName : String);
     Procedure SaveGlobalToFile(const AFileName : String);
-    procedure LogValues;
+    procedure LogValues(ALogLevel: TLogLevel);
     // Is set when the inifile has an old version number (which is also the case when a new file is generated)
     Property SaveInifileChanges : Boolean Read FSaveInifileChanges;
     Property ConfigVersion : Integer read FConfigVersion;
@@ -96,6 +97,7 @@ Type
 
   TCompilerOptions = Class(TPersistent)
   private
+    FConfigFilename: string;
     FSaveInifileChanges: Boolean;
     FConfigVersion : Integer;
     FCompiler,
@@ -119,7 +121,7 @@ Type
     Procedure InitCompilerDefaults;
     Procedure LoadCompilerFromFile(const AFileName : String);
     Procedure SaveCompilerToFile(const AFileName : String);
-    procedure LogValues(const ACfgName:string);
+    procedure LogValues(ALogLevel: TLogLevel; const ACfgName:string);
     procedure UpdateLocalRepositoryOption;
     procedure CheckCompilerValues;
     Function LocalUnitDir:string;
@@ -150,7 +152,6 @@ var
 Implementation
 
 uses
-  pkgglobals,
   pkgmessages;
 
 Const
@@ -329,6 +330,7 @@ Var
 begin
   try
     Ini:=TMemIniFile.Create(AFileName);
+    FConfigFileName:=AFileName;
     With Ini do
       begin
         FConfigVersion:=ReadInteger(SDefaults,KeyConfigVersion,0);
@@ -397,18 +399,18 @@ begin
 end;
 
 
-procedure TGlobalOptions.LogValues;
+procedure TGlobalOptions.LogValues(ALogLevel: TLogLevel);
 begin
-  Log(vlDebug,SLogGlobalCfgHeader);
-  Log(vlDebug,SLogGlobalCfgRemoteMirrorsURL,[FRemoteMirrorsURL]);
-  Log(vlDebug,SLogGlobalCfgRemoteRepository,[FRemoteRepository]);
-  Log(vlDebug,SLogGlobalCfgLocalRepository,[LocalRepository]);
-  Log(vlDebug,SLogGlobalCfgBuildDir,[BuildDir]);
-  Log(vlDebug,SLogGlobalCfgArchivesDir,[ArchivesDir]);
-  Log(vlDebug,SLogGlobalCfgCompilerConfigDir,[CompilerConfigDir]);
-  Log(vlDebug,SLogGlobalCfgDefaultCompilerConfig,[FDefaultCompilerConfig]);
-  Log(vlDebug,SLogGlobalCfgFPMakeCompilerConfig,[FFPMakeCompilerConfig]);
-  Log(vlDebug,SLogGlobalCfgDownloader,[FDownloader]);
+  Log(ALogLevel,SLogGlobalCfgHeader,[FConfigFilename]);
+  Log(ALogLevel,SLogGlobalCfgRemoteMirrorsURL,[FRemoteMirrorsURL]);
+  Log(ALogLevel,SLogGlobalCfgRemoteRepository,[FRemoteRepository]);
+  Log(ALogLevel,SLogGlobalCfgLocalRepository,[FLocalRepository,LocalRepository]);
+  Log(ALogLevel,SLogGlobalCfgBuildDir,[FBuildDir,BuildDir]);
+  Log(ALogLevel,SLogGlobalCfgArchivesDir,[FArchivesDir,ArchivesDir]);
+  Log(ALogLevel,SLogGlobalCfgCompilerConfigDir,[FCompilerConfigDir,CompilerConfigDir]);
+  Log(ALogLevel,SLogGlobalCfgDefaultCompilerConfig,[FDefaultCompilerConfig]);
+  Log(ALogLevel,SLogGlobalCfgFPMakeCompilerConfig,[FPMakeCompilerConfig]);
+  Log(ALogLevel,SLogGlobalCfgDownloader,[FDownloader]);
 end;
 
 
@@ -625,6 +627,7 @@ Var
 begin
   try
     Ini:=TMemIniFile.Create(AFileName);
+    FConfigFilename:=AFileName;
     With Ini do
       begin
         FConfigVersion:=ReadInteger(SDefaults,KeyConfigVersion,0);
@@ -678,16 +681,17 @@ begin
 end;
 
 
-procedure TCompilerOptions.LogValues(const ACfgName:string);
+procedure TCompilerOptions.LogValues(ALogLevel: TLogLevel; const ACfgName:string);
 begin
-  Log(vlDebug,SLogCompilerCfgHeader,[ACfgName]);
-  Log(vlDebug,SLogCompilerCfgCompiler,[FCompiler]);
-  Log(vlDebug,SLogCompilerCfgTarget,[MakeTargetString(CompilerCPU,CompilerOS)]);
-  Log(vlDebug,SLogCompilerCfgVersion,[FCompilerVersion]);
-  Log(vlDebug,SLogCompilerCfgGlobalInstallDir,[GlobalInstallDir]);
-  Log(vlDebug,SLogCompilerCfgLocalInstallDir,[LocalInstallDir]);
-  Log(vlDebug,SLogCompilerCfgGlobalPrefix,[GlobalPrefix]);
-  Log(vlDebug,SLogCompilerCfgLocalPrefix,[LocalPrefix]);
+  Log(ALogLevel,SLogCompilerCfgHeader,[ACfgName,FConfigFilename]);
+  Log(ALogLevel,SLogCompilerCfgCompiler,[FCompiler]);
+  Log(ALogLevel,SLogCompilerCfgTarget,[MakeTargetString(CompilerCPU,CompilerOS)]);
+  Log(ALogLevel,SLogCompilerCfgVersion,[FCompilerVersion]);
+  Log(ALogLevel,SLogCompilerCfgGlobalPrefix,[FGlobalPrefix,GlobalPrefix]);
+  Log(ALogLevel,SLogCompilerCfgLocalPrefix,[FLocalPrefix,LocalPrefix]);
+  Log(ALogLevel,SLogCompilerCfgGlobalInstallDir,[FGlobalInstallDir,GlobalInstallDir]);
+  Log(ALogLevel,SLogCompilerCfgLocalInstallDir,[FLocalInstallDir,LocalInstallDir]);
+  Log(ALogLevel,SLogCompilerCfgOptions,[Options.Text]);
 end;