(big-config) compile: fragments in big-config

Since it is possible to do all sorts of shenanigans with wildcards and
repo groups, we

  - allow only a fragment called "foo" to set permissions for a group
    called "@foo", in addition to a repo called "foo"
  - forbid defining any groups within a fragment conf.  All "@foo = bar
    baz" must be done in the main config file now.

If this proves too limiting for anyone I'll worry about it then.
This commit is contained in:
Sitaram Chamarty 2010-05-12 22:09:51 +05:30
parent 0139fe0e97
commit d11a27924b

View file

@ -173,6 +173,8 @@ sub parse_conf_file
# user or repo groups # user or repo groups
if (/^(@\S+) = (.*)/) if (/^(@\S+) = (.*)/)
{ {
die "$ABRT defining groups is not allowed inside fragments\n"
if $GL_BIG_CONFIG and $fragment ne 'master';
# store the members of each group as hash key. Keep track of when # store the members of each group as hash key. Keep track of when
# the group was *first* created by using $fragment as the *value* # the group was *first* created by using $fragment as the *value*
do { $groups{$1}{$_} ||= $fragment } for ( expand_list( split(' ', $2) ) ); do { $groups{$1}{$_} ||= $fragment } for ( expand_list( split(' ', $2) ) );
@ -239,6 +241,8 @@ sub parse_conf_file
# fragment is also called 'foo' (you're allowed to have a # fragment is also called 'foo' (you're allowed to have a
# fragment that is only concerned with one repo) # fragment that is only concerned with one repo)
( $fragment eq $repo ) or ( $fragment eq $repo ) or
# same thing in big-config-land; foo is just @foo now
( $GL_BIG_CONFIG and "\@$fragment" eq $repo ) or
# fragment is called "bar" and "@bar = foo" has been # fragment is called "bar" and "@bar = foo" has been
# defined in the master config # defined in the master config
( ($groups{"\@$fragment"}{$repo} || '') eq 'master' ) ( ($groups{"\@$fragment"}{$repo} || '') eq 'master' )