Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:30041 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 72603 invoked by uid 1010); 3 Jun 2007 22:00:33 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 72587 invoked from network); 3 Jun 2007 22:00:33 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Jun 2007 22:00:33 -0000 Authentication-Results: pb1.pair.com smtp.mail=giunta_gaetano@libero.it; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=giunta_gaetano@libero.it; sender-id=unknown Received-SPF: error (pb1.pair.com: domain libero.it from 212.52.84.42 cause and error) X-PHP-List-Original-Sender: giunta_gaetano@libero.it X-Host-Fingerprint: 212.52.84.42 smtp-out2.libero.it Linux 2.4/2.6 Received: from [212.52.84.42] ([212.52.84.42:33583] helo=smtp-out2.libero.it) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 35/BB-01606-FF933664 for ; Sun, 03 Jun 2007 18:00:32 -0400 Received: from mx4.libero.it (172.31.0.87) by smtp-out2.libero.it (7.3.120) id 4611FD9804261E65 for internals@lists.php.net; Mon, 4 Jun 2007 00:00:29 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAALXYkaXQj5c/2dsb2JhbAAN Received: from unknown (HELO [192.168.1.2]) ([151.66.62.92]) by smtp-pim.libero.it with ESMTP; 04 Jun 2007 00:00:28 +0200 Message-ID: <466339FC.9000309@libero.it> Date: Mon, 04 Jun 2007 00:00:28 +0200 User-Agent: Thunderbird 2.0.0.0 (Windows/20070326) MIME-Version: 1.0 To: internals@lists.php.net CC: Edin Kadribasic References: <46574FC3.6010707@gmail.com> <465CB041.2070809@libero.it> In-Reply-To: <465CB041.2070809@libero.it> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: pecl4win patches From: giunta_gaetano@libero.it (Gaetano Giunta) 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 = 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"; } } } ?>