Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 183 lines (153 sloc) 6.913 kb
8a5e961f »
2006-11-23 new Build.PL install system, Makefile.PL still works but warns
1 #!/usr/bin/perl -w
2
a619ab66 »
2009-08-09 fixed up capitalisation; allowed --accept; improved script install; w…
3 # This is a Module::Build script for BioPerl-DB installation.
8a5e961f »
2006-11-23 new Build.PL install system, Makefile.PL still works but warns
4 # See http://search.cpan.org/~kwilliams/Module-Build/lib/Module/Build.pm
5
6 use strict;
5af28be0 »
2009-08-07 * convert over to Module::Build
7 use warnings;
8 use Module::Build;
a619ab66 »
2009-08-09 fixed up capitalisation; allowed --accept; improved script install; w…
9 use File::Spec;
10 use File::Basename;
8a5e961f »
2006-11-23 new Build.PL install system, Makefile.PL still works but warns
11
a3eb01dd »
2009-11-02 Build.PL now checks for DBD drivers and attempts to DTRT
12 # add any supported drivers here
13 my @supported = qw(mysql Pg Oracle);
14
5af28be0 »
2009-08-07 * convert over to Module::Build
15 my $build = Module::Build->new(
a3eb01dd »
2009-11-02 Build.PL now checks for DBD drivers and attempts to DTRT
16 module_name => 'Bio::DB::BioDB',
a619ab66 »
2009-08-09 fixed up capitalisation; allowed --accept; improved script install; w…
17 dist_name => 'BioPerl-DB',
c9d270e0 »
2009-09-22 main trunk version is wrong
18 dist_version => '1.006900',
c469a0e4 »
2008-12-31 the distribution name is BioPerl, try2
19 dist_author => 'BioPerl Team <bioperl-l@bioperl.org>',
a619ab66 »
2009-08-09 fixed up capitalisation; allowed --accept; improved script install; w…
20 dist_abstract => 'BioPerl-DB - package for biological databases',
29f9f7c1 »
2007-09-05 changed license to "perl", ie. artistic or GPL
21 license => 'perl',
8a5e961f »
2006-11-23 new Build.PL install system, Makefile.PL still works but warns
22 requires => {
a3eb01dd »
2009-11-02 Build.PL now checks for DBD drivers and attempts to DTRT
23 'perl' => '5.6.1',
24 'Bio::Root::Version' => '1.006900',
25 'DBI' => 0
26048f61 »
2009-09-29 some pod cleaning
26 },
27 recommends => {
a3eb01dd »
2009-11-02 Build.PL now checks for DBD drivers and attempts to DTRT
28 'Graph::Directed' => 0
26048f61 »
2009-09-29 some pod cleaning
29 },
a3eb01dd »
2009-11-02 Build.PL now checks for DBD drivers and attempts to DTRT
30 auto_features => {
31 Pg_support => {
32 description => "Postgres databases",
33 requires => { 'DBD::Pg' => 0},
34 },
35 mysql_support => {
36 description => "MySQL databases",
37 requires => { 'DBD::mysql' => 0},
38 },
39 Oracle_support => {
40 description => "Oracle databases",
41 requires => { 'DBD::Oracle' => 0},
42 },
43 },
5eb34cfc »
2007-01-19 auto-generate Makefile.PL
44 dynamic_config => 1,
45 create_makefile_pl => 'passthrough'
8a5e961f »
2006-11-23 new Build.PL install system, Makefile.PL still works but warns
46 );
47
a619ab66 »
2009-08-09 fixed up capitalisation; allowed --accept; improved script install; w…
48 my $accept = $build->args->{accept};
49
f9437b3d »
2009-08-09 * scripts now convert over properly.
50 # Ask questions for db configuration (Harness file)
51 biosql_conf();
52
53 # Optionally have script files installed.
a619ab66 »
2009-08-09 fixed up capitalisation; allowed --accept; improved script install; w…
54 if ($accept ? 0 : $build->y_n("Install scripts? y/n", 'n')) {
f9437b3d »
2009-08-09 * scripts now convert over properly.
55 my $files = $build->_find_file_by_type('pl', 'scripts');
56
a619ab66 »
2009-08-09 fixed up capitalisation; allowed --accept; improved script install; w…
57 my $script_build = File::Spec->catdir($build->blib, 'script');
58
f9437b3d »
2009-08-09 * scripts now convert over properly.
59 my @tobp;
60 while (my ($file, $dest) = each %$files) {
61 $dest = 'bp_'.File::Basename::basename($dest);
62 $dest = File::Spec->catfile($script_build, $dest);
a619ab66 »
2009-08-09 fixed up capitalisation; allowed --accept; improved script install; w…
63 $build->copy_if_modified(from => $file, to => $dest);
f9437b3d »
2009-08-09 * scripts now convert over properly.
64 push @tobp, $dest;
65 }
66
67 $build->script_files(\@tobp);
b5b53955 »
2009-08-08 * get scripts working, module installation from Bio as well
68 }
8a5e961f »
2006-11-23 new Build.PL install system, Makefile.PL still works but warns
69
70 # Create the build script and exit
71 $build->create_build_script;
72
73 exit;
74
75 # setup t/DBHarness.biosql.conf
76 sub biosql_conf {
a3eb01dd »
2009-11-02 Build.PL now checks for DBD drivers and attempts to DTRT
77 my $continue = $accept ||
78 $build->y_n("Have you already installed BioSQL? y/n", 'y');
79 $continue ||
80 die "\nBioSQL must be installed prior to installation of bioperl-db; ".
81 "see the INSTALL file\n";
82
83 my @drivers = grep {$build->features($_.'_support')}
84 qw(mysql Pg Oracle);
85
86 die "You must install a supported database driver\n" unless @drivers;
8a5e961f »
2006-11-23 new Build.PL install system, Makefile.PL still works but warns
87
88 my $config_file = File::Spec->catfile('t', 'DBHarness.biosql.conf');
89 if (-e $config_file) {
a3eb01dd »
2009-11-02 Build.PL now checks for DBD drivers and attempts to DTRT
90 ($accept || $build->y_n(
91 "Do you want to use the existing '$config_file' config file? y/n",
92 'y')) && return;
8a5e961f »
2006-11-23 new Build.PL install system, Makefile.PL still works but warns
93 unlink($config_file);
94 }
95
a3eb01dd »
2009-11-02 Build.PL now checks for DBD drivers and attempts to DTRT
96 open(my $out, ">", $config_file)
97 or die "Error: could not write to config file '$config_file'\n";
8a5e961f »
2006-11-23 new Build.PL install system, Makefile.PL still works but warns
98
a3eb01dd »
2009-11-02 Build.PL now checks for DBD drivers and attempts to DTRT
99 my %config = (driver => $drivers[0],
8a5e961f »
2006-11-23 new Build.PL install system, Makefile.PL still works but warns
100 host => '127.0.0.1',
101 user => 'root',
102 port => 3306,
103 password => '',
b5e7df4b »
2006-12-05 default dbname same as suggested name in BioSQL docs
104 dbname => 'bioseqdb',
8a5e961f »
2006-11-23 new Build.PL install system, Makefile.PL still works but warns
105 database => 'biosql',
106 schema_sql => '../biosql-schema/sql/biosqldb-mysql.sql');
107
a3eb01dd »
2009-11-02 Build.PL now checks for DBD drivers and attempts to DTRT
108 $config{driver} = $build->prompt("DBD driver to use (mandatory)?",
109 $config{driver});
110 $config{host} = $build->prompt("Machine to connect to (mandatory)?",
111 $config{host});
112 $config{user} = $build->prompt("User to connect to server as (mandatory)?",
113 $config{user});
8a5e961f »
2006-11-23 new Build.PL install system, Makefile.PL still works but warns
114
a3eb01dd »
2009-11-02 Build.PL now checks for DBD drivers and attempts to DTRT
115 $config{port} = $build->prompt("Port the server is running on (optional, ".
116 "'' for undef/none)?", $config{port});
4be63b12 »
2009-02-02 no empty strings, unset port should be undef instead
117 $config{port} = undef if $config{port} eq "''";
8a5e961f »
2006-11-23 new Build.PL install system, Makefile.PL still works but warns
118
a3eb01dd »
2009-11-02 Build.PL now checks for DBD drivers and attempts to DTRT
119 $config{password} = $build->prompt("Password (optional)?",
120 $config{password} || 'undef');
8a5e961f »
2006-11-23 new Build.PL install system, Makefile.PL still works but warns
121 $config{password} = '' if $config{password} eq 'undef';
122
a3eb01dd »
2009-11-02 Build.PL now checks for DBD drivers and attempts to DTRT
123 $build->log_info(<<COMMENT);
124 # The next answer will be used to identify the database name in
125 # the connect string, e.g., using database=, dbname=, or sid=,
126 # depending on the driver.
127 #
128 # If this is not set the test scripts will build a temporary
129 # database from scratch at the beginning and destroy it at the
130 # end. Conversely, if you do set it then the database must exist,
131 # or else the tests will fail.
132 #
133 # Generally, it is preferred to pre-build the database, simply for
134 # efficiency reasons, and it will also enable debugging your
135 # schema content if some test acts up.\n
136 COMMENT
137 $config{dbname} = $build->prompt("Name of your existing Biosql database, ".
138 "as it is known to your RDBMS ".
139 "(optional, '' for none)?",
140 $config{dbname});
8a5e961f »
2006-11-23 new Build.PL install system, Makefile.PL still works but warns
141 $config{dbname} = '' if $config{dbname} eq "''";
142
143 unless ($config{dbname}) {
a3eb01dd »
2009-11-02 Build.PL now checks for DBD drivers and attempts to DTRT
144 $config{schema_sql} = $build->prompt("Set schema_sql to use the ".
145 "version appropriate for your ".
146 "RDBMS (mandatory)",
147 $config{schema_sql});
8a5e961f »
2006-11-23 new Build.PL install system, Makefile.PL still works but warns
148 }
a3eb01dd »
2009-11-02 Build.PL now checks for DBD drivers and attempts to DTRT
149 # don't know why it is stored as an array ref, is this correct?
150 $config{schema_sql} = "['$config{schema_sql}']";
8a5e961f »
2006-11-23 new Build.PL install system, Makefile.PL still works but warns
151
a3eb01dd »
2009-11-02 Build.PL now checks for DBD drivers and attempts to DTRT
152 $build->log_info(<<COMMENT);
153 # The next answer does not refer to the schema or RDBMS; it only
154 # identifies which of the databases supported in bioperl-db you
155 # want to be using. Since at present bioperl-db only supports biosql,
156 # this must be biosql.
157 COMMENT
158 $config{database} = $build->prompt("The name of the database within ".
159 "bioperl-db?", $config{database});
8a5e961f »
2006-11-23 new Build.PL install system, Makefile.PL still works but warns
160
a3eb01dd »
2009-11-02 Build.PL now checks for DBD drivers and attempts to DTRT
161 print $out "{\n";
8a5e961f »
2006-11-23 new Build.PL install system, Makefile.PL still works but warns
162 while (my ($key, $val) = each %config) {
4be63b12 »
2009-02-02 no empty strings, unset port should be undef instead
163 # no empty strings, undefined conf setting should be undef (w/o quotes)
164 $val = "'$val'" unless $key eq 'schema_sql' || !defined($val);
165 if (!defined($val)) {
166 $val = 'undef';
167 }
8a5e961f »
2006-11-23 new Build.PL install system, Makefile.PL still works but warns
168 print $out "\t'$key' => $val,\n";
169 }
170 print $out "}\n";
171 close($out);
172
a3eb01dd »
2009-11-02 Build.PL now checks for DBD drivers and attempts to DTRT
173 # maybe add the capability of using a temporary (test) database, and
174 # load the SQL on the fly? A little trickier (SQL is in a different
175 # repo and is driver-dependent)
176
177 # probably should add a database ping here and die gracefully otherwise.
178
8a5e961f »
2006-11-23 new Build.PL install system, Makefile.PL still works but warns
179 # we deliberately don't add the config file to cleanup, but it shouldn't
180 # cause problems because it is in MANIFEST.SKIP
181 }
b5b53955 »
2009-08-08 * get scripts working, module installation from Bio as well
182
Something went wrong with that request. Please try again.