[zi-cvs] packages/com.zzoss.zic.plugin.filerole package.xml,1.2,1.3 role_php.php,1.1,1.2

[email protected] Fri, 05 Mar 2004 06:25:28 -0800
Newsgroups gmane.comp.php.zzoss.installer.cvs
Message-ID <[email protected]>
Update of /cvsroot/zzossinstaller/packages/com.zzoss.zic.plugin.filerole
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8129/com.zzoss.zic.plugin.filerole

Modified Files:
	package.xml role_php.php 
Log Message:
new plugin architecture in installer

Index: package.xml
===================================================================
RCS file: /cvsroot/zzossinstaller/packages/com.zzoss.zic.plugin.filerole/package.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** package.xml	14 Jan 2004 15:43:45 -0000	1.2
--- package.xml	5 Mar 2004 14:25:25 -0000	1.3
***************
*** 20,37 ****
    </maintainers>
    <release>
!     <version>1.0</version>
      <date>{zi_release_date}</date>
      <license url="http://www.gnu.org/licenses/lgpl.txt" version="2.1">LGPL</license>
      <state>stable</state>
!     <notes>Initial release.</notes>
      <copyright>
          <holder year="{zi_copyright_year}" url="http://www.zzoss.com">ZZ/OSS</holder>
      </copyright>
! 	<plugin default="yes">
  		<filelist>
              <file role="role" attr="role" val="" name="role_php.php"/>
  			<file role="role" attr="role" val="php" name="role_php.php"/>
              <file role="role" attr="role" val="data" name="role_php.php"/>
              <file role="role" attr="role" val="test" name="role_php.php"/>
              <file role="role" attr="role" val="xml" name="role_php.php"/>
              <file role="role" attr="role" val="xsl" name="role_php.php"/>
--- 20,51 ----
    </maintainers>
    <release>
!     <version>2.0.0</version>
      <date>{zi_release_date}</date>
      <license url="http://www.gnu.org/licenses/lgpl.txt" version="2.1">LGPL</license>
      <state>stable</state>
!     <notes>
! <![CDATA[
! - ready for new plugin architecture
! - added filelist
! - files are installed to directory named like package name
! ]]>    
!     </notes>
      <copyright>
          <holder year="{zi_copyright_year}" url="http://www.zzoss.com">ZZ/OSS</holder>
      </copyright>
!     <filelist>
!         <file role="php" baseinstalldir="com.zzoss.zic.plugin.filerole" name="role_php.php"/>
!         <file role="build" baseinstalldir="com.zzoss.zic.plugin.filerole" name="config/config.xml-dist"/>
!         <file role="build" baseinstalldir="com.zzoss.zic.plugin.filerole" name="config/input.xml"/>
!     </filelist>
! 	<plugin>
  		<filelist>
              <file role="role" attr="role" val="" name="role_php.php"/>
  			<file role="role" attr="role" val="php" name="role_php.php"/>
+             <file role="role" attr="role" val="build" name="role_php.php"/>
+             <file role="role" attr="role" val="doc" name="role_php.php"/>
              <file role="role" attr="role" val="data" name="role_php.php"/>
              <file role="role" attr="role" val="test" name="role_php.php"/>
+             <file role="role" attr="role" val="script" name="role_php.php"/>
              <file role="role" attr="role" val="xml" name="role_php.php"/>
              <file role="role" attr="role" val="xsl" name="role_php.php"/>
***************
*** 40,43 ****
--- 54,75 ----
  		</filelist>
  	</plugin>
+     <deps>
+         <dep type="pkg" rel="ge" version="2.0.0">com.zzoss.zic.plugin.config</dep>
+     </deps>
+     <builds>
+         <build dir="config/" plugin="com.zzoss.zic.plugin.config" rel="ge" version="2.0.0"/>
+     </builds>
    </release>
+   <changelog>
+     <release>
+         <version>1.0</version>
+         <date>{zi_release_date}</date>
+         <license url="http://www.gnu.org/licenses/lgpl.txt" version="2.1">LGPL</license>
+         <state>stable</state>
+         <notes>Initial release.</notes>
+         <copyright>
+             <holder year="{zi_copyright_year}" url="http://www.zzoss.com">ZZ/OSS</holder>
+         </copyright>
+       </release>
+   </changelog>
  </package>

