From baeb020fece352befd83a672de9018d889bb90e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?agentzh=20=28=E7=AB=A0=E4=BA=A6=E6=98=A5=29?= Date: Wed, 16 Feb 2011 16:25:19 +0800 Subject: [PATCH] now "make" produces a tarball but still incomplete yet. --- .gitignore | 7 +- Makefile | 5 + patches/nginx-0.8.54-no_error_pages.patch | 90 ++++++++++ ...nginx-0.8.54-redirect_memcpy_overlap.patch | 15 ++ patches/nginx-0.8.54-server_header.patch | 26 +++ util/configure | 6 + util/get-tarball | 21 +++ util/mirror-tarballs | 162 ++++++++++++++++++ 8 files changed, 330 insertions(+), 2 deletions(-) create mode 100644 Makefile create mode 100644 patches/nginx-0.8.54-no_error_pages.patch create mode 100644 patches/nginx-0.8.54-redirect_memcpy_overlap.patch create mode 100644 patches/nginx-0.8.54-server_header.patch create mode 100644 util/configure create mode 100755 util/get-tarball create mode 100755 util/mirror-tarballs diff --git a/.gitignore b/.gitignore index 22d70f7..1381dc1 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,6 @@ haskell/bin/openhesty haskell/openhesty.txt !*.t.json cover_db -Makefile bin/test-account.sh blib haskell/big.sql @@ -59,6 +58,10 @@ diff.txt etc/compiled.actions etc/taobao_vip.conf lib/OpenResty/Handler/YLogin.pm -util/ demo/ clients/ +util/a.sql +util/blog-rows.sql +util/comments.sql +util/posts.sql +ngx_openresty-* diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..194895f --- /dev/null +++ b/Makefile @@ -0,0 +1,5 @@ +.PHONY: all + +all: + ./util/mirror-tarballs + diff --git a/patches/nginx-0.8.54-no_error_pages.patch b/patches/nginx-0.8.54-no_error_pages.patch new file mode 100644 index 0000000..1963249 --- /dev/null +++ b/patches/nginx-0.8.54-no_error_pages.patch @@ -0,0 +1,90 @@ +--- nginx-0.8.54/src/http/ngx_http_core_module.c 2010-12-14 18:38:42.000000000 +0800 ++++ nginx-0.8.54-patched/src/http/ngx_http_core_module.c 2011-01-30 19:24:34.956354518 +0800 +@@ -57,6 +57,8 @@ + void *conf); + static char *ngx_http_core_error_page(ngx_conf_t *cf, ngx_command_t *cmd, + void *conf); ++static char *ngx_http_core_no_error_pages(ngx_conf_t *cf, ngx_command_t *cmd, ++ void *conf); + static char *ngx_http_core_try_files(ngx_conf_t *cf, ngx_command_t *cmd, + void *conf); + static char *ngx_http_core_open_file_cache(ngx_conf_t *cf, ngx_command_t *cmd, +@@ -614,6 +616,14 @@ + 0, + NULL }, + ++ { ngx_string("no_error_pages"), ++ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF ++ |NGX_CONF_NOARGS, ++ ngx_http_core_no_error_pages, ++ NGX_HTTP_LOC_CONF_OFFSET, ++ 0, ++ NULL }, ++ + { ngx_string("try_files"), + NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_2MORE, + ngx_http_core_try_files, +@@ -3052,7 +3062,6 @@ + * clcf->types = NULL; + * clcf->default_type = { 0, NULL }; + * clcf->error_log = NULL; +- * clcf->error_pages = NULL; + * clcf->try_files = NULL; + * clcf->client_body_path = NULL; + * clcf->regex = NULL; +@@ -3062,6 +3071,7 @@ + * clcf->gzip_proxied = 0; + */ + ++ clcf->error_pages = NGX_CONF_UNSET_PTR; + clcf->client_max_body_size = NGX_CONF_UNSET; + clcf->client_body_buffer_size = NGX_CONF_UNSET_SIZE; + clcf->client_body_timeout = NGX_CONF_UNSET_MSEC; +@@ -3250,9 +3260,7 @@ + } + } + +- if (conf->error_pages == NULL && prev->error_pages) { +- conf->error_pages = prev->error_pages; +- } ++ ngx_conf_merge_ptr_value(conf->error_pages, prev->error_pages, NULL); + + ngx_conf_merge_str_value(conf->default_type, + prev->default_type, "text/plain"); +@@ -3988,6 +3996,10 @@ + ngx_http_compile_complex_value_t ccv; + + if (clcf->error_pages == NULL) { ++ return "conflicts with \"no_error_pages\""; ++ } ++ ++ if (clcf->error_pages == NGX_CONF_UNSET_PTR) { + clcf->error_pages = ngx_array_create(cf->pool, 4, + sizeof(ngx_http_err_page_t)); + if (clcf->error_pages == NULL) { +@@ -4095,6 +4107,25 @@ + + + static char * ++ngx_http_core_no_error_pages(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) ++{ ++ ngx_http_core_loc_conf_t *clcf = conf; ++ ++ if (clcf->error_pages == NULL) { ++ return "is duplicate"; ++ } ++ ++ if (clcf->error_pages != NGX_CONF_UNSET_PTR) { ++ return "conflicts with \"error_page\""; ++ } ++ ++ clcf->error_pages = NULL; ++ ++ return NGX_CONF_OK; ++} ++ ++ ++static char * + ngx_http_core_try_files(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) + { + ngx_http_core_loc_conf_t *clcf = conf; diff --git a/patches/nginx-0.8.54-redirect_memcpy_overlap.patch b/patches/nginx-0.8.54-redirect_memcpy_overlap.patch new file mode 100644 index 0000000..28e1cd5 --- /dev/null +++ b/patches/nginx-0.8.54-redirect_memcpy_overlap.patch @@ -0,0 +1,15 @@ +--- nginx-0.8.54/src/http/ngx_http_script.c 2010-05-14 17:56:37.000000000 +0800 ++++ nginx-0.8.54-patched/src/http/ngx_http_script.c 2010-06-07 17:15:27.399312041 +0800 +@@ -983,7 +983,11 @@ + NGX_UNESCAPE_REDIRECT); + + if (src < e->pos) { +- dst = ngx_copy(dst, src, e->pos - src); ++ if (src != dst) { ++ memmove(dst, src, e->pos - src); ++ } ++ ++ dst += e->pos - src; + } + + e->pos = dst; diff --git a/patches/nginx-0.8.54-server_header.patch b/patches/nginx-0.8.54-server_header.patch new file mode 100644 index 0000000..8056c74 --- /dev/null +++ b/patches/nginx-0.8.54-server_header.patch @@ -0,0 +1,26 @@ +diff -ur lz-nginx-0.8.54/nginx-0.8.54/src/core/nginx.h lz-nginx-0.8.54-patched/nginx-0.8.54/src/core/nginx.h +--- lz-nginx-0.8.54/nginx-0.8.54/src/core/nginx.h 2010-02-12 17:31:01.000000000 +0800 ++++ lz-nginx-0.8.54-patched/nginx-0.8.54/src/core/nginx.h 2010-03-30 10:52:13.240702627 +0800 +@@ -10,7 +10,7 @@ + + #define nginx_version 8054 + #define NGINX_VERSION "0.8.54" +-#define NGINX_VER "nginx/" NGINX_VERSION ++#define NGINX_VER "ngx_openresty/" NGINX_VERSION ".unknown" + + #define NGINX_VAR "NGINX" + #define NGX_OLDPID_EXT ".oldbin" +Only in lz-nginx-0.8.54-patched/nginx-0.8.54/src/core: nginx.h.orig +Only in lz-nginx-0.8.54-patched/nginx-0.8.54/src/core: nginx.h.rej +diff -ur lz-nginx-0.8.54/nginx-0.8.54/src/http/ngx_http_header_filter_module.c lz-nginx-0.8.54-patched/nginx-0.8.54/src/http/ngx_http_header_filter_module.c +--- lz-nginx-0.8.54/nginx-0.8.54/src/http/ngx_http_header_filter_module.c 2010-03-03 23:14:04.000000000 +0800 ++++ lz-nginx-0.8.54-patched/nginx-0.8.54/src/http/ngx_http_header_filter_module.c 2010-03-30 10:52:53.670909405 +0800 +@@ -45,7 +45,7 @@ + }; + + +-static char ngx_http_server_string[] = "Server: nginx" CRLF; ++static char ngx_http_server_string[] = "Server: ngx_openresty" CRLF; + static char ngx_http_server_full_string[] = "Server: " NGINX_VER CRLF; + + diff --git a/util/configure b/util/configure new file mode 100644 index 0000000..b4cdbb2 --- /dev/null +++ b/util/configure @@ -0,0 +1,6 @@ +#!/usr/bin/env perl + +use strict; +use warnings; + + diff --git a/util/get-tarball b/util/get-tarball new file mode 100755 index 0000000..1598a82 --- /dev/null +++ b/util/get-tarball @@ -0,0 +1,21 @@ +#!/bin/bash + +root=$(readlink -f -- "$(dirname -- "$0")/..") +work=$root/work + +if [ ! -d $work ]; then + mkdir $work || exit 1 +fi + +url=$1 +outfile=$3 +cachefile=$work/$outfile +if [ -s $cachefile ]; then + cp $work/$outfile $outfile || exit 1 +else + wget --no-check-certificate $1 -O $3 || exit 1 + if [ $? == 0 ]; then + cp $3 $work/ || exit 1 + fi +fi + diff --git a/util/mirror-tarballs b/util/mirror-tarballs new file mode 100755 index 0000000..a88c456 --- /dev/null +++ b/util/mirror-tarballs @@ -0,0 +1,162 @@ +#!/bin/bash + +root=$(readlink -f -- "$(dirname -- "$0")/..") + +debug= +main_ver=0.8.54 +minor_ver=0 +version=$main_ver.$minor_ver +name=ngx_openresty-$version +work=$root/work + +if [ -z $debug ]; then + rm -rf $name || exit 1 + mkdir -p $name/bundle || exit 1 +fi + +cd $name/bundle || exit 1 + +if [ ! -d $work ]; then + mkdir $work || exit 1 +fi + +ver="$main_ver" +$root/util/get-tarball "http://nginx.org/download/nginx-$ver.tar.gz" -O nginx-$ver.tar.gz || exit 1 +tar -xzf nginx-$ver.tar.gz || exit 1 +cd nginx-$ver || exit 1 + +# patch the patch + +cp $root/patches/nginx-$main_ver-server_header.patch server_header.patch || exit 1 +sed -i $"s/NGINX_VERSION \".unknown\"/NGINX_VERSION \".$minor_ver\"/" \ + server_header.patch || exit 1 + +patch -p2 < server_header.patch || exit 1 + +patch -p1 < $root/patches/nginx-$main_ver-redirect_memcpy_overlap.patch || exit 1 + +patch -p1 < $root/patches/nginx-$main_ver-no_error_pages.patch || exit 1 + +rm -f *.patch || exit 1 + +cd .. || exit 1 + +ver=0.36rc1 +$root/util/get-tarball "http://github.com/agentzh/echo-nginx-module/tarball/v$ver" -O echo-nginx-module-$ver.tar.gz || exit 1 +tar -xzf echo-nginx-module-$ver.tar.gz +mv agentzh-echo-nginx-module-* echo-nginx-module-$ver + +ver=0.03rc2 +$root/util/get-tarball "http://github.com/agentzh/xss-nginx-module/tarball/v$ver" -O xss-nginx-module-$ver.tar.gz || exit 1 +tar -xzf xss-nginx-module-$ver.tar.gz || exit 1 +mv agentzh-xss-nginx-module-* xss-nginx-module-$ver || exit 1 + +ver=0.2.14 +$root/util/get-tarball "http://github.com/simpl/ngx_devel_kit/tarball/v$ver" -O ngx_devel_kit-$ver.tar.gz +tar -xzf ngx_devel_kit-$ver.tar.gz || exit 1 +mv simpl-ngx_devel_kit-* ngx_devel_kit-$ver || exit 1 + +ver=0.21rc2 +$root/util/get-tarball "http://github.com/agentzh/set-misc-nginx-module/tarball/v$ver" -O set-misc-nginx-module-$ver.tar.gz || exit 1 +tar -xzf set-misc-nginx-module-$ver.tar.gz || exit 1 +mv agentzh-set-misc-nginx-module-* set-misc-nginx-module-$ver || exit 1 + +ver=0.11rc2 +$root/util/get-tarball "http://github.com/agentzh/rds-json-nginx-module/tarball/v$ver" -O rds-json-nginx-module-$ver.tar.gz || exit 1 +tar -xzf rds-json-nginx-module-$ver.tar.gz || exit 1 +mv agentzh-rds-json-nginx-module-* rds-json-nginx-module-$ver || exit 1 + +ver=0.14 +$root/util/get-tarball "http://github.com/agentzh/headers-more-nginx-module/tarball/v$ver" -O headers-more-nginx-module-$ver.tar.gz || exit 1 +tar -xzf headers-more-nginx-module-$ver.tar.gz || exit 1 +mv agentzh-headers-more-nginx-module-* headers-more-nginx-module-$ver || exit 1 + +################################# + +ver=0.0.15rc5 +$root/util/get-tarball "http://github.com/chaoslawful/drizzle-nginx-module/tarball/v$ver" -O drizzle-nginx-module-$ver.tar.gz || exit 1 +tar -xzf drizzle-nginx-module-$ver.tar.gz || exit 1 +mv chaoslawful-drizzle-nginx-module-* drizzle-nginx-module-$ver || exit 1 + +################################# + +ver=0.1.6rc1 +$root/util/get-tarball "http://github.com/chaoslawful/lua-nginx-module/tarball/v$ver" -O lua-nginx-module-$ver.tar.gz || exit 1 +tar -xzf lua-nginx-module-$ver.tar.gz || exit 1 +mv chaoslawful-lua-nginx-module-* lua-nginx-module-$ver || exit 1 + +################################# + +ver=0.02 +$root/util/get-tarball "http://github.com/agentzh/array-var-nginx-module/tarball/v$ver" -O array-var-nginx-module-$ver.tar.gz || exit 1 +tar -xzf array-var-nginx-module-$ver.tar.gz || exit 1 +mv agentzh-array-var-nginx-module-* array-var-nginx-module-$ver || exit 1 + +################################# + +ver=0.12rc1 +$root/util/get-tarball "http://github.com/agentzh/memc-nginx-module/tarball/v$ver" -O memc-nginx-module-$ver.tar.gz || exit 1 +tar -xzf memc-nginx-module-$ver.tar.gz || exit 1 +mv agentzh-memc-nginx-module-* memc-nginx-module-$ver || exit 1 + +################################# + +ver=0.12rc1 +$root/util/get-tarball "http://github.com/agentzh/srcache-nginx-module/tarball/v$ver" -O srcache-nginx-module-$ver.tar.gz || exit 1 +tar -xzf srcache-nginx-module-$ver.tar.gz || exit 1 +mv agentzh-srcache-nginx-module-* srcache-nginx-module-$ver || exit 1 + +################################# + +ver=0.07rc4 +$root/util/get-tarball "http://github.com/calio/form-input-nginx-module/tarball/v$ver" -O form-input-nginx-module-$ver.tar.gz || exit 1 +tar -xzf form-input-nginx-module-$ver.tar.gz || exit 1 +mv calio-form-input-nginx-module-* form-input-nginx-module-$ver || exit 1 + +################################# + +ver=0.10rc1 +$root/util/get-tarball "http://github.com/calio/iconv-nginx-module/tarball/v$ver" -O iconv-nginx-module-$ver.tar.gz || exit 1 +tar -xzf iconv-nginx-module-$ver.tar.gz || exit 1 +mv calio-iconv-nginx-module-* iconv-nginx-module-$ver || exit 1 + +################################# + +ver=0.01 +$root/util/get-tarball "http://github.com/agentzh/encrypted-session-nginx-module/tarball/v$ver" -O encrypted-session-nginx-module-$ver.tar.gz || exit 1 +tar -xzf encrypted-session-nginx-module-$ver.tar.gz || exit 1 +mv agentzh-encrypted-session-nginx-module-* encrypted-session-nginx-module-$ver || exit 1 + +################################# + + +ver=0.3 +$root/util/get-tarball "http://mdounin.ru/files/ngx_http_upstream_keepalive-$ver.tar.gz" -O upstream_keepalive-$ver.tar.gz || exit 1 +tar -xzf upstream_keepalive-$ver.tar.gz || exit 1 +mv ngx_http_upstream_keepalive-* upstream-keepalive-nginx-module-$ver || exit 1 + +################################# + +ver=0.2 +$root/util/get-tarball "http://mdounin.ru/hg/ngx_http_auth_request_module/archive/tip.tar.gz" -O auth_request-$ver.tar.gz || exit 1 +tar -xzf auth_request-$ver.tar.gz || exit 1 +mv ngx_http_auth_request_module-* auth-request-nginx-module-$ver || exit 1 + +################################# + +ver=0.03 +cp ~/rpm/SOURCES/lz-st-nginx-module-$ver.tar.gz ./ || exit 1 +tar -xzf lz-st-nginx-module-$ver.tar.gz || exit 1 +#mv lz-st-nginx-module-* lz-st-nginx-module-$ver + +################################# + +rm *.tar.gz + +cd .. +cp $root/util/configure ./ + +cd $root + +tar czf $name.tar.gz $name +