Skip to content

Commit

Permalink
Accommodate multiple versions of APK repos
Browse files Browse the repository at this point in the history
Move the pointers to the repos so that we can keep pointers to more than
one version in git, and choose which one to use from one place, making
it easier to switch between versions.
  • Loading branch information
tbodt committed Oct 29, 2023
1 parent e003611 commit 6b8e012
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 11 deletions.
22 changes: 22 additions & 0 deletions app/gen_apk_repositories.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import os

def trim(x, start, end):
assert x.startswith(start)
assert x.endswith(end)
return x[len(start):-len(end)]

APK_REPOSITORIES = [
'v3.14/main/x86',
'v3.14/community/x86',
]

repos_file = []
for repo in APK_REPOSITORIES:
with open(f'{os.environ["SRCROOT"]}/deps/aports/{repo}/index.txt') as f:
index_name = f.read()
index_name = trim(index_name, 'APKINDEX-', '.tar.gz\n')
repos_file.append(f'http://apk.ish.app/{index_name}/{repo}')

with open(os.path.join(os.environ['BUILT_PRODUCTS_DIR'], os.environ['CONTENTS_FOLDER_PATH'], 'repositories.txt'), 'w') as f:
for line in repos_file:
print(line, file=f)
File renamed without changes.
File renamed without changes.
3 changes: 0 additions & 3 deletions deps/aports/.gitignore

This file was deleted.

