Options:
--help Print this usage message and exit
+ --ssw=TARBALL Get ssw from TARBALL instead of from Git.
--no-binary Build source tarballs but no binaries.
--batch Do not print progress to stdout.
--no-perl Do not build Perl module."""
return backquotes("cd %s && %s rev-parse %s" % (repo, GIT, ref))
+def add_commit_to_version(name, commit, dir, extra_news = None):
+ abbrev_commit = commit[:6]
+
+ # Extract version number.
+ start_step("Extract %s repository version number" % name)
+ fields = backquotes("cd %s && autoconf -t AC_INIT" % dir).split(':')
+ file, line, macro, package, repo_version = fields[:5]
+ rest = fields[5:]
+ set_var("%s_repo_version" % name, repo_version)
+
+ # Is this a "gnits" mode tree?
+ start_step("Checking %s Automake mode" % name)
+
+ am_mode = "gnu"
+ for s in open("%s/Makefile.am" % dir):
+ if "gnits" in s:
+ am_mode = "gnits"
+ break
+ LOG.write("%s Automake mode is %s\n" % (name, am_mode))
+
+ # Generate version number for build.
+ # We want to append -g012345, but if we're in Gnits mode and the
+ # version number already has a hyphen, we have to omit it.
+ start_step("Generate %s build version number" % name)
+ version = repo_version
+ if '-' not in version:
+ version += '-'
+ version += 'g' + abbrev_commit
+ set_var("%s_version" % name, version)
+
+ # Append -g012345 to configure.ac version number.
+ start_step("Updating %s version number in %s" % (name, file))
+ fullname = "%s/%s" % (dir, file)
+ NEWFILE = open("%s.new" % fullname, "w")
+ ln = 1
+ for s in open(fullname):
+ if ln != int(line):
+ NEWFILE.write(s)
+ else:
+ NEWFILE.write("AC_INIT([%s], [%s]" % (package, version))
+ for field in rest:
+ NEWFILE.write(", [%s]" % field)
+ NEWFILE.write(")\n")
+ ln += 1
+ NEWFILE.close()
+ os.rename("%s.new" % fullname, fullname)
+
+ # Add note to beginning of NEWS (otherwise "make dist" fails).
+ start_step("Updating %s NEWS" % name)
+ fullname = "%s/NEWS" % name
+ NEWFILE = open("%s.new" % fullname, "w")
+ found_changes = False
+ for s in open(fullname):
+ if not found_changes and (s.startswith('Changes') or repo_version in s):
+ found_changes = True
+ NEWFILE.write("""\
+Changes from %(repo_version)s to %(version)s:
+
+ * Built from PSPP commit %(revision)s
+ in branch %(branch)s on builder %(builder)s.
+
+"""
+ % {'repo_version': repo_version,
+ 'version': version,
+ 'revision': commit,
+ 'branch': branch,
+ 'builder': builder})
+ if extra_news:
+ NEWFILE.write(extra_news)
+ NEWFILE.write('\n')
+
+ NEWFILE.write(s)
+ NEWFILE.close()
+ os.rename("%s.new" % fullname, fullname)
+
+ return version
+
try:
opts, args = getopt.gnu_getopt(sys.argv[1:], "ho:",
["help",
"batch", "no-batch",
"no-perl",
"output=",
+ "ssw=",
"builder=", "build-number="])
except getopt.GetoptError as err:
# print help information and exit:
build_number = None
builder = None
build_perl = True
+ssw = "https://git.savannah.gnu.org/git/ssw.git master"
for o, a in opts:
if o in ("-h", "--help"):
print_usage()
build_number = a
elif o == "--no-perl":
build_perl = False
+ elif o == "--ssw":
+ ssw = a
else:
assert False, "unhandled option"
if builder is None:
GIT = "git --git-dir=%s/.git" % topdir
-# ssw = "https://alpha.gnu.org/gnu/ssw/spread-sheet-widget-0.4.tar.gz"
-ssw = "https://git.savannah.gnu.org/git/ssw.git master"
-
if ssw.endswith('.tar.gz'):
ssw_basename = os.path.basename(ssw)
ssw_file = '%s/%s' % (topdir, ssw_basename)
if not Path(ssw_file).exists():
start_step("Retrieve spread-sheet-widget tarball %s" % ssw_file)
run("wget -O %s %s" % (ssw_file, ssw))
-
- start_step("Extract %s into %s" % (ssw_file, ssw_dir))
- run("tar xzf %s" % ssw_file)
elif ' ' in ssw:
ssw_url, ssw_ref = ssw.split()
start_step("Check out %s in ssw" % ssw_ref)
run("cd %s && git checkout %s" % (ssw_dir, ssw_ref))
- set_var("ssw_commit", ref_to_commit("HEAD", "ssw"))
+ ssw_commit = ref_to_commit("HEAD", "ssw")
+ set_var("ssw_commit", ssw_commit)
+
+ ssw_version = add_commit_to_version("ssw", ssw_commit, "ssw")
start_step("Bootstrap ssw")
- run("cd %s && ./bootstrap" % ssw_dir)
+ run("cd ssw && ./bootstrap")
+
+ start_step("Configure ssw source")
+ run("cd ssw && mkdir _build && cd _build && ../configure",
+ "configure")
+
+ start_step("Make ssw source tarball")
+ run("cd ssw/_build && make -j128 dist", "dist")
+ ssw_dir = "spread-sheet-widget-%s" % ssw_version
+ ssw_file = "ssw/_build/%s.tar.gz" % ssw_dir
+ save_result("ssw source distribution", ssw_file)
else:
assert False
+ start_step("Extract %s into %s" % (ssw_file, ssw_dir))
+ run("tar xzf %s" % ssw_file)
+
start_step("Configure spread-sheet-widget")
run("cd %s && ./configure --prefix=''" % ssw_dir)
set_var("pspp_ref", "refs/builds/%s/pspp" % build_number)
revision = ref_to_commit("refs/builds/%s/pspp" % build_number)
set_var("pspp_commit", revision)
- abbrev_commit = revision[:6]
# Extract source.
start_step("Extract branch into source directory")
run("%s archive --format=tar --prefix=pspp/ refs/builds/%s/pspp | tar xf -"
% (GIT, build_number))
- # Extract version number.
- start_step("Extract repository version number")
- fields = backquotes("cd pspp && autoconf -t AC_INIT").split(':')
- file, line, macro, package, repo_version = fields[:5]
- rest = fields[5:]
- set_var("repo_version", repo_version)
-
- # Is this a "gnits" mode tree?
- start_step("Checking Automake mode")
-
- am_mode = "gnu"
- for s in open("pspp/Makefile.am"):
- if "gnits" in s:
- am_mode = "gnits"
- break
- LOG.write("Automake mode is %s\n" % am_mode)
-
- # Generate version number for build.
- # We want to append -g012345, but if we're in Gnits mode and the
- # version number already has a hyphen, we have to omit it.
- start_step("Generate build version number")
- version = repo_version
- if '-' not in version:
- version += '-'
- version += 'g' + abbrev_commit
- set_var("version", version)
-
- # Append -g012345 to configure.ac version number.
- start_step("Updating version number in %s" % file)
- fullname = "pspp/%s" % file
- NEWFILE = open("%s.new" % fullname, "w")
- ln = 1
- for s in open(fullname):
- if ln != int(line):
- NEWFILE.write(s)
- else:
- NEWFILE.write("AC_INIT([%s], [%s]" % (package, version))
- for field in rest:
- NEWFILE.write(", [%s]" % field)
- NEWFILE.write(")\n")
- ln += 1
- NEWFILE.close()
- os.rename("%s.new" % fullname, fullname)
-
# Get Gnulib commit number.
start_step("Reading README.Git to find Gnulib commit number")
fullname = "pspp/README.Git"
sys.exit(1)
set_var("gnulib_commit", gnulib_commit)
- # Add note to beginning of NEWS (otherwise "make dist" fails).
- start_step("Updating NEWS")
- fullname = "pspp/NEWS"
- NEWFILE = open("%s.new" % fullname, "w")
- found_changes = False
- for s in open(fullname):
- if not found_changes and s.startswith('Changes'):
- found_changes = True
- NEWFILE.write("""\
-Changes from %(repo_version)s to %(version)s:
-
- * Built from PSPP commit %(revision)s
- in branch %(branch)s on builder %(builder)s.
-
- * Built from Gnulib commit %(gnulib_commit)s.
-
-"""
- % {'repo_version': repo_version,
- 'version': version,
- 'revision': revision,
- 'branch': branch,
- 'builder': builder,
- 'gnulib_commit': gnulib_commit})
-
- NEWFILE.write(s)
- NEWFILE.close()
- os.rename("%s.new" % fullname, fullname)
+ version = add_commit_to_version("pspp", revision, "pspp",
+ " * Built from Gnulib commit %(gnulib_commit)s.\n")
# If we don't already have that Gnulib commit, update Gnulib.
rc = os.system("%s rev-parse --verify --quiet %s^0 > /dev/null"