Explorar el Código

--- Merging r22825 into '.':
U utils/fppkg/fppkg.pp
U packages/fpmkunit/src/fpmkunit.pp
U packages/fppkg/src/pkgcommands.pp
U packages/fppkg/src/pkgfpmake.pp
U packages/fppkg/src/pkgglobals.pp
U packages/fppkg/src/pkgdownload.pp
U packages/fppkg/src/pkgrepos.pp
U packages/fppkg/src/fpxmlrep.pp
U packages/fppkg/src/pkgoptions.pp
U packages/fppkg/src/fprepos.pp
U packages/fppkg/src/pkghandler.pp
U packages/fppkg/src/pkgmkconv.pp
G .

git-svn-id: tags/release_2_6_2_rc1@22844 -

marco hace 12 años
padre
commit
540110ff99

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 39 - 427
packages/fpmkunit/src/fpmkunit.pp


+ 238 - 5
packages/fppkg/src/fprepos.pp

@@ -19,15 +19,57 @@ interface
 uses
   classes,sysutils,
   contnrs,
-  fpmkunit,
   streamcoll;
 
 Const
   StreamVersion   : Integer = 1;
   StreamSignature = $FEEF;
 
+Type
+  // Keep syncronized with fpmkunit.pp
+  TCpu=(cpuNone,
+    i386,m68k,powerpc,sparc,x86_64,arm,powerpc64
+  );
+  TCPUS = Set of TCPU;
+
+  // Keep syncronized with fpmkunit.pp
+  TOS=(osNone,
+    linux,go32v2,win32,os2,freebsd,beos,netbsd,
+    amiga,atari, solaris, qnx, netware, openbsd,wdosx,
+    palmos,macos,darwin,emx,watcom,morphos,netwlibc,
+    win64,wince,gba,nds,embedded,symbian,haiku
+  );
+  TOSes = Set of TOS;
+
+const
+  AllOSes = [Low(TOS)..High(TOS)];
+  AllCPUs = [Low(TCPU)..High(TCPU)];
 
 type
+  { TFPVersion }
+
+  TFPVersion = Class(TPersistent)
+  private
+    FMajor,
+    FMinor,
+    FMicro,
+    FBuild    : Word;
+    function GetAsString: String;
+    function GetEmpty: Boolean;
+    procedure SetAsString(const AValue: String);
+  Public
+   Procedure Clear;
+   Procedure Assign(Source : TPersistent); override;
+   Property AsString : String Read GetAsString Write SetAsString;
+   Function CompareVersion(AVersion : TFPVersion) : Integer;
+   Function SameVersion(AVersion : TFPVersion) : Boolean;
+   Property Empty : Boolean Read GetEmpty;
+  Published
+   Property Major : Word Read FMajor Write FMajor;
+   Property Minor : Word Read FMinor Write FMinor;
+   Property Micro : Word Read FMicro Write FMicro;
+   Property Build : Word Read FBuild Write FBuild;
+  end;
 
   { TFPDependency }
 
@@ -45,11 +87,11 @@ type
     Procedure LoadFromStream(Stream : TStream; Streamversion : Integer); override;
     Procedure SaveToStream(Stream : TStream); override;
     Procedure Assign(Source : TPersistent); override;
-    Property OSes : TOSes Read FOSes Write FOses;
-    Property CPUs : TCPUs Read FCPUs Write FCPUs;
   Published
     Property PackageName : String Read FPackageName Write FPackageName;
     Property MinVersion : TFPVersion Read FMinVersion Write SetMinVersion;
+    Property OSes : TOSes Read FOSes Write FOses;
+    Property CPUs : TCPUs Read FCPUs Write FCPUs;
     Property RequireChecksum : Cardinal Read FRequireChecksum Write FRequireChecksum;
   end;
 
@@ -111,8 +153,6 @@ type
     Property InstalledLocally : boolean read FInstalledLocally write FInstalledLocally;
     Property UnusedVersion : TFPVersion Read FUnusedVersion Write SetUnusedVersion;
     Property RecompileBroken : boolean read FRecompileBroken write FRecompileBroken;
-    Property OSes : TOSes Read FOSes Write FOses;
-    Property CPUs : TCPUs Read FCPUs Write FCPUs;
   Published
     Property Name : String Read FName Write SetName;
     Property Author : String Read FAuthor Write FAuthor;
@@ -126,6 +166,8 @@ type
     Property DownloadURL : String Read FDownloadURL Write FDownloadURL;
     Property FileName : String Read GetFileName Write FFileName;
     Property Email : String Read FEmail Write FEmail;
+    Property OSes : TOSes Read FOSes Write FOses;
+    Property CPUs : TCPUs Read FCPUs Write FCPUs;
     Property Checksum : Cardinal Read FChecksum Write FChecksum;
     Property IsFPMakeAddIn : boolean read FIsFPMakeAddIn write FIsFPMakeAddIn;
     // These properties are used to re-compile the package, when it's dependencies are changed.
@@ -243,6 +285,14 @@ Const
   // Max level of dependency searching before we decide it's a circular dependency.
   DefaultMaxDependencyLevel = 15;
 
