summaryrefslogtreecommitdiff
path: root/pear/PEAR/Packager.php
diff options
context:
space:
mode:
authorStig Bakken <ssb@php.net>2002-04-16 05:01:41 +0000
committerStig Bakken <ssb@php.net>2002-04-16 05:01:41 +0000
commite32362f7928a31c1dea69bf852ce42d296ab1d6e (patch)
treed15b6a565c12147247a6df64dda4946602c71aae /pear/PEAR/Packager.php
parent7acfa47fb526a100c069c767273a6b1b7aa5b0bd (diff)
downloadphp-git-e32362f7928a31c1dea69bf852ce42d296ab1d6e.tar.gz
* chdir back to original dir in PEAR_Packager::package
* only display "cvstag" hint if CVS/Root exists
Diffstat (limited to 'pear/PEAR/Packager.php')
-rw-r--r--pear/PEAR/Packager.php17
1 files changed, 13 insertions, 4 deletions
diff --git a/pear/PEAR/Packager.php b/pear/PEAR/Packager.php
index 0dfd396675..6179079704 100644
--- a/pear/PEAR/Packager.php
+++ b/pear/PEAR/Packager.php
@@ -95,6 +95,7 @@ class PEAR_Packager extends PEAR_Common
// Copy files -----------------------------------------------
foreach ($pkginfo['filelist'] as $fname => $atts) {
if (!file_exists($fname)) {
+ chdir($this->orig_cwd);
return $this->raiseError("File $fname does not exist");
} else {
$filelist[$i++] = $fname;
@@ -107,12 +108,14 @@ class PEAR_Packager extends PEAR_Common
}
$new_xml = $this->xmlFromInfo($pkginfo);
if (PEAR::isError($new_xml)) {
+ chdir($this->orig_cwd);
return $this->raiseError($new_xml);
}
$tmpdir = $this->mkTempDir(getcwd());
$newpkgfile = $tmpdir . DIRECTORY_SEPARATOR . 'package.xml';
$np = @fopen($newpkgfile, "w");
if (!$np) {
+ chdir($this->orig_cwd);
return $this->raiseError("PEAR_Packager: unable to rewrite $pkgfile");
}
fwrite($np, $new_xml);
@@ -126,19 +129,25 @@ class PEAR_Packager extends PEAR_Common
// ----- Creates with the package.xml file
$ok = $tar->createModify($newpkgfile, '', $tmpdir);
if (PEAR::isError($ok)) {
+ chdir($this->orig_cwd);
return $this->raiseError($ok);
} elseif (!$ok) {
+ chdir($this->orig_cwd);
return $this->raiseError('PEAR_Packager: tarball creation failed');
}
// ----- Add the content of the package
if (!$tar->addModify($filelist, $pkgver)) {
+ chdir($this->orig_cwd);
return $this->raiseError('PEAR_Packager: tarball creation failed');
}
$this->log(1, "Package $dest_package done");
- $cvsversion = preg_replace('/[^a-z0-9]/i', '_', $pkgversion);
- $cvstag = "RELEASE_$cvsversion";
- $this->log(1, "Tag the released code with `pear cvstag $pkgfile'");
- $this->log(1, "(or set the CVS tag $cvstag by hand)");
+ if (file_exists("CVS/Root")) {
+ $cvsversion = preg_replace('/[^a-z0-9]/i', '_', $pkgversion);
+ $cvstag = "RELEASE_$cvsversion";
+ $this->log(1, "Tag the released code with `pear cvstag $pkgfile'");
+ $this->log(1, "(or set the CVS tag $cvstag by hand)");
+ }
+ chdir($this->orig_cwd);
return $dest_package;
}