Procházet zdrojové kódy

--- Merging r21957 into '.':
U utils/fppkg/fppkg.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
C packages/fppkg/src/pkgrepos.pp
U packages/fppkg/src/pkgoptions.pp
U packages/fppkg/src/fpmkunitsrc.inc
C packages/fppkg/src/pkghandler.pp
U packages/fppkg/src/pkgmkconv.pp
--- Merging r21959 into '.':
G utils/fppkg/fppkg.pp
C packages/fppkg/fpmake.pp
G packages/fppkg/src/pkgfpmake.pp
G packages/fppkg/src/pkgglobals.pp
G packages/fppkg/src/pkgrepos.pp
U packages/fppkg/src/fpxmlrep.pp
G packages/fppkg/src/pkgoptions.pp
U packages/fppkg/src/fprepos.pp
--- Merging r21960 into '.':
G packages/fppkg/src/fpmkunitsrc.inc
--- Merging r22178 into '.':
U packages/fpmkunit/src/fpmkunit.pp
--- Merging r22275 into '.':
G packages/fpmkunit/src/fpmkunit.pp
--- Merging r22331 into '.':
G packages/fpmkunit/src/fpmkunit.pp
--- Merging r22348 into '.':
G packages/fpmkunit/src/fpmkunit.pp
--- Merging r22353 into '.':
G packages/fpmkunit/src/fpmkunit.pp
--- Merging r22357 into '.':
G packages/fpmkunit/src/fpmkunit.pp
--- Merging r22358 into '.':
G packages/fpmkunit/src/fpmkunit.pp
--- Merging r22359 into '.':
G packages/fpmkunit/src/fpmkunit.pp
--- Merging r22361 into '.':
G packages/fpmkunit/src/fpmkunit.pp
--- Merging r22363 into '.':
G packages/fpmkunit/src/fpmkunit.pp
--- Merging r22387 into '.':
G packages/fpmkunit/src/fpmkunit.pp
--- Merging r22407 into '.':
G packages/fpmkunit/src/fpmkunit.pp
--- Merging r22435 into '.':
G packages/fpmkunit/src/fpmkunit.pp
--- Merging r22458 into '.':
G packages/fpmkunit/src/fpmkunit.pp
--- Merging r22538 into '.':
G packages/fpmkunit/src/fpmkunit.pp
--- Merging r22539 into '.':
G packages/fpmkunit/src/fpmkunit.pp
--- Merging r22540 into '.':
G packages/fpmkunit/src/fpmkunit.pp
Summary of conflicts:
Text conflicts: 2
Tree conflicts: 1

# revisions: 21957,21959,21960,22178,22275,22331,22348,22353,22357,22358,22359,22361,22363,22387,22407,22435,22458,22538,22539,22540
r21957 | joost | 2012-07-23 22:13:19 +0200 (Mon, 23 Jul 2012) | 2 lines
Changed paths:
M /trunk/packages/fppkg/src/fpmkunitsrc.inc
M /trunk/packages/fppkg/src/pkgcommands.pp
M /trunk/packages/fppkg/src/pkgdownload.pp
M /trunk/packages/fppkg/src/pkgfpmake.pp
M /trunk/packages/fppkg/src/pkgglobals.pp
M /trunk/packages/fppkg/src/pkghandler.pp
M /trunk/packages/fppkg/src/pkgmkconv.pp
M /trunk/packages/fppkg/src/pkgoptions.pp
M /trunk/packages/fppkg/src/pkgrepos.pp
M /trunk/utils/fppkg/fppkg.pp

* Renamed TLogLevel vl** enumerations to ll**, to avoid
conflicts with fpmkunits TVerboseLevel
r21959 | joost | 2012-07-23 22:56:09 +0200 (Mon, 23 Jul 2012) | 2 lines
Changed paths:
M /trunk/packages/fppkg/fpmake.pp
M /trunk/packages/fppkg/src/fprepos.pp
M /trunk/packages/fppkg/src/fpxmlrep.pp
M /trunk/packages/fppkg/src/pkgfpmake.pp
M /trunk/packages/fppkg/src/pkgglobals.pp
M /trunk/packages/fppkg/src/pkgoptions.pp
M /trunk/packages/fppkg/src/pkgrepos.pp
M /trunk/utils/fppkg/fppkg.pp

