From 5569efefa01a9e13ea2b389b4907ca5af668ed3a Mon Sep 17 00:00:00 2001 From: Ave Ozkal Date: Tue, 8 Oct 2019 05:08:26 +0300 Subject: [PATCH] necessary: add script to get us some extra function space also adjusting ctcci and patchport to account for this sort of versioned scripts --- ctcci/ctcci.py | 7 +++++++ patches/necessary/968.sh | 2 ++ patchport.py | 10 ++++++++++ 3 files changed, 19 insertions(+) create mode 100755 patches/necessary/968.sh diff --git a/ctcci/ctcci.py b/ctcci/ctcci.py index de069738..2ca18537 100644 --- a/ctcci/ctcci.py +++ b/ctcci/ctcci.py @@ -205,6 +205,13 @@ for patch_name in PATCHES: "font", font)) # Apply any other patches else: + patch_script = os.path.join(REPO_FOLDER, "patches", + patch_name, f"{VERSION}.sh") + if os.path.exists(patch_script): + subprocess.run(f"bash {patch_script}", + shell=True, + cwd=WORK_APK_PATH) + patch(patch_file, WORK_APK_PATH, patch_name) # Pack the APK diff --git a/patches/necessary/968.sh b/patches/necessary/968.sh new file mode 100755 index 00000000..9639e1c5 --- /dev/null +++ b/patches/necessary/968.sh @@ -0,0 +1,2 @@ +#!/bin/bash +mv smali/com/crashlytics smali_classes2/com/ diff --git a/patchport.py b/patchport.py index 8480c893..335e7766 100644 --- a/patchport.py +++ b/patchport.py @@ -130,6 +130,16 @@ for patch in os.listdir(os.path.join(cutthecord_folder, "patches")): f"{to_versioncode}.patch") readme_path = os.path.join(cutthecord_folder, "patches", patch, "README.md") + # Handle copying of versioned scripts, untested and dirty! + script_path = os.path.join(cutthecord_folder, "patches", patch, + f"{from_versioncode}.sh") + if os.path.exists(script_path): + script_out_path = os.path.join(cutthecord_folder, "patches", patch, + f"{to_versioncode}.sh") + with open(script_path) as f: + with open(script_out_path, "w") as f2: + f2.write(f.read()) + # Check if patch exists for from_version, if it doesn't, warn user if not os.path.isfile(patch_path) and patch not in ["necessary"]: # Don't warn on instructional patches