www-infrastructure-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jukka Zitting <jukka.zitt...@gmail.com>
Subject Re: Improved email-update.sh
Date Thu, 12 Mar 2009 15:38:01 GMT

On Thu, Mar 12, 2009 at 2:43 PM, Jukka Zitting <jukka.zitting@gmail.com> wrote:
> On Tue, Mar 10, 2009 at 7:46 PM, Grzegorz Kossakowski
> <gkossakowski@apache.org> wrote:
>> Just pinging. Is there anything I can do so it gets reviewed or incorporated into
live config?
>> I would like like to see how it's performing.
> I've pulled your changes and I'm trying them out now.

I converted the script to Perl (see below) to make it faster and more

The script is now live, so anyone who wants to make the git mirror of
a project automatically updated per each commit just needs to
subscribe the git@jukka.zitting.name address to the relevant commit
mailing list. Note that only moderators and admins can do this, as the
git@ address won't automatically respond to the ezmlm subscribe
confirmation requests.

I'll do a similar setup also on git.zones.apache.org as soon as the
mirrors have been migrated.


Jukka Zitting

#! /usr/bin/perl

my @paths = ();
my @mirrors = ();

# Process the incoming message, looking for all the modified svn paths
my $capture = 0;
while (<>) {
    push @paths, $1 if $capture and /^    (\S+)/;
    $capture = 1 if /^Added:$/ or /^Modified:$/ or /^Removed:$/;
    $capture = 0 if /^$/;

# Iterate through all modified paths, looking for affected mirrors
for my $git (</var/git/*.git>) {
    open CONFIG, "<$git/config" or next;
    LINE: for my $line (<CONFIG>) {
        if ($line =~ m[= ([^\s\*:]+)(/\*)?:refs/remotes/]) {
            for my $path (@paths) {
                if (substr($path, 0, length($1)) eq $1) {
                    push @mirrors, $git;
                    last LINE;
    close CONFIG;

# Update all the modified mirrors
for my $git (@mirrors) {
    system "/home/jukka/git/update-repo.sh", $git;

exit 0;

View raw message