Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
cli: snap command migrated to docopts #160
Conversation
elopio
reviewed
Dec 7, 2015
| + if args['DIRECTORY']: | ||
| + # TODO: needs design | ||
| + # TODO: overly simplistic, no meta/snap.yaml check | ||
| + snap_dir = os.path.abspath(args['DIRECTORY']) |
sergiusens
Dec 8, 2015
Collaborator
@elopio The integration tests will come in the next PR where I will enable them all again. That TODO is about snap.yaml is outdated though.
elopio
reviewed
Dec 7, 2015
| + snap = lifecycle.execute('strip') | ||
| + | ||
| + snap['arch'] = snap['arch'][0] if len(snap['arch']) == 1 else 'multi' | ||
| + snap_name = '{name}_{version}_{arch}.snap'.format(**snap) |
elopio
reviewed
Dec 7, 2015
| + | ||
| + logger.info('Snapping {}'.format(snap_name)) | ||
| + subprocess.check_call( | ||
| + ['mksquashfs', snap_dir, snap_name, '-noappend', '-comp', 'xz']) |
sergiusens
Dec 8, 2015
Collaborator
yes, and effectively moving away from the requirement to have ubuntu-snappy-cli
elopio
reviewed
Dec 7, 2015
| + return {'name': config.data['name'], | ||
| + 'version': config.data['version'], | ||
| + 'arch': config.data['architectures']} | ||
| + |
|
lgtm. Minor comments, and I would like to see an integration test for snapping a dir. |
|
@elopio great, I'll write the |
elopio
reviewed
Dec 8, 2015
| + and after is not in this set, an exception will be raised. | ||
| + | ||
| + :param str step: A valid step in the lifecycle: pull, build, strip or snap. | ||
| + :raises RuntimeError: If an prerequesite of the part needs to be staged |
|
Thanks. |
kyrofa
reviewed
Dec 8, 2015
| + | ||
| + logger.info('Snapping {}'.format(snap_name)) | ||
| + subprocess.check_call( | ||
| + ['mksquashfs', snap_dir, snap_name, '-noappend', '-comp', 'xz']) |
kyrofa
Dec 8, 2015
Member
If mksquashfs exits with non-zero, this throws exceptions, right? Would it be more user-friendly to catch those here and fail gracefully, or are you intending to provide a stack trace?
sergiusens
Dec 9, 2015
Collaborator
@kyrofa nothing returns a stack trace by default. I learned my lesson and there is a catch all in our main execution entry point to take care of this; no matter what (I intend to add a --debug mode so such stack trace can be seen).
sergiusens
Dec 9, 2015
Collaborator
We can eventually catch here and throw something nice; I also don't like exposing squashfs to the build console.
sergiusens commentedDec 7, 2015
Signed-off-by: Sergio Schvezov sergio.schvezov@canonical.com