Skip to content

Commit 65528be

Browse files
committed
add release script
1 parent 044d7f3 commit 65528be

File tree

4 files changed

+257
-1
lines changed

4 files changed

+257
-1
lines changed

Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ bin_SCRIPTS = oshcc
4646
CLEANFILES = oshcc
4747
# This does not do what I want (copy to $BUILD_DIR/src)
4848
EXTRA_DIST = ${top_srcdir}/src/oshcompiler.in
49+
dist_noinst_SCRIPTS = autogen.sh
4950

5051
do_subst = sed -e 's|[@]OSHMPI_CC[@]|$(CC)|g' \
5152
-e 's|[@]OSHMPI_CXX[@]|$(CXX)|g' \

configure.ac

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
# Process this file with autoconf to produce a configure script.
22

33
AC_PREREQ([2.69])
4-
AC_INIT([OSHMPI], [0.1.0], [https://github.com/jeffhammond/oshmpi/issues], [http://github.com/jeffhammond/oshmpi])
4+
5+
m4_include([maint/version.m4])
6+
dnl 2nd arg is intentionally underquoted
7+
AC_INIT([OSHMPI],
8+
OSHMPI_VERSION_m4,
9+
[https://github.com/jeffhammond/oshmpi/issues],
10+
[oshmpi],
11+
[http://github.com/jeffhammond/oshmpi])
12+
513
AC_CONFIG_SRCDIR([src/shmem.c])
614

715
# From ARMCI-MPI

maint/release.pl

Lines changed: 210 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,210 @@
1+
#!/usr/bin/env perl
2+
#
3+
# (C) 2008 by Argonne National Laboratory.
4+
# See COPYRIGHT in top-level directory.
5+
#
6+
7+
use strict;
8+
use warnings;
9+
10+
use Cwd qw( cwd getcwd realpath );
11+
use Getopt::Long;
12+
use File::Temp qw( tempdir );
13+
14+
my $arg = 0;
15+
my $branch = "";
16+
my $version = "";
17+
my $append_commit_id;
18+
my $root = cwd();
19+
my $with_autoconf = "";
20+
my $with_automake = "";
21+
my $git_repo = "";
22+
my $with_mpi = "";
23+
24+
my $logfile = "release.log";
25+
26+
sub usage
27+
{
28+
print "Usage: $0 [OPTIONS]\n\n";
29+
print "OPTIONS:\n";
30+
31+
print "\t--git-repo path to root of the git repository (required)\n";
32+
print "\t--branch git branch to be packaged (required)\n";
33+
print "\t--version tarball version (required)\n";
34+
print "\t--with-mpi mpi installation (optional)\n";
35+
print "\t--append-commit-id append git commit description (optional)\n";
36+
37+
print "\n";
38+
39+
exit 1;
40+
}
41+
42+
sub check_package
43+
{
44+
my $pack = shift;
45+
46+
print "===> Checking for package $pack... ";
47+
if (`which $pack` eq "") {
48+
print "not found\n";
49+
exit;
50+
}
51+
print "done\n";
52+
}
53+
54+
55+
sub check_autotools_version
56+
{
57+
my $tool = shift;
58+
my $req_ver = shift;
59+
my $curr_ver;
60+
61+
$curr_ver = `$tool --version | head -1 | cut -f4 -d' ' | xargs echo -n`;
62+
if ("$curr_ver" ne "$req_ver") {
63+
print("\tERROR: $tool version mismatch ($req_ver) required\n\n");
64+
exit;
65+
}
66+
}
67+
68+
# will also chdir to the top level of the git repository
69+
sub check_git_repo {
70+
my $repo_path = shift;
71+
72+
print "===> chdir to $repo_path\n";
73+
chdir $repo_path;
74+
75+
print "===> Checking git repository sanity... ";
76+
unless (`git rev-parse --is-inside-work-tree 2> /dev/null` eq "true\n") {
77+
print "ERROR: $repo_path is not a git repository\n";
78+
exit 1;
79+
}
80+
# I'm not strictly sure that this is true, but it's not too burdensome right
81+
# now to restrict it to complete (non-bare repositories).
82+
unless (`git rev-parse --is-bare-repository 2> /dev/null` eq "false\n") {
83+
print "ERROR: $repo_path is a *bare* repository (need working tree)\n";
84+
exit 1;
85+
}
86+
87+
print "done\n";
88+
}
89+
90+
91+
sub run_cmd
92+
{
93+
my $cmd = shift;
94+
95+
#print("===> running cmd=|$cmd| from ".getcwd()."\n");
96+
system("$cmd >> $root/$logfile 2>&1");
97+
if ($?) {
98+
die "unable to execute ($cmd), \$?=$?. Stopped";
99+
}
100+
}
101+
102+
GetOptions(
103+
"branch=s" => \$branch,
104+
"version=s" => \$version,
105+
"append-commit-id!" => \$append_commit_id,
106+
"with-autoconf" => \$with_autoconf,
107+
"with-automake" => \$with_automake,
108+
"git-repo=s" => \$git_repo,
109+
"with-mpi=s" => \$with_mpi,
110+
"help" => \&usage,
111+
) or die "unable to parse options, stopped";
112+
113+
if (scalar(@ARGV) != 0) {
114+
usage();
115+
}
116+
117+
if (!$branch || !$version) {
118+
usage();
119+
}
120+
121+
check_package("git");
122+
check_package("autoconf");
123+
check_package("automake");
124+
check_package("libtool");
125+
print("\n");
126+
127+
## IMPORTANT: Changing the autotools versions can result in ABI
128+
## breakage. So make sure the ABI string in the release tarball is
129+
## updated when you do that.
130+
check_autotools_version("autoconf", "2.69");
131+
check_autotools_version("automake", "1.15");
132+
check_autotools_version("libtool", "2.4.6");
133+
print("\n");
134+
135+
my $tdir = tempdir(CLEANUP => 1);
136+
my $local_git_clone = "${tdir}/oshmpi-clone";
137+
138+
# clone git repo
139+
print("===> Cloning git repo... ");
140+
run_cmd("git clone ${git_repo} -b ${branch} --recursive ${local_git_clone}");
141+
print("done\n");
142+
143+
# chdirs to $local_git_clone if valid
144+
check_git_repo($local_git_clone);
145+
print("\n");
146+
147+
my $current_ver = `git show ${branch}:maint/version.m4 | grep OSHMPI_VERSION_m4 | \
148+
sed -e 's/^.*\\[OSHMPI_VERSION_m4\\],\\[\\(.*\\)\\].*/\\1/g'`;
149+
if ("$current_ver" ne "$version\n") {
150+
print("\tWARNING: maint/version does not match user version\n\n");
151+
}
152+
153+
if ($append_commit_id) {
154+
my $desc = `git describe --always ${branch}`;
155+
chomp $desc;
156+
$version .= "-${desc}";
157+
}
158+
159+
# apply patches to submodules
160+
#print("===> Patching submodules... ");
161+
#run_cmd("./maint/apply_patch.bash");
162+
163+
my $expdir = "${tdir}/oshmpi-${version}";
164+
165+
# Clean up the log file
166+
system("rm -f ${root}/$logfile");
167+
168+
# Check out the appropriate branch
169+
print("===> Exporting code from git... ");
170+
run_cmd("rm -rf ${expdir}");
171+
run_cmd("mkdir -p ${expdir}");
172+
run_cmd("git archive ${branch} --prefix='oshmpi-${version}/' | tar -x -C $tdir");
173+
run_cmd("git submodule foreach --recursive \'git archive HEAD --prefix='' | tar -x -C `echo \${toplevel}/\${path} | sed -e s/clone/${version}/`'");
174+
print("done\n");
175+
176+
print("===> Create release date and version information... ");
177+
chdir($local_git_clone);
178+
my $date = `git log -1 --format=%ci`;
179+
chomp $date;
180+
181+
chdir($expdir);
182+
system(qq(perl -p -i -e 's/\\[OSHMPI_RELEASE_DATE_m4\\],\\[unreleased development copy\\]/[OSHMPI_RELEASE_DATE_m4],[$date]/g' ./maint/version.m4));
183+
print("done\n");
184+
185+
# Remove content that is not being released
186+
print("===> Removing content that is not being released... ");
187+
chdir($expdir);
188+
print("done\n");
189+
190+
# Create configure
191+
print("===> Creating configure in the main codebase... ");
192+
chdir($expdir);
193+
{
194+
my $cmd = "./autogen.sh";
195+
run_cmd($cmd);
196+
}
197+
print("done\n");
198+
199+
# Execute configure and make dist
200+
print("===> Running configure... ");
201+
run_cmd("./configure --prefix=$expdir/install CC=$with_mpi/bin/mpicc");
202+
print("done\n");
203+
204+
print("===> Making the final tarball... ");
205+
run_cmd("make dist");
206+
run_cmd("cp -a oshmpi-${version}.tar.gz ${root}/");
207+
print("done\n");
208+
209+
# make sure we are outside of the tempdir so that the CLEANUP logic can run
210+
chdir("${tdir}/..");

maint/version.m4

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
[#] start of __file__
2+
#
3+
# (C) 2011 by Argonne National Laboratory.
4+
# See COPYRIGHT in top-level directory.
5+
#
6+
# This file contains versioning information for OSHMPI's configure process.
7+
# This was previously (as "maint/Version") a bit of shell code that was sourced
8+
# by configure, but shell variables are not permitted in the modern form of
9+
# AC_INIT. See "Rebuilding Makefiles" in the automake-1.11.1 manual.
10+
#
11+
# !!! NOTE !!! absolutely no shell code from this file will end up in the
12+
# configure script, including these shell comments. Any shell code must live in
13+
# the configure script and/or use m4 values defined here. We could consider
14+
# changing this by playing with diversions, but then we would probably be
15+
# playing with autotools-fire.
16+
17+
m4_define([OSHMPI_VERSION_m4],[1.0])dnl
18+
m4_define([OSHMPI_RELEASE_DATE_m4],[unreleased development copy])dnl
19+
20+
# For libtool ABI versioning rules see:
21+
# http://www.gnu.org/software/libtool/manual/libtool.html#Updating-version-info
22+
#
23+
# 1. If the library source code has changed at all since the last
24+
# update, then increment revision (`c:r:a' becomes `c:r+1:a').
25+
#
26+
# 2. If any interfaces have been added, removed, or changed since
27+
# the last update, increment current, and set revision to 0.
28+
#
29+
# 3. If any interfaces have been added since the last public
30+
# release, then increment age.
31+
#
32+
# 4. If any interfaces have been removed since the last public
33+
# release, then set age to 0.
34+
35+
m4_define([liboshmpi_so_version_m4],[0:0:0])dnl
36+
37+
[#] end of __file__

0 commit comments

Comments
 (0)