Browse Source

* Show ''broken'' option and ''fixbroken'' command in help
* Help output fits now in a width of 80 chars
* Do only fail on broken packages for commands for which this is relevant
* Show which packages are broken in the list of packages

git-svn-id: trunk@15243 -

joost 15 years ago
parent
commit
2ad42e8d8f
3 changed files with 38 additions and 19 deletions
  1. 24 17
      utils/fppkg/fppkg.pp
  2. 1 0
      utils/fppkg/pkgmessages.pp
  3. 13 2
      utils/fppkg/pkgrepos.pp

+ 24 - 17
utils/fppkg/fppkg.pp

@@ -168,23 +168,25 @@ procedure TMakeTool.ShowUsage;
 begin
   Writeln('Usage: ',Paramstr(0),' [options] <action> <package>');
   Writeln('Options:');
-  Writeln('  -c --config        Set compiler configuration to use');
-  Writeln('  -h --help          This help');
-  Writeln('  -v --verbose       Show more information');
-  Writeln('  -d --debug         Show debugging information');
-  Writeln('  -g --global        Force installation to global (system-wide) directory');
-  Writeln('  -f --force         Force installation also if the package is already installed');
-  Writeln('  -r --recovery      Recovery mode, use always internal fpmkunit');
+  Writeln('  -c --config       Set compiler configuration to use');
+  Writeln('  -h --help         This help');
+  Writeln('  -v --verbose      Show more information');
+  Writeln('  -d --debug        Show debugging information');
+  Writeln('  -g --global       Force installation to global (system-wide) directory');
+  Writeln('  -f --force        Force installation also if the package is already installed');
+  Writeln('  -r --recovery     Recovery mode, use always internal fpmkunit');
+  Writeln('  -b --broken       Do not stop on broken packages');
   Writeln('Actions:');
-  Writeln('  update             Update packages list');
-  Writeln('  list               List available and installed packages');
-  Writeln('  build              Build package');
-  Writeln('  compile            Compile package');
-  Writeln('  install            Install package');
-  Writeln('  clean              Clean package');
-  Writeln('  archive            Create archive of package');
-  Writeln('  download           Download package');
-  Writeln('  convertmk          Convert Makefile.fpc to fpmake.pp');
+  Writeln('  update            Update packages list');
+  Writeln('  list              List available and installed packages');
+  Writeln('  build             Build package');
+  Writeln('  compile           Compile package');
+  Writeln('  install           Install package');
+  Writeln('  clean             Clean package');
+  Writeln('  archive           Create archive of package');
+  Writeln('  download          Download package');
+  Writeln('  convertmk         Convert Makefile.fpc to fpmake.pp');
+  Writeln('  fixbroken         Recompile all (broken) packages with changed dependencies');
 //  Writeln('  addconfig          Add a compiler configuration for the supplied compiler');
   Halt(0);
 end;
@@ -335,8 +337,13 @@ begin
 
     // Check for broken dependencies
     if not GlobalOptions.AllowBroken and
-       not((ParaPackages.Count=0) and (ParaAction='fixbroken')) then
+       (((ParaAction='fixbroken') and (ParaPackages.Count>0)) or
+        (ParaAction='compile') or
+        (ParaAction='build') or
+        (ParaAction='install') or
+        (ParaAction='archive')) then
       begin
+        pkgglobals.Log(vlDebug,SLogCheckBrokenDependenvies);
         SL:=TStringList.Create;
         if FindBrokenPackages(SL) then
           Error(SErrBrokenPackagesFound);

+ 1 - 0
utils/fppkg/pkgmessages.pp

@@ -77,6 +77,7 @@ Resourcestring
   SLogUpgradingConfig        = 'Configuration file "%s" is updated with new configuration settings';
   SLogPackageDependency      = 'Dependency on package %s %s, installed %s, available %s  (%s)';
   SLogPackageChecksumChanged = 'Package %s needs to be rebuild, dependency %s is modified';
+  SLogCheckBrokenDependenvies= 'Checking for broken dependencies';
 
   SLogGlobalCfgHeader        = 'Using global configuration:';
   SLogGlobalCfgRemoteMirrorsURL = ' RemoteMirrorsURL: "%s"';

+ 13 - 2
utils/fppkg/pkgrepos.pp

@@ -19,6 +19,7 @@ function  PackageIsBroken(APackage:TFPPackage):boolean;
 function  FindBrokenPackages(SL:TStrings):Boolean;
 procedure CheckFPMakeDependencies;
 function  PackageInstalledVersionStr(const AName:String):string;
+function  PackageInstalledStateStr(const AName:String):string;
 function  PackageAvailableVersionStr(const AName:String):string;
 procedure ListAvailablePackages;
 procedure ListPackages;
@@ -477,6 +478,16 @@ begin
 end;
 
 
+function PackageInstalledStateStr(const AName:String):string;
+var
+  P : TFPPackage;
+begin
+  result := '';
+  P:=InstalledRepository.FindPackage(AName);
+  if (P<>nil) and PackageIsBroken(P) then
+    result:='B';
+end;
+
 
 procedure ListAvailablePackages;
 var
@@ -515,12 +526,12 @@ begin
     SL.Add(AvailableRepository.Packages[i].Name);
   for i:=0 to InstalledRepository.PackageCount-1 do
     SL.Add(InstalledRepository.Packages[i].Name);
-  Writeln(Format('%-20s %-12s %-12s',['Name','Installed','Available']));
+  Writeln(Format('%-20s %-12s %-3s %-12s',['Name','Installed','','Available']));
   for i:=0 to SL.Count-1 do
     begin
       PackageName:=SL[i];
       if (PackageName<>CmdLinePackageName) and (PackageName<>CurrentDirPackageName) then
-        Writeln(Format('%-20s %-12s %-12s',[PackageName,PackageInstalledVersionStr(PackageName),PackageAvailableVersionStr(PackageName)]));
+        Writeln(Format('%-20s %-12s %-3s %-12s',[PackageName,PackageInstalledVersionStr(PackageName),PackageInstalledStateStr(PackageName),PackageAvailableVersionStr(PackageName)]));
     end;
   FreeAndNil(SL);
 end;