Skip to content

Commit 11d4002

Browse files
author
Ralph Castain
committed
Update the nightly tarball scripts to support the new web site
1 parent 50952c3 commit 11d4002

File tree

5 files changed

+457
-44
lines changed

5 files changed

+457
-44
lines changed

contrib/build-server/hwloc-nightly-tarball.sh

Lines changed: 73 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,36 @@
77
#####
88

99
# e-mail address to send results to
10-
10+
11+
1112

12-
# svn repository uri
13-
code_uri=http://svn.open-mpi.org/svn/hwloc
13+
# git repository URL
14+
code_uri=https://github.com/open-mpi/hwloc.git
15+
raw_uri=https://raw.github.com/open-mpi/hwloc
1416

1517
# where to put built tarballs
16-
outputroot=/l/osl/www/www.open-mpi.org/software/hwloc/nightly
18+
outputroot=$HOME/hwloc/nightly
1719

1820
# where to find the build script
19-
script_uri=${code_uri}/trunk/contrib/nightly/create_tarball.sh
20-
script_uri=contrib/nightly/create_tarball.sh
21+
script_uri=contrib/nightly/make_snapshot_tarball
2122

2223
# The tarballs to make
2324
if [ $# -eq 0 ] ; then
24-
dirs="/trunk /branches/v1.5 /branches/v1.4 /branches/v1.3 /branches/v1.2 /branches/v1.1 /branches/v1.0"
25+
# Branches v1.6 and earlier were not updated to build nightly
26+
# snapshots from git, so only check v1.7 and later
27+
branches="master v1.11"
2528
else
26-
dirs=$@
29+
branches=$@
2730
fi
2831

2932
# Build root - scratch space
30-
build_root=/home/mpiteam/hwloc/nightly-tarball-build-root
33+
build_root=$HOME/hwloc/nightly-tarball-build-root
3134

32-
export PATH=$HOME/local/bin:$PATH
33-
export LD_LIBRARY_PATH=$HOME/local/lib:$LD_LIBRARY_PATH
35+
# Coverity stuff
36+
coverity_token=`cat $HOME/coverity/hwloc-token.txt`
37+
38+
export PATH=$HOME_PREFIX/bin:$PATH
39+
export LD_LIBRARY_PATH=$HOME_PREFIX/lib:$LD_LIBRARY_PATH
3440

3541
#####
3642
#
@@ -39,23 +45,27 @@ export LD_LIBRARY_PATH=$HOME/local/lib:$LD_LIBRARY_PATH
3945
#####
4046

4147
# load the modules configuration
42-
. /etc/profile.d/modules.sh
43-
module use ~/modules
48+
. $MODULE_INIT
49+
module use $AUTOTOOL_MODULE
4450

4551
# get our nightly build script
4652
mkdir -p $build_root
4753
cd $build_root
4854

55+
pending_coverity=$build_root/tarballs-to-run-through-coverity.txt
56+
rm -f $pending_coverity
57+
touch $pending_coverity
58+
debug=100
59+
4960
# Loop making them
50-
for dir in $dirs; do
51-
# Remove leading /
52-
safe_dirname=`echo $dir | sed -e 's/^\///g'`
53-
# Convert remaining /'s to -'s
54-
safe_dirname=`echo $safe_dirname | sed -e 's/\//-/g'`
55-
# Now form a URL-specific script name
56-
script=$safe_dirname-`basename $script_uri`
57-
58-
wget --quiet --no-check-certificate --tries=10 $code_uri/$dir/$script_uri -O $script
61+
for branch in $branches; do
62+
# Get the last tarball version that was made
63+
prev_snapshot=`cat $outputroot/$branch/latest_snapshot.txt`
64+
65+
# Form a URL-specific script name
66+
script=$branch-`basename $script_uri`
67+
68+
wget --quiet --no-check-certificate --tries=10 $raw_uri/$branch/$script_uri -O $script
5969
if test ! $? -eq 0 ; then
6070
echo "wget of hwloc nightly tarball create script failed."
6171
if test -f $script ; then
@@ -67,16 +77,46 @@ for dir in $dirs; do
6777
fi
6878
chmod +x $script
6979

70-
ver=`basename $dir`
71-
72-
module load "autotools/hwloc-$ver"
73-
module load "tex-live/hwloc-$ver"
74-
75-
./$script \
76-
$build_root/$ver \
77-
$results_addr \
78-
$code_uri/$dir \
79-
$outputroot/$ver >/dev/null 2>&1
80+
module load "autotools/hwloc-$branch"
81+
# module load "tex-live/hwloc-$branch"
82+
83+
./$script \
84+
$build_root/$branch \
85+
$results_addr \
86+
$outputroot/$branch \
87+
$code_uri \
88+
$branch \
89+
>/dev/null 2>&1
90+
91+
# Did the script generate a new tarball? If so, save it so that we can
92+
# spawn the coverity checker on it afterwards. Only for this for the
93+
# master (for now).
94+
latest_snapshot=`cat $outputroot/$branch/latest_snapshot.txt`
95+
if test "$prev_snapshot" != "$latest_snapshot" && \
96+
test "$branch" = "master"; then
97+
echo "$outputroot/$branch/hwloc-$latest_snapshot.tar.bz2" >> $pending_coverity
98+
echo "=== Posting tarball to open-mpi.org"
99+
# tell the web server to cleanup old nightly tarballs
100+
ssh -p 2222 [email protected] "git/ompi/contrib/build-server/remove-old.pl 7 public_html/software/hwloc/nightly/$branch"
101+
# upload the new ones
102+
scp -P 2222 $outputroot/$branch/hwloc-$latest_snapshot.tar.* [email protected]:public_html/software/hwloc/nightly/$branch/
103+
scp -P 2222 $outputroot/$branch/$latest_snapshot.txt [email protected]:public_html/software/hwloc/nightly/$branch/
104+
# direct the web server to regenerate the checksums
105+
ssh -p 2222 [email protected] "cd public_html/software/hwloc/nightly/$branch && md5sum hwloc* > md5sums.txt"
106+
ssh -p 2222 [email protected] "cd public_html/software/hwloc/nightly/$branch && sha1sum hwloc* > sha1sums.txt"
107+
fi
80108

81-
module unload autotools tex-live
109+
module unload autotools
82110
done
111+
112+
# If we had any new snapshots to send to coverity, process them now
113+
114+
#for tarball in `cat $pending_coverity`; do
115+
# /home/common/mpiteam/scripts/hwloc-nightly-coverity.pl \
116+
# --filename=$tarball \
117+
# --coverity-token=$coverity_token \
118+
# --verbose \
119+
# --logfile-dir=$HOME/coverity \
120+
# --make-args="-j8"
121+
#done
122+
rm -f $pending_coverity

contrib/build-server/openmpi-nightly-tarball.sh

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,32 +15,33 @@ master_raw_uri=https://raw.github.com/open-mpi/ompi
1515
release_code_uri=https://github.com/open-mpi/ompi-release.git
1616
release_raw_uri=https://raw.github.com/open-mpi/ompi-release
1717

18-
# where to put built tarballs
19-
outputroot=/l/osl/www/www.open-mpi.org/nightly
18+
# where to put built tarballs - needs to be
19+
# adjusted to match your site!
20+
outputroot=$HOME/openmpi/nightly
2021

2122
# where to find the build script
2223
script_uri=contrib/nightly/create_tarball.sh
2324

2425
# helper scripts dir
25-
script_dir=/u/mpiteam/scripts
26+
script_dir=$HOME/scripts
2627

2728
# The tarballs to make
2829
if [ $# -eq 0 ] ; then
29-
# We're no longer ever checking the 1.0 - 1.6 branches anymore
30-
branches="master v1.8 v1.10 v2.x"
30+
# We're no longer ever checking the 1.0 - 1.8 branches anymore
31+
branches="master v1.10 v2.x"
3132
else
3233
branches=$@
3334
fi
3435

3536
# Build root - scratch space
36-
build_root=/home/mpiteam/openmpi/nightly-tarball-build-root
37+
build_root=$HOME/openmpi/nightly-tarball-build-root
3738

3839
# Coverity stuff
3940
coverity_token=`cat $HOME/coverity/openmpi-token.txt`
4041
coverity_configure_args="--enable-debug --enable-mpi-fortran --enable-mpi-java --enable-oshmem --enable-oshmem-fortran --enable-oshmem-java --with-mxm=/opt/mellanox/mxm --with-psm --with-usnic --with-libfabric=/u/mpiteam/libfabric-current/install"
4142

42-
export PATH=$HOME/local/bin:$PATH
43-
export LD_LIBRARY_PATH=$HOME/local/lib:$LD_LIBRARY_PATH
43+
export PATH=$HOME_PREFIX/bin:$PATH
44+
export LD_LIBRARY_PATH=$HOME_PREFIX/lib:$LD_LIBRARY_PATH
4445

4546
#####
4647
#
@@ -49,8 +50,8 @@ export LD_LIBRARY_PATH=$HOME/local/lib:$LD_LIBRARY_PATH
4950
#####
5051

5152
# load the modules configuration
52-
. /etc/profile.d/modules.sh
53-
module use ~/modules
53+
. $MODULE_INIT
54+
module use $AUTOTOOL_MODULE
5455

5556
# get our nightly build script
5657
mkdir -p $build_root
@@ -115,17 +116,27 @@ for branch in $branches; do
115116
test "$branch" = "master"; then
116117
echo "=== Saving output for a Coverity run"
117118
echo "$outputroot/$branch/openmpi-$latest_snapshot.tar.bz2" >> $pending_coverity
119+
# tell the web server to cleanup old nightly tarballs
120+
ssh -p 2222 [email protected] "git/ompi/contrib/build-server/remove-old.pl 7 public_html/nightly/$branch"
121+
# upload the new ones
122+
scp -P 2222 $outputroot/$branch/openmpi-$latest_snapshot.tar.* [email protected]:public_html/nightly/$branch/
123+
scp -P 2222 $outputroot/$branch/latest_snapshot.txt [email protected]:public_html/nightly/$branch/
124+
# direct the web server to regenerate the checksums
125+
ssh -p 2222 [email protected] "cd public_html/nightly/$branch && md5sum openmpi* > md5sums.txt"
126+
ssh -p 2222 [email protected] "cd public_html/nightly/$branch && sha1sum openmpi* > sha1sums.txt"
118127
else
119128
echo "=== NOT saving output for a Coverity run"
120129
fi
121130

122131
# Failed builds are not removed. But if a human forgets to come
123132
# in here and clean up the old failed builds, we can accumulate
124-
# many over time. So remove any old failed bbuilds that are over
133+
# many over time. So remove any old failed builds that are over
125134
# 4 weeks old.
126135
${script_dir}/remove-old.pl 7 $build_root/$branch
136+
127137
done
128138

139+
129140
# If we had any new snapshots to send to coverity, process them now
130141

131142
for tarball in `cat $pending_coverity`; do
Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
#!/usr/bin/env perl
2+
3+
use warnings;
4+
use strict;
5+
6+
use Getopt::Long;
7+
use File::Temp qw/ tempfile tempdir /;
8+
use File::Basename;
9+
10+
my $coverity_project = "open-mpi%2Fpmix";
11+
12+
my $filename_arg;
13+
my $coverity_token_arg;
14+
my $dry_run_arg = 0;
15+
my $verbose_arg = 0;
16+
my $debug_arg = 0;
17+
my $logfile_dir_arg = "/tmp";
18+
my $configure_args = "";
19+
my $make_args = "-j 32";
20+
my $help_arg = 0;
21+
22+
&Getopt::Long::Configure("bundling");
23+
my $ok = Getopt::Long::GetOptions("filename=s" => \$filename_arg,
24+
"coverity-token=s" => \$coverity_token_arg,
25+
"logfile-dir=s" => \$logfile_dir_arg,
26+
"configure-args=s" => \$configure_args,
27+
"make-args=s" => \$make_args,
28+
"dry-run!" => \$dry_run_arg,
29+
"verbose!" => \$verbose_arg,
30+
"debug!" => \$debug_arg,
31+
"help|h" => \$help_arg);
32+
33+
$ok = 0
34+
if (!defined($filename_arg));
35+
$ok = 0
36+
if (!defined($coverity_token_arg));
37+
if (!$ok || $help_arg) {
38+
print "Usage: $0 --filename=FILENAME --coverity-token=TOKEN [--dry-run] [--verbose] [--help]\n";
39+
exit($ok);
40+
}
41+
42+
die "Cannot read $filename_arg"
43+
if (! -r $filename_arg);
44+
45+
$verbose_arg = 1
46+
if ($debug_arg);
47+
48+
######################################################################
49+
50+
sub verbose {
51+
print @_
52+
if ($verbose_arg);
53+
}
54+
55+
# run a command and save the stdout / stderr
56+
sub safe_system {
57+
my $allowed_to_fail = shift;
58+
my $cmd = shift;
59+
my $stdout_file = shift;
60+
61+
# Redirect stdout if requested or not verbose
62+
if (defined($stdout_file)) {
63+
$stdout_file = "$logfile_dir_arg/$stdout_file";
64+
unlink($stdout_file);
65+
$cmd .= " >$stdout_file";
66+
} elsif (!$debug_arg) {
67+
$cmd .= " >/dev/null";
68+
}
69+
$cmd .= " 2>&1";
70+
71+
my $rc = system($cmd);
72+
if (0 != $rc && !$allowed_to_fail) {
73+
# If we die/fail, ensure to change out of the temp tree so
74+
# that it can be removed upon exit.
75+
chdir("/");
76+
die "Command $cmd failed: exit status $rc";
77+
}
78+
system("cat $stdout_file")
79+
if ($debug_arg && defined($stdout_file) && -f $stdout_file);
80+
}
81+
82+
######################################################################
83+
84+
# Make an area to work
85+
86+
my $dir = tempdir(CLEANUP => 1);
87+
chdir($dir);
88+
verbose "*** Working in $dir\n";
89+
90+
######################################################################
91+
92+
# Get the coverity tool, put it in our path.
93+
94+
my $cdir = "/home/common/mpiteam/coverity";
95+
safe_system(0, "mkdir $cdir")
96+
if (! -d $cdir);
97+
98+
# Optimization: the tool is pretty large. If our local copy is less
99+
# than a day old, just use that without re-downloading.
100+
my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
101+
$atime,$mtime,$ctime,$blksize,$blocks) =
102+
stat("$cdir/coverity_tool.tgz");
103+
my $now = time();
104+
if (!defined($mtime) || $mtime < $now - 24*60*60) {
105+
verbose "*** Downloading new copy of the coverity tool\n";
106+
safe_system(0, "wget https://scan.coverity.com/download/linux-64 --post-data \"token=$coverity_token_arg\&project=$coverity_project\" -O coverity_tool.tgz");
107+
safe_system(0, "cp coverity_tool.tgz $cdir");
108+
}
109+
110+
verbose "*** Expanding coverity tool tarball\n";
111+
safe_system(0, "tar xf $cdir/coverity_tool.tgz");
112+
opendir(my $dh, ".") ||
113+
die "Can't opendir .";
114+
my @files = grep { /^cov/ && -d "./$_" } readdir($dh);
115+
closedir($dh);
116+
117+
my $cov_dir = "$dir/$files[0]/bin";
118+
$ENV{PATH} = "$cov_dir:$ENV{PATH}";
119+
120+
######################################################################
121+
122+
# Expand the PMIX tarball, build it
123+
124+
verbose "*** Extracting PMIX tarball\n";
125+
safe_system(0, "tar xf $filename_arg");
126+
my $tarball_filename = basename($filename_arg);
127+
$tarball_filename =~ m/^pmix-(.+)\.tar.+$/;
128+
my $pmix_ver = $1;
129+
chdir("pmix-$pmix_ver");
130+
131+
verbose "*** Configuring PMIX tarball\n";
132+
safe_system(0, "./configure $configure_args", "configure");
133+
134+
verbose "*** Building PMIX tarball\n";
135+
safe_system(0, "cov-build --dir cov-int make $make_args", "cov-build");
136+
137+
# Tar up the Coverity results
138+
verbose "*** Tarring up results\n";
139+
safe_system(0, "tar jcf $pmix_ver-analyzed.tar.bz2 cov-int");
140+
141+
# If not dry-run, submit to Coverity
142+
if ($dry_run_arg) {
143+
verbose "*** Would have submitted, but this is a dry run\n";
144+
} else {
145+
verbose "*** Submitting results\n";
146+
safe_system(0, "curl --form token=$coverity_token_arg " .
147+
"--form email=rhc\@open-mpi.org " .
148+
"--form file=\@$pmix_ver-analyzed.tar.bz2 " .
149+
"--form version=$pmix_ver " .
150+
"--form description=nightly-master " .
151+
"https://scan.coverity.com/builds?project=$coverity_project",
152+
"coverity-submit");
153+
}
154+
155+
verbose("*** All done\n");
156+
157+
# Chdir out of the tempdir so that it can be removed
158+
chdir("/");
159+
160+
exit(0);

0 commit comments

Comments
 (0)