make VERSION work in both types of setups

The old install method will now use conf/VERSION instead of src/VERSION everywhere.

The new one, if you use the builtin make file to "make branch.tar" will also create just such a file
This commit is contained in:
Sitaram Chamarty 2010-02-10 12:35:01 +05:30 committed by Sitaram Chamarty
parent e11f9521fe
commit 06d8ab4c18
5 changed files with 12 additions and 13 deletions

View file

@ -7,10 +7,10 @@
# Note: I'm not sure if that "-r" is a GNU tar extension... # Note: I'm not sure if that "-r" is a GNU tar extension...
.GITOLITE-VERSION: .GITOLITE-VERSION:
@touch .GITOLITE-VERSION @touch conf/VERSION
%.tar: .GITOLITE-VERSION %.tar: .GITOLITE-VERSION
git describe --all --long $* > .GITOLITE-VERSION git describe --tags --long $* > conf/VERSION
git archive $* > $@ git archive $* > $@
tar -r -f $@ .GITOLITE-VERSION tar -r -f $@ conf/VERSION
rm .GITOLITE-VERSION rm conf/VERSION

View file

@ -34,7 +34,7 @@ our $USERNAME_PATT=qr(^\@?[0-9a-zA-Z][0-9a-zA-Z._\@+-]*$); # very simple patter
our $REPOPATT_PATT=qr(^\@?[0-9a-zA-Z][\\^.$|()[\]*+?{}0-9a-zA-Z._\@/-]*$); our $REPOPATT_PATT=qr(^\@?[0-9a-zA-Z][\\^.$|()[\]*+?{}0-9a-zA-Z._\@/-]*$);
# these come from the RC file # these come from the RC file
our ($REPO_UMASK, $GL_WILDREPOS); our ($REPO_UMASK, $GL_WILDREPOS, $GL_PACKAGE_CONF);
our %repos; our %repos;
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
@ -282,7 +282,7 @@ sub report_basic
# send back some useful info if no command was given # send back some useful info if no command was given
print "hello $user, the gitolite version here is "; print "hello $user, the gitolite version here is ";
system("cat", "$GL_ADMINDIR/src/VERSION"); system("cat", ($GL_PACKAGE_CONF || "$GL_ADMINDIR/conf") . "/VERSION");
print "\ryou have the following permissions:\n\r"; print "\ryou have the following permissions:\n\r";
for my $r (sort keys %repos) { for my $r (sort keys %repos) {
my $perm .= ( $repos{$r}{C}{'@all'} ? ' @' : ( $repos{$r}{C}{$user} ? ' C' : ' ' ) ); my $perm .= ( $repos{$r}{C}{'@all'} ? ' @' : ( $repos{$r}{C}{$user} ? ' C' : ' ' ) );

View file

@ -196,12 +196,12 @@ version_info() {
# MANUAL: if needed, make a note of the version you are upgrading from, and to # MANUAL: if needed, make a note of the version you are upgrading from, and to
# record which version is being sent across; we assume it's HEAD # record which version is being sent across; we assume it's HEAD
git describe --tags --long HEAD 2>/dev/null > src/VERSION || echo '(unknown)' > src/VERSION git describe --tags --long HEAD 2>/dev/null > conf/VERSION || echo '(unknown)' > conf/VERSION
# what was the old version there? # what was the old version there?
export upgrade_details="you are upgrading \ export upgrade_details="you are upgrading \
$(ssh -p $port $user@$host cat gitolite-install/src/VERSION 2>/dev/null || echo '(or installing first-time)' ) \ $(ssh -p $port $user@$host cat gitolite-install/conf/VERSION 2>/dev/null || echo '(or installing first-time)' ) \
to $(cat src/VERSION)" to $(cat conf/VERSION)"
prompt "$upgrade_details" "$v_upgrade_details" prompt "$upgrade_details" "$v_upgrade_details"
} }
@ -283,7 +283,6 @@ copy_gl() {
ssh -p $port $user@$host mkdir -p gitolite-install ssh -p $port $user@$host mkdir -p gitolite-install
scp $quiet -P $port -r src conf doc hooks $user@$host:gitolite-install/ scp $quiet -P $port -r src conf doc hooks $user@$host:gitolite-install/
rm -f src/VERSION
# MANUAL: now log on to the server (ssh git@server) and get a command # MANUAL: now log on to the server (ssh git@server) and get a command
# line. This step is for your convenience; the script does it all from # line. This step is for your convenience; the script does it all from

View file

@ -62,6 +62,7 @@ if ($GL_PACKAGE_HOOKS) {
system("cp -R $GL_PACKAGE_HOOKS $GL_ADMINDIR"); system("cp -R $GL_PACKAGE_HOOKS $GL_ADMINDIR");
} else { } else {
system("cp -R $bindir/../src $bindir/../doc $bindir/../hooks $GL_ADMINDIR"); system("cp -R $bindir/../src $bindir/../doc $bindir/../hooks $GL_ADMINDIR");
system("cp $bindir/../conf/VERSION $GL_ADMINDIR/conf");
} }
unless (-f $GL_CONF or $GL_PACKAGE_CONF) { unless (-f $GL_CONF or $GL_PACKAGE_CONF) {
@ -95,7 +96,7 @@ if ( -d "gitolite-admin.git/hooks" ) {
} }
# fixup program renames # fixup program renames
for my $oldname qw(pta-hook.sh conf-convert.pl 00-easy-install.sh 99-emergency-addkey.sh install.pl update-hook.pl hooks/update ga-post-update-hook) { for my $oldname qw(pta-hook.sh conf-convert.pl 00-easy-install.sh 99-emergency-addkey.sh install.pl update-hook.pl hooks/update ga-post-update-hook VERSION) {
unlink "$GL_ADMINDIR/src/$oldname"; unlink "$GL_ADMINDIR/src/$oldname";
unlink "$ENV{HOME}/gitolite-install/src/$oldname"; unlink "$ENV{HOME}/gitolite-install/src/$oldname";
} }

View file

@ -58,7 +58,6 @@ GL_ADMINDIR=$(cd;perl -e 'do ".gitolite.rc"; print $GL_ADMINDIR')
REPO_BASE=$( cd;perl -e 'do ".gitolite.rc"; print $REPO_BASE' ) REPO_BASE=$( cd;perl -e 'do ".gitolite.rc"; print $REPO_BASE' )
[[ -f $GL_ADMINDIR/conf/gitolite.conf ]] || { [[ -f $GL_ADMINDIR/conf/gitolite.conf ]] || {
echo DEBUG NO DEFAULT CONF FOUND .. CREATING .. >&2
cat <<EOF > $GL_ADMINDIR/conf/gitolite.conf cat <<EOF > $GL_ADMINDIR/conf/gitolite.conf
repo gitolite-admin repo gitolite-admin
RW+ = $admin_name RW+ = $admin_name
@ -67,7 +66,7 @@ REPO_BASE=$( cd;perl -e 'do ".gitolite.rc"; print $REPO_BASE' )
RW+ = @all RW+ = @all
EOF EOF
} }
cp $pubkey_file $GL_ADMINDIR/keydir [[ -n $pubkey_file ]] && cp $pubkey_file $GL_ADMINDIR/keydir
touch $HOME/.ssh/authorized_keys touch $HOME/.ssh/authorized_keys
gl-compile-conf -q gl-compile-conf -q