* Use fpmkunit in the fppkg package, to avoid double code.
This also adds (among others) iphonesim support to fppkg
r21960 | joost | 2012-07-23 23:13:09 +0200 (Mon, 23 Jul 2012) | 1 line
Changed paths:
M /trunk/packages/fppkg/src/fpmkunitsrc.inc

* Reverted file accidentally committed in r21957
r22178 | joost | 2012-08-22 20:58:07 +0200 (Wed, 22 Aug 2012) | 1 line
Changed paths:
M /trunk/packages/fpmkunit/src/fpmkunit.pp

* When bmBuildUnit is the only available build mode, use it
r22275 | joost | 2012-08-31 13:05:24 +0200 (Fri, 31 Aug 2012) | 2 lines
Changed paths:
M /trunk/packages/fpmkunit/src/fpmkunit.pp

* Added PackageVariants. Those can be used to define multiple selectable
variants with different compiler-settings.
r22331 | joost | 2012-09-05 21:10:13 +0200 (Wed, 05 Sep 2012) | 1 line
Changed paths:
M /trunk/packages/fpmkunit/src/fpmkunit.pp

* Search the UnitConfigFile in the right location when installing with PackageVariants
r22348 | joost | 2012-09-06 22:35:22 +0200 (Thu, 06 Sep 2012) | 4 lines
Changed paths:
M /trunk/packages/fpmkunit/src/fpmkunit.pp

* Files which should not be compiled on the current target can not trigger
a compile of the package. This also avoids checks on the file-age of
unknown source files, which effectively leads to checking the age of
directories.
r22353 | joost | 2012-09-07 20:59:16 +0200 (Fri, 07 Sep 2012) | 1 line
Changed paths:
M /trunk/packages/fpmkunit/src/fpmkunit.pp

* Do not use the GlobalDictionary during compilation of a package, this is not thread-safe
r22357 | joost | 2012-09-08 17:26:29 +0200 (Sat, 08 Sep 2012) | 3 lines
Changed paths:
M /trunk/packages/fpmkunit/src/fpmkunit.pp

* Package variants are stored in the package-dictionary, so there are more
places now where the package-dictionary should be used instead of the
global one.
r22358 | joost | 2012-09-08 17:43:50 +0200 (Sat, 08 Sep 2012) | 1 line
Changed paths:
M /trunk/packages/fpmkunit/src/fpmkunit.pp

* Added ability to inherit package-variants from dependencies.
r22359 | joost | 2012-09-08 17:50:06 +0200 (Sat, 08 Sep 2012) | 1 line
Changed paths:
M /trunk/packages/fpmkunit/src/fpmkunit.pp

* Fixed compilation of programs when using a buildunit
r22361 | joost | 2012-09-09 14:57:08 +0200 (Sun, 09 Sep 2012) | 1 line
Changed paths:
M /trunk/packages/fpmkunit/src/fpmkunit.pp

* Added ability to add targets to a packagevariant
r22363 | jonas | 2012-09-10 01:33:51 +0200 (Mon, 10 Sep 2012) | 1 line
Changed paths:
M /trunk/packages/fpmkunit/src/fpmkunit.pp

- disabled multithreading because it has causes crashes
r22387 | joost | 2012-09-13 22:17:18 +0200 (Thu, 13 Sep 2012) | 1 line
Changed paths:
M /trunk/packages/fpmkunit/src/fpmkunit.pp

* Load- and Save-unitconfig made public.
r22407 | joost | 2012-09-16 22:01:31 +0200 (Sun, 16 Sep 2012) | 1 line
Changed paths:
M /trunk/packages/fpmkunit/src/fpmkunit.pp

