def get_bootstrap_args(info):
    executable = ['debootstrap']
    arch = info.manifest.system.get('userspace_architecture',
                                    info.manifest.system.get('architecture'))
    options = ['--arch=' + arch]
    if 'variant' in info.manifest.bootstrapper:
        options.append('--variant=' + info.manifest.bootstrapper['variant'])
    if info.manifest.bootstrapper.get('keyring', ''):
        options.append('--keyring=' + info.manifest.bootstrapper['keyring'])
    if info.manifest.bootstrapper.get('no-check-gpg', False) is True:
        options.append('--no-check-gpg')
    if info.manifest.bootstrapper.get('force-check-gpg', False) is True:
        from bootstrapvz.common.releases import stretch
        if info.manifest.release >= stretch:
            options.append('--force-check-gpg')
        else:
            from bootstrapvz.common.exceptions import ManifestError
            raise ManifestError(
                'force-check-gpg is only support in Stretch and newer releases'
            )
    if info.include_packages:
        options.append('--include=' + ','.join(info.include_packages))
    if info.exclude_packages:
        options.append('--exclude=' + ','.join(info.exclude_packages))
    mirror = info.manifest.bootstrapper.get('mirror', info.apt_mirror)
    arguments = [info.manifest.system['release'], info.root, mirror]
    return executable, options, arguments
Exemple #2
0
    def validation_error(self, message, data_path=None):
        """This function is passed to all validation functions so that they may
		raise a validation error because a custom validation of the manifest failed.

		:param str message: Message to user about the error
		:param list data_path: A path to the location in the manifest where the error occurred
		:raises ManifestError: With absolute certainty
		"""
        raise ManifestError(message, self.path, data_path)
Exemple #3
0
    def __init__(self, path=None, data=None):
        """Initializer: Given a path we load, validate and parse the manifest.
		To create the manifest from dynamic data instead of the contents of a file,
		provide a properly constructed dict as the data argument.

		:param str path: The path to the manifest (ignored, when `data' is provided)
		:param str data: The manifest data, if it is not None, it will be used instead of the contents of `path'
		"""
        if path is None and data is None:
            raise ManifestError('`path\' or `data\' must be provided')
        self.path = path
        self.load_data(data)
        self.load_modules()
        self.validate()
        self.parse()