cvs: pecl /PECL_Gen Extension.php package.xml
| From: | Hartmut Holzgraefe | Date: | Fri, 10 Jun 2005 10:51:08 +0000 |
| Subject: | cvs: pecl /PECL_Gen Extension.php package.xml | ||
| Groups: | php.pecl.cvs | ||
| Request: | Send a blank email to pecl-cvs+get-3254@lists.php.net to get a copy of this message | ||
hholzgra Fri Jun 10 06:51:08 2005 EDT
Modified files:
/pecl/PECL_Gen Extension.php package.xml
Log:
fixed handling of files added, path handling was braindead before
http://cvs.php.net/diff.php/pecl/PECL_Gen/Extension.php?r1=1.25&r2=1.26&ty=u
Index: pecl/PECL_Gen/Extension.php
diff -u pecl/PECL_Gen/Extension.php:1.25 pecl/PECL_Gen/Extension.php:1.26
--- pecl/PECL_Gen/Extension.php:1.25 Thu Jun 9 14:08:07 2005
+++ pecl/PECL_Gen/Extension.php Fri Jun 10 06:51:07 2005
@@ -16,7 +16,7 @@
// | Authors: Hartmut Holzgraefe <hholzgra@php.net> |
// +----------------------------------------------------------------------+
//
-// $Id: Extension.php,v 1.25 2005/06/09 18:08:07 hholzgra Exp $
+// $Id: Extension.php,v 1.26 2005/06/10 10:51:07 hholzgra Exp $
//
// {{{ includes
@@ -49,7 +49,7 @@
* A class that generates PECL extension soure and documenation files
*
* @access public
- * @version $Id: Extension.php,v 1.25 2005/06/09 18:08:07 hholzgra Exp $
+ * @version $Id: Extension.php,v 1.26 2005/06/10 10:51:07 hholzgra Exp $
*/
class PECL_Gen_Extension
@@ -534,15 +534,23 @@
/**
- * Add a package file by type and name
+ * Add a package file by type and path
*
- * @access public
- * @param string type
- * @param string name
+ * @access public
+ * @param string type
+ * @param string path
+ * @returns bool success state
*/
- function add_package_file($type, $name)
+ function add_package_file($type, $path)
{
- $this->package_files[$type][$name] = $name;
+ $basename = basename($path);
+
+ if (isset($this->package_files[$type][$basename])) {
+ return $this->raiseError("duplicate distribution file name
'$basename'");
+ }
+
+ $this->package_files[$type][$basename] = $path;
+ return true;
}
@@ -554,8 +562,10 @@
*/
function add_source_file($name)
{
+ // TODO catch errors returned from add_package_file
+
$filename = realpath($name);
-
+
if (!is_file($filename)) {
return $this->raiseError("'$name' is not a valid file");
}
@@ -568,29 +578,26 @@
$ext = $pathinfo["extension"];
switch ($ext) {
- case 'h':
- case 'hpp':
- case 'hxx':
- case 'h++':
- case 'o':
- case 'a':
- break;
case 'c':
$this->add_configfragment("AC_PROG_CC");
- return $this->add_package_file('c', $filename);
+ $this->add_package_file('code', $filename);
+ break;
case 'cpp':
case 'cxx':
case 'c++':
$this->add_configfragment("AC_PROG_CXX");
- return $this->add_package_file('c', $filename);
+ $this->add_package_file('code', $filename);
+ break;
case 'l':
case 'flex':
$this->add_configfragment("AM_PROG_LEX");
- return $this->add_package_file('c', $filename);
+ $this->add_package_file('code', $filename);
+ break;
case 'y':
case 'bison':
$this->add_configfragment("AM_PROG_YACC");
- return $this->add_package_file('c', $filename);
+ $this->add_package_file('code', $filename);
+ break;
default:
break;
}
@@ -709,8 +716,8 @@
// copy additional source files
if (isset($this->package_files['copy'])) {
- foreach ($this->package_files['copy'] as $file) {
- copy($file, $dirpath."/".basename($file));
+ foreach ($this->package_files['copy'] as $basename => $filepath) {
+ copy($filepath, $dirpath."/".$basename);
}
}
@@ -1229,7 +1236,7 @@
echo PECL_Gen_Element::c_code_editor_settings();
- $this->add_package_file("h", $filename);
+ $this->add_package_file('header', $filename);
$fp = fopen("$dirpath/$filename", "w");
fputs($fp, PECL_Gen_Tools_Indent::tabify(ob_get_contents()));
ob_end_clean();
@@ -1516,7 +1523,7 @@
echo PECL_Gen_Element::c_code_editor_settings();
- $this->add_package_file("c", $filename);
+ $this->add_package_file('code', $filename);
$fp = fopen("$dirpath/$filename", "w");
fputs($fp, PECL_Gen_Tools_Indent::tabify(ob_get_contents()));
ob_end_clean();
@@ -1630,7 +1637,7 @@
echo "
PHP_SUBST({$upname}_SHARED_LIBADD)
AC_DEFINE(HAVE_$upname, 1, [ ])
- PHP_NEW_EXTENSION({$this->name}, ".join(" ",
$this->package_files['c'])." , \$ext_shared)
+ PHP_NEW_EXTENSION({$this->name}, ".join(" ",
array_keys($this->package_files['code']))." , \$ext_shared)
";
if (count($this->makefragment)) {
@@ -1860,11 +1867,8 @@
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
';
- foreach ($this->package_files['c'] as $filename) {
- if ($filename{0}!='/' && $filename{0}!='.') {
- $filename = "./$filename";
- }
- $filename = str_replace("/","\\", $filename);
+ foreach ($this->package_files['code'] as $basename => $filepath) {
+ $filename = "./$basename";
echo "
# Begin Source File
@@ -1887,7 +1891,7 @@
# PROP Default_Filter "h;hpp;hxx;hm;inl"
';
- foreach ($this->package_files['h'] as $filename) {
+ foreach ($this->package_files['header'] as $filename) {
if ($filename{0}!='/' && $filename{0}!='.') {
$filename = "./$filename";
}
@@ -2027,9 +2031,9 @@
}
}
- foreach (array("conf", "c", "h") as $type) {
- foreach ($this->package_files[$type] as $file) {
- echo " <file role=\"src\">$file</file>\n";
+ foreach (array("conf", "code", "header") as $type) {
+ foreach ($this->package_files[$type] as $basename => $filepath) {
+ echo " <file role=\"src\">$basename</file>\n";
}
}
http://cvs.php.net/diff.php/pecl/PECL_Gen/package.xml?r1=1.12&r2=1.13&ty=u
Index: pecl/PECL_Gen/package.xml
diff -u pecl/PECL_Gen/package.xml:1.12 pecl/PECL_Gen/package.xml:1.13
--- pecl/PECL_Gen/package.xml:1.12 Thu Jun 9 14:08:55 2005
+++ pecl/PECL_Gen/package.xml Fri Jun 10 06:51:07 2005
@@ -25,8 +25,8 @@
<release>
<state>beta</state>
- <version>0.9.0rc3</version>
- <date>2005-01-17</date>
+ <version>0.9.0rc4</version>
+ <date>2005-06-10</date>
<notes>
<![CDATA[
- implemeted new proto parser, activate with --experimental