{"thread":{"id":"23881","subject":"[PATCHv3 GSoC] git-instaweb: Configure it to work with new gitweb structure","startedAt":"2010-05-23T07:32:48Z","lastAt":"2010-05-25T01:34:19Z","messageCount":7,"participants":["Pavan Kumar Sunkara","Jakub Narebski","Eric Wong","Christian Couder"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"142128","messageId":"1274599968-3749-1-git-send-email-pavan.sss1991@gmail.com","threadId":"23881","inReplyTo":null,"subject":"[PATCHv3 GSoC] git-instaweb: Configure it to work with new gitweb structure","fromName":"Pavan Kumar Sunkara","fromEmail":"pavan.sss1991@gmail.com","sentAt":"2010-05-23T07:32:48Z","receivedAt":"2010-05-23T07:32:48Z","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\nWhile at it, change apache2 configuration to use the same access log\nand error log files as the rest of web servers supported by\ngit-instaweb.\n\nSigned-off-by: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>\n---\n\nThis patch is based on 'jn/gitweb-install' in the next branch by Jakub Nareski\nand my previous 2 patches:\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 Makefile        |   11 ++------\n git-instaweb.sh |   71 ++++++++++++++++++++----------------------------------\n 2 files changed, 29 insertions(+), 53 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex caf2f64..9161172 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -1426,6 +1426,7 @@ gitexecdir_SQ = $(subst ','\\'',$(gitexecdir))\n template_dir_SQ = $(subst ','\\'',$(template_dir))\n htmldir_SQ = $(subst ','\\'',$(htmldir))\n prefix_SQ = $(subst ','\\'',$(prefix))\n+gitwebdir_SQ = $(subst ','\\'',$(gitwebdir))\n \n SHELL_PATH_SQ = $(subst ','\\'',$(SHELL_PATH))\n PERL_PATH_SQ = $(subst ','\\'',$(PERL_PATH))\n@@ -1592,15 +1593,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_SQ)|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 +1966,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_SQ) 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":"142141","messageId":"201005231155.00819.jnareb@gmail.com","threadId":"23881","inReplyTo":"1274599968-3749-1-git-send-email-pavan.sss1991@gmail.com","subject":"Re: [PATCHv3 GSoC] git-instaweb: Configure it to work with new gitweb structure","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2010-05-23T09:54:59Z","receivedAt":"2010-05-23T09:54:59Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"On Sun, 23 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> 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> Signed-off-by: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>\n\nFor what it is worth:\n\nAcked-by: Jakub Narebski <jnareb@gmail.com>\n\nBut I think more important would be ACK from Eric Wong, author and\nmaintainer of git-instaweb.  I guess that because it is preparatory\nwork, only related to the main stated goal of your GSoC 2010, you\ndon't need \"signoff\" from mentor(s) (in the form of Mentored-by:)...\n\n-- \nJakub Narebski\nPoland\n"},{"id":"142142","messageId":"20100523095645.GD3426@dcvr.yhbt.net","threadId":"23881","inReplyTo":"1274599968-3749-1-git-send-email-pavan.sss1991@gmail.com","subject":"Re: [PATCHv3 GSoC] git-instaweb: Configure it to work with new gitweb structure","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2010-05-23T09:56:45Z","receivedAt":"2010-05-23T09:56:45Z","isPatch":false,"sender":{"key":"e@80x24.org","avatar":null},"body":"Pavan Kumar Sunkara <pavan.sss1991@gmail.com> wrote:\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\nHi Pavan, I'm late to this thread, but I'm leaning against forcing\naccess logs onto people.  I don't believe access logs are necessary for\ninstaweb.  Error logs are important for debugging breakage, yes, but\naccess logs aren't worth the trouble IMHO.\n\nAlso, using the same error log paths might make it confusing to people\nswitching between web servers.  In fact, it may be the most confusing\nfor those folks if they're trying different web servers and forgetting\nto shut down the previous server before starting the next.  They could\nend up seeing confusing log messages from the wrong server if they\nlook in the error log to debug the problem.\n\nI'm not sure why Mongoose has access logs enabled by default, but I know\nI conciously left it out by default for lighttpd/apache/webrick.\n\n-- \nEric Wong\n"},{"id":"142144","messageId":"AANLkTim5M4Bv0T93GxvCLMR5kGmhaGjdGW9zqMp_isZQ@mail.gmail.com","threadId":"23881","inReplyTo":"20100523095645.GD3426@dcvr.yhbt.net","subject":"Re: [PATCHv3 GSoC] git-instaweb: Configure it to work with new gitweb structure","fromName":"Pavan Kumar Sunkara","fromEmail":"pavan.sss1991@gmail.com","sentAt":"2010-05-23T10:18:15Z","receivedAt":"2010-05-23T10:18:15Z","isPatch":false,"sender":{"key":"pavan.sss1991@gmail.com","avatar":"https://avatars.githubusercontent.com/u/174703?v=4"},"body":"On Sun, May 23, 2010 at 3:26 PM, Eric Wong <normalperson@yhbt.net> wrote:\n> Pavan Kumar Sunkara <pavan.sss1991@gmail.com> wrote:\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> Hi Pavan, I'm late to this thread, but I'm leaning against forcing\n> access logs onto people.  I don't believe access logs are necessary for\n> instaweb.  Error logs are important for debugging breakage, yes, but\n> access logs aren't worth the trouble IMHO.\n>\n> Also, using the same error log paths might make it confusing to people\n> switching between web servers.  In fact, it may be the most confusing\n> for those folks if they're trying different web servers and forgetting\n> to shut down the previous server before starting the next.  They could\n> end up seeing confusing log messages from the wrong server if they\n> look in the error log to debug the problem.\n>\n> I'm not sure why Mongoose has access logs enabled by default, but I know\n> I conciously left it out by default for lighttpd/apache/webrick.\n>\n> --\n> Eric Wong\n\nWell, Until before this patch, lighttpd and mongoose have been using\nthe same error log and access log.\nSo, I enabled it for apache2 too in the process of debugging\ngit-instaweb while using apache2.\n\nIMVHO If there is no problem using the same logs for lighttpd and\nmongoose until now, I don't think it will be a problem when apache2 is\nincluded into that group.\n\n- Pavan\n>\n"},{"id":"142194","messageId":"201005241155.30653.chriscool@tuxfamily.org","threadId":"23881","inReplyTo":"1274599968-3749-1-git-send-email-pavan.sss1991@gmail.com","subject":"Re: [PATCHv3 GSoC] git-instaweb: Configure it to work with new gitweb structure","fromName":"Christian Couder","fromEmail":"chriscool@tuxfamily.org","sentAt":"2010-05-24T09:55:30Z","receivedAt":"2010-05-24T09:55:30Z","isPatch":false,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"Hi Pavan,\n\nOn Sunday 23 May 2010 09:32:48 Pavan Kumar Sunkara wrote:\n> \n> This patch is based on 'jn/gitweb-install' in the next branch by Jakub\n>  Nareski and my previous 2 patches:\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\n>  Makefile http://article.gmane.org/gmane.comp.version-control.git/147160\n\nI tried to apply your 2 patches on top of next I got some errors with the \n\"Move static files into seperate subdirectory\" patch.\n\nCould you resend the 3 patches in a patch series after making sure that they \napply on top of next?\n\nAnd I think that it would be better if the web server logs would be in a \ndirectory with the web server name. For example \n\"$fqgitdir/gitweb/$httpd/access.log\" instead of \"$fqgitdir/gitweb/access.log\". \nBut it would be nice if you make these changes (as well as the apache2 \nconfguration changes) in another patch.\n\nThanks in advance,\nChristian.\n"},{"id":"142206","messageId":"AANLkTineGWscmBAY-rjIIEQBNHVyzXUKHJ8WGXd53yCw@mail.gmail.com","threadId":"23881","inReplyTo":"201005241155.30653.chriscool@tuxfamily.org","subject":"Re: [PATCHv3 GSoC] git-instaweb: Configure it to work with new gitweb structure","fromName":"Pavan Kumar Sunkara","fromEmail":"pavan.sss1991@gmail.com","sentAt":"2010-05-24T15:14:13Z","receivedAt":"2010-05-24T15:14:13Z","isPatch":false,"sender":{"key":"pavan.sss1991@gmail.com","avatar":"https://avatars.githubusercontent.com/u/174703?v=4"},"body":"On Mon, May 24, 2010 at 3:25 PM, Christian Couder\n<chriscool@tuxfamily.org> wrote:\n> Hi Pavan,\n>\n> On Sunday 23 May 2010 09:32:48 Pavan Kumar Sunkara wrote:\n>>\n>> This patch is based on 'jn/gitweb-install' in the next branch by Jakub\n>>  Nareski and my previous 2 patches:\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\n>>  Makefile http://article.gmane.org/gmane.comp.version-control.git/147160\n>\n> I tried to apply your 2 patches on top of next I got some errors with the\n> \"Move static files into seperate subdirectory\" patch.\n\nIt is a small error in Makefile only with this patch. The others are ok.\nI teseted it with alt-git.git repository's next branch.\nSo, I will be sending only that patch once again.\n\n> Could you resend the 3 patches in a patch series after making sure that they\n> apply on top of next?\n>\n> And I think that it would be better if the web server logs would be in a\n> directory with the web server name. For example\n> \"$fqgitdir/gitweb/$httpd/access.log\" instead of \"$fqgitdir/gitweb/access.log\".\n> But it would be nice if you make these changes (as well as the apache2\n> confguration changes) in another patch.\n>\n\nYeah. Sure.\n\n- Pavan\n"},{"id":"142226","messageId":"201005250334.21138.jnareb@gmail.com","threadId":"23881","inReplyTo":"201005241155.30653.chriscool@tuxfamily.org","subject":"Re: [PATCHv3 GSoC] git-instaweb: Configure it to work with new gitweb structure","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2010-05-25T01:34:19Z","receivedAt":"2010-05-25T01:34:19Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"On Mon, 24 May 2010, Christian Couder wrote:\n\n> And I think that it would be better if the web server logs would be in a \n> directory with the web server name. For example \n> \"$fqgitdir/gitweb/$httpd/access.log\" instead of \"$fqgitdir/gitweb/access.log\". \n> But it would be nice if you make these changes (as well as the apache2 \n> configuration changes) in another patch.\n\nYou probably meant \"$fqgitdir/gitweb/$httpd_only/access.log\", and not\n\"$fqgitdir/gitweb/$httpd/access.log\" ($httpd_only in place of $httpd),\nbecause $httpd might be 'apache2 -f' in the case of 'apache2', or in\nthe future \"$fqgitdir/gitweb/gitweb.psgi\" in the case of 'plackup'.\n\nJust FYI\n-- \nJakub Narebski\nPoland\n"}]}