summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSitaram Chamarty <sitaram@atc.tcs.com>2012-03-31 19:45:59 +0530
committerSitaram Chamarty <sitaram@atc.tcs.com>2012-04-02 13:18:30 +0530
commitb78466b1642ca4d685c26360d2882cca73614c4a (patch)
tree317d1efadb16acdc03ac4305ee39d257e4332b08
parent4e093d5909eec9447f04ee97b115a070ae3a0d92 (diff)
put the VERSION file in the right place
I don't know why I had put VERSION in GL_ADMIN_BASE, which is pretty stupid. It should be in GL_BINDIR. It also has nothing to do with setup -- the file needs to be generated at 'install' time.
-rw-r--r--INSTALL17
-rwxr-xr-xinstall63
-rw-r--r--src/Gitolite/Rc.pm2
-rw-r--r--src/Gitolite/Setup.pm3
4 files changed, 64 insertions, 21 deletions
diff --git a/INSTALL b/INSTALL
deleted file mode 100644
index b1c634d..0000000
--- a/INSTALL
+++ /dev/null
@@ -1,17 +0,0 @@
-1. Clone the repo and copy src somewhere (or leave it where it is, if you're
- sure no one will 'git pull' on a running system!)
-
- cp -a src /some/full/path
-
-2. (Optional) Make a symlink for the single executable 'gitolite' to
- somewhere in `$PATH`
-
- ln -sf /full/path/to/some/damn/place/gitolite $HOME/bin
-
-3. Run setup. That is, either run:
-
- gitolite setup -a YourName -pk /tmp/YourName.pub
-
- or, if you did not do step 2, run:
-
- /some/full/path/src/gitolite -a YourName -pk /tmp/YourName.pub
diff --git a/install b/install
new file mode 100755
index 0000000..f9df125
--- /dev/null
+++ b/install
@@ -0,0 +1,63 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+
+# Clearly you don't need a program to make one measly symlink, but the git
+# describe command involved in generating the VERSION string is a bit fiddly.
+
+use Getopt::Long;
+use FindBin;
+
+# meant to be run from the root of the gitolite tree, one level above 'src'
+BEGIN { $ENV{GL_BINDIR} = $FindBin::RealBin . "/src"; }
+use lib $ENV{GL_BINDIR};
+use Gitolite::Common;
+
+=for usage
+Usage (from gitolite clone directory):
+
+ ./install
+ to run gitolite using an absolute or relative path, for example
+ 'src/gitolite' or '/full/path/to/this/dir/src/gitolite'
+ ./install -ln [<dir>]
+ to symlink just the gitolite executable to some <dir> that is in
+ $PATH. <dir> defauls to $HOME/bin if <dir> not specified.
+ ./install -to <dir>
+ to copy the entire 'src' directory to <dir>. If <dir> is not in
+ $PATH, use the full path to run gitolite commands.
+
+Simplest use, if you have $HOME/bin in $PATH, is:
+
+ git clone -b g3 git://github.com/sitaramc/gitolite
+ gitolite/install -ln
+
+ # now run setup
+ gitolite setup -pk /path/to/YourName.pub
+=cut
+
+my ( $to, $ln, $help, $quiet );
+
+GetOptions(
+ 'to=s' => \$to,
+ 'ln:s' => \$ln,
+ 'help|h' => \$help,
+ 'quiet|q' => \$quiet,
+);
+usage() if $to and $ln or $help;
+$ln = "$ENV{HOME}/bin" if defined($ln) and not $ln;
+
+chdir($ENV{GL_BINDIR});
+my $version = `git describe --tags --long --dirty=-dt`;
+
+if ($to) {
+ _mkdir($to);
+ system("cp -a * $to");
+ _print( "$to/VERSION", $version );
+} elsif ($ln) {
+ ln_sf( $ENV{GL_BINDIR}, "gitolite", $ln );
+ _print( "VERSION", $version );
+} else {
+ say "use the following full path for gitolite:";
+ say "\t$ENV{GL_BINDIR}/gitolite";
+ _print( "VERSION", $version );
+}
diff --git a/src/Gitolite/Rc.pm b/src/Gitolite/Rc.pm
index e8def9a..57cedb2 100644
--- a/src/Gitolite/Rc.pm
+++ b/src/Gitolite/Rc.pm
@@ -161,7 +161,7 @@ sub query_rc {
sub version {
my $version = '';
$version = '(unknown)';
- for ("$rc{GL_ADMIN_BASE}/VERSION") {
+ for ("$ENV{GL_BINDIR}/VERSION") {
$version = slurp($_) if -r $_;
}
chomp($version);
diff --git a/src/Gitolite/Setup.pm b/src/Gitolite/Setup.pm
index e57b8d1..e876a50 100644
--- a/src/Gitolite/Setup.pm
+++ b/src/Gitolite/Setup.pm
@@ -102,9 +102,6 @@ sub setup_gladmin {
_mkdir( $rc{GL_ADMIN_BASE} );
_chdir( $rc{GL_ADMIN_BASE} );
- tsh_try("cd \$GL_BINDIR; git describe --tags --long --dirty=-dt 2>/dev/null")
- and _print( "VERSION", tsh_text() );
-
_mkdir("conf");
_mkdir("logs");
my $conf;