root/mpich2/branches/dev/kumudb/maint/release.pl @ 4870

Revision 4870, 7.7 KB (checked in by kumudb, 5 months ago)

Merge from trunk to kumudb r4748:r4869

  • Property svn:executable set to *
Line 
1#!/usr/bin/env perl
2
3use strict;
4use warnings;
5
6use Cwd qw( realpath );
7use Getopt::Long;
8
9my $arg = 0;
10my $source = "";
11my $version = "";
12my $pack = "";
13my $root = $ENV{PWD};
14
15# This path is the default for the MCS home directory mounts.  Pass
16# --with-autoconf='' and --with-automake='' options to this script to
17# use whatever is in your path.
18my $with_autoconf = "/homes/balaji/projects/autotools/install/bin";
19my $with_automake = "/homes/balaji/projects/autotools/install/bin";
20
21my $logfile = "release.log";
22
23sub usage
24{
25    print "Usage: $0 [--source source] {--package package} [version]\n";
26    exit;
27}
28
29sub check_package
30{
31    my $pack = shift;
32
33    print "===> Checking for package $pack... ";
34    if ($with_autoconf and ($pack eq "autoconf")) {
35        # the user specified a dir where autoconf can be found
36        if (not -x "$with_autoconf/$pack") {
37            print "not found\n";
38            exit;
39        }
40    }
41    if ($with_automake and ($pack eq "automake")) {
42        # the user specified a dir where automake can be found
43        if (not -x "$with_automake/$pack") {
44            print "not found\n";
45            exit;
46        }
47    }
48    else {
49        if (`which $pack` eq "") {
50            print "not found\n";
51            exit;
52        }
53    }
54    print "done\n";
55}
56
57sub run_cmd
58{
59    my $cmd = shift;
60
61    # FIXME: Allow for verbose output
62    system("$cmd >> $root/$logfile 2>&1");
63    if ($?) {
64        die "unable to execute ($cmd), \$?=$?.  Stopped";
65    }
66}
67
68sub debug
69{
70    my $line = shift;
71
72    print "$line";
73}
74
75sub create_docs
76{
77    my $pack = shift;
78
79    if ($pack eq "romio") {
80        chdir("romio/doc");
81        run_cmd("make");
82        run_cmd("rm -f users-guide.blg users-guide.toc users-guide.aux users-guide.bbl users-guide.log users-guide.dvi");
83    }
84    elsif ($pack eq "mpe") {
85        chdir("mpe2/maint");
86        run_cmd("make -f Makefile4man");
87    }
88}
89
90sub create_mpich2
91{
92    # Check out the appropriate source
93    debug("===> Checking out mpich2 SVN source... ");
94    run_cmd("rm -rf mpich2-${version}");
95    run_cmd("svn export -q ${source} mpich2-${version}");
96    debug("done\n");
97
98    # Remove packages that are not being released
99    debug("===> Removing packages that are not being released... ");
100    chdir("${root}/mpich2-${version}");
101    run_cmd("rm -rf src/mpid/globus doc/notes src/pm/mpd/Zeroconf.py src/pmi/pmi2");
102
103    chdir("${root}/mpich2-${version}/src/mpid/ch3/channels/nemesis/nemesis/netmod");
104    my @nem_modules = qw(elan ib psm);
105    run_cmd("rm -rf ".join(' ', map({$_ . "/*"} @nem_modules)));
106    for my $module (@nem_modules) {
107        # system to avoid problems with shell redirect in run_cmd
108        system(qq(echo "# Stub Makefile" > ${module}/Makefile.sm));
109    }
110    debug("done\n");
111
112    # Create configure
113    debug("===> Creating configure in the main package... ");
114    chdir("${root}/mpich2-${version}");
115    {
116        my $cmd = "./maint/updatefiles";
117        $cmd .= " --with-autoconf=$with_autoconf" if $with_autoconf;
118        $cmd .= " --with-automake=$with_automake" if $with_automake;
119        run_cmd($cmd);
120    }
121    debug("done\n");
122
123    # Remove unnecessary files
124    debug("===> Removing unnecessary files in the main package... ");
125    chdir("${root}/mpich2-${version}");
126    run_cmd("rm -rf README.vin maint/config.log maint/config.status unusederr.txt autom4te.cache src/mpe2/src/slog2sdk/doc/jumpshot-4/tex");
127    debug("done\n");
128
129    # Get docs
130    debug("===> Creating secondary package for the docs... ");
131    chdir("${root}");
132    run_cmd("cp -a mpich2-${version} mpich2-${version}-tmp");
133    debug("done\n");
134
135    debug("===> Configuring and making the secondary package... ");
136    chdir("${root}/mpich2-${version}-tmp");
137    {
138        my $cmd = "./maint/updatefiles";
139        $cmd .= " --with-autoconf=$with_autoconf" if $with_autoconf;
140        $cmd .= " --with-automake=$with_automake" if $with_automake;
141        run_cmd($cmd);
142    }
143    run_cmd("./configure --without-mpe --disable-f90 --disable-f77 --disable-cxx");
144    run_cmd("(make mandoc && make htmldoc && make latexdoc)");
145    debug("done\n");
146
147    debug("===> Copying docs over... ");
148    chdir("${root}/mpich2-${version}-tmp");
149    run_cmd("cp -a man ${root}/mpich2-${version}");
150    run_cmd("cp -a www ${root}/mpich2-${version}");
151    run_cmd("cp -a doc/userguide/user.pdf ${root}/mpich2-${version}/doc/userguide");
152    run_cmd("cp -a doc/installguide/install.pdf ${root}/mpich2-${version}/doc/installguide");
153    run_cmd("cp -a doc/smpd/smpd_pmi.pdf ${root}/mpich2-${version}/doc/smpd");
154    run_cmd("cp -a doc/logging/logging.pdf ${root}/mpich2-${version}/doc/logging");
155    run_cmd("cp -a doc/windev/windev.pdf ${root}/mpich2-${version}/doc/windev");
156    chdir("${root}");
157    run_cmd("rm -rf mpich2-${version}-tmp");
158    debug("done\n");
159
160    debug("===> Creating ROMIO docs... ");
161    chdir("${root}/mpich2-${version}/src/mpi");
162    create_docs("romio");
163    debug("done\n");
164
165    debug( "===> Creating MPE docs... ");
166    chdir("${root}/mpich2-${version}/src");
167    create_docs("mpe");
168    debug("done\n");
169
170    # Create the tarball
171    debug("===> Creating the final mpich2 tarball... ");
172    chdir("${root}");
173    run_cmd("tar -czvf mpich2-${version}.tar.gz mpich2-${version}");
174    run_cmd("rm -rf mpich2-${version}");
175    debug("done\n\n");
176}
177
178sub create_romio
179{
180    # Check out the appropriate source
181    debug("===> Checking out romio SVN source... ");
182    run_cmd("rm -rf romio-${version} romio");
183    run_cmd("svn export -q ${source}/src/mpi/romio");
184    debug("done\n");
185
186    debug("===> Creating configure... ");
187    chdir("${root}/romio");
188    run_cmd("autoreconf");
189    debug("done\n");
190
191    debug("===> Creating ROMIO docs... ");
192    chdir("${root}");
193    create_docs("romio");
194    debug("done\n");
195
196    # Create the tarball
197    debug("===> Creating the final romio tarball... ");
198    chdir("${root}");
199    run_cmd("mv romio romio-${version}");
200    run_cmd("tar -czvf romio-${version}.tar.gz romio-${version}");
201    run_cmd("rm -rf romio-${version}");
202    debug("done\n\n");
203}
204
205sub create_mpe
206{
207    # Check out the appropriate source
208    debug("===> Checking out mpe2 SVN source... ");
209    run_cmd("rm -rf mpe2-${version} mpe2");
210    run_cmd("svn export -q ${source}/src/mpe2");
211    debug("done\n");
212
213    debug("===> Creating configure... ");
214    chdir("${root}/mpe2");
215    {
216        my $cmd = "./maint/updatefiles";
217        $cmd .= " --with-autoconf=$with_autoconf" if $with_autoconf;
218        $cmd .= " --with-automake=$with_automake" if $with_automake;
219        run_cmd($cmd);
220    }
221    debug("done\n");
222
223    debug("===> Creating MPE docs... ");
224    chdir("${root}");
225    create_docs("mpe");
226    debug("done\n");
227
228    # Create the tarball
229    debug("===> Creating the final mpe2 tarball... ");
230    chdir("${root}");
231    run_cmd("mv mpe2 mpe2-${version}");
232    run_cmd("tar -czvf mpe2-${version}.tar.gz mpe2-${version}");
233    run_cmd("rm -rf mpe2-${version}");
234    debug("done\n\n");
235}
236
237GetOptions(
238    "source=s" => \$source,
239    "package:s"  => \$pack,
240    "with-autoconf" => \$with_autoconf,
241    "with-automake" => \$with_automake,
242    "help"     => \&usage,
243) or die "unable to parse options, stopped";
244
245if (scalar(@ARGV) != 1) {
246    usage();
247}
248
249$version = $ARGV[0];
250
251if (!$pack) {
252    $pack = "mpich2";
253}
254
255if (!$source || !$version) {
256    usage();
257}
258
259check_package("doctext");
260check_package("svn");
261check_package("latex");
262check_package("autoconf");
263check_package("automake");
264debug "\n";
265
266my $current_ver = `svn cat ${source}/maint/Version`;
267
268if ("$current_ver" ne "$version\n") {
269    debug("\n\tWARNING: Version mismatch\n\n");
270}
271
272system("rm -f ${root}/$logfile");
273
274if ($pack eq "mpich2") {
275    create_mpich2();
276}
277elsif ($pack eq "romio") {
278    create_romio();
279}
280elsif ($pack eq "mpe") {
281    create_mpe();
282}
283elsif ($pack eq "all") {
284    create_mpich2();
285    create_romio();
286#     create_mpe();
287}
288else {
289    die "Unknown package: $pack";
290}
Note: See TracBrowser for help on using the browser.