Bearsampp 2026.9.23
Loading...
Searching...
No Matches
PEAR_Packager Class Reference
Inheritance diagram for PEAR_Packager:
Collaboration diagram for PEAR_Packager:

Public Member Functions

 package ($pkgfile=null, $compress=true, $pkg2=null)
Public Member Functions inherited from PEAR_Common
 __construct ()
 _PEAR_Common ()
 _postProcessChecks ($pf)
 _postProcessValidPackagexml (&$pf)
 buildProvidesArray ($srcinfo)
 detectDependencies ($any, $status_callback=null)
 downloadHttp ( $url, &$ui, $save_dir='.', $callback=null, $lastmodified=null, $accept=false, $channel=false)
 infoFromAny ($info)
 infoFromDescriptionFile ($descfile)
 infoFromString ($data)
 infoFromTgzFile ($file)
 log ($level, $msg, $append_crlf=true)
 mkDirHier ($dir)
 mkTempDir ($tmpdir='')
 setFrontendObject (&$ui)
 validatePackageInfo ($info, &$errors, &$warnings, $dir_prefix='')
 validPackageName ($name)
 validPackageVersion ($ver)
 xmlFromInfo ($pkginfo)
Public Member Functions inherited from PEAR
 __call ($method, $arguments)
 __construct ($error_class=null)
 _checkDelExpect ($error_code)
 _PEAR ()
 delExpect ($error_code)
 expectError ($code=' *')
 PEAR ($error_class=null)
 popExpect ()

Data Fields

 $_registry
Data Fields inherited from PEAR_Common
 $_validPackageFile
 $config = null
 $current_attributes = array()
 $current_element
 $current_path = null
 $element_stack = array()
 $pkginfo = array()
 $ui = null
Data Fields inherited from PEAR
 $_debug = false
 $_default_error_handler = ''
 $_default_error_mode = null
 $_default_error_options = null
 $_error_class = 'PEAR_Error'
 $_expected_errors = array()

Additional Inherited Members

Static Public Member Functions inherited from PEAR_Common
static addTempFile ($file)
static analyzeSourceCode ($file)
static betterStates ($state, $include=false)
static getDependencyRelations ()
static getDependencyTypes ()
static getFileRoles ()
static getProvideTypes ()
static getReleaseStates ()
static getReplacementTypes ()
static getScriptPhases ()
static getUserRoles ()
static isIncludeable ($path)
Static Public Member Functions inherited from PEAR
static __callStatic ($method, $arguments)
static getSourceDateEpoch ()
static & getStaticProperty ($class, $var)
static isError ($data, $code=null)
static loadExtension ($ext)
static registerShutdownFunc ($func, $args=array())
static staticPopErrorHandling ()
static staticPushErrorHandling ($mode, $options=null)
Static Protected Member Functions inherited from PEAR
static _popErrorHandling ($object)
static _pushErrorHandling ($object, $mode, $options=null)
static _raiseError ($object, $message=null, $code=null, $mode=null, $options=null, $userinfo=null, $error_class=null, $skipmsg=false)
static _setErrorHandling ( $object, $mode=null, $options=null)
static _throwError ($object, $message=null, $code=null, $userinfo=null)
Static Protected Attributes inherited from PEAR
static $bivalentMethods

Detailed Description

Definition at line 37 of file Packager.php.

Member Function Documentation

◆ package()

package ( $pkgfile = null,
$compress = true,
$pkg2 = null )

Definition at line 44 of file Packager.php.

