def load_gadget_yaml(self): # Preserve the gadget.yaml in the working dir. shutil.copy(self.yaml_file_path, self.workdir) with open(self.yaml_file_path, 'r', encoding='utf-8') as fp: self.gadget = parse_yaml(fp) # Make a working subdirectory for every volume we're going to create. # We'll put the volume contents inside these directories, and then use # the directories to create the disk images, one per volume. # # Store some additional metadata on the VolumeSpec object. This is # convenient, if crufty, since we're poking data onto an object from # the outside. for name, volume in self.gadget.volumes.items(): volume.basedir = os.path.join(self.volumedir, name) os.makedirs(volume.basedir) envar = os.environ.get('UBUNTU_IMAGE_PRESERVE_UNPACK') if envar is not None: preserve_dir = os.path.join(envar, 'unpack') shutil.copytree(self.unpackdir, preserve_dir) self._next.append(self.populate_rootfs_contents)
def load_gadget_yaml(self): yaml_file = os.path.join(self.unpackdir, 'gadget', 'meta', 'gadget.yaml') with open(yaml_file, 'r', encoding='utf-8') as fp: self.gadget = parse_yaml(fp) self._next.append(self.populate_rootfs_contents)