Created
November 22, 2011 13:43
-
-
Save adunstan/1385688 to your computer and use it in GitHub Desktop.
example Buildfarm module to run "make dist" and collect the results
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package PGBuild::Modules::Dist; | |
use PGBuild::Options; | |
use PGBuild::SCM; | |
use strict; | |
use vars qw($VERSION); $VERSION = 'REL_4.6'; | |
my $hooks = { | |
'build' => \&build, | |
'install' => \&install, | |
}; | |
sub setup | |
{ | |
my $class = __PACKAGE__; | |
my $buildroot = shift; # where we're building | |
my $branch = shift; # The branch of Postgres that's being built. | |
my $conf = shift; # ref to the whole config object | |
my $pgsql = shift; # postgres build dir | |
die "can't run this module with vpath builds" | |
if $conf->{vpath}; | |
my $self = {buildroot => $buildroot, pgbranch=> $branch, bfconf => $conf, pgsql => $pgsql}; | |
bless ($self, $class); | |
main::register_module_hooks($self,$hooks); | |
} | |
sub build | |
{ | |
my $self = shift; | |
print main::time_str(), "running make dist ",__PACKAGE__,"\n" if $verbose; | |
my @log = `cd $self->{pgsql} && make dist 2>&1`; | |
my $status = $? >>8; | |
main::writelog('make-dist',\@log); | |
print "======== make dist log ===========\n",@log | |
if ($verbose > 1); | |
main::send_result('Make-Dist',$status,\@log) if $status; | |
} | |
sub install | |
{ | |
my $self = shift; | |
print main::time_str(), "copying dist files ",__PACKAGE__,"\n" if $verbose; | |
my $whence = $self->{pgsql}; | |
my $where = "$self->{buildroot}/$self->{pgbranch}"; | |
system("mv $whence/postgresql-*.tar* $where >/dev/null 2>&1"); | |
my $status = $? >>8; | |
main::send_result('Copy-Dist',$status,[]) if $status; | |
} | |
1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment