* [PATCH] gitweb: fill in gitweb configuration by Makefile
@ 2006-07-30 22:37 Martin Waitz
2006-07-31 1:20 ` Junio C Hamano
` (2 more replies)
0 siblings, 3 replies; 13+ messages in thread
From: Martin Waitz @ 2006-07-30 22:37 UTC (permalink / raw)
To: git
Generate gitweb/gitweb.cgi to reduce the need to patch gitweb.cgi by
the end user.
The GIT installation directory and version are already known by the
Makefile, they can be inserted directly into gitweb.
All other gitweb configuration parameters can now be specified
by providing GITWEB_* variables while building GIT.
These are described in gitweb/README.
Signed-off-by: Martin Waitz <tali@admingilde.org>
---
Makefile | 25 +++++++++++++++++++++++--
gitweb/.gitignore | 1 +
gitweb/README | 17 +++++++++++++++++
gitweb/{gitweb.cgi => gitweb.pl} | 15 +++++++--------
4 files changed, 48 insertions(+), 10 deletions(-)
diff --git a/Makefile b/Makefile
index 8349e3defacca69ae48c477ff99be527b9af3b77..bd59d6b58d1cfcaecd033f186d7c2cc537416b75 100644
--- a/Makefile
+++ b/Makefile
@@ -116,6 +116,13 @@ template_dir = $(prefix)/share/git-core/
GIT_PYTHON_DIR = $(prefix)/share/git-core/python
# DESTDIR=
+# default configuration for gitweb
+GITWEB_SITENAME =
+GITWEB_PROJECTROOT = /pub/git
+GITWEB_LIST =
+GITWEB_HOMETEXT = indextext.html
+GITWEB_CSS = gitweb.css
+
export prefix bindir gitexecdir template_dir GIT_PYTHON_DIR
CC = gcc
@@ -509,7 +516,7 @@ LIB_OBJS += $(COMPAT_OBJS)
export prefix TAR INSTALL DESTDIR SHELL_PATH template_dir
### Build rules
-all: $(ALL_PROGRAMS) $(BUILT_INS) git$X gitk
+all: $(ALL_PROGRAMS) $(BUILT_INS) git$X gitk gitweb/gitweb.cgi
all:
$(MAKE) -C templates
@@ -567,6 +574,20 @@ git-status: git-commit
cp $< $@+
mv $@+ $@
+gitweb/gitweb.cgi: gitweb/gitweb.pl
+ rm -f $@ $@+
+ sed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \
+ -e 's|@@GIT_VERSION@@|$(GIT_VERSION)|g' \
+ -e 's|@@GIT_BINDIR@@|$(bindir)|g' \
+ -e 's|@@GITWEB_SITENAME@@|$(GITWEB_SITENAME)|g' \
+ -e 's|@@GITWEB_PROJECTROOT@@|$(GITWEB_PROJECTROOT)|g' \
+ -e 's|@@GITWEB_LIST@@|$(GITWEB_LIST)|g' \
+ -e 's|@@GITWEB_HOMETEXT@@|$(GITWEB_HOMETEXT)|g' \
+ -e 's|@@GITWEB_CSS@@|$(GITWEB_CSS)|g' \
+ $< >$@+
+ chmod +x $@+
+ mv $@+ $@
+
git-instaweb: git-instaweb.sh gitweb/gitweb.cgi gitweb/gitweb.css
rm -f $@ $@+
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
@@ -577,7 +598,7 @@ git-instaweb: git-instaweb.sh gitweb/git
-e '/@@GITWEB_CGI@@/d' \
-e '/@@GITWEB_CSS@@/r gitweb/gitweb.css' \
-e '/@@GITWEB_CSS@@/d' \
- $@.sh | sed "s|/usr/bin/git|$(bindir)/git|" > $@+
+ $@.sh > $@+
chmod +x $@+
mv $@+ $@
diff --git a/gitweb/.gitignore b/gitweb/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..e83127e3f09f8496d0cd07b8f632ff341c96fd00
--- /dev/null
+++ b/gitweb/.gitignore
@@ -0,0 +1 @@
+gitweb.cgi
diff --git a/gitweb/README b/gitweb/README
index 8d672762eab427f3b732626d6b3f8e05a7e8f8c9..ed939e2fb5264cce24e770272583b12372c3ab68 100644
--- a/gitweb/README
+++ b/gitweb/README
@@ -5,5 +5,22 @@ The one working on:
From the git version 1.4.0 gitweb is bundled with git.
+
+How to configure gitweb for your local system:
+
+You can specify the following configuration variables when building GIT:
+ * GITWEB_SITENAME
+ Shown in the title of all generated pages, defaults to the servers name.
+ * GITWEB_PROJECTROOT
+ The root directory for all projects shown by gitweb.
+ * GITWEB_LIST
+ points to a directory to scan for projects (defaults to project root)
+ or to a file for explicit listing of projects.
+ * GITWEB_HOMETEXT
+ points to an .html file which is included on the gitweb project
+ overview page.
+ * GITWEB_CSS
+ Points to the location where you put gitweb.css on your web server.
+
Any comment/question/concern to:
Kay Sievers <kay.sievers@vrfy.org>
diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.pl
similarity index 100%
rename from gitweb/gitweb.cgi
rename to gitweb/gitweb.pl
index 243a2921f849568260e848201d238b3b9fe7e1f2..8e05c335f801d4c52a9b348fa56fccfae36ce621 100755
--- a/gitweb/gitweb.cgi
+++ b/gitweb/gitweb.pl
@@ -24,14 +24,14 @@ our $rss_link = "";
# core git executable to use
# this can just be "git" if your webserver has a sensible PATH
-our $GIT = "/usr/bin/git";
+our $GIT = "@@GIT_BINDIR@@/git";
# absolute fs-path which will be prepended to the project path
#our $projectroot = "/pub/scm";
-our $projectroot = "/home/kay/public_html/pub/scm";
+our $projectroot = "@@GITWEB_PROJECTROOT@@";
# version of the core git binary
-our $git_version = qx($GIT --version) =~ m/git version (.*)$/ ? $1 : "unknown";
+our $git_version = "@@GIT_VERSION@@";
# location for temporary files needed for diffs
our $git_temp = "/tmp/gitweb";
@@ -44,17 +44,16 @@ our $home_link = $my_uri;
# name of your site or organization to appear in page titles
# replace this with something more descriptive for clearer bookmarks
-our $site_name = $ENV{'SERVER_NAME'} || "Untitled";
+our $site_name = "@@GITWEB_SITENAME@@" || $ENV{'SERVER_NAME'} || "Untitled";
# html text to include at home page
-our $home_text = "indextext.html";
+our $home_text = "@@GITWEB_HOMETEXT@@";
# URI of default stylesheet
-our $stylesheet = "gitweb.css";
+our $stylesheet = "@@GITWEB_CSS@@";
# source of projects list
-#our $projects_list = $projectroot;
-our $projects_list = "index/index.aux";
+our $projects_list = "@@GITWEB_LIST@@" || "$projectroot";
# default blob_plain mimetype and default charset for text/plain blob
our $default_blob_plain_mimetype = 'text/plain';
--
1.4.2.rc2.gf055
--
Martin Waitz
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH] gitweb: fill in gitweb configuration by Makefile
2006-07-30 22:37 [PATCH] gitweb: fill in gitweb configuration by Makefile Martin Waitz
@ 2006-07-31 1:20 ` Junio C Hamano
2006-07-31 7:08 ` Martin Waitz
2006-07-31 8:14 ` Luben Tuikov
2006-07-31 3:57 ` Luben Tuikov
2006-07-31 6:55 ` Jakub Narebski
2 siblings, 2 replies; 13+ messages in thread
From: Junio C Hamano @ 2006-07-31 1:20 UTC (permalink / raw)
To: Martin Waitz; +Cc: git
Martin Waitz <tali@admingilde.org> writes:
> diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.pl
> similarity index 100%
> rename from gitweb/gitweb.cgi
> rename to gitweb/gitweb.pl
> index 243a2921f849568260e848201d238b3b9fe7e1f2..8e05c335f801d4c52a9b348fa56fccfae36ce621 100755
> --- a/gitweb/gitweb.cgi
> +++ b/gitweb/gitweb.pl
> @@ -24,14 +24,14 @@ our $rss_link = "";
>
> # core git executable to use
> # this can just be "git" if your webserver has a sensible PATH
> -our $GIT = "/usr/bin/git";
> +our $GIT = "@@GIT_BINDIR@@/git";
>
> # absolute fs-path which will be prepended to the project path
> #our $projectroot = "/pub/scm";
> -our $projectroot = "/home/kay/public_html/pub/scm";
> +our $projectroot = "@@GITWEB_PROJECTROOT@@";
>
> # version of the core git binary
> -our $git_version = qx($GIT --version) =~ m/git version (.*)$/ ? $1 : "unknown";
> +our $git_version = "@@GIT_VERSION@@";
I think the other parts are sensible but I am not sure if we
want to report the version of git distribution (your patch), or
the version of git binary the cgi script happens to use (the
current implementation).
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] gitweb: fill in gitweb configuration by Makefile
2006-07-30 22:37 [PATCH] gitweb: fill in gitweb configuration by Makefile Martin Waitz
2006-07-31 1:20 ` Junio C Hamano
@ 2006-07-31 3:57 ` Luben Tuikov
2006-07-31 6:41 ` Junio C Hamano
` (2 more replies)
2006-07-31 6:55 ` Jakub Narebski
2 siblings, 3 replies; 13+ messages in thread
From: Luben Tuikov @ 2006-07-31 3:57 UTC (permalink / raw)
To: Martin Waitz, git
--- Martin Waitz <tali@admingilde.org> wrote:
> Generate gitweb/gitweb.cgi to reduce the need to patch gitweb.cgi by
> the end user.
> The GIT installation directory and version are already known by the
> Makefile, they can be inserted directly into gitweb.
> All other gitweb configuration parameters can now be specified
> by providing GITWEB_* variables while building GIT.
> These are described in gitweb/README.
NACK.
I don't like it. While this method works, it is too much effort
to have to run make to do this, plus it pollutes your tree.
Instead, what you can do is make gitweb.cgi read a text file
from . which has those variables defined.
This way, I can just copy gitweb.cgi into my web-server directory
and voila it works, since the variable definition file would
always be there. This way:
- no need to run make to build "gitweb.cgi" or "gitweb.pl" whatever
you call it,
- no need to pollute your tree with site defined variables,
- simple copy (cp) would install a working version, instead of
the current cp + patch with local settings method.
Luben
>
> Signed-off-by: Martin Waitz <tali@admingilde.org>
> ---
> Makefile | 25 +++++++++++++++++++++++--
> gitweb/.gitignore | 1 +
> gitweb/README | 17 +++++++++++++++++
> gitweb/{gitweb.cgi => gitweb.pl} | 15 +++++++--------
> 4 files changed, 48 insertions(+), 10 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index 8349e3defacca69ae48c477ff99be527b9af3b77..bd59d6b58d1cfcaecd033f186d7c2cc537416b75 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -116,6 +116,13 @@ template_dir = $(prefix)/share/git-core/
> GIT_PYTHON_DIR = $(prefix)/share/git-core/python
> # DESTDIR=
>
> +# default configuration for gitweb
> +GITWEB_SITENAME =
> +GITWEB_PROJECTROOT = /pub/git
> +GITWEB_LIST =
> +GITWEB_HOMETEXT = indextext.html
> +GITWEB_CSS = gitweb.css
> +
> export prefix bindir gitexecdir template_dir GIT_PYTHON_DIR
>
> CC = gcc
> @@ -509,7 +516,7 @@ LIB_OBJS += $(COMPAT_OBJS)
> export prefix TAR INSTALL DESTDIR SHELL_PATH template_dir
> ### Build rules
>
> -all: $(ALL_PROGRAMS) $(BUILT_INS) git$X gitk
> +all: $(ALL_PROGRAMS) $(BUILT_INS) git$X gitk gitweb/gitweb.cgi
>
> all:
> $(MAKE) -C templates
> @@ -567,6 +574,20 @@ git-status: git-commit
> cp $< $@+
> mv $@+ $@
>
> +gitweb/gitweb.cgi: gitweb/gitweb.pl
> + rm -f $@ $@+
> + sed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \
> + -e 's|@@GIT_VERSION@@|$(GIT_VERSION)|g' \
> + -e 's|@@GIT_BINDIR@@|$(bindir)|g' \
> + -e 's|@@GITWEB_SITENAME@@|$(GITWEB_SITENAME)|g' \
> + -e 's|@@GITWEB_PROJECTROOT@@|$(GITWEB_PROJECTROOT)|g' \
> + -e 's|@@GITWEB_LIST@@|$(GITWEB_LIST)|g' \
> + -e 's|@@GITWEB_HOMETEXT@@|$(GITWEB_HOMETEXT)|g' \
> + -e 's|@@GITWEB_CSS@@|$(GITWEB_CSS)|g' \
> + $< >$@+
> + chmod +x $@+
> + mv $@+ $@
> +
> git-instaweb: git-instaweb.sh gitweb/gitweb.cgi gitweb/gitweb.css
> rm -f $@ $@+
> sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
> @@ -577,7 +598,7 @@ git-instaweb: git-instaweb.sh gitweb/git
> -e '/@@GITWEB_CGI@@/d' \
> -e '/@@GITWEB_CSS@@/r gitweb/gitweb.css' \
> -e '/@@GITWEB_CSS@@/d' \
> - $@.sh | sed "s|/usr/bin/git|$(bindir)/git|" > $@+
> + $@.sh > $@+
> chmod +x $@+
> mv $@+ $@
>
> diff --git a/gitweb/.gitignore b/gitweb/.gitignore
> new file mode 100644
> index 0000000000000000000000000000000000000000..e83127e3f09f8496d0cd07b8f632ff341c96fd00
> --- /dev/null
> +++ b/gitweb/.gitignore
> @@ -0,0 +1 @@
> +gitweb.cgi
> diff --git a/gitweb/README b/gitweb/README
> index 8d672762eab427f3b732626d6b3f8e05a7e8f8c9..ed939e2fb5264cce24e770272583b12372c3ab68 100644
> --- a/gitweb/README
> +++ b/gitweb/README
> @@ -5,5 +5,22 @@ The one working on:
>
> From the git version 1.4.0 gitweb is bundled with git.
>
> +
> +How to configure gitweb for your local system:
> +
> +You can specify the following configuration variables when building GIT:
> + * GITWEB_SITENAME
> + Shown in the title of all generated pages, defaults to the servers name.
> + * GITWEB_PROJECTROOT
> + The root directory for all projects shown by gitweb.
> + * GITWEB_LIST
> + points to a directory to scan for projects (defaults to project root)
> + or to a file for explicit listing of projects.
> + * GITWEB_HOMETEXT
> + points to an .html file which is included on the gitweb project
> + overview page.
> + * GITWEB_CSS
> + Points to the location where you put gitweb.css on your web server.
> +
> Any comment/question/concern to:
> Kay Sievers <kay.sievers@vrfy.org>
> diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.pl
> similarity index 100%
> rename from gitweb/gitweb.cgi
> rename to gitweb/gitweb.pl
> index 243a2921f849568260e848201d238b3b9fe7e1f2..8e05c335f801d4c52a9b348fa56fccfae36ce621 100755
> --- a/gitweb/gitweb.cgi
> +++ b/gitweb/gitweb.pl
> @@ -24,14 +24,14 @@ our $rss_link = "";
>
> # core git executable to use
> # this can just be "git" if your webserver has a sensible PATH
> -our $GIT = "/usr/bin/git";
> +our $GIT = "@@GIT_BINDIR@@/git";
>
> # absolute fs-path which will be prepended to the project path
> #our $projectroot = "/pub/scm";
> -our $projectroot = "/home/kay/public_html/pub/scm";
> +our $projectroot = "@@GITWEB_PROJECTROOT@@";
>
> # version of the core git binary
> -our $git_version = qx($GIT --version) =~ m/git version (.*)$/ ? $1 : "unknown";
> +our $git_version = "@@GIT_VERSION@@";
>
> # location for temporary files needed for diffs
> our $git_temp = "/tmp/gitweb";
> @@ -44,17 +44,16 @@ our $home_link = $my_uri;
>
> # name of your site or organization to appear in page titles
> # replace this with something more descriptive for clearer bookmarks
> -our $site_name = $ENV{'SERVER_NAME'} || "Untitled";
> +our $site_name = "@@GITWEB_SITENAME@@" || $ENV{'SERVER_NAME'} || "Untitled";
>
> # html text to include at home page
> -our $home_text = "indextext.html";
> +our $home_text = "@@GITWEB_HOMETEXT@@";
>
> # URI of default stylesheet
> -our $stylesheet = "gitweb.css";
> +our $stylesheet = "@@GITWEB_CSS@@";
>
> # source of projects list
> -#our $projects_list = $projectroot;
> -our $projects_list = "index/index.aux";
> +our $projects_list = "@@GITWEB_LIST@@" || "$projectroot";
>
> # default blob_plain mimetype and default charset for text/plain blob
> our $default_blob_plain_mimetype = 'text/plain';
> --
> 1.4.2.rc2.gf055
>
> --
> Martin Waitz
> -
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] gitweb: fill in gitweb configuration by Makefile
2006-07-31 3:57 ` Luben Tuikov
@ 2006-07-31 6:41 ` Junio C Hamano
2006-07-31 7:22 ` Martin Waitz
2006-07-31 21:33 ` Jon Loeliger
2 siblings, 0 replies; 13+ messages in thread
From: Junio C Hamano @ 2006-07-31 6:41 UTC (permalink / raw)
To: ltuikov; +Cc: git, Martin Waitz
-
Luben Tuikov <ltuikov@yahoo.com> writes:
> -- Martin Waitz <tali@admingilde.org> wrote:
>> Generate gitweb/gitweb.cgi to reduce the need to patch gitweb.cgi by
>> the end user.
>> The GIT installation directory and version are already known by the
>> Makefile, they can be inserted directly into gitweb.
>> All other gitweb configuration parameters can now be specified
>> by providing GITWEB_* variables while building GIT.
>> These are described in gitweb/README.
>
> NACK.
>
> I don't like it. While this method works, it is too much effort
> to have to run make to do this, plus it pollutes your tree.
I do not quite agree with this reasoning. With that definition
of "polluting your tree", all build of git-*.{sh,perl,py} are
polluting your tree. If compile/install time customization is
handier I do not have problem doing it that way.
> Instead, what you can do is make gitweb.cgi read a text file
> from . which has those variables defined.
I think there was a discussion on having a configuration file
for gitweb (not per-repository .git/config but installation wide
configuration file). If I recall correctly, the killer argument
against it was that you would need to bootstrap the process by
somehow telling gitweb.cgi where to read from that configuration
file, and if you are going to customize gitweb.cgi before
installation for the site that way, then giving a bit more
configuration in gitweb.cgi (like Martin did in the patch we are
discussion) is simpler.
> - no need to run make to build "gitweb.cgi" or "gitweb.pl" whatever
> you call it,
> - no need to pollute your tree with site defined variables,
> - simple copy (cp) would install a working version, instead of
> the current cp + patch with local settings method.
While I agree all of these "no need to" makes things slightly
simpler, I do not think it is such a big deal -- we are building
git-*.{sh,perl,py,c} anyway.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] gitweb: fill in gitweb configuration by Makefile
2006-07-30 22:37 [PATCH] gitweb: fill in gitweb configuration by Makefile Martin Waitz
2006-07-31 1:20 ` Junio C Hamano
2006-07-31 3:57 ` Luben Tuikov
@ 2006-07-31 6:55 ` Jakub Narebski
2 siblings, 0 replies; 13+ messages in thread
From: Jakub Narebski @ 2006-07-31 6:55 UTC (permalink / raw)
To: git
Martin Waitz wrote:
> gitweb/{gitweb.cgi => gitweb.pl} | 15 +++++++--------
[...]
> diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.pl
> similarity index 100%
> rename from gitweb/gitweb.cgi
> rename to gitweb/gitweb.pl
> index 243a2921f849568260e848201d238b3b9fe7e1f2..8e05c335f801d4c52a9b348fa56fccfae36ce621 100755
> --- a/gitweb/gitweb.cgi
> +++ b/gitweb/gitweb.pl
Shouldn't we use .perl suffix, i.e. gitweb.perl, like almost all
other Perl files in git distribution (the exception is
Documentation/sort_glossary.pl which never get installed).
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] gitweb: fill in gitweb configuration by Makefile
2006-07-31 1:20 ` Junio C Hamano
@ 2006-07-31 7:08 ` Martin Waitz
2006-07-31 7:38 ` Jakub Narebski
2006-07-31 8:14 ` Luben Tuikov
1 sibling, 1 reply; 13+ messages in thread
From: Martin Waitz @ 2006-07-31 7:08 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
[-- Attachment #1: Type: text/plain, Size: 514 bytes --]
hoi :)
On Sun, Jul 30, 2006 at 06:20:26PM -0700, Junio C Hamano wrote:
> I think the other parts are sensible but I am not sure if we
> want to report the version of git distribution (your patch), or
> the version of git binary the cgi script happens to use (the
> current implementation).
hmm, right.
Well, now that gitweb is included with GIT I think that they will
be in sync on many sites, but of course that's not guaranteed.
Shall I send a new patch without that change?
--
Martin Waitz
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] gitweb: fill in gitweb configuration by Makefile
2006-07-31 3:57 ` Luben Tuikov
2006-07-31 6:41 ` Junio C Hamano
@ 2006-07-31 7:22 ` Martin Waitz
2006-07-31 9:38 ` Johannes Schindelin
2006-07-31 16:59 ` Luben Tuikov
2006-07-31 21:33 ` Jon Loeliger
2 siblings, 2 replies; 13+ messages in thread
From: Martin Waitz @ 2006-07-31 7:22 UTC (permalink / raw)
To: Luben Tuikov; +Cc: git
[-- Attachment #1: Type: text/plain, Size: 1209 bytes --]
hoi :)
thanks for the feedback!
> I don't like it. While this method works, it is too much effort
> to have to run make to do this, plus it pollutes your tree.
Do you really think it is that much effort?
What do others think? alternatives?
> Instead, what you can do is make gitweb.cgi read a text file
> from . which has those variables defined.
I don't really care if it is a configuration file or a build-time
configuration, but I need something now.
If you submit your proposal, we can compare both and choose the best
one ;-).
> This way, I can just copy gitweb.cgi into my web-server directory
> and voila it works, since the variable definition file would
> always be there. This way:
> - no need to run make to build "gitweb.cgi" or "gitweb.pl" whatever
> you call it,
ok, but you have to call make anyway to build the rest of GIT,
so this shouldn't be a big problem.
> - no need to pollute your tree with site defined variables,
this is achieved by my patch, too.
> - simple copy (cp) would install a working version, instead of
> the current cp + patch with local settings method.
this is achieved by my patch, too.
--
Martin Waitz
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] gitweb: fill in gitweb configuration by Makefile
2006-07-31 7:08 ` Martin Waitz
@ 2006-07-31 7:38 ` Jakub Narebski
2006-08-01 19:34 ` Martin Waitz
0 siblings, 1 reply; 13+ messages in thread
From: Jakub Narebski @ 2006-07-31 7:38 UTC (permalink / raw)
To: git
Martin Waitz wrote:
> On Sun, Jul 30, 2006 at 06:20:26PM -0700, Junio C Hamano wrote:
>>
>> I think the other parts are sensible but I am not sure if we
>> want to report the version of git distribution (your patch), or
>> the version of git binary the cgi script happens to use (the
>> current implementation).
>
> hmm, right.
> Well, now that gitweb is included with GIT I think that they will
> be in sync on many sites, but of course that's not guaranteed.
>
> Shall I send a new patch without that change?
There are currently two version variables in gitweb: the version of the
script, and the version of git binaries used. They might be different.
But now that gitweb is bundled with git, perhaps we could use compile-time
git version as gitweb version, i.e.
our $version = "@@GIT_VERSION@@";
while leaving $git_version as is, i.e.
our $git_version =
qx($GIT --version) =~ m/git version (.*)$/ ? $1 : "unknown"
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] gitweb: fill in gitweb configuration by Makefile
2006-07-31 1:20 ` Junio C Hamano
2006-07-31 7:08 ` Martin Waitz
@ 2006-07-31 8:14 ` Luben Tuikov
1 sibling, 0 replies; 13+ messages in thread
From: Luben Tuikov @ 2006-07-31 8:14 UTC (permalink / raw)
To: Junio C Hamano, Martin Waitz; +Cc: git
--- Junio C Hamano <junkio@cox.net> wrote:
> Martin Waitz <tali@admingilde.org> writes:
>
> > diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.pl
> > similarity index 100%
> > rename from gitweb/gitweb.cgi
> > rename to gitweb/gitweb.pl
> > index 243a2921f849568260e848201d238b3b9fe7e1f2..8e05c335f801d4c52a9b348fa56fccfae36ce621
> 100755
> > --- a/gitweb/gitweb.cgi
> > +++ b/gitweb/gitweb.pl
> > @@ -24,14 +24,14 @@ our $rss_link = "";
> >
> > # core git executable to use
> > # this can just be "git" if your webserver has a sensible PATH
> > -our $GIT = "/usr/bin/git";
> > +our $GIT = "@@GIT_BINDIR@@/git";
> >
> > # absolute fs-path which will be prepended to the project path
> > #our $projectroot = "/pub/scm";
> > -our $projectroot = "/home/kay/public_html/pub/scm";
> > +our $projectroot = "@@GITWEB_PROJECTROOT@@";
> >
> > # version of the core git binary
> > -our $git_version = qx($GIT --version) =~ m/git version (.*)$/ ? $1 : "unknown";
> > +our $git_version = "@@GIT_VERSION@@";
>
> I think the other parts are sensible but I am not sure if we
> want to report the version of git distribution (your patch), or
> the version of git binary the cgi script happens to use (the
> current implementation).
I'd rather see git distribution (Martin's patch) since, after all,
gitweb became part of git not so long ago. And as thus, its own
numbers don't matter much, but the git distribution.
In fact, I was thinking of submitting a patch to the same effect
myself.
Luben
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] gitweb: fill in gitweb configuration by Makefile
2006-07-31 7:22 ` Martin Waitz
@ 2006-07-31 9:38 ` Johannes Schindelin
2006-07-31 16:59 ` Luben Tuikov
1 sibling, 0 replies; 13+ messages in thread
From: Johannes Schindelin @ 2006-07-31 9:38 UTC (permalink / raw)
To: Martin Waitz; +Cc: Luben Tuikov, git
Hi,
On Mon, 31 Jul 2006, Martin Waitz wrote:
> > I don't like it. While this method works, it is too much effort
> > to have to run make to do this, plus it pollutes your tree.
>
> Do you really think it is that much effort?
> What do others think? alternatives?
I think it is worth it, and it is cleaner. The only drawback: we have to
stuff it somehow into git-instaweb...
Ciao,
Dscho
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] gitweb: fill in gitweb configuration by Makefile
2006-07-31 7:22 ` Martin Waitz
2006-07-31 9:38 ` Johannes Schindelin
@ 2006-07-31 16:59 ` Luben Tuikov
1 sibling, 0 replies; 13+ messages in thread
From: Luben Tuikov @ 2006-07-31 16:59 UTC (permalink / raw)
To: Martin Waitz; +Cc: git, Junio C Hamano
--- Martin Waitz <tali@admingilde.org> wrote:
> > This way, I can just copy gitweb.cgi into my web-server directory
> > and voila it works, since the variable definition file would
> > always be there. This way:
> > - no need to run make to build "gitweb.cgi" or "gitweb.pl" whatever
> > you call it,
>
> ok, but you have to call make anyway to build the rest of GIT,
> so this shouldn't be a big problem.
>
> > - no need to pollute your tree with site defined variables,
>
> this is achieved by my patch, too.
>
> > - simple copy (cp) would install a working version, instead of
> > the current cp + patch with local settings method.
>
> this is achieved by my patch, too.
That's true, but the difference is that one needs to keep
a per-site-installation tree which keeps the configuration of
gitweb for that site (installation).
Since you're working on this, can you come up with an alternative way?
At this point I don't care either way, but _if_ there is an alternative
way, I'd rather we considered it. (Possibly using a symbol table file
("package") to only keep those variables?)
The bash-sed editing is kind of, you have to admit, hackish.
Luben
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] gitweb: fill in gitweb configuration by Makefile
2006-07-31 3:57 ` Luben Tuikov
2006-07-31 6:41 ` Junio C Hamano
2006-07-31 7:22 ` Martin Waitz
@ 2006-07-31 21:33 ` Jon Loeliger
2 siblings, 0 replies; 13+ messages in thread
From: Jon Loeliger @ 2006-07-31 21:33 UTC (permalink / raw)
To: ltuikov; +Cc: Martin Waitz, Git List
On Sun, 2006-07-30 at 22:57, Luben Tuikov wrote:
> --- Martin Waitz <tali@admingilde.org> wrote:
> > Generate gitweb/gitweb.cgi to reduce the need to patch gitweb.cgi by
> > the end user.
> > The GIT installation directory and version are already known by the
> > Makefile, they can be inserted directly into gitweb.
> > All other gitweb configuration parameters can now be specified
> > by providing GITWEB_* variables while building GIT.
> > These are described in gitweb/README.
>
> NACK.
>
> I don't like it. While this method works, it is too much effort
> to have to run make to do this, plus it pollutes your tree.
>
> Instead, what you can do is make gitweb.cgi read a text file
> from . which has those variables defined.
>
> This way, I can just copy gitweb.cgi into my web-server directory
> and voila it works, since the variable definition file would
> always be there. This way:
> - no need to run make to build "gitweb.cgi" or "gitweb.pl" whatever
> you call it,
> - no need to pollute your tree with site defined variables,
> - simple copy (cp) would install a working version, instead of
> the current cp + patch with local settings method.
>
> Luben
Which sounds frighteningly similar to a patch I submitted
quite a while ago, and brought up again twice, and have
had stomped on once.
So what now? :-)
jdl
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] gitweb: fill in gitweb configuration by Makefile
2006-07-31 7:38 ` Jakub Narebski
@ 2006-08-01 19:34 ` Martin Waitz
0 siblings, 0 replies; 13+ messages in thread
From: Martin Waitz @ 2006-08-01 19:34 UTC (permalink / raw)
To: Jakub Narebski; +Cc: git
hoi :)
On Mon, Jul 31, 2006 at 09:38:26AM +0200, Jakub Narebski wrote:
> There are currently two version variables in gitweb: the version of the
> script, and the version of git binaries used. They might be different.
> But now that gitweb is bundled with git, perhaps we could use compile-time
> git version as gitweb version
updated patch below:
+++
Generate gitweb/gitweb.cgi to reduce the need to patch gitweb.cgi by
the end user.
The GIT installation directory is already known by the Makefile, and can be
inserted directly into gitweb.
All other gitweb configuration parameters can now be specified by providing
GITWEB_* variables while building GIT. These are described in gitweb/README.
Signed-off-by: Martin Waitz <tali@admingilde.org>
---
Makefile | 25 +++++++++++++++++++++++--
gitweb/.gitignore | 1 +
gitweb/README | 17 +++++++++++++++++
gitweb/{gitweb.cgi => gitweb.pl} | 15 +++++++--------
4 files changed, 48 insertions(+), 10 deletions(-)
diff --git a/Makefile b/Makefile
index 15864e2..0d66c6a 100644
--- a/Makefile
+++ b/Makefile
@@ -116,6 +116,13 @@ template_dir = $(prefix)/share/git-core/
GIT_PYTHON_DIR = $(prefix)/share/git-core/python
# DESTDIR=
+# default configuration for gitweb
+GITWEB_SITENAME =
+GITWEB_PROJECTROOT = /pub/git
+GITWEB_LIST =
+GITWEB_HOMETEXT = indextext.html
+GITWEB_CSS = gitweb.css
+
export prefix bindir gitexecdir template_dir GIT_PYTHON_DIR
CC = gcc
@@ -514,7 +521,7 @@ LIB_OBJS += $(COMPAT_OBJS)
export prefix TAR INSTALL DESTDIR SHELL_PATH template_dir
### Build rules
-all: $(ALL_PROGRAMS) $(BUILT_INS) git$X gitk
+all: $(ALL_PROGRAMS) $(BUILT_INS) git$X gitk gitweb/gitweb.cgi
all:
$(MAKE) -C templates
@@ -572,6 +579,20 @@ git-status: git-commit
cp $< $@+
mv $@+ $@
+gitweb/gitweb.cgi: gitweb/gitweb.pl
+ rm -f $@ $@+
+ sed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \
+ -e 's|@@GIT_VERSION@@|$(GIT_VERSION)|g' \
+ -e 's|@@GIT_BINDIR@@|$(bindir)|g' \
+ -e 's|@@GITWEB_SITENAME@@|$(GITWEB_SITENAME)|g' \
+ -e 's|@@GITWEB_PROJECTROOT@@|$(GITWEB_PROJECTROOT)|g' \
+ -e 's|@@GITWEB_LIST@@|$(GITWEB_LIST)|g' \
+ -e 's|@@GITWEB_HOMETEXT@@|$(GITWEB_HOMETEXT)|g' \
+ -e 's|@@GITWEB_CSS@@|$(GITWEB_CSS)|g' \
+ $< >$@+
+ chmod +x $@+
+ mv $@+ $@
+
git-instaweb: git-instaweb.sh gitweb/gitweb.cgi gitweb/gitweb.css
rm -f $@ $@+
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
@@ -582,7 +603,7 @@ git-instaweb: git-instaweb.sh gitweb/git
-e '/@@GITWEB_CGI@@/d' \
-e '/@@GITWEB_CSS@@/r gitweb/gitweb.css' \
-e '/@@GITWEB_CSS@@/d' \
- $@.sh | sed "s|/usr/bin/git|$(bindir)/git|" > $@+
+ $@.sh > $@+
chmod +x $@+
mv $@+ $@
diff --git a/gitweb/.gitignore b/gitweb/.gitignore
new file mode 100644
index 0000000..e83127e
--- /dev/null
+++ b/gitweb/.gitignore
@@ -0,0 +1 @@
+gitweb.cgi
diff --git a/gitweb/README b/gitweb/README
index 8d67276..ed939e2 100644
--- a/gitweb/README
+++ b/gitweb/README
@@ -5,5 +5,22 @@ The one working on:
From the git version 1.4.0 gitweb is bundled with git.
+
+How to configure gitweb for your local system:
+
+You can specify the following configuration variables when building GIT:
+ * GITWEB_SITENAME
+ Shown in the title of all generated pages, defaults to the servers name.
+ * GITWEB_PROJECTROOT
+ The root directory for all projects shown by gitweb.
+ * GITWEB_LIST
+ points to a directory to scan for projects (defaults to project root)
+ or to a file for explicit listing of projects.
+ * GITWEB_HOMETEXT
+ points to an .html file which is included on the gitweb project
+ overview page.
+ * GITWEB_CSS
+ Points to the location where you put gitweb.css on your web server.
+
Any comment/question/concern to:
Kay Sievers <kay.sievers@vrfy.org>
diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.pl
similarity index 100%
rename from gitweb/gitweb.cgi
rename to gitweb/gitweb.pl
index e5fca63..20dd901 100755
--- a/gitweb/gitweb.cgi
+++ b/gitweb/gitweb.pl
@@ -17,18 +17,18 @@ use Fcntl ':mode';
binmode STDOUT, ':utf8';
our $cgi = new CGI;
-our $version = "267";
+our $version = "@@GIT_VERSION@@";
our $my_url = $cgi->url();
our $my_uri = $cgi->url(-absolute => 1);
our $rss_link = "";
# core git executable to use
# this can just be "git" if your webserver has a sensible PATH
-our $GIT = "/usr/bin/git";
+our $GIT = "@@GIT_BINDIR@@/git";
# absolute fs-path which will be prepended to the project path
#our $projectroot = "/pub/scm";
-our $projectroot = "/home/kay/public_html/pub/scm";
+our $projectroot = "@@GITWEB_PROJECTROOT@@";
# version of the core git binary
our $git_version = qx($GIT --version) =~ m/git version (.*)$/ ? $1 : "unknown";
@@ -44,17 +44,16 @@ our $home_link = $my_uri;
# name of your site or organization to appear in page titles
# replace this with something more descriptive for clearer bookmarks
-our $site_name = $ENV{'SERVER_NAME'} || "Untitled";
+our $site_name = "@@GITWEB_SITENAME@@" || $ENV{'SERVER_NAME'} || "Untitled";
# html text to include at home page
-our $home_text = "indextext.html";
+our $home_text = "@@GITWEB_HOMETEXT@@";
# URI of default stylesheet
-our $stylesheet = "gitweb.css";
+our $stylesheet = "@@GITWEB_CSS@@";
# source of projects list
-#our $projects_list = $projectroot;
-our $projects_list = "index/index.aux";
+our $projects_list = "@@GITWEB_LIST@@" || "$projectroot";
# default blob_plain mimetype and default charset for text/plain blob
our $default_blob_plain_mimetype = 'text/plain';
--
1.4.2.rc2.gf055
--
Martin Waitz
^ permalink raw reply related [flat|nested] 13+ messages in thread
end of thread, other threads:[~2006-08-01 19:34 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-30 22:37 [PATCH] gitweb: fill in gitweb configuration by Makefile Martin Waitz
2006-07-31 1:20 ` Junio C Hamano
2006-07-31 7:08 ` Martin Waitz
2006-07-31 7:38 ` Jakub Narebski
2006-08-01 19:34 ` Martin Waitz
2006-07-31 8:14 ` Luben Tuikov
2006-07-31 3:57 ` Luben Tuikov
2006-07-31 6:41 ` Junio C Hamano
2006-07-31 7:22 ` Martin Waitz
2006-07-31 9:38 ` Johannes Schindelin
2006-07-31 16:59 ` Luben Tuikov
2006-07-31 21:33 ` Jon Loeliger
2006-07-31 6:55 ` Jakub Narebski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).