def _build_step_copy(self, args): """ Copy build step. This is recursive. The ``args["dest"]`` setting is always relative to the image directory, such that ``/etc/foo/bar.conf`` is really ``/var/lib/sponson/images/{name}/{version}/etc/foo/bar.conf``. :param args: dictionary of options for build step :type args: dict """ if "src" not in args or "dest" not in args: raise BuilderError("Missing required copy build step arguments") if "srcimage" in args: # Check if the srcimage we've been given # is the name or the actual version image_vers = self._check_if_version(args["srcimage"]) mount_src = args["src"].lstrip("/") source = os.path.join(image_vers, mount_src) else: source = os.path.abspath(args["src"]) dest = self._image_dest_path(args["dest"]) safe_copy(source, dest, args.get("owner"), args.get("group"), args.get("chmod"))
def _copy_container(self): """ Copy container information from the old container to the clone. """ old_path = os.path.join(self.old_overlay, "upper") new_path = os.path.join(self.new_overlay, "upper") safe_copy(old_path, new_path)