コード例 #1
0
def main(argv=None):
    """Upload snap package to the Ubuntu Store."""
    argv = argv if argv else []
    docopt(__doc__, argv=argv)

    # make sure the full lifecycle is executed
    yaml_config = snapcraft.yaml.load_config()
    snap_filename = format_snap_name(yaml_config.data)

    if not os.path.exists(snap_filename):
        logger.info(
            'Snap {} not found. Running snap step to create it.'.format(
                snap_filename))
        snap.main(argv=argv)

    config = load_config()
    upload(snap_filename, yaml_config.data['name'], config=config)
コード例 #2
0
ファイル: lifecycle.py プロジェクト: morphis/snapcraft
def cleanbuild(project_options):
    if not repo.is_package_installed('lxd'):
        raise EnvironmentError(
            'The lxd package is not installed, in order to use `cleanbuild` '
            'you must install lxd onto your system. Refer to the '
            '"Ubuntu Desktop and Ubuntu Server" section on '
            'https://linuxcontainers.org/lxd/getting-started-cli/'
            '#ubuntu-desktop-and-ubuntu-server to enable a proper setup.')

    config = snapcraft.yaml.load_config(project_options)
    tar_filename = '{}_{}_source.tar.bz2'.format(
        config.data['name'], config.data['version'])

    with tarfile.open(tar_filename, 'w:bz2') as t:
        t.add(os.path.curdir, filter=_create_tar_filter(tar_filename))

    snap_filename = format_snap_name(config.data)
    Cleanbuilder(snap_filename, tar_filename, project_options).execute()
コード例 #3
0
ファイル: cleanbuild.py プロジェクト: techraf/snapcraft
def main(argv=None):
    argv = [] if argv is None else argv
    docopt(__doc__, argv=argv)

    if not repo.is_package_installed('lxd'):
        raise EnvironmentError(
            'The lxd package is not installed, in order to use `cleanbuild` '
            'you must install lxd onto your system. Refer to the '
            '"Ubuntu Desktop and Ubuntu Server" section on '
            'https://linuxcontainers.org/lxd/getting-started-cli/'
            '#ubuntu-desktop-and-ubuntu-server to enable a proper setup.')

    config = load_config()
    tar_filename = '{}_{}_source.tar.bz2'.format(config.data['name'],
                                                 config.data['version'])

    with tarfile.open(tar_filename, 'w:bz2') as t:
        t.add(os.path.curdir, filter=_create_tar_filter(tar_filename))

    snap_filename = format_snap_name(config.data)
    Cleanbuilder(snap_filename, tar_filename).execute()
コード例 #4
0
ファイル: lifecycle.py プロジェクト: morphis/snapcraft
def snap(project_options, directory=None, output=None):
    if directory:
        snap_dir = os.path.abspath(directory)
        snap = _snap_data_from_dir(snap_dir)
    else:
        # make sure the full lifecycle is executed
        snap_dir = project_options.snap_dir
        snap = execute('strip', project_options)

    snap_name = 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', '-no-xattrs']
    if snap['type'] != 'os':
        mksquashfs_args.append('-all-root')

    subprocess.check_call(
        ['mksquashfs', snap_dir, snap_name] + mksquashfs_args)
    logger.info('Snapped {}'.format(snap_name))