From a8124a4796ac10e6bb8f34c3294f8d23f1438af0 Mon Sep 17 00:00:00 2001 From: leo60228 Date: Mon, 20 Sep 2021 11:23:55 -0400 Subject: [PATCH] fix patchport --- resources/scripts/patchport.py | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/resources/scripts/patchport.py b/resources/scripts/patchport.py index b9e485d..e55df6c 100644 --- a/resources/scripts/patchport.py +++ b/resources/scripts/patchport.py @@ -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})') # 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):