cvs: pear / MkPackages.php

From: Date: Sat, 07 Jul 2001 13:09:31 +0000
Subject: cvs: pear / MkPackages.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-218@lists.php.net to get a copy of this message
chregu Sat Jul 7 09:09:31 2001 EDT Added files: /pear MkPackages.php Log: First Release to build tgz of all the Packages. Including an XML-File containing some infos about the Packages. I'm not sure, where i should put it... maybe this is the wrong place. Index: pear/MkPackages.php +++ pear/MkPackages.php #!/usr/local/bin/php -Cq <?php // -*- C++ -*- /* vim: set expandtab tabstop=4 shiftwidth=4; */ // +---------------------------------------------------------------------+ // | PHP version 4.0 | // +---------------------------------------------------------------------+ // | Copyright (c) 1997-2001 The PHP Group | // +---------------------------------------------------------------------+ // | This source file is subject to version 2.0 of the PHP license, | // | that is bundled with this package in the file LICENSE, and is | // | available through the world-wide-web at | // | http://www.php.net/license/2_02.txt. | // | If you did not receive a copy of the PHP license and are unable to | // | obtain it through the world-wide-web, please send a note to | // | license@php.net so we can mail you a copy immediately. | // +---------------------------------------------------------------------+ // | Authors: Christian Stocker <chregu@phant.ch> | // +---------------------------------------------------------------------+ // require_once "PEAR/Packager.php"; require_once "Console/Getopt.php"; $stderr = fopen("php://stderr", "w"); $options = Console_Getopt::getopt($argv, "h:?"); if (PEAR::isError($options)) { usage($options); } $TgzDir = $options[1][1]; if (!$TgzDir) { $TgzDir = getcwd(); } $fxml = fopen("$TgzDir/Packages.xml","w"); fwrite($fxml,"<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n"); fwrite($fxml,"<Packages>\n"); if ($dir = @opendir(".")) { while(($file = readdir($dir)) ) { if (! strstr($file,".") && ! strstr($file,"CVS") ) { echo "$file\n"; chdir ($file); if (file_exists("package.xml") ) { $packager =& new PEAR_Packager(); if (PEAR::isError($packager->Package())) { print "\npackage failed\n"; next; } else { print "package ok\n"; } fwrite($fxml," <Package> <Name>".$packager->pkginfo["Package,Name"]."</Name> <Summary>".$packager->pkginfo["Package,Summary"]."</Summary> <Release> <Version>".$packager->pkginfo["Release,Version"]."</Version> <Date>".$packager->pkginfo["Release,Date"]."</Date> <Notes>".$packager->pkginfo["Release,Notes"]."</Notes> </Release> </Package>\n"); copy ($packager->pkgver.".tgz",$TgzDir."/".$packager->pkgver.".tgz"); unlink ($packager->pkgver.".tgz"); } chdir (".."); } } closedir($dir); fwrite($fxml,"</Packages>\n"); } function usage($obj = null) { global $stderr; if ($obj !== null) { fputs($stderr, $obj->getMessage()); } fputs($stderr, "Usage: MkPackages.php [-h] [tgz directory]\n". "Options:\n". " -h display help/usage (this message)\n". "\n"); exit; }

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