[skip build]
[skip test]
This commit is contained in:
alexey.lysiuk 2023-03-20 16:41:12 +02:00
parent b7b62e156c
commit 7ed6cc6771
2 changed files with 18 additions and 14 deletions

View File

@ -131,9 +131,13 @@ class BuildTarget(Target):
if content == patched_content:
return
file_time = os.stat(path).st_mtime
with open(path, 'w') as f:
f.writelines(patched_content)
os.utime(path, (file_time, file_time))
@staticmethod
def _update_variables_file(path: Path, prefix_value: str,
processor: typing.Optional[typing.Callable] = None, quotes: bool = True):

View File

@ -106,27 +106,27 @@ class Radare2Target(base.MesonTarget):
search_subpath = str(state.install_path)
replace_subpath = '/usr/local'
userconf_path = state.build_path / 'r_userconf.h'
userconf_time = os.stat(userconf_path).st_mtime
def fix_paths(line: str):
return line.replace(search_subpath, replace_subpath) if search_subpath in line else line
self.update_text_file(userconf_path, fix_paths)
os.utime(userconf_path, (userconf_time, userconf_time))
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'
version_path = state.build_path / 'r_version.h'
version_time = os.stat(version_path).st_mtime
# Fix commit in r_version.h
names_values = (
('R2_GITTIP', '"ab809417aa6b676922f95cf77861924eb90e7ef2"'),
('R2_VERSION_COMMIT', '1'),
)
def fix_commit(line: str):
return f'{tip_prefix}"{tip_value}"\n' if line.startswith(tip_prefix) else line
for name, value in names_values:
beginning = f'#define {name} '
self.update_text_file(version_path, fix_commit)
os.utime(version_path, (version_time, version_time))
if line.startswith(beginning):
return f'{beginning}{value}\n'
return line
self.update_text_file(state.build_path / 'r_version.h', fix_commit)
class SeverZipTarget(base.MakeTarget):