Re: PEAR_PackageFileManager: Error: Invalid tag order
| From: | Laurent Laville | Date: | Sat, 16 Sep 2006 14:15:22 +0000 |
| Subject: | Re: PEAR_PackageFileManager: Error: Invalid tag order | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-25148@lists.php.net to get a copy of this message | ||
Hi,
This is a common error, when people uses PEAR_PackageFileManager2 (PFM2) class.
If you read carefully the source code of the PFM2 class (lines 143-145)
you 'll see this :
* // for an existing package.xml use
* // $packagexml = {@link importOptions()} instead
* $e = $packagexml->setOptions(
When you have already generated a package xml 1.0 and 2.0, PLEASE USE
importOptions() instead of setOptions().
REASON is :
package.xml is 1.0 while package2.xml is version 2.0
and when you try again to generate a new version without giving the option "packagefile" ("packagefile" => "package2.xml"), PFM2 consider that your package xml 2.0 is by default called "package.xml" what is wrong in this case. (Due to exportCompatiblePackageFile1 method).
This is a reason why i've introduces new example called
"examples\updatepackage.php" into distribution.
BTW, i think we will drop soon package xml 1.0 support in next releases.
This problem should not be a REAL ONE in future .
Hope it will help, and i didn't said stupidity. Fix me if i'm wrong Greg ?!
regards
Laurent
Torsten Roehr a écrit :
Hi, I have upgraded to PEAR_PackageFileManager 1.6.0b4 and now get the following error: 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 My script looks like this: <?php require_once 'PEAR/PackageFileManager2.php'; PEAR::setErrorHandling(PEAR_ERROR_DIE); // set values$channel = 'pear.php.net'; $package = 'HTTP_Session'; $licence = 'PHP Licence'; $summary = 'Object-oriented interface to the session_* familyfunctions';$description = 'Object-oriented interface to the session_* familyfunctions. It provides extra features such as database storage for session data using the DB, MDB and MDB2 package. It introduces new methods like isNew(), useCookies(), setExpire(), setIdle(), isExpired(), isIdled() and others.';$baseinstalldir = 'HTTP'; $version = '0.5.3';$packagedirectory = 'c:/wwwroot/pear_dev/HTTP_Session';$state = 'beta';$filelistgenerator = 'file'; // generate from cvs or file$notes = '- implemented request #8717:HTTP_Session::replicate()'; $packagexml =& new PEAR_PackageFileManager2();$packagexml->setOptions(array('baseinstalldir' => $baseinstalldir, 'packagedirectory' => $packagedirectory, 'filelistgenerator' => $filelistgenerator ) );$packagexml->setPackage($package); $packagexml->setChannel($channel); $packagexml->setSummary($summary); $packagexml->setDescription($description); $packagexml->setAPIVersion($version); $packagexml->setReleaseVersion($version); $packagexml->setReleaseStability($state); $packagexml->setAPIStability($state); $packagexml->setNotes($notes); $packagexml->setPackageType('php'); // this is a PEAR-style php script package $packagexml->addRelease(); // set up a release section $packagexml->setPhpDep('4.2.0'); $packagexml->setPearinstallerDep('1.4.0'); $packagexml->addPackageDepWithChannel('optional', 'DB', 'pear.php.net', '1.7.6'); $packagexml->addPackageDepWithChannel('optional', 'MDB', 'pear.php.net', '1.1.4'); $packagexml->addPackageDepWithChannel('optional', 'MDB2', 'pear.php.net', '2.0.1'); $packagexml->addMaintainer('lead', 'lexxx', 'Alexander Radivanovich', 'info@wwwlab.net'); $packagexml->setLicense($licence, 'http://www.php.net/license'); $packagexml->generateContents(); // create the <contents> tag $pkg =& $packagexml->exportCompatiblePackageFile1(); // get a PEAR_PackageFile object // write to file if (isset($_GET['make']) || (isset($_SERVER['argv'][1]) &&$_SERVER['argv'][1] == 'make')) { $pkg->writePackageFile(); $e = $packagexml->writePackageFile();// output on screen } else {$pkg->debugPackageFile(); $e = $packagexml->debugPackageFile();} if (PEAR::isError($e)) {echo $e->getMessage(); die();} ?> Would appreciate any hints. Thanks. Regards, Torsten