compile: add owner field in the same line as the gitweb descriptions

this goes into the project list
This commit is contained in:
Sitaram Chamarty 2009-11-27 13:23:48 +05:30
parent 6e0855eb4d
commit d2a053ba3c

View file

@ -107,8 +107,9 @@ my %rurp_seen = ();
# catch usernames<->pubkeys mismatches; search for "lint" below # catch usernames<->pubkeys mismatches; search for "lint" below
my %user_list = (); my %user_list = ();
# gitweb descriptions, plain text, keyed by repo # gitweb descriptions and owners; plain text, keyed by "$repo.git"
my %desc = (); my %desc = ();
my %owner = ();
# set the umask before creating any files # set the umask before creating any files
umask($REPO_UMASK); umask($REPO_UMASK);
@ -253,14 +254,18 @@ sub parse_conf_file
} }
} }
} }
# very simple syntax for the gitweb description of repo # very simple syntax for the gitweb description of repo; one of:
elsif (/^(\S+) = "(.*)"$/) # reponame = "some description string"
# reponame "owner name" = "some description string"
elsif (/^(\S+)(?: "(.*?)")? = "(.*)"$/)
{ {
my ($repo, $desc) = ($1, $2); my ($repo, $owner, $desc) = ($1, $2, $3);
die "$ABRT bad repo name $repo\n" unless $repo =~ $REPONAME_PATT; die "$ABRT bad repo name $repo\n" unless $repo =~ $REPONAME_PATT;
die "$WARN $fragment attempting to set description for $repo\n" if die "$WARN $fragment attempting to set description for $repo\n" if
$fragment ne 'master' and $fragment ne $repo and ($groups{"\@$fragment"}{$repo} || '') ne 'master'; $fragment ne 'master' and $fragment ne $repo and ($groups{"\@$fragment"}{$repo} || '') ne 'master';
$desc{$repo} = $desc; $desc{"$repo.git"} = $desc;
$owner =~ s/ /+/g if $owner; # gitweb/INSTALL wants more, but meh...!
$owner{"$repo.git"} = $owner || '';
} }
else else
{ {
@ -375,10 +380,10 @@ my %projlist = ();
for my $repo (sort keys %repos) { for my $repo (sort keys %repos) {
my $desc_file = "$repo.git/description"; my $desc_file = "$repo.git/description";
# note: having a description also counts as enabling gitweb # note: having a description also counts as enabling gitweb
if ($repos{$repo}{'R'}{'gitweb'} or $desc{$repo}) { if ($repos{$repo}{'R'}{'gitweb'} or $desc{"$repo.git"}) {
$projlist{"$repo.git"} = 1; $projlist{"$repo.git"} = 1;
# add the description file; no messages to user or error checking :) # add the description file; no messages to user or error checking :)
$desc{$repo} and open(DESC, ">", $desc_file) and print DESC "$desc{$repo}\n" and close DESC; $desc{"$repo.git"} and open(DESC, ">", $desc_file) and print DESC $desc{"$repo.git"} . "\n" and close DESC;
} else { } else {
# delete the description file; no messages to user or error checking :) # delete the description file; no messages to user or error checking :)
unlink $desc_file; unlink $desc_file;
@ -387,7 +392,9 @@ for my $repo (sort keys %repos) {
# update the project list # update the project list
my $projlist_fh = wrap_open( ">", $PROJECTS_LIST); my $projlist_fh = wrap_open( ">", $PROJECTS_LIST);
print $projlist_fh join("\n", sort keys %projlist), "\n" if %projlist; for my $proj (sort keys %projlist) {
print $projlist_fh "$proj" . ( $owner{$proj} ? " $owner{$proj}" : "" ) . "\n";
}
close $projlist_fh; close $projlist_fh;
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------