// 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;
}
$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);
// ----- 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;
}