Browse Source

* support passing archive on the commandline for build,compile,install.
this can be used to test build of archives using 'fppkg archive && fppkg build <archive.zip>'

git-svn-id: trunk@9858 -

peter 17 years ago
parent
commit
2377b34d16
4 changed files with 21 additions and 2 deletions
  1. 11 1
      utils/fppkg/fppkg.pp
  2. 3 0
      utils/fppkg/fprepos.pp
  3. 6 1
      utils/fppkg/pkghandler.pp
  4. 1 0
      utils/fppkg/pkgmessages.pp

+ 11 - 1
utils/fppkg/fppkg.pp

@@ -291,9 +291,19 @@ begin
         // Process packages
         // Process packages
         for i:=0 to ParaPackages.Count-1 do
         for i:=0 to ParaPackages.Count-1 do
           begin
           begin
-            ActionPackage:=CurrentRepository.PackageByName(ParaPackages[i]);
+            if FileExists(ParaPackages[i]) then
+              begin
+                ActionPackage:=TFPPackage.Create(nil);
+                ActionPackage.Name:=ChangeFileExt(ExtractFileName(ParaPackages[i]),'');
+                ActionPackage.FileName:=ExpandFileName(ParaPackages[i]);
+                ActionPackage.IsLocalPackage:=true;
+              end
+            else
+              ActionPackage:=CurrentRepository.PackageByName(ParaPackages[i]);
             Log(vDebug,SLogCommandLineAction,['['+ActionPackage.Name+']',ParaAction]);
             Log(vDebug,SLogCommandLineAction,['['+ActionPackage.Name+']',ParaAction]);
             res:=pkghandler.ExecuteAction(ActionPackage,ParaAction);
             res:=pkghandler.ExecuteAction(ActionPackage,ParaAction);
+            if ActionPackage.IsLocalPackage then;
+              FreeAndNil(ActionPackage);
             if not res then
             if not res then
               break;
               break;
           end;
           end;

+ 3 - 0
utils/fppkg/fprepos.pp

@@ -111,6 +111,7 @@ Type
     FDependencies : TFPDependencies;
     FDependencies : TFPDependencies;
     FOSes : TOSES;
     FOSes : TOSES;
     FCPUs : TCPUS;
     FCPUs : TCPUS;
+    FIsLocalPackage : Boolean;
     function GetDependencies: TFPDependencies;
     function GetDependencies: TFPDependencies;
     function GetHasDependencies: Boolean;
     function GetHasDependencies: Boolean;
     function GetFileName: String;
     function GetFileName: String;
@@ -139,6 +140,8 @@ Type
     Property Email : String Read FEmail Write FEmail;
     Property Email : String Read FEmail Write FEmail;
     Property OSes : TOSes Read FOSes Write FOses;
     Property OSes : TOSes Read FOSes Write FOses;
     Property CPUs : TCPUs Read FCPUs Write FCPUs;
     Property CPUs : TCPUs Read FCPUs Write FCPUs;
+    // Manual package from commandline not in official repository
+    Property IsLocalPackage : Boolean Read FIsLocalPackage Write FIsLocalPackage;
   end;
   end;
 
 
   { TFPPackages }
   { TFPPackages }

+ 6 - 1
utils/fppkg/pkghandler.pp

@@ -174,6 +174,8 @@ function TPackageHandler.PackageRemoteArchive: String;
 begin
 begin
   if not assigned(CurrentPackage) then
   if not assigned(CurrentPackage) then
     Error(SErrNoPackageSpecified);
     Error(SErrNoPackageSpecified);
+  if CurrentPackage.IsLocalPackage then
+    Error(SErrPackageIsLocal);
   if CurrentPackage.ExternalURL<>'' then
   if CurrentPackage.ExternalURL<>'' then
     Result:=CurrentPackage.ExternalURL
     Result:=CurrentPackage.ExternalURL
   else
   else
@@ -184,7 +186,10 @@ function TPackageHandler.PackageLocalArchive: String;
 begin
 begin
   if not assigned(CurrentPackage) then
   if not assigned(CurrentPackage) then
     Error(SErrNoPackageSpecified);
     Error(SErrNoPackageSpecified);
-  Result:=GlobalOptions.PackagesDir+CurrentPackage.FileName;
+  if CurrentPackage.IsLocalPackage then
+    Result:=CurrentPackage.FileName
+  else
+    Result:=GlobalOptions.PackagesDir+CurrentPackage.FileName;
 end;
 end;
 
 
 
 

+ 1 - 0
utils/fppkg/pkgmessages.pp

@@ -38,6 +38,7 @@ Resourcestring
   SErrInvalidCommand         = 'Invalid command: %s';
   SErrInvalidCommand         = 'Invalid command: %s';
   SErrChangeDirFailed        = 'Could not change directory to "%s"';
   SErrChangeDirFailed        = 'Could not change directory to "%s"';
   SErrCorruptPackagesFile    = 'Packages file "%s" is corrupt, delete file manual and retry';
   SErrCorruptPackagesFile    = 'Packages file "%s" is corrupt, delete file manual and retry';
+  SErrPackageIsLocal         = 'Operation not supported for local packages';
 
 
   SErrHTTPGetFailed          = 'HTTP Download failed.';
   SErrHTTPGetFailed          = 'HTTP Download failed.';
   SErrLoginFailed            = 'FTP LOGIN command failed.';
   SErrLoginFailed            = 'FTP LOGIN command failed.';