From 9795100dc9fa5da3369a8a0f5d02e49d4a78fb69 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Mon, 20 Mar 2023 15:13:00 +0200 Subject: [PATCH] wip [skip build] [skip test] --- aedi/target/base.py | 3 +++ aedi/target/tool_tier2.py | 19 +++++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/aedi/target/base.py b/aedi/target/base.py index baa305cd..255f8451 100644 --- a/aedi/target/base.py +++ b/aedi/target/base.py @@ -128,6 +128,9 @@ class BuildTarget(Target): if patched_line: patched_content.append(patched_line) + if content == patched_content: + return + with open(path, 'w') as f: f.writelines(patched_content) diff --git a/aedi/target/tool_tier2.py b/aedi/target/tool_tier2.py index 759ee562..8036cf2b 100644 --- a/aedi/target/tool_tier2.py +++ b/aedi/target/tool_tier2.py @@ -101,8 +101,23 @@ class Radare2Target(base.MesonTarget): def configure(self, state: BuildState): super().configure(state) - # TODO: fix absolute path in r_userconf.h - # TODO: fix R2_GITTIP in r_version.h + # Fix absolute paths in r_userconf.h + search_subpath = str(state.install_path) + replace_subpath = '/usr/local' + + def fix_paths(line: str): + return line.replace(search_subpath, replace_subpath) if search_subpath in line else line + + self.update_text_file(state.build_path / 'r_userconf.h', fix_paths) + + # Fix commit hash in r_version.h + tip_prefix = '#define R2_GITTIP ' + tip_value = 'ab809417aa6b676922f95cf77861924eb90e7ef2' + + def fix_commit(line: str): + return f'{tip_prefix}"{tip_value}"\n' if line.startswith(tip_prefix) else line + + self.update_text_file(state.build_path / 'r_version.h', fix_commit) class SeverZipTarget(base.MakeTarget):