cvs: pear /PEAR_PackageFileManager PackageFileManager2.php package.php

From: Date: Wed, 19 Oct 2005 00:06:14 +0000
Subject: cvs: pear /PEAR_PackageFileManager PackageFileManager2.php package.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-35693@lists.php.net to get a copy of this message
cellog Tue Oct 18 20:06:14 2005 EDT Modified files: /pear/PEAR_PackageFileManager package.php PackageFileManager2.php Log: add similar mechanism for handling other custom tasks to the one used for replacements, update package.php script http://cvs.php.net/diff.php/pear/PEAR_PackageFileManager/package.php?r1=1.12&r2=1.13&ty=u Index: pear/PEAR_PackageFileManager/package.php diff -u pear/PEAR_PackageFileManager/package.php:1.12 pear/PEAR_PackageFileManager/package.php:1.13 --- pear/PEAR_PackageFileManager/package.php:1.12 Tue Sep 6 19:19:08 2005 +++ pear/PEAR_PackageFileManager/package.php Tue Oct 18 20:06:12 2005 @@ -36,7 +36,7 @@ * @author Greg Beaver <cellog@php.net> * @copyright 2005 The PHP Group * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version CVS: $Id: package.php,v 1.12 2005/09/06 23:19:08 cellog Exp $ + * @version CVS: $Id: package.php,v 1.13 2005/10/19 00:06:12 cellog Exp $ * @link http://pear.php.net/package/PEAR_PackageFileManager * @since File available since Release 1.6.0 */ @@ -48,18 +48,18 @@ 'packagedirectory' => dirname(__FILE__), 'baseinstalldir' => 'PEAR', 'simpleoutput' => true)); -$packagexml->setNotes('Bugfix release -* add addIgnoreToRelease() to replace PEAR_PackageFile_v2_rw::addIgnore()'); +$packagexml->setNotes('New features +* add addUnixeol(), addWindowseol(), initPostinstallScript() and addPostinstallScript()'); $packagexml->addIgnore('*.tgz'); $packagexml->setPackageType('php'); $packagexml->addRelease(); $packagexml->setChannel('pear.php.net'); -$packagexml->setReleaseVersion('1.6.0a3'); +$packagexml->setReleaseVersion('1.6.0a4'); $packagexml->setAPIVersion('1.6.0'); $packagexml->setReleaseStability('alpha'); $packagexml->setAPIStability('alpha'); $packagexml->setPhpDep('4.2.0'); -$packagexml->setPearinstallerDep('1.4.0b1'); +$packagexml->setPearinstallerDep('1.4.3'); $packagexml->addGlobalReplacement('package-info', '@PEAR-VER@', 'version'); $packagexml->generateContents(); if (isset($_GET['make']) || (isset($_SERVER['argv']) && @$_SERVER['argv'][1] == 'make')) { http://cvs.php.net/diff.php/pear/PEAR_PackageFileManager/PackageFileManager2.php?r1=1.10&r2=1.11&ty=u Index: pear/PEAR_PackageFileManager/PackageFileManager2.php diff -u pear/PEAR_PackageFileManager/PackageFileManager2.php:1.10 pear/PEAR_PackageFileManager/PackageFileManager2.php:1.11 --- pear/PEAR_PackageFileManager/PackageFileManager2.php:1.10 Wed Oct 5 00:37:35 2005 +++ pear/PEAR_PackageFileManager/PackageFileManager2.php Tue Oct 18 20:06:12 2005 @@ -17,7 +17,7 @@ * @author Greg Beaver <cellog@php.net> * @copyright 2005 The PHP Group * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version CVS: $Id: PackageFileManager2.php,v 1.10 2005/10/05 04:37:35 cellog Exp $ + * @version CVS: $Id: PackageFileManager2.php,v 1.11 2005/10/19 00:06:12 cellog Exp $ * @link http://pear.php.net/package/PEAR_PackageFileManager * @since File available since Release 1.6.0 */ @@ -51,6 +51,7 @@ define('PEAR_PACKAGEFILEMANAGER2_INVALID_ROLE', 24); define('PEAR_PACKAGEFILEMANAGER2_CVS_PACKAGED', 26); define('PEAR_PACKAGEFILEMANAGER2_NO_PHPCOMPATINFO', 27); +define('PEAR_PACKAGEFILEMANAGER2_INVALID_POSTINSTALLSCRIPT', 28); /**#@-*/ /** * Error messages @@ -95,6 +96,8 @@ 'Package validation failed:%s%s', PEAR_PACKAGEFILEMANAGER2_INVALID_REPLACETYPE => 'Replacement Type must be one of "%s", was passed "%s"', + PEAR_PACKAGEFILEMANAGER2_INVALID_POSTINSTALLSCRIPT => + 'Invalid post-install script task: %s', PEAR_PACKAGEFILEMANAGER2_INVALID_ROLE => 'Invalid file role passed to addRole, must be one of "%s", was passed "%s"', PEAR_PACKAGEFILEMANAGER2_CVS_PACKAGED => @@ -771,6 +774,7 @@ * @param string variable type, either php-const, pear-config or package-info * @param string text to replace in the source file * @param string variable name to use for replacement + * @throws PEAR_PACKAGEFILEMANAGER2_INVALID_REPLACETYPE */ function addReplacement($path, $type, $from, $to) { @@ -789,6 +793,75 @@ } /** + * Convert a file to windows line endings on installation + * + * @param string relative path of file (relative to packagedirectory option) + */ + function addWindowsEol($path) + { + if (!isset($this->_options['replacements'])) { + $this->_options['replacements'] = array(); + } + require_once 'PEAR/Task/Windowseol/rw.php'; + $l = null; + $task = new PEAR_Task_Windowseol_rw($this, $this->_config, $l, ''); + // we'll use this because it will still work + $this->_options['replacements'][$path][] = $task; + } + + /** + * Convert a file to unix line endings on installation + * + * @param string relative path of file (relative to packagedirectory option) + */ + function addUnixEol($path) + { + if (!isset($this->_options['replacements'])) { + $this->_options['replacements'] = array(); + } + require_once 'PEAR/Task/Unixeol/rw.php'; + $l = null; + $task = new PEAR_Task_Unixeol_rw($this, $this->_config, $l, ''); + // we'll use this because it will still work + $this->_options['replacements'][$path][] = $task; + } + + /** + * Get a post-installation task object for manipulation prior to adding it + * + * @param string relative path of file (relative to packagedirectory option) + * @return PEAR_Task_Postinstallscript_rw + */ + function &initPostinstallScript($path) + { + require_once 'PEAR/Task/Postinstallscript/rw.php'; + $task = new PEAR_Task_Postinstallscript_rw($this, $this->_config, $l, + array('attribs' => array('name' => $path, 'role' => 'php'))); + return $task; + } + + /** + * Add post-installation script task to a post-install script. + * + * The script must have been created with {@link initPostinstallScript()} and + * then populated using the API of PEAR_Task_Postinstallscript_rw. + * @param PEAR_Task_Postinstallscript_rw + * @param string relative path of file (relative to packagedirectory option) + * @throws PEAR_PACKAGEFILEMANAGER2_INVALID_POSTINSTALLSCRIPT + */ + function addPostinstallTask($task, $path) + { + if (is_array($res = $task->validate())) { + return $this->raiseError(PEAR_PACKAGEFILEMANAGER2_INVALID_POSTINSTALLSCRIPT, + $res[1]); + } + if (!isset($this->_options['replacements'])) { + $this->_options['replacements'] = array(); + } + $this->_options['replacements'][$path][] = $task; + } + + /** * @return void|PEAR_Error * @throws PEAR_PACKAGEFILEMANAGER_RUN_SETOPTIONS */

« previous php.pear.cvs (#35693) next »