*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
4 changed files with 21 additions and 13 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue