cvs: php4 /pear/PEAR Packager.php

From: Date: Sun, 07 Apr 2002 17:07:49 +0000
Subject: cvs: php4 /pear/PEAR Packager.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-3110@lists.php.net to get a copy of this message
ssb Sun Apr 7 13:07:49 2002 EDT Modified files: /php4/pear/PEAR Packager.php Log: * give PEAR_Packager::package an option to disable compression and make plain .tar files Index: php4/pear/PEAR/Packager.php diff -u php4/pear/PEAR/Packager.php:1.33 php4/pear/PEAR/Packager.php:1.34 --- php4/pear/PEAR/Packager.php:1.33 Sun Apr 7 11:07:26 2002 +++ php4/pear/PEAR/Packager.php Sun Apr 7 13:07:49 2002 @@ -17,7 +17,7 @@ // | Tomas V.V.Cox <cox@idecnet.com> | // +----------------------------------------------------------------------+ // -// $Id: Packager.php,v 1.33 2002/04/07 15:07:26 ssb Exp $ +// $Id: Packager.php,v 1.34 2002/04/07 17:07:49 ssb Exp $ require_once 'PEAR/Common.php'; @@ -58,7 +58,7 @@ // {{{ package() - function package($pkgfile = null) + function package($pkgfile = null, $compress = true) { $this->orig_pwd = getcwd(); if (empty($pkgfile)) { @@ -66,7 +66,7 @@ } $pkginfo = $this->infoFromDescriptionFile($pkgfile); if (PEAR::isError($pkginfo)) { - return $pkginfo; + return $this->raiseError($pkginfo); } // XXX This needs to be checked in infoFromDescriptionFile // or at least a helper method to do the proper checks @@ -107,10 +107,10 @@ } $new_xml = $this->xmlFromInfo($pkginfo); if (PEAR::isError($new_xml)) { - return $new_xml; + return $this->raiseError($new_xml); } $tmpdir = $this->mkTempDir(getcwd()); - $newpkgfile = $tmpdir . DIRECTORY_SEPARATOR . $pkgfile; + $newpkgfile = $tmpdir . DIRECTORY_SEPARATOR . 'package.xml'; $np = @fopen($newpkgfile, "w"); if (!$np) { return $this->raiseError("PEAR_Packager: unable to rewrite $pkgfile"); @@ -119,13 +119,14 @@ fclose($np); // TAR the Package ------------------------------------------- - $dest_package = $this->orig_pwd . DIRECTORY_SEPARATOR . "{$pkgver}.tgz"; - $tar =& new Archive_Tar($dest_package, true); + $ext = $compress ? '.tgz' : '.tar'; + $dest_package = $this->orig_pwd . DIRECTORY_SEPARATOR . $pkgver . $ext; + $tar =& new Archive_Tar($dest_package, $compress); $tar->setErrorHandling(PEAR_ERROR_RETURN); // XXX Don't print errors // ----- Creates with the package.xml file $ok = $tar->createModify($newpkgfile, '', $tmpdir); if (PEAR::isError($ok)) { - return $ok; + return $this->raiseError($ok); } elseif (!$ok) { return $this->raiseError('PEAR_Packager: tarball creation failed'); }

« previous php.pear.cvs (#3110) next »