cvs: php4 /pear/PEAR Common.php Installer.php Packager.php
| From: | Thomas V.V.Cox | Date: | Tue, 09 Oct 2001 02:56:33 +0000 |
| Subject: | cvs: php4 /pear/PEAR Common.php Installer.php Packager.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-960@lists.php.net to get a copy of this message | ||
cox Mon Oct 8 22:56:33 2001 EDT
Modified files:
/php4/pear/PEAR Common.php Installer.php Packager.php
Log:
more clean up/fixes
Index: php4/pear/PEAR/Common.php
diff -u php4/pear/PEAR/Common.php:1.16 php4/pear/PEAR/Common.php:1.17
--- php4/pear/PEAR/Common.php:1.16 Mon Oct 8 02:10:54 2001
+++ php4/pear/PEAR/Common.php Mon Oct 8 22:56:33 2001
@@ -18,7 +18,7 @@
// | |
// +----------------------------------------------------------------------+
//
-// $Id: Common.php,v 1.16 2001/10/08 06:10:54 cox Exp $
+// $Id: Common.php,v 1.17 2001/10/09 02:56:33 cox Exp $
require_once 'PEAR.php';
require_once 'Archive/Tar.php';
@@ -74,7 +74,6 @@
function _PEAR_Common()
{
- $this->_PEAR();
while (is_array($this->_tempfiles) &&
$file = array_shift($this->_tempfiles))
{
@@ -129,7 +128,7 @@
function mkTempDir()
{
$dir = (OS_WINDOWS) ? 'c:\\windows\\temp' : '/tmp';
- $tmpdir = tempnam($tmpdir, 'pear');
+ $tmpdir = tempnam($dir, 'pear');
unlink($tmpdir);
if (!mkdir($tmpdir, 0700)) {
return $this->raiseError("Unable to create temporary directory $tmpdir");
Index: php4/pear/PEAR/Installer.php
diff -u php4/pear/PEAR/Installer.php:1.21 php4/pear/PEAR/Installer.php:1.22
--- php4/pear/PEAR/Installer.php:1.21 Mon Oct 8 12:52:33 2001
+++ php4/pear/PEAR/Installer.php Mon Oct 8 22:56:33 2001
@@ -18,7 +18,7 @@
// | |
// +----------------------------------------------------------------------+
//
-// $Id: Installer.php,v 1.21 2001/10/08 16:52:33 cox Exp $
+// $Id: Installer.php,v 1.22 2001/10/09 02:56:33 cox Exp $
require_once 'PEAR/Common.php';
@@ -198,7 +198,7 @@
{
$type = strtolower($atts['ROLE']);
switch ($type) {
- case "test":
+ case 'test':
// don't install test files for now
$this->log(2, "+ Test file $file won't be installed yet");
return true;
Index: php4/pear/PEAR/Packager.php
diff -u php4/pear/PEAR/Packager.php:1.16 php4/pear/PEAR/Packager.php:1.17
--- php4/pear/PEAR/Packager.php:1.16 Mon Oct 8 12:52:33 2001
+++ php4/pear/PEAR/Packager.php Mon Oct 8 22:56:33 2001
@@ -18,7 +18,7 @@
// | |
// +----------------------------------------------------------------------+
//
-// $Id: Packager.php,v 1.16 2001/10/08 16:52:33 cox Exp $
+// $Id: Packager.php,v 1.17 2001/10/09 02:56:33 cox Exp $
require_once 'PEAR/Common.php';
@@ -88,6 +88,7 @@
function _PEAR_Packager()
{
+ chdir($this->orig_pwd);
$this->_PEAR_Common();
}
@@ -97,6 +98,7 @@
function package($pkgfile = null)
{
+ $this->orig_pwd = getcwd();
if (empty($pkgfile)) {
$pkgfile = 'package.xml';
}
@@ -105,7 +107,6 @@
return $pkginfo;
}
// TMP DIR -------------------------------------------------
- $orig_pwd = getcwd();
// We allow calls like "pear package /home/user/mypack/package.xml"
if (!@chdir(dirname($pkgfile))) {
return $this->raiseError('Couldn\'t chdir to package.xml dir',
@@ -118,22 +119,22 @@
$pkgversion = ereg_replace ('[^a-zA-Z0-9._\-]', '_',
$pkginfo['version']);
$pkgver = $pkgname . '-' . $pkgversion;
- $this->tmpdir = $pwd . DIRECTORY_SEPARATOR . $pkgver;
- if (file_exists($this->tmpdir)) {
- return $this->raiseError('Tmpdir: ' . $this->tmpdir .' already
exists',
+ $tmpdir = $pwd . DIRECTORY_SEPARATOR . $pkgver;
+ if (file_exists($tmpdir)) {
+ return $this->raiseError('Tmpdir: ' . $tmpdir .' already
exists',
null, PEAR_ERROR_TRIGGER, E_USER_ERROR);
}
- if (!mkdir($this->tmpdir, 0755)) {
- return $this->raiseError("Unable to create temporary directory
$this->tmpdir.",
+ if (!mkdir($tmpdir, 0700)) {
+ return $this->raiseError("Unable to create temporary directory $tmpdir.",
null, PEAR_ERROR_TRIGGER, E_USER_ERROR);
} else {
- $this->log(2, "+ tmp dir created at: " . $this->tmpdir);
+ $this->log(2, "+ tmp dir created at: " . $tmpdir);
}
- $this->addTempFile($this->tmpdir);
+ $this->addTempFile($tmpdir);
// Copy files -----------------------------------------------
foreach ($pkginfo['filelist'] as $fname => $atts) {
- $file = $this->tmpdir . DIRECTORY_SEPARATOR . $fname;
+ $file = $tmpdir . DIRECTORY_SEPARATOR . $fname;
$dir = dirname($file);
if (!@is_dir($dir)) {
if (!$this->mkDirHier($dir)) {
@@ -145,31 +146,30 @@
if (!@copy($fname, $file)) {
$this->log(0, "could not copy $fname to $file");
} else {
- $this->log(2, "+ copying from $fname to $file");
+ $this->log(2, "+ copying $fname to $file");
@chmod($file, $orig_perms);
}
}
// XXX TODO: Rebuild the package file as the old method did?
// This allows build packages from different pear pack def files
- $dest_pkgfile = $this->tmpdir . DIRECTORY_SEPARATOR . 'package.xml';
+ $dest_pkgfile = $tmpdir . DIRECTORY_SEPARATOR . 'package.xml';
$this->log(2, "+ copying package $pkgfile to $dest_pkgfile");
if (!@copy($pkgfile, $dest_pkgfile)) {
return $this->raiseError("could not copy $pkgfile to $dest_pkgfile");
}
- chmod($dest_pkgfile, 0644);
+ @chmod($dest_pkgfile, 0644);
// TAR the Package -------------------------------------------
- chdir(dirname($this->tmpdir));
- $dest_package = $orig_pwd . DIRECTORY_SEPARATOR . "${pkgver}.tgz";
- $this->log(2, "Attempting to pack {$this->tmpdir} $contents_dir dir in
$dest_package");
+ chdir(dirname($tmpdir));
+ $dest_package = $this->orig_pwd . DIRECTORY_SEPARATOR . "{$pkgver}.tgz";
+ $this->log(2, "Attempting to pack $tmpdir dir in $dest_package");
$tar = new Archive_Tar($dest_package, true);
$tar->setErrorHandling(PEAR_ERROR_PRINT);
if (!$tar->create($pkgver)) {
return $this->raiseError('an error ocurred during package creation');
}
$this->log(1, "Package $dest_package done");
- chdir($orig_pwd);
return $dest_package;
}