mirror of
https://github.com/miurahr/aqtinstall.git
synced 2025-12-18 13:14:37 +03:00
make sure binfile patches are a full 256 bytes (#258)
* make sure binfile patches are a full 256 bytes, including any necessary padding. * assume binary patch values are always 256 byte zero filled. * assume zero terminated patch values instead of a fixed length. * add qmake patchs for qt_epfxpath and qt_hpfxpath. * tighten up binary patch
This commit is contained in:
@@ -39,7 +39,10 @@ class Updater:
|
||||
if idx < 0:
|
||||
return
|
||||
assert len(newpath) < 256, "Qt Prefix path is too long(255)."
|
||||
data = data[:idx] + key + newpath + data[idx + len(key) + len(newpath) :]
|
||||
oldlen = data[idx + len(key) :].find(b"\0")
|
||||
assert oldlen >= 0
|
||||
value = newpath + b"\0" * (oldlen - len(newpath))
|
||||
data = data[: idx + len(key)] + value + data[idx + len(key) + len(value) :]
|
||||
file.write_bytes(data)
|
||||
os.chmod(str(file), st.st_mode)
|
||||
|
||||
@@ -98,6 +101,16 @@ class Updater:
|
||||
key=b"qt_prfxpath=",
|
||||
newpath=bytes(str(self.prefix), "UTF-8"),
|
||||
)
|
||||
self._patch_binfile(
|
||||
self.qmake_path,
|
||||
key=b"qt_epfxpath=",
|
||||
newpath=bytes(str(self.prefix), "UTF-8"),
|
||||
)
|
||||
self._patch_binfile(
|
||||
self.qmake_path,
|
||||
key=b"qt_hpfxpath=",
|
||||
newpath=bytes(str(self.prefix), "UTF-8"),
|
||||
)
|
||||
|
||||
def patch_qmake_script(self, base_dir, qt_version, os_name):
|
||||
if os_name == "linux":
|
||||
|
||||
Reference in New Issue
Block a user