Apache-Test

 view release on metacpan or  search on metacpan

lib/Apache/TestBuild.pm  view on Meta::CPAN

    if (-e $file) {
        print "unlink $file\n";
    }
    else {
        print "$file does not exist\n";
    }
    CORE::unlink($file);
}

sub symlink {
    my($from, $to) = @_;
    print "symlink $from => $to\n";
    unless (-e $from) {
        print "source $from does not exist\n";
    }
    my $base = dirname $to;
    unless (-e $base) {
        print "target dir $base does not exist\n";
    }
    CORE::symlink($from, $to) or die $!;
}

sub cvs {
    my $self = shift;

    my $cmd = "cvs -d $self->{cvsroot} @_";

    if (DRYRUN) {
        info "$cmd";
    }
    else {
        system $cmd;
    }
}

my %cvs_names = (
    '2.0' => 'httpd-2.0',
    '1.3' => 'apache-1.3',
);

my %cvs_snames = (
    '2.0' => 'httpd',
    '1.3' => 'apache',
);

sub cvs_up {
    my($self, $version) = @_;

    my $name = $cvs_names{$version};

    my $dir = $self->srcdir($version);

    if ($self->{cvsroot} eq 'anon') {
        $self->{cvsroot} = ':pserver:anoncvs@cvs.apache.org:/home/cvspublic';
        unless (-d $dir) {
            #XXX do something better than doesn't require prompt if
            #we already have an entry in ~/.cvspass
            #$self->cvs('login');

            warning "may need to run the following command ",
                    "(password is 'anoncvs')";
            warning "cvs -d $self->{cvsroot} login";
        }
    }

    if (-d $dir) {
        chdir $dir;
        $self->cvs(up => "-dP $self->{cvstag}");
        return;
    }

    my $co = checkout($name);
    $self->$co($name, $dir);

    my $post = post_checkout($name);
    $self->$post($name, $dir);
}

sub checkout_httpd_2_0 {
    my($self, $name, $dir) = @_;

    my $tag = $self->{cvstag};

    $self->cvs(co => "-d $dir $tag $name");
    chdir "$dir/srclib";
    $self->cvs(co => "$tag apr apr-util");
}

sub checkout_apache_1_3 {
    my($self, $name, $dir) = @_;

    $self->cvs(co => "-d $dir $self->{cvstag} $name");
}

sub post_checkout_httpd_2_0 {
    my($self, $name, $dir) = @_;
}

sub post_checkout_apache_1_3 {
}

sub canon {
    my $name = shift;
    return $name unless $name;
    $name =~ s/[.-]/_/g;
    $name;
}

sub checkout {
    my $name = canon(shift);
    \&{"checkout_$name"};
}

sub post_checkout {
    my $name = canon(shift);
    \&{"post_checkout_$name"};
}

sub cvs_update {
    my $self = shift;



( run in 1.120 second using v1.01-cache-2.11-cpan-df04353d9ac )