* PackageVariants are now owned by the installer. Multiple packages can have references to them.
r22435 | jonas | 2012-09-22 00:42:35 +0200 (Sat, 22 Sep 2012) | 2 lines
Changed paths:
M /trunk/packages/fpmkunit/src/fpmkunit.pp

- reverted r22363 (disabling of multi-threaded compilation), didn't notice
the issue had been fixed in r22353
r22458 | pierre | 2012-09-26 13:48:15 +0200 (Wed, 26 Sep 2012) | 1 line
Changed paths:
M /trunk/packages/fpmkunit/src/fpmkunit.pp

* Fix compilation for targets without process unit
r22538 | joost | 2012-10-04 21:25:41 +0200 (Thu, 04 Oct 2012) | 1 line
Changed paths:
M /trunk/packages/fpmkunit/src/fpmkunit.pp

* Replaced remaining usage of build option with package variant
r22539 | joost | 2012-10-04 22:05:28 +0200 (Thu, 04 Oct 2012) | 1 line
Changed paths:
M /trunk/packages/fpmkunit/src/fpmkunit.pp

* Show in debug-output why a package or target is being recompiled
r22540 | joost | 2012-10-04 22:10:23 +0200 (Thu, 04 Oct 2012) | 1 line
Changed paths:
M /trunk/packages/fpmkunit/src/fpmkunit.pp

* Issue a warning when a package-name is used twice

git-svn-id: branches/fixes_2_6@22753 -

marco před 12 roky
rodič
revize
67da577bbf

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 427 - 39
packages/fpmkunit/src/fpmkunit.pp


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

@@ -19,57 +19,15 @@ 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 }
 
@@ -87,11 +45,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;
 
@@ -153,6 +111,8 @@ 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;
@@ -166,8 +126,6 @@ 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.
@@ -285,14 +243,6 @@ 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);
 
@@ -331,64 +281,6 @@ 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);
@@ -407,131 +299,6 @@ 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;
+  Classes, SysUtils, dom, fprepos, fpmkunit;
 
 Type
 

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

@@ -124,16 +124,16 @@ var
 
 procedure TCommandListSettings.Execute;
 begin
-  GlobalOptions.LogValues(vlProgres);
-  CompilerOptions.LogValues(vlProgres,'');
-  FPMakeCompilerOptions.LogValues(vlProgres,'fpmake-building ');
+  GlobalOptions.LogValues(llProgres);
+  CompilerOptions.LogValues(llProgres,'');
+  FPMakeCompilerOptions.LogValues(llProgres,'fpmake-building ');
 end;
 
 
 procedure TCommandAddConfig.Execute;
 begin
 {
-  Log(vlInfo,SLogGeneratingCompilerConfig,[S]);
+  Log(llInfo,SLogGeneratingCompilerConfig,[S]);
   Options.InitCompilerDefaults(Args[2]);
   Options.SaveCompilerToFile(S);
 }
@@ -149,13 +149,13 @@ begin
   if (GlobalOptions.RemoteMirrorsURL<>'') and
      (GlobalOptions.RemoteRepository='auto') then
     begin
-      Log(vlCommands,SLogDownloading,[GlobalOptions.RemoteMirrorsURL,GlobalOptions.LocalMirrorsFile]);
+      Log(llCommands,SLogDownloading,[GlobalOptions.RemoteMirrorsURL,GlobalOptions.LocalMirrorsFile]);
       DownloadFile(GlobalOptions.RemoteMirrorsURL,GlobalOptions.LocalMirrorsFile);
       LoadLocalAvailableMirrors;
     end;
   // Download packages.xml
   PackagesURL:=GetRemoteRepositoryURL(PackagesFileName);
