[zi-cvs] packages/com.zzoss.package.lib Package.php,1.13,1.14 package.xml,1.5,1.6

Sandro Zic <[email protected]> Sat, 24 Apr 2004 15:34:22 +0000
Newsgroups gmane.comp.php.zzoss.installer.cvs
Message-ID <[email protected]>
Update of /cvsroot/zzossinstaller/packages/com.zzoss.package.lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24936/com.zzoss.package.lib

Modified Files:
	Package.php package.xml 
Log Message:
create package tgz with dir in filelist

Index: Package.php
===================================================================
RCS file: /cvsroot/zzossinstaller/packages/com.zzoss.package.lib/Package.php,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** Package.php	14 Apr 2004 11:13:48 -0000	1.13
--- Package.php	24 Apr 2004 15:34:20 -0000	1.14
***************
*** 496,500 ****
                              }
                              
!                             $pkg_tgz_path = ZZOSS_Package::createPkgArchive($package_src, $package_dest);
                              $log[$package_unique] .= '  Created package '.$pkg_tgz_path.'.'."\n";
                              
--- 496,501 ----
                              }
                              
!                             include_once 'ZZOSS_Package/Archive.php';
!                             $pkg_tgz_path = ZZOSS_PackageArchive::create($package_src, $package_dest);
                              $log[$package_unique] .= '  Created package '.$pkg_tgz_path.'.'."\n";
                              
***************
*** 535,643 ****
      }
      
-     function createPkgArchive($pkg_src_dir, $pkg_dest_dir = null)
-     {
-         static $pkg_tmpdir = '';
-         
-         // take care of *nix and Win directory separators
-         if(DIRECTORY_SEPARATOR == '/'){
-             $wrong_dir_separator = '\\';
-         } else {
-             $wrong_dir_separator = '/';
-         }
-         
-         if(is_null($pkg_dest_dir)){
-             $pkg_dest_dir = $pkg_src_dir;
-         }
-         
-         $package_xml = $pkg_src_dir.DIRECTORY_SEPARATOR.'package.xml';
-         
-         // Get package.xml and parse it to fill placeholder with content.
-         
-         $replace_values['{zi_release_date}'] = date('Y-m-d');
-         $replace_values['{zi_copyright_year}'] = date('Y');
-         
-         include_once 'ZZOSS_File/Replace.php';
-         $replace = new ZZOSS_FileReplace;
-         $replace->file($package_xml);
-         $replace->replace($replace_values);
-         
-         // Create a temporary package.xml
-         
-         // Create the temporary directory where we place it.
-         // But only if the directory does not already exist.
-         if(!isset($pkg_tmpdir) || !strlen($pkg_tmpdir)){
-             if (!($pkg_tmpdir = System::mktemp('-d'))) {
-                 return PEAR::raiseError("Cannot create temporary directory.");
-             }
-         }
-         
-         $package_xml_new = $pkg_tmpdir.DIRECTORY_SEPARATOR.'package.xml';
-         $replace->writeout($package_xml_new);
-         
-         // Get package.xml parameters.
-         include_once 'ZZOSS_Config/Config.php';
-         $config = new ZZOSS_Config(array('cache' => true, 'numeric' => array('file')));
-         $config->setFile($package_xml_new);
-         $xml = $config->query('/package');
-         
-         $pkg_unique = $xml['name'].'-'.$xml['release']['version'];
-         $pkg_tgz    = $pkg_dest_dir.DIRECTORY_SEPARATOR.$pkg_unique.'.tgz';
-         $tar_list   = array();
-         
-         // Iterate files.
-         if(
-             !isset($xml['release']['filelist']['file']) ||
-             !is_array($xml['release']['filelist']['file'])
-             ){
-             $files = array();
-         } else {
-             $files = $xml['release']['filelist']['file'];
-         }
-         if(count($files)){
-             foreach($files as $file){
-                 $tar_list[] = str_replace($wrong_dir_separator,DIRECTORY_SEPARATOR,$file['@']['name']);
-             }
-         }
-         
-         $plugin_files = array();
-         // Process plugin files.
-         if(
-             isset($xml['release']['plugin']['filelist']['file']) &&
-             is_array($xml['release']['plugin']['filelist']['file'])){
-             $plugin_files = $xml['release']['plugin']['filelist']['file'];
-         }
-         if(
-             isset($xml['release']['plugin']['file']) &&
-             is_array($xml['release']['plugin']['file'])){
-             $plugin_files = $xml['release']['plugin']['file'];
-         }
-         
-         if(count($plugin_files)){
-             // We remember if a plugin file has been defined
-             // various times, because we need to process it only once.
-             $plugin_files_processed = array();
-             foreach($plugin_files as $plugin_file){
-                 if(!in_array($plugin_file['@']['name'], $plugin_files_processed)){
-                     array_push($plugin_files_processed, $plugin_file['@']['name']);
-                     $tar_list[] = $plugin_file['@']['name'];
-                 }
-             }
-         }
-         
-         $cwd = getcwd();
-         chdir($pkg_src_dir);
-         $tar = new Archive_Tar($pkg_tgz);
-         //$tar->setErrorHandling(PEAR_ERROR_PRINT);
-         $tar->createModify($package_xml_new, '', $pkg_tmpdir);
-         //$tar->create('package.xml');
-         $tar->addModify($tar_list, $pkg_unique);
-         chdir($cwd);
-         
-         // delete the temporary package.xml
-         unlink($package_xml_new);
-         
-         return $pkg_tgz;
-     }
-     
      function getLog()
      {
--- 536,539 ----

Index: package.xml
===================================================================
RCS file: /cvsroot/zzossinstaller/packages/com.zzoss.package.lib/package.xml,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** package.xml	13 Apr 2004 10:24:30 -0000	1.5
--- package.xml	24 Apr 2004 15:34:20 -0000	1.6
***************
*** 38,46 ****
          </filelist>
          <deps>
-             <!--<dep type="pkg" rel="ge" version="1.0.1">com.zzoss.installer.lib</dep>-->
-             <dep type="pkg" rel="ge" version="1.0.0">com.zzoss.file.replace.lib</dep>
              <dep type="pkg" rel="ge" version="1.0.0">com.zzoss.dir.lib</dep>
              <dep type="pkg" rel="ge" version="1.0">com.zzoss.config.lib</dep>
              <dep type="pkg" rel="ge" version="0.4">com.zzoss.debug.lib</dep>
              <dep type="pkg" rel="ge" version="1.3b3">PEAR</dep>
              <dep type="pkg" rel="ge" version="1.1">Archive_Tar</dep>
--- 38,45 ----
          </filelist>
          <deps>
              <dep type="pkg" rel="ge" version="1.0.0">com.zzoss.dir.lib</dep>
              <dep type="pkg" rel="ge" version="1.0">com.zzoss.config.lib</dep>
              <dep type="pkg" rel="ge" version="0.4">com.zzoss.debug.lib</dep>
+             <dep type="pkg" rel="ge" version="1.0.0">com.zzoss.package.archive.lib</dep>
              <dep type="pkg" rel="ge" version="1.3b3">PEAR</dep>
              <dep type="pkg" rel="ge" version="1.1">Archive_Tar</dep>



-------------------------------------------------------
This SF.net email is sponsored by: The Robotic Monkeys at ThinkGeek
For a limited time only, get FREE Ground shipping on all orders of $35
or more. Hurry up and shop folks, this offer expires April 30th!
http://www.thinkgeek.com/freeshipping/?cpg=12297