Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Unified Diff: tools/create_debian_packages.py

Issue 197313010: Initial refactorings to support archiving the src and debian package builds. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/bots/src-tarball.py ('k') | tools/create_tarball.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/create_debian_packages.py
===================================================================
--- tools/create_debian_packages.py (revision 33696)
+++ tools/create_debian_packages.py (working copy)
@@ -9,6 +9,7 @@
# will build a source package and a 32-bit (i386) and 64-bit (amd64)
# binary packages.
+import optparse
import sys
import tarfile
import subprocess
@@ -21,6 +22,17 @@
HOST_CPUS = utils.GuessCpus()
DART_DIR = abspath(join(__file__, '..', '..'))
+def BuildOptions():
+ result = optparse.OptionParser()
+ result.add_option("--tar_filename",
+ default=None,
+ help="The tar file to build from.")
+ result.add_option("--out_dir",
+ default=None,
+ help="Where to put the packages.")
+
+ return result
+
def RunBuildPackage(opt, cwd):
cmd = ['dpkg-buildpackage', '-j%d' % HOST_CPUS]
cmd.extend(opt)
@@ -32,14 +44,12 @@
raise Exception('Command \'%s\' failed: %s\nSTDOUT: %s' %
(' '.join(cmd), stderr, stdout))
-def BuildDebianPackage():
+def BuildDebianPackage(tarball, out_dir):
version = utils.GetVersion()
- builddir = join(DART_DIR, utils.GetBuildDir(HOST_OS, HOST_OS))
tarroot = 'dart-%s' % version
- tarname = 'dart-%s.tar.gz' % version
origtarname = 'dart_%s.orig.tar.gz' % version
- tarball = join(builddir, tarname)
- if not exists(join(builddir, tarball)):
+
+ if not exists(join(out_dir, tarball)):
print 'Source tarball not found'
return -1
@@ -76,18 +86,25 @@
'%s-1_amd64.deb' % debbase
]
for name in source_package:
- copyfile(join(temp_dir, name), join(builddir, name))
+ copyfile(join(temp_dir, name), join(out_dir, name))
for name in i386_package:
- copyfile(join(temp_dir, name), join(builddir, name))
+ copyfile(join(temp_dir, name), join(out_dir, name))
for name in amd64_package:
- copyfile(join(temp_dir, name), join(builddir, name))
+ copyfile(join(temp_dir, name), join(out_dir, name))
def Main():
if HOST_OS != 'linux':
print 'Debian build only supported on linux'
return -1
- BuildDebianPackage()
+ options, args = BuildOptions().parse_args()
+ out_dir = options.out_dir
+ tar_filename = options.tar_filename
+ if not options.out_dir:
+ out_dir = join(DART_DIR, utils.GetBuildDir(HOST_OS, HOST_OS))
+ if not options.tar_filename:
+ raise Exception('Please specify the input filename.')
+ BuildDebianPackage(options.tar_filename, options.out_dir)
if __name__ == '__main__':
sys.exit(Main())
« no previous file with comments | « tools/bots/src-tarball.py ('k') | tools/create_tarball.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698