-  Log(vlCommands,SLogDownloading,[PackagesURL,GlobalOptions.LocalPackagesFile]);
+  Log(llCommands,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(vlCommands,SLogUnzippping,[ArchiveFile]);
+      Log(llCommands,SLogUnzippping,[ArchiveFile]);
       OutputPath:=PackageBuildPath(P);
       UnZipAllFiles(ArchiveFile);
     Finally
@@ -404,12 +404,12 @@ begin
               else
                 status:='OK';
             end;
-          Log(vlInfo,SLogPackageDependency,
+          Log(llInfo,SLogPackageDependency,
               [D.PackageName,D.MinVersion.AsString,PackageInstalledVersionStr(D.PackageName),
                PackageAvailableVersionStr(D.PackageName),status]);
         end
       else
-        Log(vlDebug,SDbgPackageDependencyOtherTarget,[D.PackageName,MakeTargetString(CompilerOptions.CompilerCPU,CompilerOptions.CompilerOS)]);
+        Log(llDebug,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(vlProgres,SProgrInstallDependencies);
+        pkgglobals.Log(llProgres,SProgrInstallDependencies);
       inc(DependenciesDepth);
 
       for i:=0 to L.Count-1 do
@@ -426,7 +426,7 @@ begin
 
       dec(DependenciesDepth);
       if DependenciesDepth=0 then
-        pkgglobals.Log(vlProgres,SProgrDependenciesInstalled);
+        pkgglobals.Log(llProgres,SProgrDependenciesInstalled);
     end;
   FreeAndNil(L);
   if FreeManifest then
@@ -444,7 +444,7 @@ begin
     FindBrokenPackages(SL);
     if SL.Count=0 then
       break;
-    pkgglobals.Log(vlProgres,SProgrReinstallDependent);
+    pkgglobals.Log(llProgres,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(vlCommands,SLogDownloading,[PackageRemoteArchive(P),PackageLocalArchive(P)]);
-      pkgglobals.log(vlProgres,SProgrDownloadPackage,[P.Name, P.Version.AsString]);
+      Log(llCommands,SLogDownloading,[PackageRemoteArchive(P),PackageLocalArchive(P)]);
+      pkgglobals.log(llProgres,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;
+  pkghandler, fpmkunit;
 
 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 vlInfo in LogLevels then
+      if llInfo in LogLevels then
         AddOption('-vi');
       AddOption('-O2');
       AddOption('-XXs');
@@ -243,7 +243,7 @@ begin
       DeleteDir(TempBuildDir);
     end
   else
-    Log(vlCommands,SLogNotCompilingFPMake);
+    Log(llCommands,SLogNotCompilingFPMake);
 end;
 
 
@@ -295,9 +295,9 @@ begin
   { Maybe compile fpmake executable? }
   ExecuteAction(PackageName,'compilefpmake');
   { Create options }
-  if vlDebug in LogLevels then
+  if llDebug in LogLevels then
     AddOption('--debug')
-  else if vlInfo in LogLevels then
+  else if llInfo 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

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

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

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

@@ -87,7 +87,7 @@ begin
   FullActionName:=APackageName+AAction;
   if ExecutedActions.Find(FullActionName)<>nil then
     begin
-      Log(vlDebug,'Already executed or executing action '+FullActionName);
+      Log(llDebug,'Already executed or executing action '+FullActionName);
       exit;
     end;
 
@@ -97,9 +97,9 @@ begin
   pkghandlerclass:=GetPkgHandler(AAction);
   With pkghandlerclass.Create(nil,APackageName) do
     try
-      Log(vlDebug,SLogRunAction+' start',[AAction]);
+      Log(llDebug,SLogRunAction+' start',[AAction]);
       Execute;
-      Log(vlDebug,SLogRunAction+' end',[AAction]);
+      Log(llDebug,SLogRunAction+' end',[AAction]);
     finally
       Free;
     end;
@@ -169,9 +169,93 @@ 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(vlCommands,SLogExecute,[Prog,Args]);
+  Log(llCommands,SLogExecute,[Prog,Args]);
   Flush(StdOut);
   Result:=SysUtils.ExecuteProcess(Prog,Args);
 end;
@@ -179,7 +263,7 @@ end;
 
 Procedure TPackageHandler.SetCurrentDir(Const ADir:String);
 begin
-  Log(vlCommands,SLogChangeDir,[ADir]);
+  Log(llCommands,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(vlDebug,'Converting '+AFileName);
+  Log(llDebug,'Converting '+AFileName);
   T:=Nil;
   D:=Nil;
   S:=Nil;
@@ -684,7 +684,7 @@ Var
   L : TStrings;
 
 begin
-  Log(vlInfo,SLogGeneratingFPMake);
+  Log(llInfo,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;
+uses Classes, Sysutils, Inifiles, fprepos, fpTemplate, pkgglobals, fpmkunit;
 
 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(vlDebug,SLogGeneratingGlobalConfig,[cfgfile])
+    pkgglobals.Log(llDebug,SLogGeneratingGlobalConfig,[cfgfile])
   else
-    pkgglobals.Log(vlDebug,SLogLoadingGlobalConfig,[cfgfile]);
+    pkgglobals.Log(llDebug,SLogLoadingGlobalConfig,[cfgfile]);
   // Log configuration
-  GlobalOptions.LogValues(vlDebug);
+  GlobalOptions.LogValues(llDebug);
 end;
 
 
@@ -255,7 +255,7 @@ begin
   CompilerOptions.UpdateLocalRepositoryOption;
   if FileExists(S) then
     begin
-      pkgglobals.Log(vlDebug,SLogLoadingCompilerConfig,[S]);
+      pkgglobals.Log(llDebug,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(vlDebug,SLogGeneratingCompilerConfig,[S]);
+          pkgglobals.Log(llDebug,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(vlDebug,'');
+  CompilerOptions.LogValues(llDebug,'');
   // 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(vlDebug,SLogLoadingFPMakeCompilerConfig,[S]);
+      pkgglobals.Log(llDebug,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(vlDebug,'fpmake-building ');
+  FPMakeCompilerOptions.LogValues(llDebug,'fpmake-building ');
 end;
 
 
@@ -439,7 +439,7 @@ begin
         FConfigVersion:=ReadInteger(SDefaults,KeyConfigVersion,0);
         if (FConfigVersion<>CurrentConfigVersion) then
           begin
-            log(vlDebug,SLogUpgradingConfig,[AFileName]);
+            log(llDebug,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(vlDebug,SLogDetectedCompiler,[FCompiler,FCompilerVersion,MakeTargetString(FCompilerCPU,FCompilerOS)]);
+  log(llDebug,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(vlDebug,SLogDetectedPrefix,['global',FGlobalPrefix]);
+  log(llDebug,SLogDetectedPrefix,['global',FGlobalPrefix]);
   // User writable install directory
   if not IsSuperUser then
     begin
       FLocalPrefix:= '{LocalRepository}';
-      log(vlDebug,SLogDetectedPrefix,['local',FLocalPrefix]);
+      log(llDebug,SLogDetectedPrefix,['local',FLocalPrefix]);
     end;
 
   fpcdir:=FixPath(GetEnvironmentVariable('FPCDIR'));
@@ -720,7 +720,7 @@ begin
     {$ifndef Unix}
     fpcdir:=ExpandFileName(fpcdir);
     {$endif unix}
-    log(vlDebug,SLogFPCDirEnv,[fpcdir]);
+    log(llDebug,SLogFPCDirEnv,[fpcdir]);
     FGlobalInstallDir:=fpcdir;
     end;
 end;
@@ -738,7 +738,7 @@ begin
         FConfigVersion:=ReadInteger(SDefaults,KeyConfigVersion,0);
         if (FConfigVersion<>CurrentConfigVersion) then
           begin
-            log(vlDebug,SLogUpgradingConfig,[AFileName]);
+            log(llDebug,SLogUpgradingConfig,[AFileName]);
             FSaveInifileChanges:=true;
             if (FConfigVersion>CurrentConfigVersion) then
               Error(SErrUnsupportedConfigVersion,[AFileName]);

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

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

+ 8 - 7
utils/fppkg/fppkg.pp

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

Některé soubory nejsou zobrazeny, neboť je v těchto rozdílových datech změněno mnoho souborů