From c66ad5d6dbc0b7133b57092a52da09bb71157361 Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Tue, 26 Jun 2012 15:20:07 -0700 Subject: 1. Add 'verbose' options to both. 2. Fixup the debian building after util changes --- packages/bddeb | 39 +++++++++++++++++++++++++++++++-------- packages/brpm | 10 +++++++++- 2 files changed, 40 insertions(+), 9 deletions(-) (limited to 'packages') diff --git a/packages/bddeb b/packages/bddeb index 5f250738..9015585b 100755 --- a/packages/bddeb +++ b/packages/bddeb @@ -13,6 +13,8 @@ if os.path.exists(os.path.join(possible_topdir, "cloudinit", "__init__.py")): from cloudinit import templater from cloudinit import util +import argparse + # Package names that will showup in requires to what we can actually # use in our debian 'control' file PKG_MP = { @@ -70,6 +72,23 @@ def write_debian_folder(root, version, revno): def main(): + parser = argparse.ArgumentParser() + parser.add_argument("-n", "--no-sign", dest="sign", + help=("attempt to sign " + "the package (default: %(default)s)"), + default=True, + action='store_false') + parser.add_argument("-v", "--verbose", dest="verbose", + help=("run verbosely" + " (default: %(default)s)"), + default=False, + action='store_true') + args = parser.parse_args() + + capture = True + if args.verbose: + capture = False + with util.tempdir() as tdir: cmd = [sys.executable, @@ -95,24 +114,28 @@ def main(): base_name = os.path.basename(arch_fn)[:-len(".tar.gz")] shutil.move(util.abs_join(tdir, base_name), util.abs_join(tdir, 'cloud-init')) - + write_debian_folder(util.abs_join(tdir, 'cloud-init'), version, revno) - + tar_fn = "cloud-init_%s~%s.orig.tar.gz" % (version, revno) cmd = ['tar', '-czvf', util.abs_join(tdir, tar_fn), '-C', util.abs_join(tdir, 'cloud-init')] cmd.extend(os.listdir(util.abs_join(tdir, 'cloud-init'))) util.subp(cmd) + shutil.copy(util.abs_join(tdir, tar_fn), tar_fn) + print("Wrote out archive %r" % (util.abs_join(tar_fn))) - ocwd = os.getcwd() with util.chdir(util.abs_join(tdir, 'cloud-init')): - util.subp(['debuild'], capture=False) - debname = "cloud-init_%s~bzr%s-1_all.deb" % (version, revno) - shutil.move(debname, util.abs_join(ocwd, debname)) - - print("Wrote out debian package %s" % (util.abs_join(ocwd, debname))) + cmd = ['debuild'] + if not args.sign: + cmd.extend(['-us', '-uc']) + util.subp(cmd, capture=capture) + + debname = "cloud-init_%s~%s-1_all.deb" % (version, revno) + shutil.move(util.abs_join(tdir, debname), debname) + print("Wrote out debian package %r" % (util.abs_join(debname))) return 0 diff --git a/packages/brpm b/packages/brpm index 6870e172..b7246d8d 100755 --- a/packages/brpm +++ b/packages/brpm @@ -191,7 +191,15 @@ def main(): help="select boot type (default: %(default)s)", metavar="TYPE", default='initd', choices=['upstart', 'initd', 'systemd']) + parser.add_argument("-v", "--verbose", dest="verbose", + help=("run verbosely" + " (default: %(default)s)"), + default=False, + action='store_true') args = parser.parse_args() + capture = True + if args.verbose: + capture = False # Clean out the root dir and make sure the dirs we want are in place root_dir = os.path.expanduser("~/rpmbuild") @@ -216,7 +224,7 @@ def main(): # Now build it! cmd = ['rpmbuild', '-ba', spec_fn] - util.subp(cmd, capture=False) + util.subp(cmd, capture=capture) # Copy the items built to our local dir globs = [] -- cgit v1.2.3