File renamed without changes.
File renamed without changes.
18 changes: 10 additions & 8 deletions iSH.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@
49302D8D277669D300C9885A /* ish.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ish.c; sourceTree = "<group>"; };
49302D972777FAB400C9885A /* ish.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ish.h; sourceTree = "<group>"; };
493B378F290F5320000C41ED /* CLI.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = CLI.xcconfig; sourceTree = "<group>"; };
494D03F72727DAC6004F0CCE /* xcode-ninja.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "xcode-ninja.sh"; sourceTree = "<group>"; };
494D03F72727DAC6004F0CCE /* xcode-ninja.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; name = "xcode-ninja.sh"; path = "app/xcode-ninja.sh"; sourceTree = "<group>"; };
497A08BC2961168400B323CF /* AccessibilityFixes.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AccessibilityFixes.m; sourceTree = "<group>"; };
497F6BDA254E5C0D00C82F46 /* mem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mem.h; sourceTree = "<group>"; };
497F6BDB254E5C0D00C82F46 /* path.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = path.c; sourceTree = "<group>"; };
Expand Down Expand Up @@ -599,6 +599,7 @@
BB0B880E2589662200208600 /* sprite64.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = sprite64.png; sourceTree = "<group>"; };
BB0B88172589662A00208600 /* reworked.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = reworked.png; sourceTree = "<group>"; };
BB0B88202589734A00208600 /* notsurewhatthisis.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = notsurewhatthisis.png; sourceTree = "<group>"; };
BB0C03002AEEC85500E5ECBB /* gen_apk_repositories.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; name = gen_apk_repositories.py; path = app/gen_apk_repositories.py; sourceTree = "<group>"; };
BB0F552D239F8A790032A2A1 /* Icons.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Icons.plist; sourceTree = "<group>"; };
BB0F552F239F8B360032A2A1 /* uninspired.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = uninspired.png; sourceTree = "<group>"; };
BB0F553123A0AB9B0032A2A1 /* pydann1.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = pydann1.png; sourceTree = "<group>"; };
Expand All @@ -619,7 +620,7 @@
BB123ACD26C9F13500419CDA /* IOSCalls.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = IOSCalls.m; sourceTree = "<group>"; };
BB13F4DC21C5770000343E17 /* NSError+ISHErrno.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSError+ISHErrno.h"; sourceTree = "<group>"; };
BB13F4DD21C5770000343E17 /* NSError+ISHErrno.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSError+ISHErrno.m"; sourceTree = "<group>"; };
BB13F7C8200ACC24003D1C4D /* xcode-meson.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = "xcode-meson.sh"; sourceTree = "<group>"; };
BB13F7C8200ACC24003D1C4D /* xcode-meson.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = "xcode-meson.sh"; path = "app/xcode-meson.sh"; sourceTree = "<group>"; };
BB13F7DC200AD81D003D1C4D /* libish.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libish.a; sourceTree = BUILT_PRODUCTS_DIR; };
BB149E7E256DC97C00F57815 /* PassthroughView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PassthroughView.h; sourceTree = "<group>"; };
BB149E7F256DC97C00F57815 /* PassthroughView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PassthroughView.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -906,6 +907,7 @@
children = (
BB13F7C8200ACC24003D1C4D /* xcode-meson.sh */,
494D03F72727DAC6004F0CCE /* xcode-ninja.sh */,
BB0C03002AEEC85500E5ECBB /* gen_apk_repositories.py */,
);
name = Scripts;
sourceTree = "<group>";
Expand Down Expand Up @@ -1355,7 +1357,7 @@
buildConfigurationList = BB13F7CB200ACC31003D1C4D /* Build configuration list for PBXLegacyTarget "Meson" */;
buildPhases = (
);
buildToolPath = "$(SRCROOT)/xcode-meson.sh";
buildToolPath = "$(SRCROOT)/app/xcode-meson.sh";
buildWorkingDirectory = "";
dependencies = (
);
Expand All @@ -1369,7 +1371,7 @@
buildConfigurationList = BB13F7D1200ACCA2003D1C4D /* Build configuration list for PBXLegacyTarget "Ninja" */;
buildPhases = (
);
buildToolPath = "$(SRCROOT)/xcode-ninja.sh";
buildToolPath = "$(SRCROOT)/app/xcode-ninja.sh";
buildWorkingDirectory = "$(MESON_BUILD_DIR)";
dependencies = (
BB13F7D5200ACCA8003D1C4D /* PBXTargetDependency */,
Expand Down Expand Up @@ -1821,8 +1823,8 @@
"$(BUILT_PRODUCTS_DIR)/$(CONTENTS_FOLDER_PATH)/repositories.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /usr/bin/python3;
shellScript = "import os\ndef trim(x, start, end):\n assert x.startswith(start)\n assert x.endswith(end)\n return x[len(start):-len(end)]\nrepos_file = []\nfor repo in ['main', 'community']:\n with open(f'{os.environ[\"SRCROOT\"]}/deps/aports/{repo}/x86/index.txt') as f:\n index_name = f.read()\n index_name = trim(index_name, 'APKINDEX-', '.tar.gz\\n')\n repos_file.append(f'http://apk.ish.app/{index_name}/{repo}')\nwith open(os.path.join(os.environ['BUILT_PRODUCTS_DIR'], os.environ['CONTENTS_FOLDER_PATH'], 'repositories.txt'), 'w') as f:\n for line in repos_file:\n print(line, file=f)\n";
shellPath = "/bin/sh -e";
shellScript = "python3 $SRCROOT/app/gen_apk_repositories.py\n";
};
BB13F813200AEFAC003D1C4D /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
Expand Down Expand Up @@ -1939,8 +1941,8 @@
"$(BUILT_PRODUCTS_DIR)/$(CONTENTS_FOLDER_PATH)/repositories.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /usr/bin/python3;
shellScript = "import os\ndef trim(x, start, end):\n assert x.startswith(start)\n assert x.endswith(end)\n return x[len(start):-len(end)]\nrepos_file = []\nfor repo in ['main', 'community']:\n with open(f'{os.environ[\"SRCROOT\"]}/deps/aports/{repo}/x86/index.txt') as f:\n index_name = f.read()\n index_name = trim(index_name, 'APKINDEX-', '.tar.gz\\n')\n repos_file.append(f'http://apk.ish.app/{index_name}/{repo}')\nwith open(os.path.join(os.environ['BUILT_PRODUCTS_DIR'], os.environ['CONTENTS_FOLDER_PATH'], 'repositories.txt'), 'w') as f:\n for line in repos_file:\n print(line, file=f)\n";
shellPath = "/bin/sh -e";
shellScript = "python3 $SRCROOT/app/gen_apk_repositories.py\n";
};
BBEF197B268066D1001225BD /* Compile JavaScript */ = {
isa = PBXShellScriptBuildPhase;
Expand Down

0 comments on commit 6b8e012

Please sign in to comment.