[zi-cvs] packages/com.zzoss.package.instant.lib Instant.php,NONE,1.1 package.xml,NONE,1.1
Sandro Zic <[email protected]> Sat, 03 Apr 2004 16:14:48 +0000
| Newsgroups | gmane.comp.php.zzoss.installer.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/zzossinstaller/packages/com.zzoss.package.instant.lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28324/com.zzoss.package.instant.lib
Added Files:
Instant.php package.xml
Log Message:
library for instant bundle
--- NEW FILE: Instant.php ---
<?php
/*
Copyright (C) 2001-2004 ZZOSS GbR, http://www.zzoss.com
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/**
@version $Id: Instant.php,v 1.1 2004/04/03 16:14:46 ordnas Exp $
@copyright Copyright © 2001-2004 ZZ/OSS GbR, http://www.zzoss.com
@license http://opensource.org/licenses/lgpl-license.php GNU Lesser General Public License
*/
require_once 'PEAR.php';
require_once 'ZZOSS_File/Find.php';
/**
* This class parses the XML config file and provides the objects of the
* XML document.
*
* Extends PEAR XML_Parser class.
*
* @version 1
* @author Sandro Zic <[email protected]>; |
*/
class ZZOSS_PackageInstant extends PEAR {
/**
* The path to the instant tgz.
*/
var $_instant_tgz = '';
/*
* Destructor
*/
function _ZZOSS_PackageInstant()
{
// clean up temporary bundle tgz
if ($this->_instant_tgz != ''){
@unlink($this->_instant_tgz);
}
$this->_PEAR();
}
function create($instant_name, $installer_dir, $bundles = array())
{
// check if bundles have been passed as array
if(!is_array($bundles)){
return PEAR::raiseError('Bundles must be provided in a numeric array.');
}
// check if the installer dir exists
if(!is_dir($installer_dir)){
return PEAR::raiseError("'$installer_dir' is not a directory.");
}
// check if installer dir is readable
if(!is_readable($installer_dir.DIRECTORY_SEPARATOR.'.')){
return PEAR::raiseError("Cannot read '$installer_dir'.");
}
// reset previous instant tgz
$this->_instant_tgz = '';
// The temporary instant tgz
$instant_tgz_tmp = System::tmpdir().DIRECTORY_SEPARATOR.$instant_name.'.tgz';
// Grab all installer files from the various installer directories.
$filter_dirs = array('CVS', 'bundles');
// TODO: .bak
$filter_files = '/[~#]$/i';
// Create tar file list.
$zi_filefind = new ZZOSS_FileFind;
$zi_filefind->setFilterDirs($filter_dirs);
$zi_filefind->setFilterFiles($filter_files);
$tar_list = $zi_filefind->listFiles($installer_dir);
/*
echo '<pre>';
print_r($tar_list);
echo '</pre>';
*/
$tar = new Archive_Tar($instant_tgz_tmp);
//$tar->setErrorHandling(PEAR_ERROR_PRINT);
$cwd = getcwd();
chdir($installer_dir);
$tar->createModify($tar_list, $instant_name.'/installer/');
chdir($cwd);
// add the bundles to the temporary instant tgz
if(count($bundles)){
foreach($bundles as $bundle_tgz){
if(!file_exists($bundle_tgz)){
PEAR::raiseError("The bundle '$bundle_tgz' does not exist.");
}
$tar->addModify($bundle_tgz, $instant_name.'/installer/bundles/', dirname($bundle_tgz));
}
}
// We use PEAR to clean up the temporary bundle upon shutdown
// with the destructor.
// Notice that ZZOSS_Package extends PEAR!
$this->PEAR();
$this->_instant_tgz = $instant_tgz_tmp;
return $this->_instant_tgz;
}
}
?>
--- NEW FILE: package.xml ---
<?xml version="1.0" encoding="ISO-8859-1" ?>
<package version="1.0"
xmlns="http://www.zzoss.com/NS/installer/package/">
<name>com.zzoss.package.instant.lib</name>
<summary>Classes to manage instant ZZ/OSS Installer or PEAR packages.</summary>
<description>Method for instant bundle.</description>
<maintainers>
<maintainer>
<user>czonsius</user>
<name>Christian Zonsius</name>
<email>[email protected]</email>
<role>developer</role>
</maintainer>
<maintainer>
<user>ordnas</user>
<name>Sandro Zic</name>
<email>[email protected]</email>
<role>lead</role>
</maintainer>
</maintainers>
<release>
<version>1.0.0</version>
<date>{zi_release_date}</date>
<license url="http://www.gnu.org/licenses/lgpl.txt" version="2">LGPL</license>
<state>stable</state>
<notes>
<![CDATA[
Initial release.
]]>
</notes>
<copyright>
<holder year="2004" url="http://www.zzoss.com">ZZ/OSS</holder>
</copyright>
<filelist>
<file role="php" baseinstalldir="ZZOSS_Package" name="Instant.php"/>
</filelist>
<deps>
<dep type="pkg" rel="ge" version="1.3b3">PEAR</dep>
<dep type="pkg" rel="ge" version="1.1">Archive_Tar</dep>
<dep type="pkg" rel="ge" version="0.6">com.zzoss.filefind.lib</dep>
</deps>
</release>
</package>
-------------------------------------------------------
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