Please find here: http://gggeek.altervista.org/sw/pecl4win.zip a
slightly improved version of the pecl4win pages:
- allow sorting of columns in the DLLs page
- more descriptive titles in the extensions list page for both search
and single branch cases
Sorry for not providing diffs - the full versions of the files are included
Ideas for further improvement:
- add table of all available branches in the extensions list page (one
column per branch) - add compile log, date, size, in the extensions list page (when
filtered by single branch) - other ?
Bye
Gaetano Giunta
I've attached the patch for this.
Please find here: http://gggeek.altervista.org/sw/pecl4win.zip a
slightly improved version of the pecl4win pages:
- allow sorting of columns in the DLLs page
- more descriptive titles in the extensions list page for both search
and single branch casesSorry for not providing diffs - the full versions of the files are included
Ideas for further improvement:
- add table of all available branches in the extensions list page (one
column per branch)- add compile log, date, size, in the extensions list page (when
filtered by single branch)- other ?
Bye
Gaetano Giunta--
--
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
"Standing on the shoulders of some very clever giants!"
One more patch: a php file to generate rss feeds for pecl4win releases.
It can list all files or all files for a given php branch.
The base rss code is taken from pecl rss.
It assumes that for every extension and php branch, there is only one
file in the db (ie. not many builds corresponding to different php
versions).
Bye
Gaetano
ps: sorry for spamming the list. Is there some other place I should post
this?
<?php
/**
+----------------------------------------------------------------------+
| PECL4WIN Web site |
+----------------------------------------------------------------------+
| Copyright (c) 2007 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 2.02 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available at through the world-wide-web at |
| http://www.php.net/license/3_01.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. |
+----------------------------------------------------------------------+
@author Pierre-Alain Joye pajoye@php.net
@author G. Giunta
@version $Id: $
@todo use a better xml-escaping filter than htmlspecialchars
@todo shall we return a specific error if user asks for inexisting
extension?
*/
if (!defined("SITE_ROOT")) {
define("SITE_ROOT", dirname(FILE));
}
include SITE_ROOT."/lib/includes/init.php";
function rss_bailout() {
header('HTTP/1.0 404 Not Found');
echo "<h1>The requested URL " . (($_SERVER['REQUEST_URI'])) . " was
not found on this server.</h1>";
exit();
}
/* if file is given, the file will be used to store the rss feed /
function rss_create($items, $channel_title, $channel_description,
$dest_file=false) {
if (is_array($items) /&& count($items)>0*/) {
$rss_top = <<<EOT
<?xml version="1.0" encoding="iso-8859-1"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://purl.org/rss/1.0/"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel rdf:about="http://pecl4win.php.net/">
<link>http://pecl4win.php.net/</link>
dc:creatoredink@php.net</dc:creator>
dc:publisheredink@php.net</dc:publisher>
dc:languageen-us</dc:language>
EOT;
$items_xml = "<items>
rdf:Seq";
$item_entries = '';
foreach ($items as $item) {
$date = date("Y-m-d\TH:i:s-05:00",
strtotime($item['releasedate']));
/* allows to override the default link */
if (!isset($item['link'])) {
$url = 'http://pecl4win.php.net/download.php/ext/' .
$item['branch'] . '/' . $item['version'] . '/' . $item['name'];
} else {
$url = $item['link'];
}
if (!empty($item['branch'])) {
$title = $item['name'] . ' (' . $item['branch'] . '
branch)';
} else {
$title = $item['name'];
}
//$node = $this->newItem($title, $url,
$item['releasenotes'], $date);
$items_xml .= '<rdf:li rdf:resource="' . $url . '"/>' . "\n";
$item_entries .= "<item rdf:about=" . '"' .$url . '"' . ">
$items_xml .= "</rdf:Seq>
</items>\n";
$rss_feed = $rss_top . $items_xml ."
<title>$channel_title</title>
<description>$channel_description</description>
</channel>
$item_entries
</rdf:RDF>";
/* lock free write, thx rasmus for the tip */
if($dest_file && (!file_exists($dest_file) ||
filemtime($dest_file) < (time()-$timeout))) {
$stream = fopen($url,'r');
$tmpf = tempnam('/tmp','YWS');
// Note the direct write from the stream here
file_put_contents($tmpf, $stream);
fclose($stream);
rename($tmpf, $dest_file);
}
header("Content-Type: text/xml; charset=iso-8859-1");
echo $rss_feed;
} else {
rss_bailout();
}
}
$channel_title = 'PECL4WIN: Latest releases';
$channel_description = 'The latest releases in PECL4WIN.';
$q = "select fname, branch, pversion, filesize, updated from ext";
$args = isset($_SERVER['PATH_INFO']) ? explode("/",
$_SERVER['PATH_INFO']) : '';
if (count($args) > 1 && $args[1] != '') {
//$branch = $args[1];
$channel_title .= ' for branch '.htmlspecialchars($args[1]);
$q .= safe_sql_str(" where branch=!s", $args[1]);
}
else {
//$branch = '';
}
$q .= " order by updated desc";
$res = $DB->query($q);
$i = 0;
$items = array();
while ($row = $DB->fetchRow($res)) {
$file = new stdClass;
$DB->loadFromDbRow($file, $res, $row);
$items[] = array(
'name' => $file->fname,
'branch' => $file->branch,
'releasedate' => $file->updated,
'version' => $file->pversion,
'releasenotes' => 'Size: ' . $file->filesize . " KB - Last
build: " . date('Y-m-d H:i:s', $file->updated)
);
/// @todo move select limit from here unto query for bette resource
usage
if (++$i > 10) {
break;
}
}
// we do not use yet static files. It will be activated with the new
backends.
// $file = dirname(FILE) . '/' . $type . '_' . $argument . '.rss';
$file = false;
rss_create($items, $channel_title, $channel_description, $file);
Here's my first attempt at a revision of the build process used by pecl4win:
-
the pecl sources and version numbers are gotten off the pecl website
(transport layer can be easily switched if the server is the same); once
a version is downloaded it is never again, unless deleted; the download
script can operate on a given extension/version or globally on
everything in the db -
the build script is modified to build the same pecl extension for all
php versions. It is untested, since I do not have (yet) a working win32
build env (missing msdev at the moment)
The one question I have facing right now is: is the pversion column in
the ext table used at all? If not, it could be converted to hold the
pecl extension version. If it is used, I would have to add a new column
to the ext table. Any way, most db queries would have to be rewritten.
Any indication on the best approach would be preciated, before I start
on it...
Bye
Gaetano
--- mk4.php Fri Feb 02 01:52:26 2007
+++ mk42.php Sun Jun 03 23:43:49 2007
@@ -4,16 +4,21 @@
require dirname(FILE) . '/conf.php';
+//$base="/php4build";
+$base="C:/htdocs/pecl4win_cvs/pecl4win/lib";
if (!strlen($argv[1])) {
$branch = "4_3";
} else {
$branch = $argv[1];
}
-if (!strlen($argv[2])) {
+if (!strlen(@$argv[2])) {
$pecl_ext = "*";
} else {
- $pecl_ext = $argv[2];
- $pecl_ext = $argv;
- array_shift($pecl_ext);
- array_shift($pecl_ext);
}
if (!isset($conf[$branch])) {
@@ -30,15 +35,17 @@
putenv('LIB=' . $lib);
if ($pecl_ext != "*") {
- $dsps = array($c['pecl_dir'] . "/ext/{$pecl_ext}/{$pecl_ext}.dsp");
- $dsps = array();
- foreach($pecl_ext as $pecl_ext2)
- $dsps[] = $base . "/exts/{$pecl_ext2}/{$pecl_ext2}.dsp";
} else {
- $dsps = glob($c['pecl_dir'] . "/ext/{$pecl_ext}/{$pecl_ext}.dsp");
- $dsps = glob($base . "/exts/{$pecl_ext}/{$pecl_ext}.dsp");
}
$fail = "";
foreach ($dsps as $dsp) {
- print "Trying $dsp...";
-
print "Trying $dsp...\n";
$dir = dirname($dsp);
chdir($dir);
system("rm -rf $dir/Release_TS");
@@ -49,10 +56,10 @@if ($res || ((!$content = @file_get_contents($c['pecl_dir'] .
"/Release_TS/$fname")) && (!$content =
@file_get_contents("$dir/Release_TS/$fname")) )) {
print "$dir/Release_TS/$fname";
- print "FAILED";
- print " FAILED";
$fail .= "\n\nFailed building $dsp\n" . implode("\n", $out);
} else {
- print "SUCCESS uploading $fname ";
-
print " SUCCESS uploading $fname ";
$downloads = 0;if (($res = $DB->query(safe_sql_str("select downloads from ext
where fname=!s and branch=!s and pversion=!s", $fname, $branch,
$c['version'])))
@@ -60,7 +67,7 @@
$downloads = (int)$row['downloads'];
$DB->query(safe_sql_str("delete from ext where fname=!s and
branch=!s and pversion=!s", $fname, $branch, $c['version']));
}
-
$res = $DB->query(safe_sql_str("insert into ext(fname, branch,
pversion, clog, md5hash, filesize, updated, content, downloads) values
(!s, !s, !s, !s, !s, !i, !t, !b, !i)", $fname, $branch, $c['version'],
implode("\n", $out), md5($content), strlen($content),time()
, $content,
$downloads));if ($res) {
--- buildall.sh Fri Mar 16 00:36:21 2007
+++ buildall2.sh Sun Jun 03 22:59:01 2007
@@ -1,11 +1,18 @@
#!/bin/bash
$Id: buildall.sh,v 1.9 2007/03/15 22:36:21 edink Exp $
+###
+### base idea:
+### + get new revisions from pecl (ie those not yet downloaded)
+### + for every version of php: build it
. /etc/vcenv.sh 6
cvsopt="-z3 -q"
-base="/php4build"
-php="$base/bin/php -c $base/bin/php.ini"
+###base="/php4build"
+base="C:/htdocs/pecl4win_cvs/pecl4win/lib"
+###php="$base/bin/php -c $base/bin/php.ini"
+php="C:/php5/php -c C:/php5/php.ini"
if [ -f $base/lock.pecl ]; then
echo Builder locked
@@ -14,44 +21,54 @@
touch $base/lock.pecl
+echo $php $base/bin/fetch.php all $base/exts
+exit 0
+# get new revisions from pecl (ie those not yet downloaded)
+cd $base/exts
+extlist=$php $base/bin/fetch.php all $base/exts
Make php 4.3 and 4.4
-cd $base/pecl_4_3/ext
-cvs $cvsopt upd -dP
+###cd $base/pecl_4_3/ext
+###cvs $cvsopt upd -dP
Compiler crashes on ingres module, delete it
-rm -rf ingres
-$php $base/bin/mk4.php 4_3
-$php $base/bin/mk4.php 4_4
+###rm -rf ingres
+$php $base/bin/mk42.php 4_3 $ext_list
+$php $base/bin/clean_ext2.php $ext_list
+$php $base/bin/mk42.php 4_4
Make php 5.0
-cd $base/pecl_5_0
-cvs $cvsopt upd -dP
+###cd $base/pecl_5_0
+###cvs $cvsopt upd -dP
Relic from the past no one wants to delete from cvs
-rm -rf pdo_ids
-$php $base/bin/clean_ext.php 5_0
-$php $base/bin/mk5.php 5_0
+###rm -rf pdo_ids
+$php $base/bin/clean_ext2.php $ext_list
+$php $base/bin/mk52.php 5_0
Make php 5.1
-cd $base/pecl_5_0
-cvs $cvsopt upd -dP
+###cd $base/pecl_5_0
+###cvs $cvsopt upd -dP
Relic from the past no one wants to delete from cvs
-rm -rf pdo_ids
-$php $base/bin/clean_ext.php 5_1
-$php $base/bin/mk5.php 5_1
+###rm -rf pdo_ids
+$php $base/bin/clean_ext2.php 5_1
+$php $base/bin/mk52.php 5_1
Make php 5.2
-cd $base/pecl_5_2
-cvs $cvsopt upd -dP
+###cd $base/pecl_5_2
+###cvs $cvsopt upd -dP
Relic from the past no one wants to delete from cvs
-rm -rf pdo_ids
-$php $base/bin/clean_ext.php 5_2
-$php $base/bin/mk5.php 5_2
+###rm -rf pdo_ids
+$php $base/bin/clean_ext2.php 5_2
+$php $base/bin/mk52.php 5_2
Make php 6.0
-cd $base/pecl_6_0
-cvs $cvsopt upd -dP
+###cd $base/pecl_6_0
+###cvs $cvsopt upd -dP
Relic from the past no one wants to delete from cvs
-rm -rf pdo_ids
-$php $base/bin/clean_ext.php 6_0
-$php $base/bin/mk5.php 6_0
+###rm -rf pdo_ids
+$php $base/bin/clean_ext2.php 6_0
+$php $base/bin/mk52.php 6_0
rm -f $base/lock.pecl
New file: fetch.php
<?php
/**
- Given a pecl extension name and a target dir, downloads all versions
from pecl - and unpacks them as subdirectories. Optionally gets a single given
version - ('last' accepted to get latest version, and 'all' to get all extensions).
- Does not download extensions/versions that exist already locally as
directory. - @author Gaetano Giunta
- @version $Id: $
- @copyright (C) G. Giunta 2007
- @license code licensed under the BSD License
*/
if ($argc < 3)
{
die ('Usage: fetch.php extension target_dir [version]');
}
$ext = $argv[1];
$dir = $argv[2];
$ver = $argc >= 4 ? $argv[3] : null;
//ini_set('display_errors', false);
/**
- Given a pecl extension name, returns an array of existing versions
(or false) - @todo fetch more info, such as release date, alpha/beta/stable state,
etc... ?
/
function get_versions($ext)
{
$file = file_get_contents('http://pecl.php.net/package/'.$ext.'/');
//$file =
file_get_contents('c:/htdocs/pecl4win_cvs/pecl4win/lib/bin/hash.htm');
if (preg_match_all('|href="/package/'.$ext.'/([^"])|i', $file,
$matches)) {
return ($matches[1]);
}
else
return false;
}
/// dowloads a given version of a given extension (in tgz format).
'last' ok as version name
function get_ext($ext, $ver)
{
if ($ver == 'last')
{
return file_get_contents('http://pecl.php.net/get/'.$ext);
}
else
{
return
file_get_contents('http://pecl.php.net/get/'.$ext.'-'.$ver.'.tgz');
}
}
if ($ext == '*' or $ext == 'all')
{
require dirname(FILE) . '/conf.php';
$res = $DB->query('select distinct fname from ext');
$exts = array();
while ($row = $DB->fetchRow($res))
{
$file = new stdClass;
$DB->loadFromDbRow($file, $res, $row);
$exts[] = substr($file->fname, 4, -4);
}
}
else
{
$exts = array($ext);
}
foreach($exts as $ext)
{
if ($ver)
{
$vers = array($ver);
}
else
{
$vers = get_versions($ext);
if ($vers == null)
{
//echo "ERROR: could not fetch version list for extension
$ext\n";
$vers = array();
}
}
foreach($vers as $version)
{
$filename = $ext.'-'.$version;
// do not download again if it exists
if (is_dir($dir.'/'.$filename))
{
continue;
}
$file = get_ext($ext, $version);
if ($file != '')
{
/// @todo use php zip functions to degzip the file?
file_put_contents($dir.'/'.$filename.'.tgz', $file);
system("gunzip $filename.tgz && tar -xvf $filename.tar && rm
$filename.tar");
echo "$filename ";
}
else
{
//echo "ERROR: could not fetch version $version of extension
$ext\n";
}
}
}
?