Index: role_php.php
===================================================================
RCS file: /cvsroot/zzossinstaller/packages/com.zzoss.zic.plugin.filerole/role_php.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** role_php.php	22 Dec 2003 17:30:07 -0000	1.1
--- role_php.php	5 Mar 2004 14:25:26 -0000	1.2
***************
*** 26,49 ****
      echo '['.$GLOBALS['ZI']['package_action'].' '.$GLOBALS['ZI']['package_name'].'-'.$GLOBALS['ZI']['package_version'].']'."\n";
  
      switch($GLOBALS['ZI']['package_action']){
          case 'remove':
!             unlink($GLOBALS['ZI']['file_dest']);
!             $GLOBALS['ZI']['plugin_log'] .= 'deleted '.$GLOBALS['ZI']['file_dest'];
              break;
          case 'update':
          case 'install':
!             System::mkDir(array("-p",dirname($GLOBALS['ZI']['file_dest'])));
!             echo 'created directory '.$GLOBALS['ZI']['file_baseinstalldir']."\n";
!             //ZZOSS_InstallerUtils::mkdir($pathinfo["dirname"]);
!             //$log .= 'src: '.$src. 'dest: '.$dest."\n";
!             //echo 'src: '.$src. 'dest: '.$dest."\n<br>";
!             if(!copy($GLOBALS['ZI']['file_src'],$GLOBALS['ZI']['file_dest'])) {
!                 $GLOBALS['ZI']['plugin_log'] .=
!                 'Cannot copy '.$GLOBALS['ZI']['file_src']."\n".
!                 '  to '.$GLOBALS['ZI']['file_dest']."\n";
              } else {
!                 $GLOBALS['ZI']['plugin_log'] .=
!                     'Copied '.$GLOBALS['ZI']['file_src']."\n".
!                     '  to '.$GLOBALS['ZI']['file_dest']."\n";
              }
              break;
--- 26,80 ----
      echo '['.$GLOBALS['ZI']['package_action'].' '.$GLOBALS['ZI']['package_name'].'-'.$GLOBALS['ZI']['package_version'].']'."\n";
  
+     if(
+         isset($GLOBALS['ZI']['file_role']) &&
+         !isset($fileroles_dirs[$GLOBALS['ZI']['file_role']]) &&
+         $GLOBALS['ZI']['file_role'] == 'doc' ||
+         $GLOBALS['ZI']['file_role'] == 'data' ||
+         $GLOBALS['ZI']['file_role'] == 'test' ||
+         $GLOBALS['ZI']['file_role'] == 'script'
+         ){
+         // grab the destination directories for the various roles
+         $config_file = $GLOBALS['ZI']['application_data_dir'].'data'.DIRECTORY_SEPARATOR.'plugin'.DIRECTORY_SEPARATOR.'com.zzoss.zic.plugin.filerole'.DIRECTORY_SEPARATOR.'config.xml';
+         require_once 'ZZOSS_Config/Config.php';
+         $config = new ZZOSS_Config;
+         $config->setFile($config_file);
+         $GLOBALS['ZI']['plugin_log'] .=
+             "Reading filerole destination directories from '$config_file'"."\n";
+         $fileroles_dirs = $config->query('/application');
+         $GLOBALS['ZI']['plugin_log'] .=
+             "Extracted data from '$config_file'"."\n";
+     } else {
+         $fileroles_dirs = array(
+                                 $GLOBALS['ZI']['file_role'] => $GLOBALS['ZI']['package_baseinstalldir']
+                                 );
+     }
+     $file_dest = $fileroles_dirs[$GLOBALS['ZI']['file_role']].DIRECTORY_SEPARATOR.$GLOBALS['ZI']['file_baseinstalldir'].$GLOBALS['ZI']['file_name'];
+     
      switch($GLOBALS['ZI']['package_action']){
          case 'remove':
!             unlink($file_dest);
!             $GLOBALS['ZI']['plugin_log'] .= 'deleted '.$file_dest;
              break;
          case 'update':
          case 'install':
!             if(isset($GLOBALS['ZI']['file_role']) && $GLOBALS['ZI']['file_role'] == 'build'){
!                 break;
              } else {
!                 if(!is_dir(dirname($file_dest))){
!                     System::mkDir(array("-p",dirname($file_dest)));
!                     $GLOBALS['ZI']['plugin_log'] .= 'Created directory '.dirname($file_dest)."\n";
!                 }
!                 //ZZOSS_InstallerUtils::mkdir($pathinfo["dirname"]);
!                 //$log .= 'src: '.$src. 'dest: '.$dest."\n";
!                 //echo 'src: '.$src. 'dest: '.$dest."\n<br>";
!                 if(!copy($GLOBALS['ZI']['file_src'],$file_dest)) {
!                     $GLOBALS['ZI']['plugin_log'] .=
!                     'Cannot copy '.$GLOBALS['ZI']['file_src']."\n".
!                     '  to '.$file_dest."\n";
!                 } else {
!                     $GLOBALS['ZI']['plugin_log'] .=
!                         'Copied '.$GLOBALS['ZI']['file_src']."\n".
!                         '  to '.$file_dest."\n";
!                 }
              }
              break;



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click