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
1=== modified file 'crossbuild.py'
2--- crossbuild.py 2016-11-28 23:02:09 +0000
3+++ crossbuild.py 2016-11-28 23:02:09 +0000
4@@ -292,7 +292,7 @@
5 parser_win_agent = subparsers.add_parser(
6 'win-agent', help='Build an amd64 windows juju agent.')
7 parser_win_agent.add_argument(
8- '-b', '--build-dir', default='~/crossbuild',
9+ '-b', '--build-dir', default='$HOME/crossbuild',
10 help='The path cross build dir.')
11 parser_win_agent.add_argument(
12 'tarball_path', help='The path to the juju source tarball.')
13@@ -312,6 +312,17 @@
14 help='The path cross build dir.')
15 parser_centos.add_argument(
16 'tarball_path', help='The path to the juju source tarball.')
17+ # ./crossbuild ubuntu juju-core-1.2.3.tar.gz
18+ parser_ubuntu = subparsers.add_parser(
19+ 'ubuntu', help='Build an Ubuntu <something> agent.')
20+ parser_ubuntu.add_argument(
21+ '--goarch', default='amd64',
22+ help='The GOARCH to build. Environment: $GOARCH.')
23+ parser_ubuntu.add_argument(
24+ '-b', '--build-dir', default='$HOME/crossbuild',
25+ help='The path cross build dir.')
26+ parser_ubuntu.add_argument(
27+ 'tarball_path', help='The path to the juju source tarball.')
28 return parser.parse_args(args)
29
30
31@@ -339,6 +350,10 @@
32 build_centos(
33 args.tarball_path, args.build_dir,
34 dry_run=args.dry_run, verbose=args.verbose)
35+ elif args.command == 'ubuntu':
36+ build_ubuntu_agent(
37+ args.tarball_path, args.build_dir, args.goarch,
38+ dry_run=args.dry_run, verbose=args.verbose)
39 except Exception as e:
40 print(e)
41 print(getattr(e, 'output', ''))
42
43=== modified file 'tests/test_crossbuild.py'
44--- tests/test_crossbuild.py 2016-11-28 23:02:09 +0000
45+++ tests/test_crossbuild.py 2016-11-28 23:02:09 +0000
46@@ -20,6 +20,7 @@
47 make_client_tarball,
48 make_agent_tarball,
49 main,
50+ parse_args,
51 run_command,
52 working_directory,
53 )
54@@ -340,3 +341,12 @@
55 '1.2.3',
56 os.getcwd()),
57 mt_mock.call_args[0])
58+
59+
60+class TestParseArgs(TestCase):
61+
62+ def test_parse_args_ubuntu_goarch(self):
63+ args = parse_args(['ubuntu', '/ball/path'])
64+ self.assertEqual('amd64', args.goarch)
65+ args = parse_args(['ubuntu', '/ball/path', '--goarch', 'arm64'])
66+ self.assertEqual('arm64', args.goarch)

Subscribers

People subscribed via source and target branches