+Function OSToString(OS: TOS) : String;
+Function OSesToString(OSes: TOSes) : String;
+Function CPUToString(CPU: TCPU) : String;
+Function CPUSToString(CPUS: TCPUS) : String;
+Function StringToOS(S : String) : TOS;
+Function OSesToString(S : String) : TOSes;
+Function StringToCPU(S : String) : TCPU;
+Function StringToCPUS(S : String) : TCPUS;
 Function MakeTargetString(CPU : TCPU;OS: TOS) : String;
 Procedure StringToCPUOS(S : String; Var CPU : TCPU; Var OS: TOS);
 
@@ -281,6 +331,64 @@ ResourceString
   SErrMirrorNotFound       = 'Mirror "%s" not found.';
 
 
+Function OSToString(OS: TOS) : String;
+begin
+  Result:=LowerCase(GetenumName(TypeInfo(TOS),Ord(OS)));
+end;
+
+
+Function OSesToString(OSes: TOSes) : String;
+begin
+  Result:=LowerCase(SetToString(PtypeInfo(TypeInfo(TOSes)),Integer(OSes),False));
+end;
+
+
+Function CPUToString(CPU: TCPU) : String;
+begin
+  Result:=LowerCase(GetenumName(TypeInfo(TCPU),Ord(CPU)));
+end;
+
+
+Function CPUSToString(CPUS: TCPUS) : String;
+begin
+  Result:=LowerCase(SetToString(PTypeInfo(TypeInfo(TCPUS)),Integer(CPUS),False));
+end;
+
+
+Function StringToOS(S : String) : TOS;
+Var
+  I : Integer;
+begin
+  I:=GetEnumValue(TypeInfo(TOS),S);
+  if (I=-1) then
+    Raise EPackage.CreateFmt(SErrInvalidOS,[S]);
+  Result:=TOS(I);
+end;
+
+
+Function OSesToString(S : String) : TOSes;
+begin
+  Result:=TOSes(StringToSet(PTypeInfo(TypeInfo(TOSes)),S));
+end;
+
+
+Function StringToCPU(S : String) : TCPU;
+Var
+  I : Integer;
+begin
+  I:=GetEnumValue(TypeInfo(TCPU),S);
+  if (I=-1) then
+    Raise EPackage.CreateFmt(SErrInvalidCPU,[S]);
+  Result:=TCPU(I);
+end;
+
+
+Function StringToCPUS(S : String) : TCPUS;
+begin
+  Result:=TCPUS(StringToSet(PTypeInfo(TypeInfo(TCPUS)),S));
+end;
+
+
 Function MakeTargetString(CPU : TCPU;OS: TOS) : String;
 begin
   Result:=CPUToString(CPU)+'-'+OSToString(OS);
@@ -299,6 +407,131 @@ begin
 end;
 
 
