diff options
author | Joshua Harlow <harlowja@yahoo-inc.com> | 2012-06-25 21:33:25 -0700 |
---|---|---|
committer | Joshua Harlow <harlowja@yahoo-inc.com> | 2012-06-25 21:33:25 -0700 |
commit | 0b692aa1f4cd99332e47fca7a8cc27843ad1bbe5 (patch) | |
tree | 86335f23b87f0d7b4f00bd3a5d2dd5a81c1702d2 /packages | |
parent | b40acd43cd8a7849887147c293d41f0ee5e1145c (diff) | |
download | vyos-cloud-init-0b692aa1f4cd99332e47fca7a8cc27843ad1bbe5.tar.gz vyos-cloud-init-0b692aa1f4cd99332e47fca7a8cc27843ad1bbe5.zip |
Coverting this to use the python utils
Diffstat (limited to 'packages')
-rwxr-xr-x | packages/bddeb | 46 |
1 files changed, 35 insertions, 11 deletions
diff --git a/packages/bddeb b/packages/bddeb index 465bd986..f2158d5b 100755 --- a/packages/bddeb +++ b/packages/bddeb @@ -42,22 +42,46 @@ def info(msg): def warn(msg): print("WARNING: %s" % (msg)) - + +def archive_code(): + (stdout, _stderr) = tiny_p([sys.executable, + join(os.getcwd(), 'tar-me')]) + lines = stdout.splitlines() + revno = lines[0] + version = lines[1] + bname = lines[2] + arc_fn = lines[3] + return (revno, version, bname, arc_fn) + def main(): with tmpdir() as td: - info("Using %s as a temporary workspace" % (td)) - (stdout, _stderr) = tiny_p(['bzr', 'revno']) - revno = stdout.strip() - - - - cmd = [sys.executable, join(os.pardir, 'tools', 'read-version')] - (stdout, _stderr) = tiny_p(cmd) - version = stdout.strip() - + (revno, version, bname, archive_fn) = archive_code() + real_archive_fn = os.path.join(td, os.path.basename(archive_fn)) + shutil.move(archive_fn, real_archive_fn) + info("Archived code to %s" % (real_archive_fn)) + + cmd = ['tar', '-xvzf', real_archive_fn, '-C', td] + stdout, stderr = tiny_p(cmd) + + edir = join(td, bname) + shutil.move(edir, join(td, 'cloud-init')) + shutil.copytree('debian.trunk', join(td, 'cloud-init', 'debian')) + + cmd = ['sed', '-i', '-e',"s,VERSION,%s," %(version), + '-e', "s,REVNO,bzr%s," % (revno), + join(td, 'cloud-init', 'debian', 'changelog')] + tiny_p(cmd) + ocwd = os.getcwd() + os.chdir(join(td, 'cloud-init')) + cmd = ['debuild'] + tiny_p(cmd) + + debname = "cloud-init_%s~bzr%s-1_all.deb" % (version, revno) + shutil.move(debname, join(owcwd, debname)) + info("Wrote out debian package %s" % (join(owcwd, debname))) return 0 |