コード例 #1
0
    def __init__(self, build_path):
        config_host_path = join(build_path, 'config-host.mak')
        if not isfile(config_host_path):
            forget_build_path(build_path)
            raise BadBuildPath("%s does not exists." % config_host_path)

        self.build_path = build_path

        config_host_f = open(config_host_path)
        config_host = config_host_f.read()
        config_host_f.close()

        self.src_path = fixpath(
            QemuVersionDescription.ch_lookup(config_host, "SRC_PATH"))
        self.target_list = fixpath(
            QemuVersionDescription.ch_lookup(config_host, "TARGET_DIRS"))

        # Get SHA
        self.repo = Repo(self.src_path)
        self.commit_sha = self.repo.head.commit.hexsha

        VERSION_path = join(self.src_path, 'VERSION')

        if not isfile(VERSION_path):
            raise BadBuildPath("{} does not exists\n".format(VERSION_path))

        VERSION_f = open(VERSION_path)
        self.qemu_version = VERSION_f.readline().rstrip("\n")
        VERSION_f.close()

        print("Qemu version is {}".format(self.qemu_version))

        self.include_paths = [
            join(self.src_path, 'include'),
            join(self.src_path, 'tcg')
        ]

        self.qvc = None
        self.qvc_is_ready = False
コード例 #2
0
ファイル: version_description.py プロジェクト: dimas3452/qdt
    def __init__(self, build_path, version=None):
        config_host_path = join(build_path, 'config-host.mak')
        if not isfile(config_host_path):
            raise BadBuildPath("%s does not exists." % config_host_path)

        self.build_path = build_path

        config_host_f = open(config_host_path)
        config_host = config_host_f.read()
        config_host_f.close()

        self.src_path = fixpath(
            QemuVersionDescription.ch_lookup(config_host, "SRC_PATH"))
        self.target_list = fixpath(
            QemuVersionDescription.ch_lookup(config_host, "TARGET_DIRS"))

        # Get SHA
        self.repo = Repo(self.src_path)

        if version is None:
            c = self.repo.head.commit
        else:
            c = self.repo.commit(version)

        self.commit_sha = c.hexsha

        VERSION = c.tree["VERSION"]
        self.qemu_version = VERSION.data_stream.read().strip().decode()

        print("Qemu version is {}".format(self.qemu_version))

        self.include_paths = ("include", "tcg")

        self.include_abs_paths = list(
            join(self.src_path, d) for d in self.include_paths)

        self.qvc = None
        self.qvc_is_ready = False
コード例 #3
0
ファイル: version_description.py プロジェクト: ufwt/qdt
    def __init__(self, build_path, version = None):
        config_host_path = join(build_path, "config-host.mak")
        if not isfile(config_host_path):
            raise BadBuildPath("%s does not exists." % config_host_path)
        self.config_host = config_host = ConfigHost(config_host_path)

        self.build_path = build_path
        self.src_path = fixpath(config_host.SRC_PATH)
        self.target_list = config_host.TARGET_DIRS.split(" ")

        self.softmmu_targets = st = set()
        for t in self.target_list:
            target_desc = t.split("-")
            if "softmmu" in target_desc:
                st.add(target_desc[0])

        # Get SHA
        self.repo = Repo(self.src_path)

        if version is None:
            c = self.repo.head.commit
        else:
            c = git_find_commit(self.repo, version)

        self.commit_sha = c.hexsha

        VERSION = c.tree["VERSION"]
        self.qemu_version = VERSION.data_stream.read().strip().decode()

        print("Qemu version is {}".format(self.qemu_version))

        self.include_paths = (
            # path, need recursion
            ("include", True),
            ("tcg", False)
        )

        self.include_abs_paths = list(
            join(self.src_path, d) for d, _ in self.include_paths
        )

        self.qvc = None
        self.qvc_is_ready = False
コード例 #4
0
ファイル: version_description.py プロジェクト: windsmell/qdt
    def co_init_device_tree(self, targets=None):
        if not targets:
            targets = self.softmmu_targets

        yield True

        print("Creating Device Tree for " + ", ".join(t for t in targets) +
              "...")

        root = self.qvc.device_tree
        if root is None:
            root = QType("device")

        arches_count = len(root.arches)
        for arch in targets:
            # Try to get QOM tree using binaries from different places.
            # Installed binary is tried first because in this case Qemu
            # launched as during normal operation.
            # However, if user did not install Qemu, we should try to use
            # binary from build directory.
            install_dir = join(fixpath(self.config_host.prefix), "bin")
            build_dir = join(self.build_path, arch + "-softmmu")

            binaries = [
                join(install_dir, "qemu-system-" + arch),
                join(build_dir, "qemu-system-" + arch)
            ]

            message = []

            for qemu_exec in binaries:
                try:
                    yield co_update_device_tree(qemu_exec, self.src_path, arch,
                                                root)
                except Exception as e:
                    message.extend([
                        "\n",
                        "Failure for binary '%s':\n" % qemu_exec,
                        "\n",
                    ])
                    if isinstance(e, (CancelledCallee, FailedCallee)):
                        message.extend(e.callee.traceback_lines)
                    else:
                        message.extend(format_exception(*exc_info()))
                else:
                    root.arches.add(arch)
                    # Stop on first successful update.
                    break
            else:
                # All binaries are absent/useless.
                message.insert(0, "Device Tree for %s isn't created:\n" % arch)
                print("".join(message))

        if not root.children:
            # Device Tree was not built
            self.qvc.device_tree = None
            return

        if arches_count == len(root.arches):
            # No new architecture has been added
            return

        self.qvc.device_tree = root
        print("Device Tree was created")

        t2m = defaultdict(list)
        yield self.co_text2macros(t2m)

        print("Adding macros to device tree ...")
        yield self.co_add_dt_macro(self.qvc.device_tree.children, t2m)
        print("Macros were added to device tree")