+{ TFPVersion }
+
+function TFPVersion.GetAsString: String;
+begin
+  if Empty then
+    Result:='<none>'
+  else
+    Result:=Format('%d.%d.%d-%d',[Major,Minor,Micro,Build]);
+end;
+
+
+function TFPVersion.GetEmpty: Boolean;
+begin
+  Result:=(Major=0) and (Minor=0) and (Micro=0) and (Build=0);
+end;
+
+
+procedure TFPVersion.SetAsString(const AValue: String);
+
+  Function NextDigit(sep : Char; NonNumerisIsSep : boolean; var V : string; aDefault : integer = 0) : integer;
+  Var
+    P : Integer;
+    i : Integer;
+  begin
+    P:=Pos(Sep,V);
+    If (P=0) then
+      P:=Length(V)+1;
+    If NonNumerisIsSep then
+      for i := 1 to P-1 do
+        if not (V[i] in ['0','1','2','3','4','5','6','7','8','9']) then
+          begin
+            P := i;
+            Break;
+          end;
+    Result:=StrToIntDef(Copy(V,1,P-1),-1);
+    If Result<>-1 then
+      Delete(V,1,P)
+    else
+      Result:=aDefault;
+  end;
+
+Var
+  V : String;
+  b : integer;
+begin
+  Clear;
+  // Special support for empty version string
+  if (AValue='') or (AValue='<none>') then
+    exit;
+  V:=AValue;
+  // Supported version-format is x.y.z-b
+  // x,y,z and b are all optional and are set to 0 if they are not provided
+  // except for b which has a default of 1.
+  // x and y must be numeric. z or b may contain a non-numeric suffix which
+  // will be stripped. If there is any non-numeric character in z or b and
+  // there is no value supplied for b, build will be set to 0
+  // examples:
+  // 2          -> 2.0.0-1
+  // 2.2        -> 2.2.0-1
+  // 2.2.4      -> 2.2.4-1
+  // 2.2.4-0    -> 2.2.4-0
+  // 2.2.4rc1   -> 2.2.4-0
+  // 2.2.4-0rc1 -> 2.2.4-0
+  // 2.2.4-2rc1 -> 2.2.4-2
+  Major:=NextDigit('.',False,V);
+  Minor:=NextDigit('.',False,V);
+  Micro:=NextDigit('-',True,V);
+  b := NextDigit(#0,True,V,-1);
+  if b<0 then
+    if V <> '' then
+      Build := 0
+    else
+      Build := 1
+  else
+    Build := b;
+end;
+
+
+procedure TFPVersion.Clear;
+begin
+  Micro:=0;
+  Major:=0;
+  Minor:=0;
+  Build:=0;
+end;
+
+
+procedure TFPVersion.Assign(Source: TPersistent);
+Var
+  V : TFPVersion;
+begin
+  if Source is TFPVersion then
+    begin
+      V:=Source as TFPVersion;
+      Major:=V.Major;
+      Minor:=V.Minor;
+      Micro:=V.Micro;
+      Build:=V.Build;
+    end
+  else
+    inherited Assign(Source);
+end;
+
+
+function TFPVersion.CompareVersion(AVersion: TFPVersion): Integer;
+begin
+  Result:=Major-AVersion.Major;
+  If (Result=0) then
+    begin
+      Result:=Minor-AVersion.Minor;
+      if (Result=0) then
+        begin
+          Result:=Micro-AVersion.Micro;
+          If (Result=0) then
+            Result:=Build-AVersion.Build;
+        end;
+    end;
+end;
+
+
+function TFPVersion.SameVersion(AVersion: TFPVersion): Boolean;
+begin
+  Result:=CompareVersion(AVersion)=0;
+end;
+
 { TFPPackage }
 
 procedure TFPPackage.SetVersion(const AValue: TFPVersion);

+ 1 - 1
packages/fppkg/src/fpxmlrep.pp

@@ -17,7 +17,7 @@ unit fpxmlrep;
 interface
 
 uses
-  Classes, SysUtils, dom, fprepos, fpmkunit;
+  Classes, SysUtils, dom, fprepos;
 
 Type
 

+ 12 - 12
packages/fppkg/src/pkgcommands.pp

@@ -124,16 +124,16 @@ var
 
 procedure TCommandListSettings.Execute;
 begin
-  GlobalOptions.LogValues(llProgres);
-  CompilerOptions.LogValues(llProgres,'');
-  FPMakeCompilerOptions.LogValues(llProgres,'fpmake-building ');
+  GlobalOptions.LogValues(vlProgres);
+  CompilerOptions.LogValues(vlProgres,'');
+  FPMakeCompilerOptions.LogValues(vlProgres,'fpmake-building ');
 end;
 
 
 procedure TCommandAddConfig.Execute;
 begin
 {
-  Log(llInfo,SLogGeneratingCompilerConfig,[S]);
+  Log(vlInfo,SLogGeneratingCompilerConfig,[S]);
   Options.InitCompilerDefaults(Args[2]);
   Options.SaveCompilerToFile(S);
 }
@@ -149,13 +149,13 @@ begin
   if (GlobalOptions.RemoteMirrorsURL<>'') and
      (GlobalOptions.RemoteRepository='auto') then
     begin
-      Log(llCommands,SLogDownloading,[GlobalOptions.RemoteMirrorsURL,GlobalOptions.LocalMirrorsFile]);
+      Log(vlCommands,SLogDownloading,[GlobalOptions.RemoteMirrorsURL,GlobalOptions.LocalMirrorsFile]);
       DownloadFile(GlobalOptions.RemoteMirrorsURL,GlobalOptions.LocalMirrorsFile);
       LoadLocalAvailableMirrors;
     end;
   // Download packages.xml
   PackagesURL:=GetRemoteRepositoryURL(PackagesFileName);
-  Log(llCommands,SLogDownloading,[PackagesURL,GlobalOptions.LocalPackagesFile]);
+  Log(vlCommands,SLogDownloading,[PackagesURL,GlobalOptions.LocalPackagesFile]);
   DownloadFile(PackagesURL,GlobalOptions.LocalPackagesFile);
   // Read the repository again
   LoadLocalAvailableRepository;
@@ -210,7 +210,7 @@ begin
   { Unzip Archive }
   With TUnZipper.Create do
     try
-      Log(llCommands,SLogUnzippping,[ArchiveFile]);
+      Log(vlCommands,SLogUnzippping,[ArchiveFile]);
       OutputPath:=PackageBuildPath(P);
       UnZipAllFiles(ArchiveFile);
     Finally
@@ -404,12 +404,12 @@ begin
               else
                 status:='OK';
             end;
-          Log(llInfo,SLogPackageDependency,
+          Log(vlInfo,SLogPackageDependency,
               [D.PackageName,D.MinVersion.AsString,PackageInstalledVersionStr(D.PackageName),
                PackageAvailableVersionStr(D.PackageName),status]);
         end
       else
-        Log(llDebug,SDbgPackageDependencyOtherTarget,[D.PackageName,MakeTargetString(CompilerOptions.CompilerCPU,CompilerOptions.CompilerOS)]);
+        Log(vlDebug,SDbgPackageDependencyOtherTarget,[D.PackageName,MakeTargetString(CompilerOptions.CompilerCPU,CompilerOptions.CompilerOS)]);
     end;
   // Give error on first missing dependency
   if assigned(MissingDependency) then
@@ -418,7 +418,7 @@ begin
   if L.Count > 0 then
     begin
       if DependenciesDepth=0 then
-        pkgglobals.Log(llProgres,SProgrInstallDependencies);
+        pkgglobals.Log(vlProgres,SProgrInstallDependencies);
       inc(DependenciesDepth);
 
       for i:=0 to L.Count-1 do
@@ -426,7 +426,7 @@ begin
 
       dec(DependenciesDepth);
       if DependenciesDepth=0 then
-        pkgglobals.Log(llProgres,SProgrDependenciesInstalled);
+        pkgglobals.Log(vlProgres,SProgrDependenciesInstalled);
     end;
   FreeAndNil(L);
   if FreeManifest then
@@ -444,7 +444,7 @@ begin
     FindBrokenPackages(SL);
     if SL.Count=0 then
       break;
-    pkgglobals.Log(llProgres,SProgrReinstallDependent);
+    pkgglobals.Log(vlProgres,SProgrReinstallDependent);
     for i:=0 to SL.Count-1 do
       begin
         ExecuteAction(SL[i],'build');

+ 2 - 2
packages/fppkg/src/pkgdownload.pp

@@ -168,8 +168,8 @@ begin
   DownloaderClass:=GetDownloader(GlobalOptions.Downloader);
   with DownloaderClass.Create(nil) do
     try
-      Log(llCommands,SLogDownloading,[PackageRemoteArchive(P),PackageLocalArchive(P)]);
-      pkgglobals.log(llProgres,SProgrDownloadPackage,[P.Name, P.Version.AsString]);
+      Log(vlCommands,SLogDownloading,[PackageRemoteArchive(P),PackageLocalArchive(P)]);
+      pkgglobals.log(vlProgres,SProgrDownloadPackage,[P.Name, P.Version.AsString]);
       Download(PackageRemoteArchive(P),PackageLocalArchive(P));
     finally
       Free;

+ 5 - 5
packages/fppkg/src/pkgfpmake.pp

@@ -6,7 +6,7 @@ interface
 
 uses
   Classes,SysUtils,DateUtils,
-  pkghandler, fpmkunit;
+  pkghandler;
 
 implementation
 
@@ -224,7 +224,7 @@ begin
       // Compile options
       //   -- default is to optimize, smartlink and strip to reduce
       //      the executable size (there can be 100's of fpmake's on a system)
-      if llInfo in LogLevels then
+      if vlInfo in LogLevels then
         AddOption('-vi');
       AddOption('-O2');
       AddOption('-XXs');
@@ -243,7 +243,7 @@ begin
       DeleteDir(TempBuildDir);
     end
   else
-    Log(llCommands,SLogNotCompilingFPMake);
+    Log(vlCommands,SLogNotCompilingFPMake);
 end;
 
 
@@ -295,9 +295,9 @@ begin
   { Maybe compile fpmake executable? }
   ExecuteAction(PackageName,'compilefpmake');
   { Create options }
-  if llDebug in LogLevels then
+  if vlDebug in LogLevels then
     AddOption('--debug')
-  else if llInfo in LogLevels then
+  else if vlInfo in LogLevels then
     AddOption('--verbose');
   if P.RecompileBroken and
      (P.FPMakeOptionsString<>'') then // Check for a empty FPMakeOptionString for packages being installed with an old fpmkunit

+ 13 - 14
packages/fppkg/src/pkgglobals.pp

@@ -10,7 +10,6 @@ uses
 {$endif}
   SysUtils,
   Classes,
-  fpmkunit,
   fprepos;
 
 Const
@@ -53,13 +52,13 @@ Const
   );
 
 Type
-  TLogLevel = (llError,llWarning,llInfo,llCommands,llDebug,llProgres);
+  TLogLevel = (vlError,vlWarning,vlInfo,vlCommands,vlDebug,vlProgres);
   TLogLevels = Set of TLogLevel;
   TLogProc = procedure(Level:TLogLevel;Const Msg: String);
 
 const
-  DefaultLogLevels = [llError,llWarning, llProgres];
-  AllLogLevels = [llError,llWarning,llCommands,llInfo];
+  DefaultLogLevels = [vlError,vlWarning, vlProgres];
+  AllLogLevels = [vlError,vlWarning,vlCommands,vlInfo];
 
 type
   EPackagerError = class(Exception);
@@ -155,15 +154,15 @@ begin
     exit;
   Prefix:='';
   case Level of
-    llWarning :
+    vlWarning :
       Prefix:=SWarning;
-    llError :
+    vlError :
       Prefix:=SError;
-{    llInfo :
+{    vlInfo :
       Prefix:='I: ';
-    llCommands :
+    vlCommands :
       Prefix:='C: ';
-    llDebug :
+    vlDebug :
       Prefix:='D: '; }
   end;
   Writeln(stdOut,Prefix,Msg);
@@ -254,9 +253,9 @@ Function DirectoryExistsLog(const ADir:string):Boolean;
 begin
   result:=SysUtils.DirectoryExists(ADir);
   if result then
-    log(llDebug,SDbgDirectoryExists,[ADir,SDbgFound])
+    log(vlDebug,SDbgDirectoryExists,[ADir,SDbgFound])
   else
-    log(llDebug,SDbgDirectoryExists,[ADir,SDbgNotFound]);
+    log(vlDebug,SDbgDirectoryExists,[ADir,SDbgNotFound]);
 end;
 
 
@@ -264,9 +263,9 @@ Function FileExistsLog(const AFileName:string):Boolean;
 begin
   result:=SysUtils.FileExists(AFileName);
   if result then
-    log(llDebug,SDbgFileExists,[AFileName,SDbgFound])
+    log(vlDebug,SDbgFileExists,[AFileName,SDbgFound])
   else
-    log(llDebug,SDbgFileExists,[AFileName,SDbgNotFound]);
+    log(vlDebug,SDbgFileExists,[AFileName,SDbgNotFound]);
 end;
 
 
@@ -275,7 +274,7 @@ Var
   BFN : String;
 begin
   BFN:=AFileName+'.bak';
-  log(llDebug,SDbgBackupFile,[BFN]);
+  log(vlDebug,SDbgBackupFile,[BFN]);
   If not RenameFile(AFileName,BFN) then
     Error(SErrBackupFailed,[AFileName,BFN]);
 end;

+ 5 - 89
packages/fppkg/src/pkghandler.pp

@@ -87,7 +87,7 @@ begin
   FullActionName:=APackageName+AAction;
   if ExecutedActions.Find(FullActionName)<>nil then
     begin
-      Log(llDebug,'Already executed or executing action '+FullActionName);
+      Log(vlDebug,'Already executed or executing action '+FullActionName);
       exit;
     end;
 
@@ -97,9 +97,9 @@ begin
   pkghandlerclass:=GetPkgHandler(AAction);
   With pkghandlerclass.Create(nil,APackageName) do
     try
-      Log(llDebug,SLogRunAction+' start',[AAction]);
+      Log(vlDebug,SLogRunAction+' start',[AAction]);
       Execute;
-      Log(llDebug,SLogRunAction+' end',[AAction]);
+      Log(vlDebug,SLogRunAction+' end',[AAction]);
     finally
       Free;
     end;
@@ -169,93 +169,9 @@ begin
   FPackageName:=APackageName;
 end;
 
-{$ifdef HAS_UNIT_PROCESS}
-function ExecuteFPC(const Path: string; const ComLine: string): integer;
-var
-  P: TProcess;
-  ConsoleOutput: TMemoryStream;
-  BytesRead: longint;
-
-  function ReadFromStream: longint;
-
-  const
-    READ_BYTES = 2048;
-
-  var
-    n: longint;
-    BuffPos: longint;
-    sLine: string;
-    ch: char;
-  begin
-    // make sure we have room
-    ConsoleOutput.SetSize(BytesRead + READ_BYTES);
-
-    // try reading it
-    n := P.Output.Read((ConsoleOutput.Memory + BytesRead)^, READ_BYTES);
-    if n > 0 then
-    begin
-      Inc(BytesRead, n);
-
-      sLine := '';
-      BuffPos := ConsoleOutput.Position;
-
-      //read lines from the stream
-      repeat
-        ConsoleOutput.Read(ch,1);
-
-        if ch in [#10, #13] then
-        begin
-          log(llProgres,sLine);
-          sLine := '';
-          BuffPos := ConsoleOutput.Position;
-        end
-        else
-          sLine := sLine + ch;
-
-      until ConsoleOutput.Position >= BytesRead;
-
-      ConsoleOutput.Position := BuffPos;
-    end
-    else
-    begin
-      // no data, wait 100 ms
-      Sleep(100);
-    end;
-
-    Result := n;
-  end;
-
-begin
-  result := -1;
-  BytesRead := 0;
-  ConsoleOutput := TMemoryStream.Create;
-  try
-    P := TProcess.Create(nil);
-    try
-      P.CommandLine := Path + ' ' + ComLine;
-      P.Options := [poUsePipes];
-      P.Execute;
-      while P.Running do
-        ReadFromStream;
-
-      // read last part
-      repeat
-      until ReadFromStream = 0;
-      ConsoleOutput.SetSize(BytesRead);
-
-      result := P.ExitStatus;
-    finally
-      P.Free;
-    end;
-  finally
-    ConsoleOutput.Free;
-  end;
-end;
-{$endif HAS_UNIT_PROCESS}
-
 Function TPackageHandler.ExecuteProcess(Const Prog,Args:String):Integer;
 begin
-  Log(llCommands,SLogExecute,[Prog,Args]);
+  Log(vlCommands,SLogExecute,[Prog,Args]);
   Flush(StdOut);
   Result:=SysUtils.ExecuteProcess(Prog,Args);
 end;
@@ -263,7 +179,7 @@ end;
 
 Procedure TPackageHandler.SetCurrentDir(Const ADir:String);
 begin
-  Log(llCommands,SLogChangeDir,[ADir]);
+  Log(vlCommands,SLogChangeDir,[ADir]);
   if not SysUtils.SetCurrentDir(ADir) then
     Error(SErrChangeDirFailed,[ADir]);
 end;

+ 2 - 2
packages/fppkg/src/pkgmkconv.pp

@@ -598,7 +598,7 @@ Var
   B : Boolean;
 
 begin
-  Log(llDebug,'Converting '+AFileName);
+  Log(vlDebug,'Converting '+AFileName);
   T:=Nil;
   D:=Nil;
   S:=Nil;
@@ -684,7 +684,7 @@ Var
   L : TStrings;
 
 begin
-  Log(llInfo,SLogGeneratingFPMake);
+  Log(vlInfo,SLogGeneratingFPMake);
   L:=TStringList.Create;
   Try
     StartInstaller(L);

+ 15 - 15
packages/fppkg/src/pkgoptions.pp

@@ -16,7 +16,7 @@ unit pkgoptions;
 
 interface
 
-uses Classes, Sysutils, Inifiles, fprepos, fpTemplate, pkgglobals, fpmkunit;
+uses Classes, Sysutils, Inifiles, fprepos, fpTemplate, pkgglobals;
 
 Const
   UnitConfigFileName   = 'fpunits.cfg';
@@ -238,11 +238,11 @@ begin
   GlobalOptions.CompilerConfig:=GlobalOptions.DefaultCompilerConfig;
   // Tracing of what we've done above, need to be done after the verbosity is set
   if GeneratedConfig then
-    pkgglobals.Log(llDebug,SLogGeneratingGlobalConfig,[cfgfile])
+    pkgglobals.Log(vlDebug,SLogGeneratingGlobalConfig,[cfgfile])
   else
-    pkgglobals.Log(llDebug,SLogLoadingGlobalConfig,[cfgfile]);
+    pkgglobals.Log(vlDebug,SLogLoadingGlobalConfig,[cfgfile]);
   // Log configuration
-  GlobalOptions.LogValues(llDebug);
+  GlobalOptions.LogValues(vlDebug);
 end;
 
 
@@ -255,7 +255,7 @@ begin
   CompilerOptions.UpdateLocalRepositoryOption;
   if FileExists(S) then
     begin
-      pkgglobals.Log(llDebug,SLogLoadingCompilerConfig,[S]);
+      pkgglobals.Log(vlDebug,SLogLoadingCompilerConfig,[S]);
       CompilerOptions.LoadCompilerFromFile(S)
     end
   else
@@ -263,7 +263,7 @@ begin
       // Generate a default configuration if it doesn't exists
       if GlobalOptions.CompilerConfig='default' then
         begin
-          pkgglobals.Log(llDebug,SLogGeneratingCompilerConfig,[S]);
+          pkgglobals.Log(vlDebug,SLogGeneratingCompilerConfig,[S]);
           CompilerOptions.InitCompilerDefaults;
           CompilerOptions.SaveCompilerToFile(S);
           if CompilerOptions.SaveInifileChanges then
@@ -273,13 +273,13 @@ begin
         Error(SErrMissingCompilerConfig,[S]);
     end;
   // Log compiler configuration
-  CompilerOptions.LogValues(llDebug,'');
+  CompilerOptions.LogValues(vlDebug,'');
   // Load FPMake compiler config, this is normally the same config as above
   S:=GlobalOptions.CompilerConfigDir+GlobalOptions.FPMakeCompilerConfig;
   FPMakeCompilerOptions.UpdateLocalRepositoryOption;
   if FileExists(S) then
     begin
-      pkgglobals.Log(llDebug,SLogLoadingFPMakeCompilerConfig,[S]);
+      pkgglobals.Log(vlDebug,SLogLoadingFPMakeCompilerConfig,[S]);
       FPMakeCompilerOptions.LoadCompilerFromFile(S);
       if FPMakeCompilerOptions.SaveInifileChanges then
         FPMakeCompilerOptions.SaveCompilerToFile(S);
@@ -287,7 +287,7 @@ begin
   else
     Error(SErrMissingCompilerConfig,[S]);
   // Log compiler configuration
-  FPMakeCompilerOptions.LogValues(llDebug,'fpmake-building ');
+  FPMakeCompilerOptions.LogValues(vlDebug,'fpmake-building ');
 end;
 
 
@@ -439,7 +439,7 @@ begin
         FConfigVersion:=ReadInteger(SDefaults,KeyConfigVersion,0);
         if (FConfigVersion<>CurrentConfigVersion) then
           begin
-            log(llDebug,SLogUpgradingConfig,[AFileName]);
+            log(vlDebug,SLogUpgradingConfig,[AFileName]);
             FSaveInifileChanges:=true;
             if FConfigVersion<1 then
               begin
@@ -688,7 +688,7 @@ begin
   // We retrieve the real binary
   if FCompilerVersion='2.2.0' then
     FCompiler:=GetCompilerInfo(FCompiler,'-PB');
-  log(llDebug,SLogDetectedCompiler,[FCompiler,FCompilerVersion,MakeTargetString(FCompilerCPU,FCompilerOS)]);
+  log(vlDebug,SLogDetectedCompiler,[FCompiler,FCompilerVersion,MakeTargetString(FCompilerCPU,FCompilerOS)]);
 
   // Use the same algorithm as the compiler, see options.pas
   // Except that the prefix is extracted and GlobalInstallDir is set using
@@ -706,12 +706,12 @@ begin
   FGlobalPrefix:=ExpandFileName(FGlobalPrefix);
 {$endif unix}
 
-  log(llDebug,SLogDetectedPrefix,['global',FGlobalPrefix]);
+  log(vlDebug,SLogDetectedPrefix,['global',FGlobalPrefix]);
   // User writable install directory
   if not IsSuperUser then
     begin
       FLocalPrefix:= '{LocalRepository}';
-      log(llDebug,SLogDetectedPrefix,['local',FLocalPrefix]);
+      log(vlDebug,SLogDetectedPrefix,['local',FLocalPrefix]);
     end;
 
   fpcdir:=FixPath(GetEnvironmentVariable('FPCDIR'));
@@ -720,7 +720,7 @@ begin
     {$ifndef Unix}
     fpcdir:=ExpandFileName(fpcdir);
     {$endif unix}
-    log(llDebug,SLogFPCDirEnv,[fpcdir]);
+    log(vlDebug,SLogFPCDirEnv,[fpcdir]);
     FGlobalInstallDir:=fpcdir;
     end;
 end;
@@ -738,7 +738,7 @@ begin
         FConfigVersion:=ReadInteger(SDefaults,KeyConfigVersion,0);
         if (FConfigVersion<>CurrentConfigVersion) then
           begin
-            log(llDebug,SLogUpgradingConfig,[AFileName]);
+            log(vlDebug,SLogUpgradingConfig,[AFileName]);
             FSaveInifileChanges:=true;
             if (FConfigVersion>CurrentConfigVersion) then
               Error(SErrUnsupportedConfigVersion,[AFileName]);

+ 19 - 24
packages/fppkg/src/pkgrepos.pp

@@ -6,8 +6,7 @@ interface
 
 uses
   SysUtils,Classes,
-  fprepos,pkgoptions,
-  fpmkunit;
+  fprepos,pkgoptions;
 
 function GetRemoteRepositoryURL(const AFileName:string):string;
 
@@ -81,7 +80,7 @@ begin
 
   // Repository
   S:=GlobalOptions.LocalMirrorsFile;
-  log(llDebug,SLogLoadingMirrorsFile,[S]);
+  log(vlDebug,SLogLoadingMirrorsFile,[S]);
   if not FileExists(S) then
     exit;
   try
@@ -95,7 +94,7 @@ begin
   except
     on E : Exception do
       begin
-        Log(llError,E.Message);
+        Log(vlError,E.Message);
         Error(SErrCorruptMirrorsFile,[S]);
       end;
   end;
@@ -137,7 +136,7 @@ begin
     end;
   if assigned(M) then
     begin
-      log(llInfo,SLogSelectedMirror,[M.Name]);
+      log(vlInfo,SLogSelectedMirror,[M.Name]);
       Result:=M.URL;
     end
   else
@@ -206,7 +205,7 @@ procedure FindInstalledPackages(ACompilerOptions:TCompilerOptions;showdups:boole
         result.UnusedVersion:=result.Version;
         // Log packages found in multiple locations (local and global) ?
         if showdups then
-          log(llDebug,SDbgPackageMultipleLocations,[result.Name,ExtractFilePath(AFileName)]);
+          log(vlDebug,SDbgPackageMultipleLocations,[result.Name,ExtractFilePath(AFileName)]);
       end;
     result.InstalledLocally:=Local;
   end;
@@ -235,7 +234,7 @@ procedure FindInstalledPackages(ACompilerOptions:TCompilerOptions;showdups:boole
     Result:=false;
     if FindFirst(IncludeTrailingPathDelimiter(AUnitDir)+AllFiles,faDirectory,SR)=0 then
       begin
-        log(llDebug,SLogFindInstalledPackages,[AUnitDir]);
+        log(vlDebug,SLogFindInstalledPackages,[AUnitDir]);
         repeat
           if ((SR.Attr and faDirectory)=faDirectory) and (SR.Name<>'.') and (SR.Name<>'..') then
             begin
@@ -279,7 +278,7 @@ end;
 
 Procedure AddFPMakeAddIn(APackage: TFPPackage);
 begin
-  log(llDebug,SLogFoundFPMakeAddin,[APackage.Name]);
+  log(vlDebug,SLogFoundFPMakeAddin,[APackage.Name]);
   setlength(FPMKUnitDeps,length(FPMKUnitDeps)+1);
   FPMKUnitDeps[high(FPMKUnitDeps)].package:=APackage.Name;
   FPMKUnitDeps[high(FPMKUnitDeps)].reqver:=APackage.Version.AsString;
@@ -308,7 +307,7 @@ begin
             begin
               if (DepPackage.Checksum<>D.RequireChecksum) then
                 begin
-                  log(llInfo,SLogPackageChecksumChanged,[APackage.Name,D.PackageName]);
+                  log(vlInfo,SLogPackageChecksumChanged,[APackage.Name,D.PackageName]);
                   result:=true;
                   if MarkForReInstall then
                     begin
@@ -337,7 +336,7 @@ begin
                 end;
             end
           else
-            log(llDebug,SDbgObsoleteDependency,[D.PackageName]);
+            log(vlDebug,SDbgObsoleteDependency,[D.PackageName]);
         end;
     end;
 end;
@@ -387,19 +386,15 @@ begin
           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;
+          ReqVer.AsString:=FPMKUnitDeps[i].ReqVer;
+          log(vlDebug,SLogFPMKUnitDepVersion,[P.Name,ReqVer.AsString,P.Version.AsString,AvailVerStr]);
+          if ReqVer.CompareVersion(P.Version)<=0 then
+            FPMKUnitDeps[i].available:=true
+          else
+            log(vlDebug,SLogFPMKUnitDepTooOld,[FPMKUnitDeps[i].package]);
         end
       else
-        log(llDebug,SLogFPMKUnitDepTooOld,[FPMKUnitDeps[i].package]);
+        log(vlDebug,SLogFPMKUnitDepTooOld,[FPMKUnitDeps[i].package]);
     end;
 end;
 
@@ -418,7 +413,7 @@ begin
   AvailableRepository:=GetDefaultRepositoryClass.Create(Nil);
   // Repository
   S:=GlobalOptions.LocalPackagesFile;
-  log(llDebug,SLogLoadingPackagesFile,[S]);
+  log(vlDebug,SLogLoadingPackagesFile,[S]);
   if not FileExists(S) then
     exit;
   try
@@ -432,7 +427,7 @@ begin
   except
     on E : Exception do
       begin
-        Log(llError,E.Message);
+        Log(vlError,E.Message);
         Error(SErrCorruptPackagesFile,[S]);
       end;
   end;
@@ -629,7 +624,7 @@ begin
         { Unzip manifest.xml }
         With TUnZipper.Create do
           try
-            log(llCommands,SLogUnzippping,[ArchiveSL[i]]);
+            log(vlCommands,SLogUnzippping,[ArchiveSL[i]]);
             OutputPath:='.';
             UnZipFiles(ArchiveSL[i],ManifestSL);
           Finally

+ 7 - 8
utils/fppkg/fppkg.pp

@@ -9,7 +9,7 @@ program fppkg;
 uses
   // General
 {$ifdef unix}
-  baseunix, cthreads,
+  baseunix,
 {$endif}
   Classes, SysUtils, TypInfo, custapp,
   // Repository handler objects
@@ -17,8 +17,7 @@ uses
   pkgmessages, pkgglobals, pkgoptions, pkgrepos,
   // Package Handler components
   pkghandler,pkgmkconv, pkgdownload,
-  pkgfpmake, pkgcommands,
-  fpmkunit
+  pkgfpmake, pkgcommands
   // Downloaders
 {$if defined(unix) or defined(windows)}
   ,pkgwget
@@ -58,7 +57,7 @@ begin
   for i:=1 to ParamCount do
     if (ParamStr(i)='-d') or (ParamStr(i)='--debug') then
       begin
-        LogLevels:=AllLogLevels+[llDebug];
+        LogLevels:=AllLogLevels+[vlDebug];
         break;
       end;
   // First try config file from command line
@@ -199,7 +198,7 @@ begin
       else if CheckOption(I,'v','verbose') then
         LogLevels:=AllLogLevels
       else if CheckOption(I,'d','debug') then
-        LogLevels:=AllLogLevels+[llDebug]
+        LogLevels:=AllLogLevels+[vlDebug]
       else if CheckOption(I,'g','global') then
         GlobalOptions.InstallGlobal:=true
       else if CheckOption(I,'r','recovery') then
@@ -314,7 +313,7 @@ begin
           pkghandler.ExecuteAction('','update');
         except
           on E: Exception do
-            pkgglobals.Log(llWarning,E.Message);
+            pkgglobals.Log(vlWarning,E.Message);
         end;
       end;
     LoadLocalAvailableRepository;
@@ -333,7 +332,7 @@ begin
         (ParaAction='install') or
         (ParaAction='archive')) then
       begin
-        pkgglobals.Log(llDebug,SLogCheckBrokenDependenvies);
+        pkgglobals.Log(vlDebug,SLogCheckBrokenDependenvies);
         SL:=TStringList.Create;
         if FindBrokenPackages(SL) then
           Error(SErrBrokenPackagesFound);
@@ -358,7 +357,7 @@ begin
               end
             else
               begin
-                pkgglobals.Log(llDebug,SLogCommandLineAction,['['+ParaPackages[i]+']',ParaAction]);
+                pkgglobals.Log(vlDebug,SLogCommandLineAction,['['+ParaPackages[i]+']',ParaAction]);
                 pkghandler.ExecuteAction(ParaPackages[i],ParaAction);
               end;
           end;

Algunos archivos no se mostraron porque demasiados archivos cambiaron en este cambio