File: release.pl

package info (click to toggle)
mpich2 1.2.1.1-5
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 73,904 kB
  • ctags: 65,947
  • sloc: ansic: 343,583; makefile: 55,174; java: 34,959; sh: 27,558; perl: 17,355; cpp: 10,472; python: 9,649; f90: 5,753; fortran: 5,128; cs: 4,019; csh: 152; xml: 91; php: 8
file content (238 lines) | stat: -rwxr-xr-x 6,978 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
#!/usr/bin/env perl
#
# (C) 2008 by Argonne National Laboratory.
#     See COPYRIGHT in top-level directory.
#
#
# Known limitations:
#
#    1. This script assumes that it is the only client accessing the
#    svn server. Version number verifications, diffs for ABI
#    mismatches and other checks are run assuming atomicity.
#
#    2. ABI mismatch checks are run using an svn diff in mpi.h.in and
#    the binding directory. This can come up with false positives, and
#    is only meant to be a worst-case guess.
#

use strict;
use warnings;

use Cwd qw( realpath );
use Getopt::Long;

my $arg = 0;
my $source = "";
my $psource = "";
my $version = "";
my $append_svnrev;
my $root = $ENV{PWD};
my $with_autoconf = "";
my $with_automake = "";

# Default to MPICH2
my $pack = "mpich2";

my $logfile = "release.log";

sub usage
{
    print "Usage: $0 [OPTIONS]\n\n";
    print "OPTIONS:\n";

    # Source svn repository from where the package needs to be downloaded from
    print "\t--source          source svn repository (required)\n";

    # svn repository for the previous source in this series to ensure ABI compliance
    print "\t--psource    source repo for the previous version for ABI compliance (required)\n";

    # what package we are creating
    print "\t--package         package to create (optional)\n";

    # version string associated with the tarball
    print "\t--version         tarball version (required)\n";

    # append svn revision
    print "\t--append-svnrev   append svn revision number (optional)\n";

    print "\n";

    exit;
}

sub check_package
{
    my $pack = shift;

    print "===> Checking for package $pack... ";
    if ($with_autoconf and ($pack eq "autoconf")) {
        # the user specified a dir where autoconf can be found
        if (not -x "$with_autoconf/$pack") {
            print "not found\n";
            exit;
        }
    }
    if ($with_automake and ($pack eq "automake")) {
        # the user specified a dir where automake can be found
        if (not -x "$with_automake/$pack") {
            print "not found\n";
            exit;
        }
    }
    else {
        if (`which $pack` eq "") {
            print "not found\n";
            exit;
        }
    }
    print "done\n";
}

sub run_cmd
{
    my $cmd = shift;

    # FIXME: Allow for verbose output
    system("$cmd >> $root/$logfile 2>&1");
    if ($?) {
        die "unable to execute ($cmd), \$?=$?.  Stopped";
    }
}

GetOptions(
    "source=s" => \$source,
    "psource=s" => \$psource,
    "package:s"  => \$pack,
    "version=s" => \$version,
    "append-svnrev!" => \$append_svnrev,
    "with-autoconf" => \$with_autoconf,
    "with-automake" => \$with_automake,
    "help"     => \&usage,
) or die "unable to parse options, stopped";

if (scalar(@ARGV) != 0) {
    usage();
}

if (!$source || !$version || !$psource) {
    usage();
}

check_package("doctext");
check_package("txt2man");
check_package("svn");
check_package("latex");
check_package("autoconf");
check_package("automake");
print("\n");

my $current_ver = `svn cat ${source}/maint/Version | grep ^MPICH2_VERSION: | cut -f2 -d' '`;
if ("$current_ver" ne "$version\n") {
    print("\tWARNING: Version mismatch\n\n");
}

if ($psource) {
    # Check diff
    my $d = `svn diff ${psource}/src/include/mpi.h.in ${source}/src/include/mpi.h.in`;
    $d .= `svn diff ${psource}/src/binding ${source}/src/binding`;
    if ("$d" ne "") {
	print("\tWARNING: ABI mismatch\n\n");
    }
}

if ($append_svnrev) {
    $version .= "-r";
    $version .= `svn info ${source} | grep ^Revision: | cut -f2 -d' ' | xargs echo -n`;
}

