Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
example Buildfarm module to run "make dist" and collect the results
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);
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;
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;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment