From 6adbe967aa97fef891f28239fb68cf60904031dd Mon Sep 17 00:00:00 2001 From: "Edward Z. Yang" Date: Mon, 16 Feb 2009 03:22:58 -0500 Subject: [PATCH 1/4] Initial commit. Signed-off-by: Edward Z. Yang --- .gitignore | 2 ++ bin/phpv | 9 +++++++++ fix-cgi.sh | 7 +++++++ get-url.php | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ install.sh | 14 ++++++++++++++ update-all-dev.sh | 4 ++++ update-dev.sh | 7 +++++++ 7 files changed, 91 insertions(+) create mode 100644 .gitignore create mode 100755 bin/phpv create mode 100755 fix-cgi.sh create mode 100644 get-url.php create mode 100755 install.sh create mode 100755 update-all-dev.sh create mode 100755 update-dev.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5eaab81 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +versions +working diff --git a/bin/phpv b/bin/phpv new file mode 100755 index 0000000..fa8cf42 --- /dev/null +++ b/bin/phpv @@ -0,0 +1,9 @@ +#!/bin/bash +VERSION="$1" +if [ "$VERSION" = "" ] +then + echo "Usage: phpv version ..." + exit +fi +shift 1 +"/home/ezyang/Dev/php/versions/$VERSION/bin/php" $@ diff --git a/fix-cgi.sh b/fix-cgi.sh new file mode 100755 index 0000000..ac0620c --- /dev/null +++ b/fix-cgi.sh @@ -0,0 +1,7 @@ +#!/bin/bash +set -e +VERSION="$1" +BIN="versions/$VERSION/bin" +mv "$BIN/php" "$BIN/php-cgi" +mv "working/php-$VERSION/sapi/cli/php" "$BIN/php" +versions/$VERSION/bin/php --version diff --git a/get-url.php b/get-url.php new file mode 100644 index 0000000..a4ef335 --- /dev/null +++ b/get-url.php @@ -0,0 +1,48 @@ +#!/usr/bin/env php +loadHTMLFile($url); + $xpath = new DOMXPath($doc); + return $xpath->query('//a'); +} + +if (!isset($_SERVER['argv'][1])) { + echo <<getAttribute('href'); + if (!$url) continue; + $result = preg_match('#/php-([^-]+?)\.tar\.gz#', $url, $matches); + if (!$result) continue; + list($full, $version) = $matches; + $url = str_replace('/from/a/mirror', '/from/this/mirror', $url); // make download ready + if ($url[0] == '/') $url = $url_mirror . $url; // heuristic assumes absolute paths are used + $index[$version] = $url; + } +} + +// maybe add qa support + +if (!isset($index[$install_version])) { + fwrite(STDERR, "Could not find $install_version\n"); + exit(1); +} + +echo $index[$install_version]; + diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..42dfd5e --- /dev/null +++ b/install.sh @@ -0,0 +1,14 @@ +#!/bin/bash +set -e +VERSION="$1" +URL=$(php get-url.php "$VERSION") +mkdir "versions/$VERSION" +cd working +wget $URL -O "php-$VERSION.tar.gz" +tar xzf "php-$VERSION.tar.gz" +cd "php-$VERSION" +./configure --prefix=/home/ezyang/Dev/php/versions/$VERSION +make +make install +../../versions/$VERSION/bin/php --version + diff --git a/update-all-dev.sh b/update-all-dev.sh new file mode 100755 index 0000000..df2eaa3 --- /dev/null +++ b/update-all-dev.sh @@ -0,0 +1,4 @@ +#!/bin/bash +./update-dev.sh 5.2 +./update-dev.sh 5.3 +./update-dev.sh 6.0 diff --git a/update-dev.sh b/update-dev.sh new file mode 100755 index 0000000..a2b5276 --- /dev/null +++ b/update-dev.sh @@ -0,0 +1,7 @@ +#!/bin/bash +set -e +cd "working/$1" +cvs up +./config.nice +make +make install -- 2.11.4.GIT From c57e96b30eeeb0eff13d63d09ee6c0fc71ebbe35 Mon Sep 17 00:00:00 2001 From: "Edward Z. Yang" Date: Thu, 19 Feb 2009 17:51:14 -0500 Subject: [PATCH 2/4] Don't make spurious version directories, and fix update-dev script. Signed-off-by: Edward Z. Yang --- install.sh | 2 +- update-dev.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index 42dfd5e..bc4f0e5 100755 --- a/install.sh +++ b/install.sh @@ -2,10 +2,10 @@ set -e VERSION="$1" URL=$(php get-url.php "$VERSION") -mkdir "versions/$VERSION" cd working wget $URL -O "php-$VERSION.tar.gz" tar xzf "php-$VERSION.tar.gz" +mkdir "../versions/$VERSION" cd "php-$VERSION" ./configure --prefix=/home/ezyang/Dev/php/versions/$VERSION make diff --git a/update-dev.sh b/update-dev.sh index a2b5276..032a098 100755 --- a/update-dev.sh +++ b/update-dev.sh @@ -1,6 +1,6 @@ #!/bin/bash set -e -cd "working/$1" +cd "working/php-$1-dev" cvs up ./config.nice make -- 2.11.4.GIT From 97d4fde8648cc500e884f89683b46a327a25e062 Mon Sep 17 00:00:00 2001 From: "Edward Z. Yang" Date: Thu, 19 Feb 2009 17:51:30 -0500 Subject: [PATCH 3/4] Add phpv-cgi script. Signed-off-by: Edward Z. Yang --- bin/phpv-cgi | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100755 bin/phpv-cgi diff --git a/bin/phpv-cgi b/bin/phpv-cgi new file mode 100755 index 0000000..fdb7a11 --- /dev/null +++ b/bin/phpv-cgi @@ -0,0 +1,9 @@ +#!/bin/bash +VERSION="$1" +if [ "$VERSION" = "" ] +then + echo "Usage: phpv-cgi version ..." + exit +fi +shift 1 +"/home/ezyang/Dev/php/versions/$VERSION/bin/php-cgi" $@ -- 2.11.4.GIT From 68a4579878b19dfbd8ddad904d37f19b21b025e5 Mon Sep 17 00:00:00 2001 From: "Edward Z. Yang" Date: Fri, 27 Mar 2009 17:04:32 -0400 Subject: [PATCH 4/4] Genericize paths. Signed-off-by: Edward Z. Yang --- bin/phpv | 2 +- bin/phpv-cgi | 2 +- get-url.php | 7 ++++++- install.sh | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/bin/phpv b/bin/phpv index fa8cf42..510da07 100755 --- a/bin/phpv +++ b/bin/phpv @@ -6,4 +6,4 @@ then exit fi shift 1 -"/home/ezyang/Dev/php/versions/$VERSION/bin/php" $@ +"`dirname "$0"`/../versions/$VERSION/bin/php" $@ diff --git a/bin/phpv-cgi b/bin/phpv-cgi index fdb7a11..f9d6ace 100755 --- a/bin/phpv-cgi +++ b/bin/phpv-cgi @@ -6,4 +6,4 @@ then exit fi shift 1 -"/home/ezyang/Dev/php/versions/$VERSION/bin/php-cgi" $@ +"`dirname "$0"`/../versions/$VERSION/bin/php-cgi" $@ diff --git a/get-url.php b/get-url.php index a4ef335..b0581a5 100644 --- a/get-url.php +++ b/get-url.php @@ -20,8 +20,13 @@ $install_version = $_SERVER['argv'][1]; $url_mirror = 'http://us2.php.net'; $url_releases = $url_mirror . '/releases/'; $url_downloads = $url_mirror . '/downloads.php'; +$url_qa = 'http://qa.php.net'; -$link_sets = array(extract_links($url_releases), extract_links($url_downloads)); +$link_sets = array( + extract_links($url_releases), + extract_links($url_downloads), + extract_links($url_qa) +); $index = array(); foreach ($link_sets as $links) { diff --git a/install.sh b/install.sh index bc4f0e5..557b4e1 100755 --- a/install.sh +++ b/install.sh @@ -7,7 +7,7 @@ wget $URL -O "php-$VERSION.tar.gz" tar xzf "php-$VERSION.tar.gz" mkdir "../versions/$VERSION" cd "php-$VERSION" -./configure --prefix=/home/ezyang/Dev/php/versions/$VERSION +./configure --prefix=../../versions/$VERSION make make install ../../versions/$VERSION/bin/php --version -- 2.11.4.GIT