| Line 2... |
Line 2... |
| 2 |
/**
|
2 |
/**
|
| 3 |
* PEAR_Command_Pickle (pickle command)
|
3 |
* PEAR_Command_Pickle (pickle command)
|
| 4 |
*
|
4 |
*
|
| 5 |
* PHP versions 4 and 5
|
5 |
* PHP versions 4 and 5
|
| 6 |
*
|
6 |
*
|
| 7 |
* LICENSE: This source file is subject to version 3.0 of the PHP license
|
- |
|
| 8 |
* that is available through the world-wide-web at the following URI:
|
- |
|
| 9 |
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
|
- |
|
| 10 |
* the PHP License and are unable to obtain it through the web, please
|
- |
|
| 11 |
* send a note to license@php.net so we can mail you a copy immediately.
|
- |
|
| 12 |
*
|
- |
|
| 13 |
* @category pear
|
7 |
* @category pear
|
| 14 |
* @package PEAR
|
8 |
* @package PEAR
|
| 15 |
* @author Greg Beaver <cellog@php.net>
|
9 |
* @author Greg Beaver <cellog@php.net>
|
| 16 |
* @copyright 2005-2006 The PHP Group
|
10 |
* @copyright 2005-2009 The Authors
|
| 17 |
* @license http://www.php.net/license/3_0.txt PHP License 3.0
|
11 |
* @license http://opensource.org/licenses/bsd-license.php New BSD License
|
| 18 |
* @version CVS: $Id: Pickle.php,v 1.6 2006/05/12 02:38:58 cellog Exp $
|
- |
|
| 19 |
* @link http://pear.php.net/package/PEAR
|
12 |
* @link http://pear.php.net/package/PEAR
|
| 20 |
* @since File available since Release 1.4.1
|
13 |
* @since File available since Release 1.4.1
|
| 21 |
*/
|
14 |
*/
|
| Line 22... |
Line 15... |
| 22 |
|
15 |
|
| Line 29... |
Line 22... |
| 29 |
* PEAR commands for login/logout
|
22 |
* PEAR commands for login/logout
|
| 30 |
*
|
23 |
*
|
| 31 |
* @category pear
|
24 |
* @category pear
|
| 32 |
* @package PEAR
|
25 |
* @package PEAR
|
| 33 |
* @author Greg Beaver <cellog@php.net>
|
26 |
* @author Greg Beaver <cellog@php.net>
|
| 34 |
* @copyright 2005-2006 The PHP Group
|
27 |
* @copyright 2005-2009 The Authors
|
| 35 |
* @license http://www.php.net/license/3_0.txt PHP License 3.0
|
28 |
* @license http://opensource.org/licenses/bsd-license.php New BSD License
|
| 36 |
* @version Release: 1.5.1
|
29 |
* @version Release: 1.10.1
|
| 37 |
* @link http://pear.php.net/package/PEAR
|
30 |
* @link http://pear.php.net/package/PEAR
|
| 38 |
* @since Class available since Release 1.4.1
|
31 |
* @since Class available since Release 1.4.1
|
| 39 |
*/
|
32 |
*/
|
| Line 40... |
Line 33... |
| 40 |
|
33 |
|
| Line 80... |
Line 73... |
| 80 |
/**
|
73 |
/**
|
| 81 |
* PEAR_Command_Package constructor.
|
74 |
* PEAR_Command_Package constructor.
|
| 82 |
*
|
75 |
*
|
| 83 |
* @access public
|
76 |
* @access public
|
| 84 |
*/
|
77 |
*/
|
| 85 |
function PEAR_Command_Pickle(&$ui, &$config)
|
78 |
function __construct(&$ui, &$config)
|
| 86 |
{
|
79 |
{
|
| 87 |
parent::PEAR_Command_Common($ui, $config);
|
80 |
parent::__construct($ui, $config);
|
| 88 |
}
|
81 |
}
|
| Line 89... |
Line -... |
| 89 |
|
- |
|
| 90 |
|
82 |
|
| 91 |
/**
|
83 |
/**
|
| 92 |
* For unit-testing ease
|
84 |
* For unit-testing ease
|
| 93 |
*
|
85 |
*
|
| 94 |
* @return PEAR_Packager
|
86 |
* @return PEAR_Packager
|
| 95 |
*/
|
87 |
*/
|
| 96 |
function &getPackager()
|
88 |
function &getPackager()
|
| 97 |
{
|
89 |
{
|
| 98 |
if (!class_exists('PEAR_Packager')) {
|
90 |
if (!class_exists('PEAR_Packager')) {
|
| 99 |
require_once 'PEAR/Packager.php';
|
91 |
require_once 'PEAR/Packager.php';
|
| - |
|
92 |
}
|
| 100 |
}
|
93 |
|
| 101 |
$a = &new PEAR_Packager;
|
94 |
$a = new PEAR_Packager;
|
| 102 |
return $a;
|
95 |
return $a;
|
| Line 103... |
Line 96... |
| 103 |
}
|
96 |
}
|
| 104 |
|
97 |
|
| Line 108... |
Line 101... |
| 108 |
* @param PEAR_Config $config
|
101 |
* @param PEAR_Config $config
|
| 109 |
* @param bool $debug
|
102 |
* @param bool $debug
|
| 110 |
* @param string|null $tmpdir
|
103 |
* @param string|null $tmpdir
|
| 111 |
* @return PEAR_PackageFile
|
104 |
* @return PEAR_PackageFile
|
| 112 |
*/
|
105 |
*/
|
| 113 |
function &getPackageFile($config, $debug = false, $tmpdir = null)
|
106 |
function &getPackageFile($config, $debug = false)
|
| 114 |
{
|
107 |
{
|
| 115 |
if (!class_exists('PEAR_Common')) {
|
108 |
if (!class_exists('PEAR_Common')) {
|
| 116 |
require_once 'PEAR/Common.php';
|
109 |
require_once 'PEAR/Common.php';
|
| 117 |
}
|
110 |
}
|
| - |
|
111 |
|
| 118 |
if (!class_exists('PEAR/PackageFile.php')) {
|
112 |
if (!class_exists('PEAR_PackageFile')) {
|
| 119 |
require_once 'PEAR/PackageFile.php';
|
113 |
require_once 'PEAR/PackageFile.php';
|
| 120 |
}
|
114 |
}
|
| - |
|
115 |
|
| 121 |
$a = &new PEAR_PackageFile($config, $debug, $tmpdir);
|
116 |
$a = new PEAR_PackageFile($config, $debug);
|
| 122 |
$common = new PEAR_Common;
|
117 |
$common = new PEAR_Common;
|
| 123 |
$common->ui = $this->ui;
|
118 |
$common->ui = $this->ui;
|
| 124 |
$a->setLogger($common);
|
119 |
$a->setLogger($common);
|
| 125 |
return $a;
|
120 |
return $a;
|
| 126 |
}
|
121 |
}
|
| Line 131... |
Line 126... |
| 131 |
$pkginfofile = isset($params[0]) ? $params[0] : 'package2.xml';
|
126 |
$pkginfofile = isset($params[0]) ? $params[0] : 'package2.xml';
|
| 132 |
$packager = &$this->getPackager();
|
127 |
$packager = &$this->getPackager();
|
| 133 |
if (PEAR::isError($err = $this->_convertPackage($pkginfofile))) {
|
128 |
if (PEAR::isError($err = $this->_convertPackage($pkginfofile))) {
|
| 134 |
return $err;
|
129 |
return $err;
|
| 135 |
}
|
130 |
}
|
| - |
|
131 |
|
| 136 |
$compress = empty($options['nocompress']) ? true : false;
|
132 |
$compress = empty($options['nocompress']) ? true : false;
|
| 137 |
$result = $packager->package($pkginfofile, $compress, 'package.xml');
|
133 |
$result = $packager->package($pkginfofile, $compress, 'package.xml');
|
| 138 |
if (PEAR::isError($result)) {
|
134 |
if (PEAR::isError($result)) {
|
| 139 |
return $this->raiseError($result);
|
135 |
return $this->raiseError($result);
|
| 140 |
}
|
136 |
}
|
| - |
|
137 |
|
| 141 |
// Don't want output, only the package file name just created
|
138 |
// Don't want output, only the package file name just created
|
| 142 |
if (isset($options['showname'])) {
|
139 |
if (isset($options['showname'])) {
|
| 143 |
$this->ui->outputData($result, $command);
|
140 |
$this->ui->outputData($result, $command);
|
| 144 |
}
|
141 |
}
|
| - |
|
142 |
|
| 145 |
return true;
|
143 |
return true;
|
| 146 |
}
|
144 |
}
|
| Line 147... |
Line 145... |
| 147 |
|
145 |
|
| 148 |
function _convertPackage($packagexml)
|
146 |
function _convertPackage($packagexml)
|
| Line 151... |
Line 149... |
| 151 |
$pf2 = &$pkg->fromPackageFile($packagexml, PEAR_VALIDATE_NORMAL);
|
149 |
$pf2 = &$pkg->fromPackageFile($packagexml, PEAR_VALIDATE_NORMAL);
|
| 152 |
if (!is_a($pf2, 'PEAR_PackageFile_v2')) {
|
150 |
if (!is_a($pf2, 'PEAR_PackageFile_v2')) {
|
| 153 |
return $this->raiseError('Cannot process "' .
|
151 |
return $this->raiseError('Cannot process "' .
|
| 154 |
$packagexml . '", is not a package.xml 2.0');
|
152 |
$packagexml . '", is not a package.xml 2.0');
|
| 155 |
}
|
153 |
}
|
| - |
|
154 |
|
| 156 |
require_once 'PEAR/PackageFile/v1.php';
|
155 |
require_once 'PEAR/PackageFile/v1.php';
|
| 157 |
$pf = new PEAR_PackageFile_v1;
|
156 |
$pf = new PEAR_PackageFile_v1;
|
| 158 |
$pf->setConfig($this->config);
|
157 |
$pf->setConfig($this->config);
|
| 159 |
if ($pf2->getPackageType() != 'extsrc' && $pf2->getPackageType() != 'zendextsrc') {
|
158 |
if ($pf2->getPackageType() != 'extsrc' && $pf2->getPackageType() != 'zendextsrc') {
|
| 160 |
return $this->raiseError('Cannot safely convert "' . $packagexml .
|
159 |
return $this->raiseError('Cannot safely convert "' . $packagexml .
|
| 161 |
'", is not an extension source package. Using a PEAR_PackageFileManager-based ' .
|
160 |
'", is not an extension source package. Using a PEAR_PackageFileManager-based ' .
|
| 162 |
'script is an option');
|
161 |
'script is an option');
|
| 163 |
}
|
162 |
}
|
| - |
|
163 |
|
| 164 |
if (is_array($pf2->getUsesRole())) {
|
164 |
if (is_array($pf2->getUsesRole())) {
|
| 165 |
return $this->raiseError('Cannot safely convert "' . $packagexml .
|
165 |
return $this->raiseError('Cannot safely convert "' . $packagexml .
|
| 166 |
'", contains custom roles. Using a PEAR_PackageFileManager-based script or ' .
|
166 |
'", contains custom roles. Using a PEAR_PackageFileManager-based script or ' .
|
| 167 |
'the convert command is an option');
|
167 |
'the convert command is an option');
|
| 168 |
}
|
168 |
}
|
| - |
|
169 |
|
| 169 |
if (is_array($pf2->getUsesTask())) {
|
170 |
if (is_array($pf2->getUsesTask())) {
|
| 170 |
return $this->raiseError('Cannot safely convert "' . $packagexml .
|
171 |
return $this->raiseError('Cannot safely convert "' . $packagexml .
|
| 171 |
'", contains custom tasks. Using a PEAR_PackageFileManager-based script or ' .
|
172 |
'", contains custom tasks. Using a PEAR_PackageFileManager-based script or ' .
|
| 172 |
'the convert command is an option');
|
173 |
'the convert command is an option');
|
| 173 |
}
|
174 |
}
|
| - |
|
175 |
|
| 174 |
$deps = $pf2->getDependencies();
|
176 |
$deps = $pf2->getDependencies();
|
| 175 |
if (isset($deps['group'])) {
|
177 |
if (isset($deps['group'])) {
|
| 176 |
return $this->raiseError('Cannot safely convert "' . $packagexml .
|
178 |
return $this->raiseError('Cannot safely convert "' . $packagexml .
|
| 177 |
'", contains dependency groups. Using a PEAR_PackageFileManager-based script ' .
|
179 |
'", contains dependency groups. Using a PEAR_PackageFileManager-based script ' .
|
| 178 |
'or the convert command is an option');
|
180 |
'or the convert command is an option');
|
| 179 |
}
|
181 |
}
|
| - |
|
182 |
|
| 180 |
if (isset($deps['required']['subpackage']) ||
|
183 |
if (isset($deps['required']['subpackage']) ||
|
| 181 |
isset($deps['optional']['subpackage'])) {
|
184 |
isset($deps['optional']['subpackage'])) {
|
| 182 |
return $this->raiseError('Cannot safely convert "' . $packagexml .
|
185 |
return $this->raiseError('Cannot safely convert "' . $packagexml .
|
| 183 |
'", contains subpackage dependencies. Using a PEAR_PackageFileManager-based '.
|
186 |
'", contains subpackage dependencies. Using a PEAR_PackageFileManager-based '.
|
| 184 |
'script is an option');
|
187 |
'script is an option');
|
| 185 |
}
|
188 |
}
|
| - |
|
189 |
|
| 186 |
if (isset($deps['required']['os'])) {
|
190 |
if (isset($deps['required']['os'])) {
|
| 187 |
return $this->raiseError('Cannot safely convert "' . $packagexml .
|
191 |
return $this->raiseError('Cannot safely convert "' . $packagexml .
|
| 188 |
'", contains os dependencies. Using a PEAR_PackageFileManager-based '.
|
192 |
'", contains os dependencies. Using a PEAR_PackageFileManager-based '.
|
| 189 |
'script is an option');
|
193 |
'script is an option');
|
| 190 |
}
|
194 |
}
|
| - |
|
195 |
|
| 191 |
if (isset($deps['required']['arch'])) {
|
196 |
if (isset($deps['required']['arch'])) {
|
| 192 |
return $this->raiseError('Cannot safely convert "' . $packagexml .
|
197 |
return $this->raiseError('Cannot safely convert "' . $packagexml .
|
| 193 |
'", contains arch dependencies. Using a PEAR_PackageFileManager-based '.
|
198 |
'", contains arch dependencies. Using a PEAR_PackageFileManager-based '.
|
| 194 |
'script is an option');
|
199 |
'script is an option');
|
| 195 |
}
|
200 |
}
|
| - |
|
201 |
|
| 196 |
$pf->setPackage($pf2->getPackage());
|
202 |
$pf->setPackage($pf2->getPackage());
|
| 197 |
$pf->setSummary($pf2->getSummary());
|
203 |
$pf->setSummary($pf2->getSummary());
|
| 198 |
$pf->setDescription($pf2->getDescription());
|
204 |
$pf->setDescription($pf2->getDescription());
|
| 199 |
foreach ($pf2->getMaintainers() as $maintainer) {
|
205 |
foreach ($pf2->getMaintainers() as $maintainer) {
|
| 200 |
$pf->addMaintainer($maintainer['role'], $maintainer['handle'],
|
206 |
$pf->addMaintainer($maintainer['role'], $maintainer['handle'],
|
| 201 |
$maintainer['name'], $maintainer['email']);
|
207 |
$maintainer['name'], $maintainer['email']);
|
| 202 |
}
|
208 |
}
|
| - |
|
209 |
|
| 203 |
$pf->setVersion($pf2->getVersion());
|
210 |
$pf->setVersion($pf2->getVersion());
|
| 204 |
$pf->setDate($pf2->getDate());
|
211 |
$pf->setDate($pf2->getDate());
|
| 205 |
$pf->setLicense($pf2->getLicense());
|
212 |
$pf->setLicense($pf2->getLicense());
|
| 206 |
$pf->setState($pf2->getState());
|
213 |
$pf->setState($pf2->getState());
|
| 207 |
$pf->setNotes($pf2->getNotes());
|
214 |
$pf->setNotes($pf2->getNotes());
|
| 208 |
$pf->addPhpDep($deps['required']['php']['min'], 'ge');
|
215 |
$pf->addPhpDep($deps['required']['php']['min'], 'ge');
|
| 209 |
if (isset($deps['required']['php']['max'])) {
|
216 |
if (isset($deps['required']['php']['max'])) {
|
| 210 |
$pf->addPhpDep($deps['required']['php']['max'], 'le');
|
217 |
$pf->addPhpDep($deps['required']['php']['max'], 'le');
|
| 211 |
}
|
218 |
}
|
| - |
|
219 |
|
| 212 |
if (isset($deps['required']['package'])) {
|
220 |
if (isset($deps['required']['package'])) {
|
| 213 |
if (!isset($deps['required']['package'][0])) {
|
221 |
if (!isset($deps['required']['package'][0])) {
|
| 214 |
$deps['required']['package'] = array($deps['required']['package']);
|
222 |
$deps['required']['package'] = array($deps['required']['package']);
|
| 215 |
}
|
223 |
}
|
| - |
|
224 |
|
| 216 |
foreach ($deps['required']['package'] as $dep) {
|
225 |
foreach ($deps['required']['package'] as $dep) {
|
| 217 |
if (!isset($dep['channel'])) {
|
226 |
if (!isset($dep['channel'])) {
|
| 218 |
return $this->raiseError('Cannot safely convert "' . $packagexml . '"' .
|
227 |
return $this->raiseError('Cannot safely convert "' . $packagexml . '"' .
|
| 219 |
' contains uri-based dependency on a package. Using a ' .
|
228 |
' contains uri-based dependency on a package. Using a ' .
|
| 220 |
'PEAR_PackageFileManager-based script is an option');
|
229 |
'PEAR_PackageFileManager-based script is an option');
|
| 221 |
}
|
230 |
}
|
| - |
|
231 |
|
| - |
|
232 |
if ($dep['channel'] != 'pear.php.net'
|
| - |
|
233 |
&& $dep['channel'] != 'pecl.php.net'
|
| 222 |
if ($dep['channel'] != 'pear.php.net' && $dep['channel'] != 'pecl.php.net') {
|
234 |
&& $dep['channel'] != 'doc.php.net') {
|
| 223 |
return $this->raiseError('Cannot safely convert "' . $packagexml . '"' .
|
235 |
return $this->raiseError('Cannot safely convert "' . $packagexml . '"' .
|
| 224 |
' contains dependency on a non-standard channel package. Using a ' .
|
236 |
' contains dependency on a non-standard channel package. Using a ' .
|
| 225 |
'PEAR_PackageFileManager-based script is an option');
|
237 |
'PEAR_PackageFileManager-based script is an option');
|
| 226 |
}
|
238 |
}
|
| - |
|
239 |
|
| 227 |
if (isset($dep['conflicts'])) {
|
240 |
if (isset($dep['conflicts'])) {
|
| 228 |
return $this->raiseError('Cannot safely convert "' . $packagexml . '"' .
|
241 |
return $this->raiseError('Cannot safely convert "' . $packagexml . '"' .
|
| 229 |
' contains conflicts dependency. Using a ' .
|
242 |
' contains conflicts dependency. Using a ' .
|
| 230 |
'PEAR_PackageFileManager-based script is an option');
|
243 |
'PEAR_PackageFileManager-based script is an option');
|
| 231 |
}
|
244 |
}
|
| - |
|
245 |
|
| 232 |
if (isset($dep['exclude'])) {
|
246 |
if (isset($dep['exclude'])) {
|
| 233 |
$this->ui->outputData('WARNING: exclude tags are ignored in conversion');
|
247 |
$this->ui->outputData('WARNING: exclude tags are ignored in conversion');
|
| 234 |
}
|
248 |
}
|
| - |
|
249 |
|
| 235 |
if (isset($dep['min'])) {
|
250 |
if (isset($dep['min'])) {
|
| 236 |
$pf->addPackageDep($dep['name'], $dep['min'], 'ge');
|
251 |
$pf->addPackageDep($dep['name'], $dep['min'], 'ge');
|
| 237 |
}
|
252 |
}
|
| - |
|
253 |
|
| 238 |
if (isset($dep['max'])) {
|
254 |
if (isset($dep['max'])) {
|
| 239 |
$pf->addPackageDep($dep['name'], $dep['max'], 'le');
|
255 |
$pf->addPackageDep($dep['name'], $dep['max'], 'le');
|
| 240 |
}
|
256 |
}
|
| 241 |
}
|
257 |
}
|
| 242 |
}
|
258 |
}
|
| - |
|
259 |
|
| 243 |
if (isset($deps['required']['extension'])) {
|
260 |
if (isset($deps['required']['extension'])) {
|
| 244 |
if (!isset($deps['required']['extension'][0])) {
|
261 |
if (!isset($deps['required']['extension'][0])) {
|
| 245 |
$deps['required']['extension'] = array($deps['required']['extension']);
|
262 |
$deps['required']['extension'] = array($deps['required']['extension']);
|
| 246 |
}
|
263 |
}
|
| - |
|
264 |
|
| 247 |
foreach ($deps['required']['extension'] as $dep) {
|
265 |
foreach ($deps['required']['extension'] as $dep) {
|
| 248 |
if (isset($dep['conflicts'])) {
|
266 |
if (isset($dep['conflicts'])) {
|
| 249 |
return $this->raiseError('Cannot safely convert "' . $packagexml . '"' .
|
267 |
return $this->raiseError('Cannot safely convert "' . $packagexml . '"' .
|
| 250 |
' contains conflicts dependency. Using a ' .
|
268 |
' contains conflicts dependency. Using a ' .
|
| 251 |
'PEAR_PackageFileManager-based script is an option');
|
269 |
'PEAR_PackageFileManager-based script is an option');
|
| 252 |
}
|
270 |
}
|
| - |
|
271 |
|
| 253 |
if (isset($dep['exclude'])) {
|
272 |
if (isset($dep['exclude'])) {
|
| 254 |
$this->ui->outputData('WARNING: exclude tags are ignored in conversion');
|
273 |
$this->ui->outputData('WARNING: exclude tags are ignored in conversion');
|
| 255 |
}
|
274 |
}
|
| - |
|
275 |
|
| 256 |
if (isset($dep['min'])) {
|
276 |
if (isset($dep['min'])) {
|
| 257 |
$pf->addExtensionDep($dep['name'], $dep['min'], 'ge');
|
277 |
$pf->addExtensionDep($dep['name'], $dep['min'], 'ge');
|
| 258 |
}
|
278 |
}
|
| - |
|
279 |
|
| 259 |
if (isset($dep['max'])) {
|
280 |
if (isset($dep['max'])) {
|
| 260 |
$pf->addExtensionDep($dep['name'], $dep['max'], 'le');
|
281 |
$pf->addExtensionDep($dep['name'], $dep['max'], 'le');
|
| 261 |
}
|
282 |
}
|
| 262 |
}
|
283 |
}
|
| 263 |
}
|
284 |
}
|
| - |
|
285 |
|
| 264 |
if (isset($deps['optional']['package'])) {
|
286 |
if (isset($deps['optional']['package'])) {
|
| 265 |
if (!isset($deps['optional']['package'][0])) {
|
287 |
if (!isset($deps['optional']['package'][0])) {
|
| 266 |
$deps['optional']['package'] = array($deps['optional']['package']);
|
288 |
$deps['optional']['package'] = array($deps['optional']['package']);
|
| 267 |
}
|
289 |
}
|
| - |
|
290 |
|
| 268 |
foreach ($deps['optional']['package'] as $dep) {
|
291 |
foreach ($deps['optional']['package'] as $dep) {
|
| 269 |
if (!isset($dep['channel'])) {
|
292 |
if (!isset($dep['channel'])) {
|
| 270 |
return $this->raiseError('Cannot safely convert "' . $packagexml . '"' .
|
293 |
return $this->raiseError('Cannot safely convert "' . $packagexml . '"' .
|
| 271 |
' contains uri-based dependency on a package. Using a ' .
|
294 |
' contains uri-based dependency on a package. Using a ' .
|
| 272 |
'PEAR_PackageFileManager-based script is an option');
|
295 |
'PEAR_PackageFileManager-based script is an option');
|
| 273 |
}
|
296 |
}
|
| - |
|
297 |
|
| - |
|
298 |
if ($dep['channel'] != 'pear.php.net'
|
| - |
|
299 |
&& $dep['channel'] != 'pecl.php.net'
|
| 274 |
if ($dep['channel'] != 'pear.php.net' && $dep['channel'] != 'pecl.php.net') {
|
300 |
&& $dep['channel'] != 'doc.php.net') {
|
| 275 |
return $this->raiseError('Cannot safely convert "' . $packagexml . '"' .
|
301 |
return $this->raiseError('Cannot safely convert "' . $packagexml . '"' .
|
| 276 |
' contains dependency on a non-standard channel package. Using a ' .
|
302 |
' contains dependency on a non-standard channel package. Using a ' .
|
| 277 |
'PEAR_PackageFileManager-based script is an option');
|
303 |
'PEAR_PackageFileManager-based script is an option');
|
| 278 |
}
|
304 |
}
|
| - |
|
305 |
|
| 279 |
if (isset($dep['exclude'])) {
|
306 |
if (isset($dep['exclude'])) {
|
| 280 |
$this->ui->outputData('WARNING: exclude tags are ignored in conversion');
|
307 |
$this->ui->outputData('WARNING: exclude tags are ignored in conversion');
|
| 281 |
}
|
308 |
}
|
| - |
|
309 |
|
| 282 |
if (isset($dep['min'])) {
|
310 |
if (isset($dep['min'])) {
|
| 283 |
$pf->addPackageDep($dep['name'], $dep['min'], 'ge', 'yes');
|
311 |
$pf->addPackageDep($dep['name'], $dep['min'], 'ge', 'yes');
|
| 284 |
}
|
312 |
}
|
| - |
|
313 |
|
| 285 |
if (isset($dep['max'])) {
|
314 |
if (isset($dep['max'])) {
|
| 286 |
$pf->addPackageDep($dep['name'], $dep['max'], 'le', 'yes');
|
315 |
$pf->addPackageDep($dep['name'], $dep['max'], 'le', 'yes');
|
| 287 |
}
|
316 |
}
|
| 288 |
}
|
317 |
}
|
| 289 |
}
|
318 |
}
|
| - |
|
319 |
|
| 290 |
if (isset($deps['optional']['extension'])) {
|
320 |
if (isset($deps['optional']['extension'])) {
|
| 291 |
if (!isset($deps['optional']['extension'][0])) {
|
321 |
if (!isset($deps['optional']['extension'][0])) {
|
| 292 |
$deps['optional']['extension'] = array($deps['optional']['extension']);
|
322 |
$deps['optional']['extension'] = array($deps['optional']['extension']);
|
| 293 |
}
|
323 |
}
|
| - |
|
324 |
|
| 294 |
foreach ($deps['optional']['extension'] as $dep) {
|
325 |
foreach ($deps['optional']['extension'] as $dep) {
|
| 295 |
if (isset($dep['exclude'])) {
|
326 |
if (isset($dep['exclude'])) {
|
| 296 |
$this->ui->outputData('WARNING: exclude tags are ignored in conversion');
|
327 |
$this->ui->outputData('WARNING: exclude tags are ignored in conversion');
|
| 297 |
}
|
328 |
}
|
| - |
|
329 |
|
| 298 |
if (isset($dep['min'])) {
|
330 |
if (isset($dep['min'])) {
|
| 299 |
$pf->addExtensionDep($dep['name'], $dep['min'], 'ge', 'yes');
|
331 |
$pf->addExtensionDep($dep['name'], $dep['min'], 'ge', 'yes');
|
| 300 |
}
|
332 |
}
|
| - |
|
333 |
|
| 301 |
if (isset($dep['max'])) {
|
334 |
if (isset($dep['max'])) {
|
| 302 |
$pf->addExtensionDep($dep['name'], $dep['max'], 'le', 'yes');
|
335 |
$pf->addExtensionDep($dep['name'], $dep['max'], 'le', 'yes');
|
| 303 |
}
|
336 |
}
|
| 304 |
}
|
337 |
}
|
| 305 |
}
|
338 |
}
|
| - |
|
339 |
|
| 306 |
$contents = $pf2->getContents();
|
340 |
$contents = $pf2->getContents();
|
| 307 |
$release = $pf2->getReleases();
|
341 |
$release = $pf2->getReleases();
|
| 308 |
if (isset($releases[0])) {
|
342 |
if (isset($releases[0])) {
|
| 309 |
return $this->raiseError('Cannot safely process "' . $packagexml . '" contains '
|
343 |
return $this->raiseError('Cannot safely process "' . $packagexml . '" contains '
|
| 310 |
. 'multiple extsrcrelease/zendextsrcrelease tags. Using a PEAR_PackageFileManager-based script ' .
|
344 |
. 'multiple extsrcrelease/zendextsrcrelease tags. Using a PEAR_PackageFileManager-based script ' .
|
| 311 |
'or the convert command is an option');
|
345 |
'or the convert command is an option');
|
| 312 |
}
|
346 |
}
|
| - |
|
347 |
|
| 313 |
if ($configoptions = $pf2->getConfigureOptions()) {
|
348 |
if ($configoptions = $pf2->getConfigureOptions()) {
|
| 314 |
foreach ($configoptions as $option) {
|
349 |
foreach ($configoptions as $option) {
|
| 315 |
$pf->addConfigureOption($option['name'], $option['prompt'],
|
350 |
$default = isset($option['default']) ? $option['default'] : false;
|
| 316 |
isset($option['default']) ? $option['default'] : false);
|
351 |
$pf->addConfigureOption($option['name'], $option['prompt'], $default);
|
| 317 |
}
|
352 |
}
|
| 318 |
}
|
353 |
}
|
| - |
|
354 |
|
| 319 |
if (isset($release['filelist']['ignore'])) {
|
355 |
if (isset($release['filelist']['ignore'])) {
|
| 320 |
return $this->raiseError('Cannot safely process "' . $packagexml . '" contains '
|
356 |
return $this->raiseError('Cannot safely process "' . $packagexml . '" contains '
|
| 321 |
. 'ignore tags. Using a PEAR_PackageFileManager-based script or the convert' .
|
357 |
. 'ignore tags. Using a PEAR_PackageFileManager-based script or the convert' .
|
| 322 |
' command is an option');
|
358 |
' command is an option');
|
| 323 |
}
|
359 |
}
|
| - |
|
360 |
|
| 324 |
if (isset($release['filelist']['install']) &&
|
361 |
if (isset($release['filelist']['install']) &&
|
| 325 |
!isset($release['filelist']['install'][0])) {
|
362 |
!isset($release['filelist']['install'][0])) {
|
| 326 |
$release['filelist']['install'] = array($release['filelist']['install']);
|
363 |
$release['filelist']['install'] = array($release['filelist']['install']);
|
| 327 |
}
|
364 |
}
|
| - |
|
365 |
|
| 328 |
if (isset($contents['dir']['attribs']['baseinstalldir'])) {
|
366 |
if (isset($contents['dir']['attribs']['baseinstalldir'])) {
|
| 329 |
$baseinstalldir = $contents['dir']['attribs']['baseinstalldir'];
|
367 |
$baseinstalldir = $contents['dir']['attribs']['baseinstalldir'];
|
| 330 |
} else {
|
368 |
} else {
|
| 331 |
$baseinstalldir = false;
|
369 |
$baseinstalldir = false;
|
| 332 |
}
|
370 |
}
|
| - |
|
371 |
|
| 333 |
if (!isset($contents['dir']['file'][0])) {
|
372 |
if (!isset($contents['dir']['file'][0])) {
|
| 334 |
$contents['dir']['file'] = array($contents['dir']['file']);
|
373 |
$contents['dir']['file'] = array($contents['dir']['file']);
|
| 335 |
}
|
374 |
}
|
| - |
|
375 |
|
| 336 |
foreach ($contents['dir']['file'] as $file) {
|
376 |
foreach ($contents['dir']['file'] as $file) {
|
| 337 |
if ($baseinstalldir && !isset($file['attribs']['baseinstalldir'])) {
|
377 |
if ($baseinstalldir && !isset($file['attribs']['baseinstalldir'])) {
|
| 338 |
$file['attribs']['baseinstalldir'] = $baseinstalldir;
|
378 |
$file['attribs']['baseinstalldir'] = $baseinstalldir;
|
| 339 |
}
|
379 |
}
|
| - |
|
380 |
|
| 340 |
$processFile = $file;
|
381 |
$processFile = $file;
|
| 341 |
unset($processFile['attribs']);
|
382 |
unset($processFile['attribs']);
|
| 342 |
if (count($processFile)) {
|
383 |
if (count($processFile)) {
|
| 343 |
foreach ($processFile as $name => $task) {
|
384 |
foreach ($processFile as $name => $task) {
|
| 344 |
if ($name != $pf2->getTasksNs() . ':replace') {
|
385 |
if ($name != $pf2->getTasksNs() . ':replace') {
|
| Line 347... |
Line 388... |
| 347 |
'PEAR_PackageFileManager-based script is an option.');
|
388 |
'PEAR_PackageFileManager-based script is an option.');
|
| 348 |
}
|
389 |
}
|
| 349 |
$file['attribs']['replace'][] = $task;
|
390 |
$file['attribs']['replace'][] = $task;
|
| 350 |
}
|
391 |
}
|
| 351 |
}
|
392 |
}
|
| - |
|
393 |
|
| 352 |
if (!in_array($file['attribs']['role'], PEAR_Common::getFileRoles())) {
|
394 |
if (!in_array($file['attribs']['role'], PEAR_Common::getFileRoles())) {
|
| 353 |
return $this->raiseError('Cannot safely convert "' . $packagexml .
|
395 |
return $this->raiseError('Cannot safely convert "' . $packagexml .
|
| 354 |
'", contains custom roles. Using a PEAR_PackageFileManager-based script ' .
|
396 |
'", contains custom roles. Using a PEAR_PackageFileManager-based script ' .
|
| 355 |
'or the convert command is an option');
|
397 |
'or the convert command is an option');
|
| 356 |
}
|
398 |
}
|
| - |
|
399 |
|
| 357 |
if (isset($release['filelist']['install'])) {
|
400 |
if (isset($release['filelist']['install'])) {
|
| 358 |
foreach ($release['filelist']['install'] as $installas) {
|
401 |
foreach ($release['filelist']['install'] as $installas) {
|
| 359 |
if ($installas['attribs']['name'] == $file['attribs']['name']) {
|
402 |
if ($installas['attribs']['name'] == $file['attribs']['name']) {
|
| 360 |
$file['attribs']['install-as'] = $installas['attribs']['as'];
|
403 |
$file['attribs']['install-as'] = $installas['attribs']['as'];
|
| 361 |
}
|
404 |
}
|
| 362 |
}
|
405 |
}
|
| 363 |
}
|
406 |
}
|
| - |
|
407 |
|
| 364 |
$pf->addFile('/', $file['attribs']['name'], $file['attribs']);
|
408 |
$pf->addFile('/', $file['attribs']['name'], $file['attribs']);
|
| 365 |
}
|
409 |
}
|
| - |
|
410 |
|
| 366 |
if ($pf2->getChangeLog()) {
|
411 |
if ($pf2->getChangeLog()) {
|
| 367 |
$this->ui->outputData('WARNING: changelog is not translated to package.xml ' .
|
412 |
$this->ui->outputData('WARNING: changelog is not translated to package.xml ' .
|
| 368 |
'1.0, use PEAR_PackageFileManager-based script if you need changelog-' .
|
413 |
'1.0, use PEAR_PackageFileManager-based script if you need changelog-' .
|
| 369 |
'translation for package.xml 1.0');
|
414 |
'translation for package.xml 1.0');
|
| 370 |
}
|
415 |
}
|
| - |
|
416 |
|
| 371 |
$gen = &$pf->getDefaultGenerator();
|
417 |
$gen = &$pf->getDefaultGenerator();
|
| 372 |
$gen->toPackageFile('.');
|
418 |
$gen->toPackageFile('.');
|
| 373 |
}
|
419 |
}
|
| 374 |
}
|
420 |
}
|
| 375 |
|
- |
|
| 376 |
?>
|
- |
|