{"thread":{"id":"23874","subject":"[PATCHv2 GSoC] git-instaweb: Configure it to work with new gitweb structure","startedAt":"2010-05-22T10:11:45Z","lastAt":"2010-05-22T19:56:37Z","messageCount":6,"participants":["Pavan Kumar Sunkara","Jakub Narebski"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"142085","messageId":"1274523105-3327-1-git-send-email-pavan.sss1991@gmail.com","threadId":"23874","inReplyTo":null,"subject":"[PATCHv2 GSoC] git-instaweb: Configure it to work with new gitweb structure","fromName":"Pavan Kumar Sunkara","fromEmail":"pavan.sss1991@gmail.com","sentAt":"2010-05-22T10:11:45Z","receivedAt":"2010-05-22T10:11:45Z","isPatch":false,"sender":{"key":"pavan.sss1991@gmail.com","avatar":"https://avatars.githubusercontent.com/u/174703?v=4"},"body":"git-instaweb in its current form (re)creates gitweb.cgi and\n(some of) required static files in $GIT_DIR/gitweb/ directory.\nSplitting gitweb would make it difficult for git-instaweb to\ncontinue with this method.\n\nUse the instaweb.gitwebdir config variable to point git-instaweb script\nto a global directory which contains gitweb files as server root\nand the httpd.conf along with server logs and pid go into\n'$(GIT_DIR)/gitweb' directory.\n\nSigned-off-by: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>\n---\n\nThis patch is based on commit 'jn/gitweb-install' in the next branch.\n\n Makefile        |   10 +------\n git-instaweb.sh |   71 ++++++++++++++++++++----------------------------------\n 2 files changed, 28 insertions(+), 53 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex caf2f64..91cd726 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -1592,15 +1592,8 @@ git-instaweb: git-instaweb.sh gitweb/gitweb.cgi gitweb/static/gitweb.css gitweb/\n \tsed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \\\n \t    -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \\\n \t    -e 's/@@NO_CURL@@/$(NO_CURL)/g' \\\n-\t    -e '/@@GITWEB_CGI@@/r gitweb/gitweb.cgi' \\\n-\t    -e '/@@GITWEB_CGI@@/d' \\\n-\t    -e '/@@GITWEB_CSS@@/r $(GITWEB_CSS)' \\\n-\t    -e '/@@GITWEB_CSS@@/d' \\\n-\t    -e '/@@GITWEB_JS@@/r $(GITWEB_JS)' \\\n-\t    -e '/@@GITWEB_JS@@/d' \\\n+\t    -e 's|@@GITWEBDIR@@|$(gitwebdir)|g' \\\n \t    -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \\\n-            -e 's|@@GITWEB_CSS_NAME@@|$(GITWEB_CSS)|' \\\n-            -e 's|@@GITWEB_JS_NAME@@|$(GITWEB_JS)|' \\\n \t    $@.sh > $@+ && \\\n \tchmod +x $@+ && \\\n \tmv $@+ $@\n@@ -1972,6 +1965,7 @@ install: all\n \t$(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install\n ifndef NO_PERL\n \t$(MAKE) -C perl prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' install\n+\t$(MAKE) -C gitweb gitwebdir=$(gitwebdir) install\n endif\n ifndef NO_PYTHON\n \t$(MAKE) -C git_remote_helpers prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' install\ndiff --git a/git-instaweb.sh b/git-instaweb.sh\nindex f608014..b3e9192 100755\n--- a/git-instaweb.sh\n+++ b/git-instaweb.sh\n@@ -24,6 +24,7 @@ restart        restart the web server\n fqgitdir=\"$GIT_DIR\"\n local=\"$(git config --bool --get instaweb.local)\"\n httpd=\"$(git config --get instaweb.httpd)\"\n+root=\"$(git config --get instaweb.gitwebdir)\"\n port=$(git config --get instaweb.port)\n module_path=\"$(git config --get instaweb.modulepath)\"\n \n@@ -34,6 +35,9 @@ conf=\"$GIT_DIR/gitweb/httpd.conf\"\n # if installed, it doesn't need further configuration (module_path)\n test -z \"$httpd\" && httpd='lighttpd -f'\n \n+# Default is @@GITWEBDIR@@\n+test -z \"$root\" && root='@@GITWEBDIR@@'\n+\n # any untaken local port will do...\n test -z \"$port\" && port=1234\n \n@@ -57,7 +61,7 @@ resolve_full_httpd () {\n \t\t# these days and those are not in most users $PATHs\n \t\t# in addition, we may have generated a server script\n \t\t# in $fqgitdir/gitweb.\n-\t\tfor i in /usr/local/sbin /usr/sbin \"$fqgitdir/gitweb\"\n+\t\tfor i in /usr/local/sbin /usr/sbin \"$root\" \"$fqgitdir/gitweb\"\n \t\tdo\n \t\t\tif test -x \"$i/$httpd_only\"\n \t\t\tthen\n@@ -159,8 +163,8 @@ done\n mkdir -p \"$GIT_DIR/gitweb/tmp\"\n GIT_EXEC_PATH=\"$(git --exec-path)\"\n GIT_DIR=\"$fqgitdir\"\n-export GIT_EXEC_PATH GIT_DIR\n-\n+GITWEB_CONFIG=\"$fqgitdir/gitweb/gitweb_config.perl\"\n+export GIT_EXEC_PATH GIT_DIR GITWEB_CONFIG\n \n webrick_conf () {\n \t# generate a standalone server script in $fqgitdir/gitweb.\n@@ -192,7 +196,7 @@ EOF\n \n \tcat >\"$conf\" <<EOF\n :Port: $port\n-:DocumentRoot: \"$fqgitdir/gitweb\"\n+:DocumentRoot: \"$root\"\n :DirectoryIndex: [\"gitweb.cgi\"]\n :PidFile: \"$fqgitdir/pid\"\n EOF\n@@ -201,7 +205,7 @@ EOF\n \n lighttpd_conf () {\n \tcat > \"$conf\" <<EOF\n-server.document-root = \"$fqgitdir/gitweb\"\n+server.document-root = \"$root\"\n server.port = $port\n server.modules = ( \"mod_setenv\", \"mod_cgi\" )\n server.indexfiles = ( \"gitweb.cgi\" )\n@@ -212,7 +216,7 @@ server.errorlog = \"$fqgitdir/gitweb/error.log\"\n # variable above and uncomment this\n #accesslog.filename = \"$fqgitdir/gitweb/access.log\"\n \n-setenv.add-environment = ( \"PATH\" => env.PATH )\n+setenv.add-environment = ( \"PATH\" => env.PATH, \"GITWEB_CONFIG\" => env.GITWEB_CONFIG )\n \n cgi.assign = ( \".cgi\" => \"\" )\n \n@@ -277,14 +281,15 @@ EOF\n \n apache2_conf () {\n \ttest -z \"$module_path\" && module_path=/usr/lib/apache2/modules\n-\tmkdir -p \"$GIT_DIR/gitweb/logs\"\n \tbind=\n \ttest x\"$local\" = xtrue && bind='127.0.0.1:'\n \techo 'text/css css' > \"$fqgitdir/mime.types\"\n \tcat > \"$conf\" <<EOF\n ServerName \"git-instaweb\"\n-ServerRoot \"$fqgitdir/gitweb\"\n-DocumentRoot \"$fqgitdir/gitweb\"\n+ServerRoot \"$root\"\n+DocumentRoot \"$root\"\n+ErrorLog \"$fqgitdir/gitweb/error.log\"\n+CustomLog \"$fqgitdir/gitweb/access.log\" combined\n PidFile \"$fqgitdir/pid\"\n Listen $bind$port\n EOF\n@@ -303,13 +308,14 @@ EOF\n \t# check to see if Dennis Stosberg's mod_perl compatibility patch\n \t# (<20060621130708.Gcbc6e5c@leonov.stosberg.net>) has been applied\n \tif test -f \"$module_path/mod_perl.so\" &&\n-\t   sane_grep 'MOD_PERL' \"$GIT_DIR/gitweb/gitweb.cgi\" >/dev/null\n+\t   sane_grep 'MOD_PERL' \"$root/gitweb.cgi\" >/dev/null\n \tthen\n \t\t# favor mod_perl if available\n \t\tcat >> \"$conf\" <<EOF\n LoadModule perl_module $module_path/mod_perl.so\n PerlPassEnv GIT_DIR\n PerlPassEnv GIT_EXEC_DIR\n+PerlPassEnv GITWEB_CONFIG\n <Location /gitweb.cgi>\n \tSetHandler perl-script\n \tPerlResponseHandler ModPerl::Registry\n@@ -353,7 +359,7 @@ mongoose_conf() {\n # For detailed description of every option, visit\n # http://code.google.com/p/mongoose/wiki/MongooseManual\n \n-root\t\t$fqgitdir/gitweb\n+root\t\t$root\n ports\t\t$port\n index_files\tgitweb.cgi\n #ssl_cert\t$fqgitdir/gitweb/ssl_cert.pem\n@@ -361,7 +367,7 @@ error_log\t$fqgitdir/gitweb/error.log\n access_log\t$fqgitdir/gitweb/access.log\n \n #cgi setup\n-cgi_env\t\tPATH=$PATH,GIT_DIR=$GIT_DIR,GIT_EXEC_PATH=$GIT_EXEC_PATH\n+cgi_env\t\tPATH=$PATH,GIT_DIR=$GIT_DIR,GIT_EXEC_PATH=$GIT_EXEC_PATH,GITWEB_CONFIG=$GITWEB_CONFIG\n cgi_interp\t$PERL\n cgi_ext\t\tcgi,pl\n \n@@ -370,41 +376,16 @@ mime_types\t.gz=application/x-gzip,.tar.gz=application/x-tgz,.tgz=application/x-t\n EOF\n }\n \n-\n-script='\n-s#^(my|our) \\$projectroot =.*#$1 \\$projectroot = \"'$(dirname \"$fqgitdir\")'\";#;\n-s#(my|our) \\$gitbin =.*#$1 \\$gitbin = \"'$GIT_EXEC_PATH'\";#;\n-s#(my|our) \\$projects_list =.*#$1 \\$projects_list = \\$projectroot;#;\n-s#(my|our) \\$git_temp =.*#$1 \\$git_temp = \"'$fqgitdir/gitweb/tmp'\";#;'\n-\n-gitweb_cgi () {\n-\tcat > \"$1.tmp\" <<\\EOFGITWEB\n-@@GITWEB_CGI@@\n-EOFGITWEB\n-\t# Use the configured full path to perl to match the generated\n-\t# scripts' 'hashpling' line\n-\t\"$PERL\" -p -e \"$script\" \"$1.tmp\"  > \"$1\"\n-\tchmod +x \"$1\"\n-\trm -f \"$1.tmp\"\n-}\n-\n-gitweb_css () {\n-\tcat > \"$1\" <<\\EOFGITWEB\n-@@GITWEB_CSS@@\n-\n-EOFGITWEB\n-}\n-\n-gitweb_js () {\n-\tcat > \"$1\" <<\\EOFGITWEB\n-@@GITWEB_JS@@\n-\n-EOFGITWEB\n+gitweb_conf() {\n+\tcat > \"$fqgitdir/gitweb/gitweb_config.perl\" <<EOF\n+#!/usr/bin/perl\n+our \\$projectroot = \"$(dirname \"$fqgitdir\")\";\n+our \\$git_temp = \"$fqgitdir/gitweb/tmp\";\n+our \\$projects_list = \\$projectroot;\n+EOF\n }\n \n-gitweb_cgi \"$GIT_DIR/gitweb/gitweb.cgi\"\n-gitweb_css \"$GIT_DIR/@@GITWEB_CSS_NAME@@\"\n-gitweb_js  \"$GIT_DIR/@@GITWEB_JS_NAME@@\"\n+gitweb_conf\n \n case \"$httpd\" in\n *lighttpd*)\n-- \n1.7.1.18.g74211d.dirty\n"},{"id":"142103","messageId":"201005221757.38376.jnareb@gmail.com","threadId":"23874","inReplyTo":"1274523105-3327-1-git-send-email-pavan.sss1991@gmail.com","subject":"Re: [PATCHv2 GSoC] git-instaweb: Configure it to work with new gitweb structure","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2010-05-22T15:57:37Z","receivedAt":"2010-05-22T15:57:37Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"On Sat, 22 May 2010, Pavan Kumar Sunkara wrote:\n\n> git-instaweb in its current form (re)creates gitweb.cgi and\n> (some of) required static files in $GIT_DIR/gitweb/ directory.\n> Splitting gitweb would make it difficult for git-instaweb to\n> continue with this method.\n> \n> Use the instaweb.gitwebdir config variable to point git-instaweb script\n> to a global directory which contains gitweb files as server root\n> and the httpd.conf along with server logs and pid go into\n> '$(GIT_DIR)/gitweb' directory.\n\nThat's not all this patch changes, isn't it?\n\n  While at it, change apache2 configuration to use the same access log\n  and error log files as the rest of web servers supported by\n  git-instaweb.\n\nWhile it would be better to have it as a separate commit, I think it\ndoesn't matter much, and having it in this patch is acceptable as\n\"while at it\" change.\n\n> \n> Signed-off-by: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>\n\nI like this change, because it simplifies greatly git-instaweb\ngeneration; besides the fact that it is necessary for future splitting\ngitweb for better maintability, and for write functionality for gitweb.\n\n\nAcked-by: Jakub Narebski <jnareb@gmail.com>\n\n_If_ there is no problem with $(gitwebdir) and not $(gitwebdir_SQ),\nsee below for details.\n\n> ---\n> \n> This patch is based on commit 'jn/gitweb-install' in the next branch.\n\nI think it is based on your earlier patches:\n\n* gitweb: Move static files into seperate subdirectory\n  http://article.gmane.org/gmane.comp.version-control.git/147321 \n* gitweb: Set default destination directory for installing gitweb in Makefile\n  http://article.gmane.org/gmane.comp.version-control.git/147160\n\nThose are necessary for this patch to be applied.  Well, the second is\nnecessary for it to make sense...\n\n\nBTW. which web servers supported by git-instaweb: lighttpd, apache2,\nwebrick, mongoose you have tested your change with?\n\n>  Makefile        |   10 +------\n>  git-instaweb.sh |   71 ++++++++++++++++++++----------------------------------\n>  2 files changed, 28 insertions(+), 53 deletions(-)\n> \n> diff --git a/Makefile b/Makefile\n> index caf2f64..91cd726 100644\n> --- a/Makefile\n> +++ b/Makefile\n> @@ -1592,15 +1592,8 @@ git-instaweb: git-instaweb.sh gitweb/gitweb.cgi gitweb/static/gitweb.css gitweb/\n>  \tsed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \\\n[...]\n> +\t    -e 's|@@GITWEBDIR@@|$(gitwebdir)|g' \\\n>  \t    -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \\\n> -            -e 's|@@GITWEB_CSS_NAME@@|$(GITWEB_CSS)|' \\\n> -            -e 's|@@GITWEB_JS_NAME@@|$(GITWEB_JS)|' \\\n>  \t    $@.sh > $@+ && \\\n>  \tchmod +x $@+ && \\\n>  \tmv $@+ $@\n> @@ -1972,6 +1965,7 @@ install: all\n>  \t$(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install\n>  ifndef NO_PERL\n>  \t$(MAKE) -C perl prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' install\n> +\t$(MAKE) -C gitweb gitwebdir=$(gitwebdir) install\n>  endif\n\nHave you checked that you can use $(gitwebdir) and don't need\n$(gitwebdir_SQ) here?  Does git-instaweb installs and works correctly\nif 'gitwebdir' contains spaces and single or double quote characters?\n\nBut perhaps that doesn't matter in practice, and this is good enough.\n\n> diff --git a/git-instaweb.sh b/git-instaweb.sh\n> index f608014..b3e9192 100755\n> --- a/git-instaweb.sh\n> +++ b/git-instaweb.sh\n> @@ -24,6 +24,7 @@ restart        restart the web server\n>  fqgitdir=\"$GIT_DIR\"\n>  local=\"$(git config --bool --get instaweb.local)\"\n>  httpd=\"$(git config --get instaweb.httpd)\"\n> +root=\"$(git config --get instaweb.gitwebdir)\"\n>  port=$(git config --get instaweb.port)\n>  module_path=\"$(git config --get instaweb.modulepath)\"\n>  \n> @@ -34,6 +35,9 @@ conf=\"$GIT_DIR/gitweb/httpd.conf\"\n>  # if installed, it doesn't need further configuration (module_path)\n>  test -z \"$httpd\" && httpd='lighttpd -f'\n>  \n> +# Default is @@GITWEBDIR@@\n> +test -z \"$root\" && root='@@GITWEBDIR@@'\n> +\n\nNice.\n\n> @@ -57,7 +61,7 @@ resolve_full_httpd () {\n>  \t\t# these days and those are not in most users $PATHs\n>  \t\t# in addition, we may have generated a server script\n>  \t\t# in $fqgitdir/gitweb.\n> -\t\tfor i in /usr/local/sbin /usr/sbin \"$fqgitdir/gitweb\"\n> +\t\tfor i in /usr/local/sbin /usr/sbin \"$root\" \"$fqgitdir/gitweb\"\n>  \t\tdo\n>  \t\t\tif test -x \"$i/$httpd_only\"\n>  \t\t\tthen\n\nYou probably want to update comment above this loop.  But this is not\nsomething very important.\n\nAlternatively, if e.g. webrick.rb and webrick (shell script) are\ninstalled in \"$fqgitdir/gitweb\" directory, there is no need to check\n\"$root\".\n\n>  webrick_conf () {\n[...]\n> -:DocumentRoot: \"$fqgitdir/gitweb\"\n> +:DocumentRoot: \"$root\"\n\n>  lighttpd_conf () {\n>  \tcat > \"$conf\" <<EOF\n> -server.document-root = \"$fqgitdir/gitweb\"\n> +server.document-root = \"$root\"\n[...]\n> -setenv.add-environment = ( \"PATH\" => env.PATH )\n> +setenv.add-environment = ( \"PATH\" => env.PATH, \"GITWEB_CONFIG\" => env.GITWEB_CONFIG )\n\n>  apache2_conf () {\n[...]\n> -ServerRoot \"$fqgitdir/gitweb\"\n> -DocumentRoot \"$fqgitdir/gitweb\"\n> +ServerRoot \"$root\"\n> +DocumentRoot \"$root\"\n[...]\n>  PerlPassEnv GIT_DIR\n>  PerlPassEnv GIT_EXEC_DIR\n> +PerlPassEnv GITWEB_CONFIG\n\n> @@ -353,7 +359,7 @@ mongoose_conf() {\n>  # For detailed description of every option, visit\n>  # http://code.google.com/p/mongoose/wiki/MongooseManual\n>  \n> -root\t\t$fqgitdir/gitweb\n> +root\t\t$root\n[...]\n> -cgi_env\t\tPATH=$PATH,GIT_DIR=$GIT_DIR,GIT_EXEC_PATH=$GIT_EXEC_PATH\n> +cgi_env\t\tPATH=$PATH,GIT_DIR=$GIT_DIR,GIT_EXEC_PATH=$GIT_EXEC_PATH,GITWEB_CONFIG=$GITWEB_CONFIG\n\nAll right, those changes are pretty clear.\n\n> @@ -277,14 +281,15 @@ EOF\n>  \n>  apache2_conf () {\n>  \ttest -z \"$module_path\" && module_path=/usr/lib/apache2/modules\n> -\tmkdir -p \"$GIT_DIR/gitweb/logs\"\n>  \tbind=\n>  \ttest x\"$local\" = xtrue && bind='127.0.0.1:'\n>  \techo 'text/css css' > \"$fqgitdir/mime.types\"\n>  \tcat > \"$conf\" <<EOF\n>  ServerName \"git-instaweb\"\n> -ServerRoot \"$fqgitdir/gitweb\"\n> -DocumentRoot \"$fqgitdir/gitweb\"\n> +ServerRoot \"$root\"\n> +DocumentRoot \"$root\"\n> +ErrorLog \"$fqgitdir/gitweb/error.log\"\n> +CustomLog \"$fqgitdir/gitweb/access.log\" combined\n>  PidFile \"$fqgitdir/pid\"\n>  Listen $bind$port\n>  EOF\n\nThis is independent change, modifying configuration of apache2 web\nserver to use the same files for access log and for error log\n(\"$fqgitdir/gitweb/access.log\" and \"$fqgitdir/gitweb/error.log\",\nrespectively) as the rest of web servers.\n\nIsn't it?\n\n> @@ -370,41 +376,16 @@ mime_types\t.gz=application/x-gzip,.tar.gz=application/x-tgz,.tgz=application/x-t\n>  EOF\n>  }\n>  \n> -\n> -script='\n> -s#^(my|our) \\$projectroot =.*#$1 \\$projectroot = \"'$(dirname \"$fqgitdir\")'\";#;\n> -s#(my|our) \\$gitbin =.*#$1 \\$gitbin = \"'$GIT_EXEC_PATH'\";#;\n> -s#(my|our) \\$projects_list =.*#$1 \\$projects_list = \\$projectroot;#;\n> -s#(my|our) \\$git_temp =.*#$1 \\$git_temp = \"'$fqgitdir/gitweb/tmp'\";#;'\n> -\n> -gitweb_cgi () {\n[...]\n\n> +gitweb_conf() {\n> +\tcat > \"$fqgitdir/gitweb/gitweb_config.perl\" <<EOF\n> +#!/usr/bin/perl\n> +our \\$projectroot = \"$(dirname \"$fqgitdir\")\";\n> +our \\$git_temp = \"$fqgitdir/gitweb/tmp\";\n> +our \\$projects_list = \\$projectroot;\n> +EOF\n>  }\n\nRight, $GIT (formerly $gitbin) is set when generating gitweb.cgi from\ngitweb.perl.\n\nActually $git_temp is not needed by modern gitweb (from quite some time,\nsince using external /usr/bin/diff was replaced by git-diff-tree), so\nsetting it could be removed from gitweb_config.perl.  Nevertheless it is\nnot a problem having it.\n\n> -gitweb_cgi \"$GIT_DIR/gitweb/gitweb.cgi\"\n> -gitweb_css \"$GIT_DIR/@@GITWEB_CSS_NAME@@\"\n> -gitweb_js  \"$GIT_DIR/@@GITWEB_JS_NAME@@\"\n> +gitweb_conf\n>  \n>  case \"$httpd\" in\n>  *lighttpd*)\n> -- \n> 1.7.1.18.g74211d.dirty\n\n\n-- \nJakub Narebski\nPoland\n"},{"id":"142108","messageId":"AANLkTinbzlRsmQekpLlFQC3xOMB2ZUurLqJoyFCnHZFG@mail.gmail.com","threadId":"23874","inReplyTo":"201005221757.38376.jnareb@gmail.com","subject":"Re: [PATCHv2 GSoC] git-instaweb: Configure it to work with new gitweb structure","fromName":"Pavan Kumar Sunkara","fromEmail":"pavan.sss1991@gmail.com","sentAt":"2010-05-22T16:57:51Z","receivedAt":"2010-05-22T16:57:51Z","isPatch":false,"sender":{"key":"pavan.sss1991@gmail.com","avatar":"https://avatars.githubusercontent.com/u/174703?v=4"},"body":"2010/5/22 Jakub Narebski <jnareb@gmail.com>:\n> On Sat, 22 May 2010, Pavan Kumar Sunkara wrote:\n>\n>> git-instaweb in its current form (re)creates gitweb.cgi and\n>> (some of) required static files in $GIT_DIR/gitweb/ directory.\n>> Splitting gitweb would make it difficult for git-instaweb to\n>> continue with this method.\n>>\n>> Use the instaweb.gitwebdir config variable to point git-instaweb script\n>> to a global directory which contains gitweb files as server root\n>> and the httpd.conf along with server logs and pid go into\n>> '$(GIT_DIR)/gitweb' directory.\n>\n> That's not all this patch changes, isn't it?\n>\n>  While at it, change apache2 configuration to use the same access log\n>  and error log files as the rest of web servers supported by\n>  git-instaweb.\n>\n> While it would be better to have it as a separate commit, I think it\n> doesn't matter much, and having it in this patch is acceptable as\n> \"while at it\" change.\n>\n>>\n>> Signed-off-by: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>\n>\n> I like this change, because it simplifies greatly git-instaweb\n> generation; besides the fact that it is necessary for future splitting\n> gitweb for better maintability, and for write functionality for gitweb.\n\nThanks.\n\n> Acked-by: Jakub Narebski <jnareb@gmail.com>\n>\n> _If_ there is no problem with $(gitwebdir) and not $(gitwebdir_SQ),\n> see below for details.\n>\n>> ---\n>>\n>> This patch is based on commit 'jn/gitweb-install' in the next branch.\n>\n> I think it is based on your earlier patches:\n>\n> * gitweb: Move static files into seperate subdirectory\n>  http://article.gmane.org/gmane.comp.version-control.git/147321\n> * gitweb: Set default destination directory for installing gitweb in Makefile\n>  http://article.gmane.org/gmane.comp.version-control.git/147160\n>\n> Those are necessary for this patch to be applied.  Well, the second is\n> necessary for it to make sense...\n\nYes. They are necessary patches before this patch.\nI assume, they are going to be merged before this patch is.\n\n> BTW. which web servers supported by git-instaweb: lighttpd, apache2,\n> webrick, mongoose you have tested your change with?\n\nI tested this patch with lighttpd and apache2.\nAnd am sure about mongoose. But don't know the status with webrick.\n\n>>  Makefile        |   10 +------\n>>  git-instaweb.sh |   71 ++++++++++++++++++++----------------------------------\n>>  2 files changed, 28 insertions(+), 53 deletions(-)\n>>\n>> diff --git a/Makefile b/Makefile\n>> index caf2f64..91cd726 100644\n>> --- a/Makefile\n>> +++ b/Makefile\n>> @@ -1592,15 +1592,8 @@ git-instaweb: git-instaweb.sh gitweb/gitweb.cgi gitweb/static/gitweb.css gitweb/\n>>       sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \\\n> [...]\n>> +         -e 's|@@GITWEBDIR@@|$(gitwebdir)|g' \\\n>>           -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \\\n>> -            -e 's|@@GITWEB_CSS_NAME@@|$(GITWEB_CSS)|' \\\n>> -            -e 's|@@GITWEB_JS_NAME@@|$(GITWEB_JS)|' \\\n>>           $@.sh > $@+ && \\\n>>       chmod +x $@+ && \\\n>>       mv $@+ $@\n>> @@ -1972,6 +1965,7 @@ install: all\n>>       $(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install\n>>  ifndef NO_PERL\n>>       $(MAKE) -C perl prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' install\n>> +     $(MAKE) -C gitweb gitwebdir=$(gitwebdir) install\n>>  endif\n>\n> Have you checked that you can use $(gitwebdir) and don't need\n> $(gitwebdir_SQ) here?  Does git-instaweb installs and works correctly\n> if 'gitwebdir' contains spaces and single or double quote characters?\n> But perhaps that doesn't matter in practice, and this is good enough.\n\nNope. I didn't check it. But you are right.\n\n>\n>> diff --git a/git-instaweb.sh b/git-instaweb.sh\n>> index f608014..b3e9192 100755\n>> --- a/git-instaweb.sh\n>> +++ b/git-instaweb.sh\n>> @@ -24,6 +24,7 @@ restart        restart the web server\n>>  fqgitdir=\"$GIT_DIR\"\n>>  local=\"$(git config --bool --get instaweb.local)\"\n>>  httpd=\"$(git config --get instaweb.httpd)\"\n>> +root=\"$(git config --get instaweb.gitwebdir)\"\n>>  port=$(git config --get instaweb.port)\n>>  module_path=\"$(git config --get instaweb.modulepath)\"\n>>\n>> @@ -34,6 +35,9 @@ conf=\"$GIT_DIR/gitweb/httpd.conf\"\n>>  # if installed, it doesn't need further configuration (module_path)\n>>  test -z \"$httpd\" && httpd='lighttpd -f'\n>>\n>> +# Default is @@GITWEBDIR@@\n>> +test -z \"$root\" && root='@@GITWEBDIR@@'\n>> +\n>\n> Nice.\n>\n>> @@ -57,7 +61,7 @@ resolve_full_httpd () {\n>>               # these days and those are not in most users $PATHs\n>>               # in addition, we may have generated a server script\n>>               # in $fqgitdir/gitweb.\n>> -             for i in /usr/local/sbin /usr/sbin \"$fqgitdir/gitweb\"\n>> +             for i in /usr/local/sbin /usr/sbin \"$root\" \"$fqgitdir/gitweb\"\n>>               do\n>>                       if test -x \"$i/$httpd_only\"\n>>                       then\n>\n> You probably want to update comment above this loop.  But this is not\n> something very important.\n>\n> Alternatively, if e.g. webrick.rb and webrick (shell script) are\n> installed in \"$fqgitdir/gitweb\" directory, there is no need to check\n> \"$root\".\n>\n>>  webrick_conf () {\n> [...]\n>> -:DocumentRoot: \"$fqgitdir/gitweb\"\n>> +:DocumentRoot: \"$root\"\n>\n>>  lighttpd_conf () {\n>>       cat > \"$conf\" <<EOF\n>> -server.document-root = \"$fqgitdir/gitweb\"\n>> +server.document-root = \"$root\"\n> [...]\n>> -setenv.add-environment = ( \"PATH\" => env.PATH )\n>> +setenv.add-environment = ( \"PATH\" => env.PATH, \"GITWEB_CONFIG\" => env.GITWEB_CONFIG )\n>\n>>  apache2_conf () {\n> [...]\n>> -ServerRoot \"$fqgitdir/gitweb\"\n>> -DocumentRoot \"$fqgitdir/gitweb\"\n>> +ServerRoot \"$root\"\n>> +DocumentRoot \"$root\"\n> [...]\n>>  PerlPassEnv GIT_DIR\n>>  PerlPassEnv GIT_EXEC_DIR\n>> +PerlPassEnv GITWEB_CONFIG\n>\n>> @@ -353,7 +359,7 @@ mongoose_conf() {\n>>  # For detailed description of every option, visit\n>>  # http://code.google.com/p/mongoose/wiki/MongooseManual\n>>\n>> -root         $fqgitdir/gitweb\n>> +root         $root\n> [...]\n>> -cgi_env              PATH=$PATH,GIT_DIR=$GIT_DIR,GIT_EXEC_PATH=$GIT_EXEC_PATH\n>> +cgi_env              PATH=$PATH,GIT_DIR=$GIT_DIR,GIT_EXEC_PATH=$GIT_EXEC_PATH,GITWEB_CONFIG=$GITWEB_CONFIG\n>\n> All right, those changes are pretty clear.\n>\n>> @@ -277,14 +281,15 @@ EOF\n>>\n>>  apache2_conf () {\n>>       test -z \"$module_path\" && module_path=/usr/lib/apache2/modules\n>> -     mkdir -p \"$GIT_DIR/gitweb/logs\"\n>>       bind=\n>>       test x\"$local\" = xtrue && bind='127.0.0.1:'\n>>       echo 'text/css css' > \"$fqgitdir/mime.types\"\n>>       cat > \"$conf\" <<EOF\n>>  ServerName \"git-instaweb\"\n>> -ServerRoot \"$fqgitdir/gitweb\"\n>> -DocumentRoot \"$fqgitdir/gitweb\"\n>> +ServerRoot \"$root\"\n>> +DocumentRoot \"$root\"\n>> +ErrorLog \"$fqgitdir/gitweb/error.log\"\n>> +CustomLog \"$fqgitdir/gitweb/access.log\" combined\n>>  PidFile \"$fqgitdir/pid\"\n>>  Listen $bind$port\n>>  EOF\n>\n> This is independent change, modifying configuration of apache2 web\n> server to use the same files for access log and for error log\n> (\"$fqgitdir/gitweb/access.log\" and \"$fqgitdir/gitweb/error.log\",\n> respectively) as the rest of web servers.\n>\n> Isn't it?\n\nYes. But I included it in this commit because, it is not a big change\nto be included in another commit.\n\n>> @@ -370,41 +376,16 @@ mime_types      .gz=application/x-gzip,.tar.gz=application/x-tgz,.tgz=application/x-t\n>>  EOF\n>>  }\n>>\n>> -\n>> -script='\n>> -s#^(my|our) \\$projectroot =.*#$1 \\$projectroot = \"'$(dirname \"$fqgitdir\")'\";#;\n>> -s#(my|our) \\$gitbin =.*#$1 \\$gitbin = \"'$GIT_EXEC_PATH'\";#;\n>> -s#(my|our) \\$projects_list =.*#$1 \\$projects_list = \\$projectroot;#;\n>> -s#(my|our) \\$git_temp =.*#$1 \\$git_temp = \"'$fqgitdir/gitweb/tmp'\";#;'\n>> -\n>> -gitweb_cgi () {\n> [...]\n>\n>> +gitweb_conf() {\n>> +     cat > \"$fqgitdir/gitweb/gitweb_config.perl\" <<EOF\n>> +#!/usr/bin/perl\n>> +our \\$projectroot = \"$(dirname \"$fqgitdir\")\";\n>> +our \\$git_temp = \"$fqgitdir/gitweb/tmp\";\n>> +our \\$projects_list = \\$projectroot;\n>> +EOF\n>>  }\n>\n> Right, $GIT (formerly $gitbin) is set when generating gitweb.cgi from\n> gitweb.perl.\n>\n> Actually $git_temp is not needed by modern gitweb (from quite some time,\n> since using external /usr/bin/diff was replaced by git-diff-tree), so\n> setting it could be removed from gitweb_config.perl.  Nevertheless it is\n> not a problem having it.\n>\n>> -gitweb_cgi \"$GIT_DIR/gitweb/gitweb.cgi\"\n>> -gitweb_css \"$GIT_DIR/@@GITWEB_CSS_NAME@@\"\n>> -gitweb_js  \"$GIT_DIR/@@GITWEB_JS_NAME@@\"\n>> +gitweb_conf\n>>\n>>  case \"$httpd\" in\n>>  *lighttpd*)\n>> --\n>> 1.7.1.18.g74211d.dirty\n>\n>\n> --\n> Jakub Narebski\n> Poland\n>\n\nThanks\n-Pavan\n"},{"id":"142111","messageId":"201005222059.54995.jnareb@gmail.com","threadId":"23874","inReplyTo":"AANLkTinbzlRsmQekpLlFQC3xOMB2ZUurLqJoyFCnHZFG@mail.gmail.com","subject":"Re: [PATCHv2 GSoC] git-instaweb: Configure it to work with new gitweb structure","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2010-05-22T18:59:54Z","receivedAt":"2010-05-22T18:59:54Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"On Sat, 22 May 2010, Pavan Kumar Sunkara wrote:\n> 2010/5/22 Jakub Narebski <jnareb@gmail.com>:\n>> On Sat, 22 May 2010, Pavan Kumar Sunkara wrote:\n\n>> Acked-by: Jakub Narebski <jnareb@gmail.com>\n>>\n>> _If_ there is no problem with $(gitwebdir) and not $(gitwebdir_SQ),\n>> see below for details.\n[...]\n>>> diff --git a/Makefile b/Makefile\n>>> index caf2f64..91cd726 100644\n>>> --- a/Makefile\n>>> +++ b/Makefile\n>>> @@ -1592,15 +1592,8 @@ git-instaweb: git-instaweb.sh gitweb/gitweb.cgi gitweb/static/gitweb.css gitweb/\n>>>       sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \\\n>> [...]\n>>> +         -e 's|@@GITWEBDIR@@|$(gitwebdir)|g' \\\n>>>           -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \\\n>>> -            -e 's|@@GITWEB_CSS_NAME@@|$(GITWEB_CSS)|' \\\n>>> -            -e 's|@@GITWEB_JS_NAME@@|$(GITWEB_JS)|' \\\n>>>           $@.sh> $@+ && \\\n>>>       chmod +x $@+ && \\\n>>>       mv $@+ $@\n>>> @@ -1972,6 +1965,7 @@ install: all\n>>>       $(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install\n>>>  ifndef NO_PERL\n>>>       $(MAKE) -C perl prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' install\n>>> +     $(MAKE) -C gitweb gitwebdir=$(gitwebdir) install\n>>>  endif\n>>\n>> Have you checked that you can use $(gitwebdir) and don't need\n>> $(gitwebdir_SQ) here?  Does git-instaweb installs and works correctly\n>> if 'gitwebdir' contains spaces and single or double quote characters?\n>> But perhaps that doesn't matter in practice, and this is good enough.\n> \n> Nope. I didn't check it. But you are right.\n\nDoes it mean that after your patch git-instaweb works correctly if\n'gitwebdir' is set to something like (for example):\n\n  gitwebdir=\"/home/local/some strange \\\"path'\"\n\n-- \nJakub Narebski\nPoland\n"},{"id":"142112","messageId":"AANLkTikSJQ7MMWytdMjJwaP1YBV1lebo4f7I4OUOIXAV@mail.gmail.com","threadId":"23874","inReplyTo":"201005222059.54995.jnareb@gmail.com","subject":"Re: [PATCHv2 GSoC] git-instaweb: Configure it to work with new gitweb structure","fromName":"Pavan Kumar Sunkara","fromEmail":"pavan.sss1991@gmail.com","sentAt":"2010-05-22T19:18:12Z","receivedAt":"2010-05-22T19:18:12Z","isPatch":false,"sender":{"key":"pavan.sss1991@gmail.com","avatar":"https://avatars.githubusercontent.com/u/174703?v=4"},"body":"No. It doesn't.\n\nDo you want me to make that change to and send the patch again ?\n\n- Pavan\n"},{"id":"142114","messageId":"201005222156.37919.jnareb@gmail.com","threadId":"23874","inReplyTo":"AANLkTikSJQ7MMWytdMjJwaP1YBV1lebo4f7I4OUOIXAV@mail.gmail.com","subject":"Re: [PATCHv2 GSoC] git-instaweb: Configure it to work with new gitweb structure","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2010-05-22T19:56:37Z","receivedAt":"2010-05-22T19:56:37Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"On Sat, 22 May 2010, Pavan Kumar Sunkara wrote:\n\n> Do you want me to make that change to and send the patch again ?\n\nYes, I would like you to.\n\nAnd push this change to your repository after it is accepted as a final \nversion. TIA.\n-- \nJakub Narebski\nPoland\n"}]}