# Clean up the log file
system("rm -f ${root}/$logfile");

# Check out the appropriate source
print("===> Checking out $pack SVN source... ");
run_cmd("rm -rf ${pack}-${version}");
run_cmd("svn export -q ${source} ${pack}-${version}");
print("done\n");

# Remove packages that are not being released
print("===> Removing packages that are not being released... ");
chdir("${root}/${pack}-${version}");
run_cmd("rm -rf src/mpid/globus doc/notes src/pm/mpd/Zeroconf.py");

chdir("${root}/${pack}-${version}/src/mpid/ch3/channels/nemesis/nemesis/netmod");
my @nem_modules = qw(elan ib psm);
run_cmd("rm -rf ".join(' ', map({$_ . "/*"} @nem_modules)));
for my $module (@nem_modules) {
    # system to avoid problems with shell redirect in run_cmd
    system(qq(echo "# Stub Makefile" > ${module}/Makefile.sm));
}
print("done\n");

# Create configure
print("===> Creating configure in the main package... ");
chdir("${root}/${pack}-${version}");
{
    my $cmd = "./maint/updatefiles";
    $cmd .= " --with-autoconf=$with_autoconf" if $with_autoconf;
    $cmd .= " --with-automake=$with_automake" if $with_automake;
    run_cmd($cmd);
}
print("done\n");

# Remove unnecessary files
print("===> Removing unnecessary files in the main package... ");
chdir("${root}/${pack}-${version}");
run_cmd("rm -rf README.vin maint/config.log maint/config.status unusederr.txt src/mpe2/src/slog2sdk/doc/jumpshot-4/tex");
run_cmd("find . -name autom4te.cache | xargs rm -rf");
print("done\n");

# Get docs
print("===> Creating secondary package for the docs... ");
chdir("${root}");
run_cmd("cp -a ${pack}-${version} ${pack}-${version}-tmp");
print("done\n");

print("===> Configuring and making the secondary package... ");
chdir("${root}/${pack}-${version}-tmp");
{
    my $cmd = "./maint/updatefiles";
    $cmd .= " --with-autoconf=$with_autoconf" if $with_autoconf;
    $cmd .= " --with-automake=$with_automake" if $with_automake;
    run_cmd($cmd);
}
run_cmd("./configure --disable-mpe --disable-f90 --disable-f77 --disable-cxx");
run_cmd("(make mandoc && make htmldoc && make latexdoc)");
print("done\n");

print("===> Copying docs over... ");
chdir("${root}/${pack}-${version}-tmp");
run_cmd("cp -a man ${root}/${pack}-${version}");
run_cmd("cp -a www ${root}/${pack}-${version}");
run_cmd("cp -a doc/userguide/user.pdf ${root}/${pack}-${version}/doc/userguide");
run_cmd("cp -a doc/installguide/install.pdf ${root}/${pack}-${version}/doc/installguide");
run_cmd("cp -a doc/smpd/smpd_pmi.pdf ${root}/${pack}-${version}/doc/smpd");
run_cmd("cp -a doc/logging/logging.pdf ${root}/${pack}-${version}/doc/logging");
run_cmd("cp -a doc/windev/windev.pdf ${root}/${pack}-${version}/doc/windev");
chdir("${root}");
run_cmd("rm -rf ${pack}-${version}-tmp");
print("done\n");

print("===> Creating ROMIO docs... ");
chdir("${root}/${pack}-${version}/src/mpi");
chdir("romio/doc");
run_cmd("make");
run_cmd("rm -f users-guide.blg users-guide.toc users-guide.aux users-guide.bbl users-guide.log users-guide.dvi");
print("done\n");

print( "===> Creating MPE docs... ");
chdir("${root}/${pack}-${version}/src");
chdir("mpe2/maint");
run_cmd("make -f Makefile4man");
print("done\n");

# Create the tarball
print("===> Creating the final ${pack} tarball... ");
chdir("${root}");
run_cmd("tar -czvf ${pack}-${version}.tar.gz ${pack}-${version}");
run_cmd("rm -rf ${pack}-${version}");
print("done\n\n");