Re: Pear channels, uri, package_filemanager, etc. I cannot make my package

From: Date: Sun, 26 Nov 2006 14:39:38 +0000
Subject: Re: Pear channels, uri, package_filemanager, etc. I cannot make my package
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-45015@lists.php.net to get a copy of this message
Hi, Coda a écrit :
Hi, I'd like to use package_filemanager to generate a package.xml file with version 2 format. Whatever I try, I always get a result like this one : PEAR_PackageFileManager2 Error: Package validation failed: Error: Invalid tag order in <package>, found <summary> expected one of "channel, uri" Error: package.xml <package> tag has no version attribute, or version is not 2.0 or other variants.
Reason is you forgot to put $packagexml->setChannel('pear.php.net');
I don't have a channel setup for my packages yet and I don't know what to put in uri since it is not documented apparently.
It was, but I dropped the User Guide / Tutorial that was available on my web space [1] If you don't want to use a channel as "pear.php.net", you can use uri like this : $packagexml->setUri('http://www.mamasam.com/Mamasam_ACL-0.9.0'); or something equal. URI is address where PEAR installer can download archive .tar or .tgz Avoid to give extension ".tar" ".tgz", PEAR installer will do it for you
Here is the code I use to generate my package, it's taken directly package_filemanager2 comments: <code> require_once('PEAR/PackageFileManager2.php'); PEAR::setErrorHandling(PEAR_ERROR_DIE); $packagexml = new PEAR_PackageFileManager2; $e = $packagexml->setOptions( array('baseinstalldir' => 'Mamasam', 'packagedirectory' => dirname(__FILE__).'/..', 'filelistgenerator' => 'file', // generate from cvs, use file for directory 'ignore' => array('.svn/', 'tests/'), // ignore TODO, all files in tests/ 'dir_roles' => array('tests' => 'test'), )); // same for the license $packagexml->setPackage('Mamasam_ACL'); $packagexml->setSummary('Rights and permissions management package'); $packagexml->setDescription('Rights and permissions management package.'); $packagexml->setAPIVersion('1.0.0'); $packagexml->setReleaseVersion('0.9.0'); $packagexml->setReleaseStability('beta'); $packagexml->setAPIStability('stable'); $packagexml->setNotes("Initial release"); $packagexml->setPackageType('php'); // this is a PEAR-style php script package $packagexml->setPhpDep('5.1.0'); $packagexml->setPearinstallerDep('1.4.3'); $packagexml->addMaintainer('lead', 'mansion', 'Bertrand Mansion', 'golgote@mamasam.com'); $packagexml->setLicense('New BSD License', 'http://opensource.org/licenses/bsd-license.php'); $packagexml->generateContents(); // create the <contents> tag // replace @PHP-BIN@ in this file with the path to php executable! pretty neat $packagexml->addGlobalReplacement('package-info', '@package_version@', 'version'); $pkg = &$packagexml->exportCompatiblePackageFile1(); // get a PEAR_PackageFile object
It's only my opinion: Avoid to use exportCompatible function, you may have more problems than solutions. And with a PEAR 1.4.x package.xml 1.0 is not mandatory. Generate a package xml 2.0 is enough !
// note use of {@link debugPackageFile()} - this is VERY important if (isset($_GET['make']) || (isset($_SERVER['argv']) && @$_SERVER['argv'][1] == 'make')) {
    $pkg->writePackageFile();
    $packagexml->writePackageFile();
} else {
    $pkg->debugPackageFile();
    $packagexml->debugPackageFile();
} </code> Can somebody help me ? Should I write the package2.xml file by hand ? Or is there a tutorial somewhere on how to do this
I've decided to put again my version of PEAR_PackageFileManager online [1] until someone will include it in PEAR manual. It will avoid to lose works I've done in past . To continue with my next post related to PEAR_PackageFileManager user guide ... and maybe also how to
setup a server with channels.
Greg server [2] and Chiara_PEAR_Server package is the solution !
TIA, -- Bertrand Mansion Mamasam Work : http://www.mamasam.com Blog : http://golgote.freeflux.net
Hope it will help :) Laurent Laville [1] http://pear.laurent-laville.org/PEAR_PackageFileManager [2] http://pear.chiaraquartet.net/

« previous php.pear.dev (#45015) next »