Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 185 lines (128 sloc) 4.094 kb
93ef1e2 @adunstan Add FileTextArrayFDW module
adunstan authored
1
2 # Package Namespace is hardcoded. Modules must live in
3 # PGBuild::Modules
4
5 package PGBuild::Modules::FileTextArrayFDW;
6
7 use PGBuild::Options;
8 use PGBuild::SCM;
9
10 use strict;
11
12 # strip required namespace from package name
13 (my $MODULE = __PACKAGE__ ) =~ s/PGBuild::Modules:://;
14
15 use vars qw($VERSION); $VERSION = 'REL_4.8';
16
17 my $hooks = {
18 'checkout' => \&checkout,
19 'setup-target' => \&setup_target,
20 # 'need-run' => \&need_run,
21 # 'configure' => \&configure,
22 'build' => \&build,
23 # 'check' => \&check,
24 'install' => \&install,
25 'installcheck' => \&installcheck,
26 'cleanup' => \&cleanup,
27 };
28
29 sub setup
30 {
31 my $class = __PACKAGE__;
32
33 my $buildroot = shift; # where we're building
34 my $branch = shift; # The branch of Postgres that's being built.
35 my $conf = shift; # ref to the whole config object
36 my $pgsql = shift; # postgres build dir
37
38 return unless $branch ge 'REL9_1_STABLE' || $branch eq 'HEAD';
39
40 # could even set up several of these (e.g. for different branches)
41 my $self = {
42 buildroot => $buildroot,
43 pgbranch=> $branch,
44 bfconf => $conf,
45 pgsql => $pgsql
46 };
47 bless($self, $class);
48
49 my $scmconf =
50 {
51 scm => 'git',
52 scmrepo => 'git://github.com/adunstan/file_text_array_fdw.git',
53 git_reference => undef,
54 git_keep_mirror => undef,
55 git_ignore_mirror_failure => undef,
56 };
57
58 $self->{scm} = new PGBuild::SCM $scmconf, 'file_text_array_fdw';
59 my $where = $self->{scm}->get_build_path();
60 $self->{where} = $where;
61
62 # for each instance you create, do:
63 main::register_module_hooks($self,$hooks);
64
65 }
66
67 sub checkout
68 {
69 my $self = shift;
70 my $savescmlog = shift; # array ref to the log lines
71
72 print main::time_str(), "checking out $MODULE\n" if $verbose;
73
74 my $scmlog = $self->{scm}->checkout($self->{pgbranch});
75
76 push(@$savescmlog, "------------- $MODULE checkout ----------------\n",
77 @$scmlog);
78 }
79
80 sub setup_target
81 {
82 my $self = shift;
83
84 # copy the code or setup a vpath dir if supported as appropriate
85
86 print main::time_str(), "copying source to ...$self->{where}\n"
87 if $verbose;
88
89 $self->{scm}->copy_source(undef);
90
91 }
92
93 sub need_run
94 {
95 my $self = shift;
96 my $run_needed = shift; # ref to flag
97
98 # to force a run do:
99 # $$run_needed = 1;
100
101 print main::time_str(), "checking if run needed by $MODULE\n"
102 if $verbose;
103
104 }
105
106 sub configure
107 {
108 my $self = shift;
109
110 print main::time_str(), "configuring $MODULE\n" if $verbose;
111
112
113 }
114
115 sub build
116 {
117 my $self = shift;
118
119 print main::time_str(), "building $MODULE\n" if $verbose;
120
121 my $cmd = "PATH=../inst:$ENV{PATH} make USE_PGXS=1";
122
123 my @makeout = `cd $self->{where} && $cmd 2>&1`;
124
125 my $status = $? >>8;
126 main::writelog("$MODULE-build",\@makeout);
127 print "======== make log ===========\n",@makeout if ($verbose > 1);
128 main::send_result("$MODULE-build",$status,\@makeout) if $status;
129
130 }
131
132 sub install
133 {
134 my $self = shift;
135
136 print main::time_str(), "installing $MODULE\n" if $verbose;
137
138 my $cmd = "PATH=../inst:$ENV{PATH} make USE_PGXS=1 install";
139
140 my @log = `cd $self->{where} && $cmd 2>&1`;
141
142 my $status = $? >>8;
143 main::writelog("$MODULE-install",\@log);
144 print "======== install log ===========\n",@log if ($verbose > 1);
145 main::send_result("$MODULE-install",$status,\@log) if $status;
146
147 }
148
149 sub check
150 {
151 my $self = shift;
152
153 print main::time_str(), "checking ",__PACKAGE__,"\n" if $verbose;
154 }
155
156 sub installcheck
157 {
158 my $self = shift;
159 my $locale = shift;
160
161 print main::time_str(), "install-checking $MODULE\n" if $verbose;
162
163 my $cmd = "PATH=../inst:$ENV{PATH} make USE_PGXS=1 installcheck";
164
165 my @log = `cd $self->{where} && $cmd 2>&1`;
166
167 my $status = $? >>8;
168 main::writelog("$MODULE-installcheck-$locale",\@log);
169 print "======== installcheck ($locale) log ===========\n",@log
170 if ($verbose > 1);
171 main::send_result("$MODULE-installcheck-$locale",$status,\@log) if $status;
172
173 }
174
175 sub cleanup
176 {
177 my $self = shift;
178
179 print main::time_str(), "cleaning up $MODULE\n" if $verbose;
180
181 system("rm -rf $self->{where}");
182 }
183
184 1;
Something went wrong with that request. Please try again.