45 {
46 // {{{ validate supplied package.xml file
47 if (empty($pkgfile)) {
48 $pkgfile = 'package.xml';
49 }
50
52 $pkg = new PEAR_PackageFile($this->config, $this->debug);
53 $pf = &$pkg->fromPackageFile($pkgfile, PEAR_VALIDATE_NORMAL);
54 $main = &$pf;
56 if (PEAR::isError($pf)) {
57 if (is_array($pf->getUserInfo())) {
58 foreach ($pf->getUserInfo() as $error) {
59 $this->log(0, 'Error: ' . $error['message']);
60 }
61 }
62
63 $this->log(0, $pf->getMessage());
64 return $this->raiseError("Cannot package, errors in package file");
65 }
66
67 foreach ($pf->getValidationWarnings() as $warning) {
68 $this->log(1, 'Warning: ' . $warning['message']);
69 }
70
71 // }}}
72 if ($pkg2) {
73 $this->log(0, 'Attempting to process the second package file');
75 $pf2 = &$pkg->fromPackageFile($pkg2, PEAR_VALIDATE_NORMAL);
77 if (PEAR::isError($pf2)) {
78 if (is_array($pf2->getUserInfo())) {
79 foreach ($pf2->getUserInfo() as $error) {
80 $this->log(0, 'Error: ' . $error['message']);
81 }
82 }
83 $this->log(0, $pf2->getMessage());
84 return $this->raiseError("Cannot package, errors in second package file");
85 }
86
87 foreach ($pf2->getValidationWarnings() as $warning) {
88 $this->log(1, 'Warning: ' . $warning['message']);
89 }
90
91 if ($pf2->getPackagexmlVersion() == '2.0' ||
92 $pf2->getPackagexmlVersion() == '2.1'
93 ) {
94 $main = &$pf2;
95 $other = &$pf;
96 } else {
97 $main = &$pf;
98 $other = &$pf2;
99 }
100
101 if ($main->getPackagexmlVersion() != '2.0' &&
102 $main->getPackagexmlVersion() != '2.1') {
103 return PEAR::raiseError('Error: cannot package two package.xml version 1.0, can ' .
104 'only package together a package.xml 1.0 and package.xml 2.0');
105 }
106
107 if ($other->getPackagexmlVersion() != '1.0') {
108 return PEAR::raiseError('Error: cannot package two package.xml version 2.0, can ' .
109 'only package together a package.xml 1.0 and package.xml 2.0');
110 }
111 }
112
113 $main->setLogger($this);
114 if (!$main->validate(PEAR_VALIDATE_PACKAGING)) {
115 foreach ($main->getValidationWarnings() as $warning) {
116 $this->log(0, 'Error: ' . $warning['message']);
117 }
118 return $this->raiseError("Cannot package, errors in package");
119 }
120
121 foreach ($main->getValidationWarnings() as $warning) {
122 $this->log(1, 'Warning: ' . $warning['message']);
123 }
124
125 if ($pkg2) {
126 $other->setLogger($this);
127 $a = false;
128 if (!$other->validate(PEAR_VALIDATE_NORMAL) || $a = !$main->isEquivalent($other)) {
129 foreach ($other->getValidationWarnings() as $warning) {
130 $this->log(0, 'Error: ' . $warning['message']);
131 }
132
133 foreach ($main->getValidationWarnings() as $warning) {
134 $this->log(0, 'Error: ' . $warning['message']);
135 }
136
137 if ($a) {
138 return $this->raiseError('The two package.xml files are not equivalent!');
139 }
140
141 return $this->raiseError("Cannot package, errors in package");
142 }
143
144 foreach ($other->getValidationWarnings() as $warning) {
145 $this->log(1, 'Warning: ' . $warning['message']);
146 }
147
148 $gen = &$main->getDefaultGenerator();
149 $tgzfile = $gen->toTgz2($this, $other, $compress);
150 if (PEAR::isError($tgzfile)) {
151 return $tgzfile;
152 }
153
154 $dest_package = basename($tgzfile);
155 $pkgdir = dirname($pkgfile);
156
157 // TAR the Package -------------------------------------------
158 $this->log(1, "Package $dest_package done");
159 if (file_exists("$pkgdir/CVS/Root")) {
160 $cvsversion = preg_replace('/[^a-z0-9]/i', '_', $pf->getVersion());
161 $cvstag = "RELEASE_$cvsversion";
162 $this->log(1, 'Tag the released code with "pear cvstag ' .
163 $main->getPackageFile() . '"');
164 $this->log(1, "(or set the CVS tag $cvstag by hand)");
165 } elseif (file_exists("$pkgdir/.svn")) {
166 $svnversion = preg_replace('/[^a-z0-9]/i', '.', $pf->getVersion());
167 $svntag = $pf->getName() . "-$svnversion";
168 $this->log(1, 'Tag the released code with "pear svntag ' .
169 $main->getPackageFile() . '"');
170 $this->log(1, "(or set the SVN tag $svntag by hand)");
171 }
172 } else { // this branch is executed for single packagefile packaging
173 $gen = &$pf->getDefaultGenerator();
174 $tgzfile = $gen->toTgz($this, $compress);
175 if (PEAR::isError($tgzfile)) {
176 $this->log(0, $tgzfile->getMessage());
177 return $this->raiseError("Cannot package, errors in package");
178 }
179
180 $dest_package = basename($tgzfile);
181 $pkgdir = dirname($pkgfile);
182
183 // TAR the Package -------------------------------------------
184 $this->log(1, "Package $dest_package done");
185 if (file_exists("$pkgdir/CVS/Root")) {
186 $cvsversion = preg_replace('/[^a-z0-9]/i', '_', $pf->getVersion());
187 $cvstag = "RELEASE_$cvsversion";
188 $this->log(1, "Tag the released code with `pear cvstag $pkgfile'");
189 $this->log(1, "(or set the CVS tag $cvstag by hand)");
190 } elseif (file_exists("$pkgdir/.svn")) {
191 $svnversion = preg_replace('/[^a-z0-9]/i', '.', $pf->getVersion());
192 $svntag = $pf->getName() . "-$svnversion";
193 $this->log(1, "Tag the released code with `pear svntag $pkgfile'");
194 $this->log(1, "(or set the SVN tag $svntag by hand)");
195 }
196 }
197
198 return $dest_package;
199 }
const PEAR_ERROR_RETURN
Definition PEAR.php:24
const PEAR_VALIDATE_PACKAGING
Definition Validate.php:22
const PEAR_VALIDATE_NORMAL
Definition Validate.php:20
log($level, $msg, $append_crlf=true)
Definition Common.php:244
static staticPopErrorHandling()
Definition PEAR.php:654
static staticPushErrorHandling($mode, $options=null)
Definition PEAR.php:619

References PEAR\isError(), PEAR_Common\log(), PEAR_ERROR_RETURN, PEAR_VALIDATE_NORMAL, PEAR_VALIDATE_PACKAGING, PEAR\staticPopErrorHandling(), and PEAR\staticPushErrorHandling().

Here is the call graph for this function:

Field Documentation

◆ $_registry

$_registry

Definition at line 42 of file Packager.php.


The documentation for this class was generated from the following file:
  • E:/Bearsampp-development/sandbox/core/libs/php/pear/pear/PEAR/Packager.php