cvs: phpdoc /scripts/iniupdate cvs-versions.php generate_changelog.php insert_db.php make_db.php update-all update_db.php
| From: | Nuno Lopes | Date: | Sun, 25 Dec 2005 21:01:17 +0000 |
| Subject: | cvs: phpdoc /scripts/iniupdate cvs-versions.php generate_changelog.php insert_db.php make_db.php update-all update_db.php | ||
| Groups: | php.doc | ||
| Request: | Send a blank email to phpdoc+get-969371343@lists.php.net to get a copy of this message | ||
nlopess Sun Dec 25 21:01:17 2005 EDT
Added files:
/phpdoc/scripts/iniupdate cvs-versions.php
Modified files:
/phpdoc/scripts/iniupdate generate_changelog.php insert_db.php
make_db.php update-all update_db.php
Log:
Christmas present to phpdoc team:
update to PHP 6
make the scripts easier to update for new major versions
# now back to cakes :)
# not tested yet.. I've to study for the exams first..
http://cvs.php.net/viewcvs.cgi/phpdoc/scripts/iniupdate/generate_changelog.php?r1=1.4&r2=1.5&diff_format=u Index: phpdoc/scripts/iniupdate/generate_changelog.php diff -u phpdoc/scripts/iniupdate/generate_changelog.php:1.4 phpdoc/scripts/iniupdate/generate_changelog.php:1.5 --- phpdoc/scripts/iniupdate/generate_changelog.php:1.4 Wed Jul 20 18:45:50 2005 +++ phpdoc/scripts/iniupdate/generate_changelog.php Sun Dec 25 21:01:16 2005 @@ -17,18 +17,16 @@ +----------------------------------------------------------------------+ */ -// replaces php5-cvs with the following version -$cvs_version = '5.1.0'; - +require_once './cvs-versions.php'; /** converts a tag like php_5_0_0 into a version like 5.0.0 */ function tag2version($tag) { - $version = strtr(substr($tag, 4), '_', '.'); + global $cvs_versions; - if ($version == '5.cvs') - return $GLOBALS['cvs_version']; + if (isset($cvs_versions[$tag])) + return $cvs_versions[$tag]; - return $version; + return strtr(substr($tag, 4), '_', '.'); } http://cvs.php.net/viewcvs.cgi/phpdoc/scripts/iniupdate/insert_db.php?r1=1.2&r2=1.3&diff_format=u Index: phpdoc/scripts/iniupdate/insert_db.php diff -u phpdoc/scripts/iniupdate/insert_db.php:1.2 phpdoc/scripts/iniupdate/insert_db.php:1.3 --- phpdoc/scripts/iniupdate/insert_db.php:1.2 Tue Jun 28 16:59:35 2005 +++ phpdoc/scripts/iniupdate/insert_db.php Sun Dec 25 21:01:16 2005 @@ -18,6 +18,7 @@ */ require './ini_search_lib.php'; +require_once './cvs-versions.php'; function insert_in_db($tag) { global $array, $idx; @@ -45,12 +46,6 @@ die("Couldn't create the DB: $error"); } -if (!isset($tags)) { - $tags[] = 'php_4_cvs'; - $tags[] = 'php_5_cvs'; - $tags = array_merge($tags, array_map('rtrim', array_merge(file('version4.tags'), file('version5.tags')))); -} - foreach($tags as $tag) { $array = array(); recurse("./sources/$tag"); http://cvs.php.net/viewcvs.cgi/phpdoc/scripts/iniupdate/make_db.php?r1=1.2&r2=1.3&diff_format=u Index: phpdoc/scripts/iniupdate/make_db.php diff -u phpdoc/scripts/iniupdate/make_db.php:1.2 phpdoc/scripts/iniupdate/make_db.php:1.3 --- phpdoc/scripts/iniupdate/make_db.php:1.2 Tue Jun 28 16:59:35 2005 +++ phpdoc/scripts/iniupdate/make_db.php Sun Dec 25 21:01:16 2005 @@ -17,6 +17,7 @@ +----------------------------------------------------------------------+ */ +require_once './cvs-versions.php'; $db_open = isset($idx) ? true : false; if (!$db_open && !$idx = sqlite_open('ini_changelog.sqlite', 0666, $error)) { @@ -26,10 +27,6 @@ $sql = 'CREATE TABLE changelog ( name TEXT PRIMARY KEY,'; -$tags[] = 'php_4_cvs'; -$tags[] = 'php_5_cvs'; -$tags = array_merge($tags, array_map('rtrim', array_merge(file('version4.tags'), file('version5.tags')))); - foreach($tags as $tag) { $sql .= "$tag TEXT,"; } http://cvs.php.net/viewcvs.cgi/phpdoc/scripts/iniupdate/update-all?r1=1.1&r2=1.2&diff_format=u Index: phpdoc/scripts/iniupdate/update-all diff -u phpdoc/scripts/iniupdate/update-all:1.1 phpdoc/scripts/iniupdate/update-all:1.2 --- phpdoc/scripts/iniupdate/update-all:1.1 Tue Feb 22 17:54:58 2005 +++ phpdoc/scripts/iniupdate/update-all Sun Dec 25 21:01:16 2005 @@ -1,5 +1,8 @@ #!/bin/bash # taken from cvs.php.net/functable by Harmut +PHP_4_CVS=PHP_4_4 +PHP_5_CVS=PHP_5_1 +PHP_6_CVS=HEAD if [ ! -d sources ] @@ -23,12 +26,7 @@ # getting php4 latest developement snapshot echo updating php4 cvs -if [ -d php_4_cvs ] - then - (cd php_4_cvs; cvs update 2>&1 | grep -v "^. php_4_cvs" | grep -v Updating) -else - cvs -d ":pserver:cvsread@cvs.php.net:/repository" get -d php_4_cvs -r PHP_4_3 php-src -fi +cvs -q -d ":pserver:cvsread@cvs.php.net:/repository" co -d php_4_cvs -r $PHP_4_CVS php-src # getting php5 releases @@ -45,9 +43,8 @@ # getting php5 latest developement snapshot echo updating php5 cvs -if [ -d php_5_cvs ] - then - (cd php_5_cvs; cvs update 2>&1 | grep -v "^. php_5_cvs" | grep -v Updating) -else - cvs -d ":pserver:cvsread@cvs.php.net:/repository" get -d php_5_cvs -r HEAD php-src -fi +cvs -q -d ":pserver:cvsread@cvs.php.net:/repository" co -d php_5_cvs -r $PHP_5_CVS php-src + +# getting php6 latest developement snapshot +echo updating php6 cvs +cvs -q -d ":pserver:cvsread@cvs.php.net:/repository" co -d php_6_cvs -r $PHP_6_CVS php-src http://cvs.php.net/viewcvs.cgi/phpdoc/scripts/iniupdate/update_db.php?r1=1.2&r2=1.3&diff_format=u Index: phpdoc/scripts/iniupdate/update_db.php diff -u phpdoc/scripts/iniupdate/update_db.php:1.2 phpdoc/scripts/iniupdate/update_db.php:1.3 --- phpdoc/scripts/iniupdate/update_db.php:1.2 Tue Jun 28 16:59:35 2005 +++ phpdoc/scripts/iniupdate/update_db.php Sun Dec 25 21:01:16 2005 @@ -17,6 +17,8 @@ +----------------------------------------------------------------------+ */ +require_once './cvs-versions.php'; + copy('ini_changelog.sqlite', 'backup.sqlite'); if (!$idx = sqlite_open('ini_changelog.sqlite', 0666, $error)) { @@ -40,8 +42,9 @@ sqlite_query($idx, $sql); +// check which versions need to be updated $tmp = $tags; -$tags = array('php_4_cvs', 'php_5_cvs'); +$tags = array_keys($cvs_versions); //always update cvs versions foreach($tmp as $tag) { if (!isset($columns[$tag])) { @@ -49,7 +52,7 @@ } } -unset($tmp, $columns, $sql); +unset($tmp, $columns, $sql, $olddata); // finally recurse through the new PHP versions include './insert_db.php'; http://cvs.php.net/viewcvs.cgi/phpdoc/scripts/iniupdate/cvs-versions.php?view=markup&rev=1.1 Index: phpdoc/scripts/iniupdate/cvs-versions.php +++ phpdoc/scripts/iniupdate/cvs-versions.php <?php /* +----------------------------------------------------------------------+ | ini doc settings updater | +----------------------------------------------------------------------+ | Copyright (c) 1997-2005 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.0 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_0.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: Nuno Lopes <nlopess@php.net> | +----------------------------------------------------------------------+ */ // fetch all version tags $tags = array(); foreach (glob('*.tags') as $file) { $tmp = array_map('rtrim', file($file)); $last_versions[] = substr(end($tmp), 4); // this is the last released version from a major version $tags = array_merge($tags, $tmp); } // fetch cvs versions $file = file_get_contents('./update-all'); preg_match_all('/PHP_(\d)_CVS=(\w+)/', $file, $data, PREG_SET_ORDER); $cvs_versions = array(); foreach ($data as $v) { if ($v[2] == 'HEAD') { $version = "PHP $v[1].0.0"; } else { $version = 'PHP ' . make_cvs_version(substr($v[2], 4)); } $cvs_versions["php_$v[1]_cvs"] = $version; } $tags = array_merge(array_keys($cvs_versions), $tags); // the file was called directly: DEBUG mode if (basename(__FILE__) == $_SERVER['PHP_SELF']) { print_r($cvs_versions); print_r($last_versions); print_r($tags); } // guess the cvs version number by checking last released versions function make_cvs_version($tag) { global $last_versions; foreach ($last_versions as $ver) { if (strpos($ver, $tag) === 0) { //found it $parts = explode('_', $ver); ++$parts[2]; //increment minor version (5.5.1 -> 5.5.2) return implode('.', $parts); } } die("ERROR: couldn't map $tag to a specific version!\n"); } unset($file, $data, $last_versions); ?>
http://cvs.php.net/viewcvs.cgi/phpdoc/scripts/iniupdate/generate_changelog.php?r1=1.4&r2=1.5&diff_format=u Index: phpdoc/scripts/iniupdate/generate_changelog.php diff -u phpdoc/scripts/iniupdate/generate_changelog.php:1.4 phpdoc/scripts/iniupdate/generate_changelog.php:1.5 --- phpdoc/scripts/iniupdate/generate_changelog.php:1.4 Wed Jul 20 18:45:50 2005 +++ phpdoc/scripts/iniupdate/generate_changelog.php Sun Dec 25 21:01:16 2005 @@ -17,18 +17,16 @@ +----------------------------------------------------------------------+ */ -// replaces php5-cvs with the following version -$cvs_version = '5.1.0'; - +require_once './cvs-versions.php'; /** converts a tag like php_5_0_0 into a version like 5.0.0 */ function tag2version($tag) { - $version = strtr(substr($tag, 4), '_', '.'); + global $cvs_versions; - if ($version == '5.cvs') - return $GLOBALS['cvs_version']; + if (isset($cvs_versions[$tag])) + return $cvs_versions[$tag]; - return $version; + return strtr(substr($tag, 4), '_', '.'); } http://cvs.php.net/viewcvs.cgi/phpdoc/scripts/iniupdate/insert_db.php?r1=1.2&r2=1.3&diff_format=u Index: phpdoc/scripts/iniupdate/insert_db.php diff -u phpdoc/scripts/iniupdate/insert_db.php:1.2 phpdoc/scripts/iniupdate/insert_db.php:1.3 --- phpdoc/scripts/iniupdate/insert_db.php:1.2 Tue Jun 28 16:59:35 2005 +++ phpdoc/scripts/iniupdate/insert_db.php Sun Dec 25 21:01:16 2005 @@ -18,6 +18,7 @@ */ require './ini_search_lib.php'; +require_once './cvs-versions.php'; function insert_in_db($tag) { global $array, $idx; @@ -45,12 +46,6 @@ die("Couldn't create the DB: $error"); } -if (!isset($tags)) { - $tags[] = 'php_4_cvs'; - $tags[] = 'php_5_cvs'; - $tags = array_merge($tags, array_map('rtrim', array_merge(file('version4.tags'), file('version5.tags')))); -} - foreach($tags as $tag) { $array = array(); recurse("./sources/$tag"); http://cvs.php.net/viewcvs.cgi/phpdoc/scripts/iniupdate/make_db.php?r1=1.2&r2=1.3&diff_format=u Index: phpdoc/scripts/iniupdate/make_db.php diff -u phpdoc/scripts/iniupdate/make_db.php:1.2 phpdoc/scripts/iniupdate/make_db.php:1.3 --- phpdoc/scripts/iniupdate/make_db.php:1.2 Tue Jun 28 16:59:35 2005 +++ phpdoc/scripts/iniupdate/make_db.php Sun Dec 25 21:01:16 2005 @@ -17,6 +17,7 @@ +----------------------------------------------------------------------+ */ +require_once './cvs-versions.php'; $db_open = isset($idx) ? true : false; if (!$db_open && !$idx = sqlite_open('ini_changelog.sqlite', 0666, $error)) { @@ -26,10 +27,6 @@ $sql = 'CREATE TABLE changelog ( name TEXT PRIMARY KEY,'; -$tags[] = 'php_4_cvs'; -$tags[] = 'php_5_cvs'; -$tags = array_merge($tags, array_map('rtrim', array_merge(file('version4.tags'), file('version5.tags')))); - foreach($tags as $tag) { $sql .= "$tag TEXT,"; } http://cvs.php.net/viewcvs.cgi/phpdoc/scripts/iniupdate/update-all?r1=1.1&r2=1.2&diff_format=u Index: phpdoc/scripts/iniupdate/update-all diff -u phpdoc/scripts/iniupdate/update-all:1.1 phpdoc/scripts/iniupdate/update-all:1.2 --- phpdoc/scripts/iniupdate/update-all:1.1 Tue Feb 22 17:54:58 2005 +++ phpdoc/scripts/iniupdate/update-all Sun Dec 25 21:01:16 2005 @@ -1,5 +1,8 @@ #!/bin/bash # taken from cvs.php.net/functable by Harmut +PHP_4_CVS=PHP_4_4 +PHP_5_CVS=PHP_5_1 +PHP_6_CVS=HEAD if [ ! -d sources ] @@ -23,12 +26,7 @@ # getting php4 latest developement snapshot echo updating php4 cvs -if [ -d php_4_cvs ] - then - (cd php_4_cvs; cvs update 2>&1 | grep -v "^. php_4_cvs" | grep -v Updating) -else - cvs -d ":pserver:cvsread@cvs.php.net:/repository" get -d php_4_cvs -r PHP_4_3 php-src -fi +cvs -q -d ":pserver:cvsread@cvs.php.net:/repository" co -d php_4_cvs -r $PHP_4_CVS php-src # getting php5 releases @@ -45,9 +43,8 @@ # getting php5 latest developement snapshot echo updating php5 cvs -if [ -d php_5_cvs ] - then - (cd php_5_cvs; cvs update 2>&1 | grep -v "^. php_5_cvs" | grep -v Updating) -else - cvs -d ":pserver:cvsread@cvs.php.net:/repository" get -d php_5_cvs -r HEAD php-src -fi +cvs -q -d ":pserver:cvsread@cvs.php.net:/repository" co -d php_5_cvs -r $PHP_5_CVS php-src + +# getting php6 latest developement snapshot +echo updating php6 cvs +cvs -q -d ":pserver:cvsread@cvs.php.net:/repository" co -d php_6_cvs -r $PHP_6_CVS php-src http://cvs.php.net/viewcvs.cgi/phpdoc/scripts/iniupdate/update_db.php?r1=1.2&r2=1.3&diff_format=u Index: phpdoc/scripts/iniupdate/update_db.php diff -u phpdoc/scripts/iniupdate/update_db.php:1.2 phpdoc/scripts/iniupdate/update_db.php:1.3 --- phpdoc/scripts/iniupdate/update_db.php:1.2 Tue Jun 28 16:59:35 2005 +++ phpdoc/scripts/iniupdate/update_db.php Sun Dec 25 21:01:16 2005 @@ -17,6 +17,8 @@ +----------------------------------------------------------------------+ */ +require_once './cvs-versions.php'; + copy('ini_changelog.sqlite', 'backup.sqlite'); if (!$idx = sqlite_open('ini_changelog.sqlite', 0666, $error)) { @@ -40,8 +42,9 @@ sqlite_query($idx, $sql); +// check which versions need to be updated $tmp = $tags; -$tags = array('php_4_cvs', 'php_5_cvs'); +$tags = array_keys($cvs_versions); //always update cvs versions foreach($tmp as $tag) { if (!isset($columns[$tag])) { @@ -49,7 +52,7 @@ } } -unset($tmp, $columns, $sql); +unset($tmp, $columns, $sql, $olddata); // finally recurse through the new PHP versions include './insert_db.php'; http://cvs.php.net/viewcvs.cgi/phpdoc/scripts/iniupdate/cvs-versions.php?view=markup&rev=1.1 Index: phpdoc/scripts/iniupdate/cvs-versions.php +++ phpdoc/scripts/iniupdate/cvs-versions.php <?php /* +----------------------------------------------------------------------+ | ini doc settings updater | +----------------------------------------------------------------------+ | Copyright (c) 1997-2005 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.0 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_0.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: Nuno Lopes <nlopess@php.net> | +----------------------------------------------------------------------+ */ // fetch all version tags $tags = array(); foreach (glob('*.tags') as $file) { $tmp = array_map('rtrim', file($file)); $last_versions[] = substr(end($tmp), 4); // this is the last released version from a major version $tags = array_merge($tags, $tmp); } // fetch cvs versions $file = file_get_contents('./update-all'); preg_match_all('/PHP_(\d)_CVS=(\w+)/', $file, $data, PREG_SET_ORDER); $cvs_versions = array(); foreach ($data as $v) { if ($v[2] == 'HEAD') { $version = "PHP $v[1].0.0"; } else { $version = 'PHP ' . make_cvs_version(substr($v[2], 4)); } $cvs_versions["php_$v[1]_cvs"] = $version; } $tags = array_merge(array_keys($cvs_versions), $tags); // the file was called directly: DEBUG mode if (basename(__FILE__) == $_SERVER['PHP_SELF']) { print_r($cvs_versions); print_r($last_versions); print_r($tags); } // guess the cvs version number by checking last released versions function make_cvs_version($tag) { global $last_versions; foreach ($last_versions as $ver) { if (strpos($ver, $tag) === 0) { //found it $parts = explode('_', $ver); ++$parts[2]; //increment minor version (5.5.1 -> 5.5.2) return implode('.', $parts); } } die("ERROR: couldn't map $tag to a specific version!\n"); } unset($file, $data, $last_versions); ?>