示例#1
0
 def main(self):
     bundle = Bundle.create_from_manifest(
         self.args['manifest'],
         partdir=self.args['source'],
         privkey_filename=self.args['privatekey'])
     pbar = self.get_progressbar(maxval=bundle.bundled_size)
     return bundle.extract_image(self.args['destination'], progressbar=pbar)
示例#2
0
 def main(self):
     bundle = Bundle.create_from_manifest(
         self.args['manifest'], partdir=self.args['source'],
         privkey_filename=self.args['privatekey'])
     pbar = self.get_progressbar(maxval=bundle.bundled_size)
     return bundle.extract_image(self.args['destination'],
                                 progressbar=pbar)
示例#3
0
    def main(self):
        prefix = (self.args.get('prefix') or
                  os.path.basename(self.args['image']))
        if self.args.get('destination'):
            path_prefix = os.path.join(self.args['destination'], prefix)
            if not os.path.exists(self.args['destination']):
                os.mkdir(self.args['destination'])
        else:
            tempdir = mkdtemp_for_large_files(prefix='bundle-')
            path_prefix = os.path.join(tempdir, prefix)
        self.log.debug('bundle path prefix: %s', path_prefix)

        label = self.args.get('progressbar_label', 'Bundling image')
        pbar = self.get_progressbar(label=label,
                                    maxval=os.path.getsize(self.args['image']))
        bundle = Bundle.create_from_image(
            self.args['image'], path_prefix,
            part_size=self.args.get('part_size'), progressbar=pbar)
        manifest = self.generate_manifest_xml(bundle)
        manifest_filename = path_prefix + '.manifest.xml'
        with open(manifest_filename, 'w') as manifest_file:
            manifest_file.write(manifest)
        return (part['path'] for part in bundle.parts), manifest_filename
示例#4
0
    def main(self):
        prefix = (self.args.get('prefix')
                  or os.path.basename(self.args['image']))
        if self.args.get('destination'):
            path_prefix = os.path.join(self.args['destination'], prefix)
            if not os.path.exists(self.args['destination']):
                os.mkdir(self.args['destination'])
        else:
            tempdir = mkdtemp_for_large_files(prefix='bundle-')
            path_prefix = os.path.join(tempdir, prefix)
        self.log.debug('bundle path prefix: %s', path_prefix)

        label = self.args.get('progressbar_label', 'Bundling image')
        pbar = self.get_progressbar(label=label,
                                    maxval=os.path.getsize(self.args['image']))
        bundle = Bundle.create_from_image(self.args['image'],
                                          path_prefix,
                                          part_size=self.args.get('part_size'),
                                          progressbar=pbar)
        manifest = self.generate_manifest_xml(bundle)
        manifest_filename = path_prefix + '.manifest.xml'
        with open(manifest_filename, 'w') as manifest_file:
            manifest_file.write(manifest)
        return (part['path'] for part in bundle.parts), manifest_filename