Merge lp:~andrewjbeach/juju-release-tools/ubuntu-parse-args into lp:juju-release-tools

Proposed by Andrew James Beach
Status: Merged
Merged at revision: 354
Proposed branch: lp:~andrewjbeach/juju-release-tools/ubuntu-parse-args
Merge into: lp:juju-release-tools
Prerequisite: lp:~andrewjbeach/juju-release-tools/build-ubuntu-agent
Diff against target: 66 lines (+26/-1)
2 files modified
crossbuild.py (+16/-1)
tests/test_crossbuild.py (+10/-0)
To merge this branch: bzr merge lp:~andrewjbeach/juju-release-tools/ubuntu-parse-args
Reviewer Review Type Date Requested Status
Curtis Hovey (community) code Approve
Review via email: mp+311988@code.launchpad.net

Description of the change

Adds code to actually use crossbuild.build_ubuntu_agent. This is a new
sub-parser for the command line and another elif block if the sub-parser is
used.

To post a comment you must log in.
Revision history for this message
Curtis Hovey (sinzui) wrote :

Thank you.

review: Approve (code)
357. By Andrew James Beach

Merged build-ubuntu-agent into ubuntu-parse-args.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'crossbuild.py'
--- crossbuild.py 2016-11-28 23:02:09 +0000
+++ crossbuild.py 2016-11-28 23:02:09 +0000
@@ -292,7 +292,7 @@
292 parser_win_agent = subparsers.add_parser(292 parser_win_agent = subparsers.add_parser(
293 'win-agent', help='Build an amd64 windows juju agent.')293 'win-agent', help='Build an amd64 windows juju agent.')
294 parser_win_agent.add_argument(294 parser_win_agent.add_argument(
295 '-b', '--build-dir', default='~/crossbuild',295 '-b', '--build-dir', default='$HOME/crossbuild',
296 help='The path cross build dir.')296 help='The path cross build dir.')
297 parser_win_agent.add_argument(297 parser_win_agent.add_argument(
298 'tarball_path', help='The path to the juju source tarball.')298 'tarball_path', help='The path to the juju source tarball.')
@@ -312,6 +312,17 @@
312 help='The path cross build dir.')312 help='The path cross build dir.')
313 parser_centos.add_argument(313 parser_centos.add_argument(
314 'tarball_path', help='The path to the juju source tarball.')314 'tarball_path', help='The path to the juju source tarball.')
315 # ./crossbuild ubuntu juju-core-1.2.3.tar.gz
316 parser_ubuntu = subparsers.add_parser(
317 'ubuntu', help='Build an Ubuntu <something> agent.')
318 parser_ubuntu.add_argument(
319 '--goarch', default='amd64',
320 help='The GOARCH to build. Environment: $GOARCH.')
321 parser_ubuntu.add_argument(
322 '-b', '--build-dir', default='$HOME/crossbuild',
323 help='The path cross build dir.')
324 parser_ubuntu.add_argument(
325 'tarball_path', help='The path to the juju source tarball.')
315 return parser.parse_args(args)326 return parser.parse_args(args)
316327
317328
@@ -339,6 +350,10 @@
339 build_centos(350 build_centos(
340 args.tarball_path, args.build_dir,351 args.tarball_path, args.build_dir,
341 dry_run=args.dry_run, verbose=args.verbose)352 dry_run=args.dry_run, verbose=args.verbose)
353 elif args.command == 'ubuntu':
354 build_ubuntu_agent(
355 args.tarball_path, args.build_dir, args.goarch,
356 dry_run=args.dry_run, verbose=args.verbose)
342 except Exception as e:357 except Exception as e:
343 print(e)358 print(e)
344 print(getattr(e, 'output', ''))359 print(getattr(e, 'output', ''))
345360
=== modified file 'tests/test_crossbuild.py'
--- tests/test_crossbuild.py 2016-11-28 23:02:09 +0000
+++ tests/test_crossbuild.py 2016-11-28 23:02:09 +0000
@@ -20,6 +20,7 @@
20 make_client_tarball,20 make_client_tarball,
21 make_agent_tarball,21 make_agent_tarball,
22 main,22 main,
23 parse_args,
23 run_command,24 run_command,
24 working_directory,25 working_directory,
25)26)
@@ -340,3 +341,12 @@
340 '1.2.3',341 '1.2.3',
341 os.getcwd()),342 os.getcwd()),
342 mt_mock.call_args[0])343 mt_mock.call_args[0])
344
345
346class TestParseArgs(TestCase):
347
348 def test_parse_args_ubuntu_goarch(self):
349 args = parse_args(['ubuntu', '/ball/path'])
350 self.assertEqual('amd64', args.goarch)
351 args = parse_args(['ubuntu', '/ball/path', '--goarch', 'arm64'])
352 self.assertEqual('arm64', args.goarch)

Subscribers

People subscribed via source and target branches