*try* to make upgrades resilient to format changes (pkg maintainers please read)
the commits leading up to v1.5 caused the data format to change (we added a rule sequence number). This in turn caused a problem for people who may have installed using the "system install / user setup" mode of install (which includes people who used RPM/DEB to install it) -- they would now have to *manually* run "gl-setup" once after the rpm/deb upgrade. This commit *tries* to mitigate this problem by recording a data format version number in the compiled output file. On any access to that file, if the version number is not found or is found to be not equal to the current version, gl-setup is run again. The reason I say "*tries*" is that the exact command used to do this is a bit of a hack for now. However, if it works for Fedora and Debian, I'm going to leave it at that :)
This commit is contained in:
parent
c993050ef9
commit
fd85ee2c91
|
@ -173,14 +173,6 @@ just work without any change; you should not normally have to do anything
|
|||
special. However, some new features may require additional settings in your
|
||||
`~/.gitolite.rc` file.
|
||||
|
||||
> [The only exception to this is when there is a change in the format of the
|
||||
"compiler" output -- then *each* gitolite hosting user must run "`gl-setup`
|
||||
again (no arguments needed this time), to fix up the compiled file format.
|
||||
|
||||
> Such a change will be clearly marked with "upgrade notes" both in the
|
||||
CHANGELOG and in the commit message. For example, this applies when upgrading
|
||||
to v1.5 or later from any version before it.]
|
||||
|
||||
Finally, in the rare case that you managed to lose your keys to the admin repo
|
||||
and want to supply a new pubkey, you can use this command to replace any such
|
||||
key. Could be useful in an emergency -- just get your new "yourname.pub" to
|
||||
|
|
|
@ -2,11 +2,14 @@ Major changes to gitolite, master branch only, most recent first, no dates but
|
|||
the tags can help you position stuff approximately
|
||||
[NYD = not yet documented due to lack of time...]
|
||||
|
||||
- v1.5.1 -- tries to eliminate the need to run gl-setup on data version
|
||||
change, thus hopefully obsoleting the upgrade note for v1.5 (just below).
|
||||
|
||||
- v1.5 -- IMPORTANT UPGRADE NOTES below
|
||||
|
||||
Upgrading to v1.5 from any version prior to v1.5 requires an extra step for
|
||||
people who installed gitolite using the "system install / user setup" method
|
||||
described in doc/0-INSTALL.mkd. For such installations, after the
|
||||
Upgrading to v1.5 from any version prior to v1.5 requires an extra step
|
||||
for people who installed gitolite using the "system install / user setup"
|
||||
method described in doc/0-INSTALL.mkd. For such installations, after the
|
||||
administrator has upgraded gitolite system-wide, each "gitolite host" user
|
||||
must run `gl-setup` once (this time without any arguments).
|
||||
|
||||
|
|
|
@ -40,6 +40,8 @@ our $REPOPATT_PATT=qr(^\@?[0-9a-zA-Z][\\^.$|()[\]*+?{}0-9a-zA-Z._\@/-]*$);
|
|||
our ($REPO_UMASK, $GL_WILDREPOS, $GL_PACKAGE_CONF, $GL_PACKAGE_HOOKS, $REPO_BASE, $GL_CONF_COMPILED, $GL_BIG_CONFIG);
|
||||
our %repos;
|
||||
our %groups;
|
||||
our $data_version;
|
||||
our $current_data_version = '1.5';
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# convenience subs
|
||||
|
@ -253,6 +255,13 @@ sub parse_acl
|
|||
our $gl_user = $ENV{GL_USER};
|
||||
|
||||
die "parse $GL_CONF_COMPILED failed: " . ($! or $@) unless do $GL_CONF_COMPILED;
|
||||
unless (defined($data_version) and $data_version eq $current_data_version) {
|
||||
# this cannot happen for 'easy-install' cases, by the way...
|
||||
print STDERR "(INTERNAL: $data_version -> $current_data_version; running gl-setup)\n";
|
||||
system("$ENV{SHELL} -l gl-setup >&2");
|
||||
|
||||
die "parse $GL_CONF_COMPILED failed: " . ($! or $@) unless do $GL_CONF_COMPILED;
|
||||
}
|
||||
|
||||
# basic access reporting doesn't send $repo, and doesn't need to; you just
|
||||
# want the config dumped as is, really
|
||||
|
|
|
@ -103,6 +103,8 @@ my $rule_seq = 0;
|
|||
# multiple times for the same repo+user. So...
|
||||
my %rurp_seen = ();
|
||||
|
||||
our $current_data_version; # this comes from gitolite.pm
|
||||
|
||||
# catch usernames<->pubkeys mismatches; search for "lint" below
|
||||
my %user_list = ();
|
||||
|
||||
|
@ -372,6 +374,8 @@ for my $fragment_file (glob("conf/fragments/*.conf"))
|
|||
}
|
||||
|
||||
my $compiled_fh = wrap_open( ">", $GL_CONF_COMPILED );
|
||||
my $data_version = $current_data_version;
|
||||
print $compiled_fh Data::Dumper->Dump([$data_version], [qw(*data_version)]);
|
||||
my $dumped_data = Data::Dumper->Dump([\%repos], [qw(*repos)]);
|
||||
# the dump uses single quotes, but we convert any strings containing $creator,
|
||||
# $readers, $writers, to double quoted strings. A wee bit sneaky, but not too
|
||||
|
|
Loading…
Reference in a new issue