Partial 93205 port #133

Open
leo60228 wants to merge 2 commits from leo60228/cutthecord:93205 into 2021-05-31
Showing only changes of commit a8124a4796 - Show all commits

View file

@ -16,7 +16,7 @@ with open("/opt/ctc/gitrepo/resources/patchport-state.json", "r") as f:
from_versionname = jin["versionname"]
apk_folder = sys.argv[1]
cutthecord_folder = os.path.dirname(os.path.realpath(__file__))
cutthecord_folder = os.path.dirname(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
debug = False
tmp_folder = "/tmp/patchport"
@ -32,11 +32,6 @@ def modify_patch(patch_name, patch_path):
patch_content = patch_content.replace(from_versioncode, to_versioncode)
patch_content = patch_content.replace(from_versionname, to_versionname)
if patch_name == "notrack":
# TODO: There's a risk here that we'll replace the nulled value
from_crashlytics_id = re_crashlytics.findall(patch_content)[0]
patch_content = patch_content.replace(from_crashlytics_id,
to_crashlytics_id)
return patch_content
@ -113,9 +108,6 @@ re_versioncode_yml = re.compile(r'versionCode: \'([0-9]+)\'')
re_versionname_yml = re.compile(r'versionName: \'?(.+?)\'?$')
re_releasedate = re.compile(r'released on ([0-9]{4}-[0-9]{2}-[0-9]{2})')
re_crashlytics = re.compile(r'com\.crashlytics\.android\.build_id">([a-z0-9]'
r'{8}-?[a-z0-9]{4}-?[a-z0-9]{4}-?[a-z0-9]{4}-?'
r'[a-z0-9]{12})</string>')
# Get version code and name
@ -124,12 +116,6 @@ with open(os.path.join(apk_folder, "apktool.yml")) as f:
to_versioncode = re_versioncode_yml.findall(file_contents)[0]
to_versionname = re_versionname_yml.findall(file_contents)[0]
# Get crashlytics build ID
with open(os.path.join(apk_folder, "res", "values", "strings.xml")) as f:
file_contents = f.read()
to_crashlytics_id = re_crashlytics.findall(file_contents)[0]
failures = []
for patch in os.listdir(os.path.join(cutthecord_folder, "resources/xmlpatches")):
@ -152,6 +138,8 @@ for patch in os.listdir(os.path.join(cutthecord_folder, "resources/xmlpatches"))
tmp_out_path = os.path.join("/tmp/", patch, f"{to_versioncode}.xml")
readme_path = os.path.join(cutthecord_folder, "resources/xmlpatches", patch, "README.md")
os.mkdir(os.path.dirname(tmp_out_path))
# Handle copying of versioned scripts, untested and dirty!
script_path = os.path.join(cutthecord_folder, "resources/xmlpatches", patch, f"{from_versioncode}.sh")
if os.path.exists(script_path):