def test_dependency_recursed_correctly(self): fake_logger = fixtures.FakeLogger(level=logging.INFO) self.useFixture(fake_logger) self.make_snapcraft_yaml("""name: after version: 0 vendor: To Be Removed <*****@*****.**> summary: test stage description: if the build is succesful the state file will be updated icon: icon.png parts: part1: plugin: nil part2: plugin: nil after: - part1 """) open('icon.png', 'w').close() lifecycle.execute('pull') self.assertEqual( 'Pulling part1 \n' '\'part2\' has prerequisites that need to be staged: part1\n' 'Skipping pull part1 (already ran)\n' 'Building part1 \n' 'Staging part1 \n' 'Pulling part2 \n', fake_logger.output)
def test_dependency_recursed_correctly(self): fake_logger = fixtures.FakeLogger(level=logging.INFO) self.useFixture(fake_logger) self.make_snapcraft_yaml("""name: after version: 0 summary: test stage description: if the build is succesful the state file will be updated icon: icon.png parts: part1: plugin: nil part2: plugin: nil after: - part1 """) open('icon.png', 'w').close() lifecycle.execute('pull') self.assertEqual( 'Pulling part1 \n' '\'part2\' has prerequisites that need to be staged: part1\n' 'Skipping pull part1 (already ran)\n' 'Building part1 \n' 'Staging part1 \n' 'Pulling part2 \n', fake_logger.output)
def test_exception_when_dependency_is_required(self): self.make_snapcraft_yaml("""name: after version: 0 vendor: To Be Removed <*****@*****.**> summary: test stage description: if the build is succesful the state file will be updated icon: icon.png parts: part1: plugin: nil part2: plugin: nil after: - part1 """) open('icon.png', 'w').close() with self.assertRaises(RuntimeError) as raised: lifecycle.execute('pull', part_names=['part2']) self.assertEqual( raised.exception.__str__(), "Requested 'pull' of 'part2' but there are unsatisfied " "prerequisites: 'part1'")
def test_os_type_returned_by_lifecycle(self): fake_logger = fixtures.FakeLogger(level=logging.INFO) self.useFixture(fake_logger) self.make_snapcraft_yaml("""name: after version: 0 summary: test stage description: check and see if we return type 'os' type: os parts: part1: plugin: nil part2: plugin: nil after: - part1 """) open('icon.png', 'w').close() snap_info = lifecycle.execute('pull') expected_snap_info = { 'name': 'after', 'version': 0, 'arch': [common.get_arch()], 'type': 'os' } self.assertEqual(snap_info, expected_snap_info)
def main(argv=None): argv = argv if argv else [] args = docopt(__doc__, argv=argv) if args['DIRECTORY']: snap_dir = os.path.abspath(args['DIRECTORY']) snap = _snap_data_from_dir(snap_dir) else: # make sure the full lifecycle is executed snap_dir = common.get_snapdir() snap = lifecycle.execute('strip') snap_name = args['--output'] or _format_snap_name(snap) logger.info('Snapping {}'.format(snap_name)) subprocess.check_call( ['mksquashfs', snap_dir, snap_name, '-noappend', '-comp', 'xz']) logger.info('Snapped {}'.format(snap_name))
def main(argv=None): argv = argv if argv else [] args = docopt(__doc__, argv=argv) if args['DIRECTORY']: # TODO: migrate to meta/snap.yaml # TODO: write integration test snap_dir = os.path.abspath(args['DIRECTORY']) snap = _snap_data_from_dir(snap_dir) else: # make sure the full lifecycle is executed snap_dir = common.get_snapdir() snap = lifecycle.execute('strip') snap_name = _format_snap_name(snap) logger.info('Snapping {}'.format(snap_name)) subprocess.check_call( ['mksquashfs', snap_dir, snap_name, '-noappend', '-comp', 'xz']) logger.info('Snapped {}'.format(snap_name))
def main(argv=None): argv = argv if argv else [] args = docopt(__doc__, argv=argv) if args['DIRECTORY']: snap_dir = os.path.abspath(args['DIRECTORY']) snap = _snap_data_from_dir(snap_dir) else: # make sure the full lifecycle is executed snap_dir = common.get_snapdir() snap = lifecycle.execute('strip') snap_name = args['--output'] or _format_snap_name(snap) logger.info('Snapping {}'.format(snap_name)) # These options need to match the review tools: # http://bazaar.launchpad.net/~click-reviewers/click-reviewers-tools/trunk/view/head:/clickreviews/common.py#L38 mksquashfs_args = ['-noappend', '-comp', 'xz', '-all-root', '-no-xattrs'] subprocess.check_call( ['mksquashfs', snap_dir, snap_name] + mksquashfs_args) logger.info('Snapped {}'.format(snap_name))
def main(argv=None): argv = argv if argv else [] args = docopt(__doc__, argv=argv) if args['DIRECTORY']: snap_dir = os.path.abspath(args['DIRECTORY']) snap = _snap_data_from_dir(snap_dir) else: # make sure the full lifecycle is executed snap_dir = common.get_snapdir() snap = lifecycle.execute('strip') snap_name = args['--output'] or _format_snap_name(snap) logger.info('Snapping {}'.format(snap_name)) # These options need to match the review tools: # http://bazaar.launchpad.net/~click-reviewers/click-reviewers-tools/trunk/view/head:/clickreviews/common.py#L38 mksquashfs_args = ['-noappend', '-comp', 'xz', '-all-root', '-no-xattrs'] subprocess.check_call(['mksquashfs', snap_dir, snap_name] + mksquashfs_args) logger.info('Snapped {}'.format(snap_name))
def main(argv=None): argv = argv if argv else [] args = docopt(__doc__, argv=argv) lifecycle.execute('pull', args['PART'])
def main(argv=None): argv = argv if argv else [] args = docopt(__doc__, argv=argv) lifecycle.execute('stage', args['PART'])