From 2006505885a9de02a83d67edca1ad12b974528f3 Mon Sep 17 00:00:00 2001 From: Joseph P Date: Fri, 12 Apr 2024 13:54:28 +0300 Subject: [PATCH] release: bump KSU version, rename wrapper directory --- Dockerfile | 2 +- README.md | 87 ++++++------ {wrapper => builder}/__main__.py | 12 +- {wrapper => builder}/clients/__init__.py | 0 {wrapper => builder}/clients/github.py | 4 +- {wrapper => builder}/clients/los.py | 2 +- {wrapper => builder}/clients/pa.py | 2 +- {wrapper => builder}/clients/rom_api.py | 4 +- {wrapper => builder}/commands/__init__.py | 0 {wrapper => builder}/commands/assets.py | 2 +- {wrapper => builder}/commands/bundle.py | 10 +- {wrapper => builder}/commands/kernel.py | 2 +- builder/configs/__init__.py | 2 + .../configs/arguments.py | 6 +- .../configs/directories.py | 0 {wrapper => builder}/core/__init__.py | 0 {wrapper => builder}/core/assets_collector.py | 8 +- {wrapper => builder}/core/kernel_builder.py | 36 ++--- {wrapper => builder}/engines/__init__.py | 0 .../engines/container_engine.py | 14 +- {wrapper => builder}/engines/docker_engine.py | 8 +- {wrapper => builder}/engines/podman_engine.py | 2 +- {wrapper => builder}/interfaces/__init__.py | 0 {wrapper => builder}/interfaces/clients.py | 0 {wrapper => builder}/interfaces/commands.py | 0 {wrapper => builder}/interfaces/engines.py | 4 +- {wrapper => builder}/interfaces/modules.py | 2 +- {wrapper => builder}/manifests/devices.json | 0 {wrapper => builder}/manifests/tools.json | 2 +- .../4.14/add-wifi-injection-4.14.patch | 0 .../4.14/fix-ath9k-naming-conflict.patch | 0 .../dumplinger/4.14/kernelsu-compat.patch | 0 .../4.4/add-wifi-injection-4.4.patch | 0 .../4.4/fix-ath9k-naming-conflict.patch | 0 .../dumplinger/4.4/fix-hci-uart.patch | 0 .../4.4/fix-rt2800-injection-4.04.patch | 0 .../dumplinger/4.4/kernelsu-compat.patch | 0 .../dumplinger/4.4/qcacld_pa.patch | 0 ...ctor-monitor-representation-in-sdata.patch | 0 .../dumplinger/anykernel3/anykernel.sh | 0 .../anykernel3/ramdisk/init.nethunter.rc | 0 .../ramdisk/keyboard-descriptor.bin | 0 .../anykernel3/ramdisk/mouse-descriptor.bin | 0 .../modifications/gki/.gitkeep | 0 .../modifications/lemonade/5.4/.gitkeep | 0 .../modifications/lemonadep/5.4/.gitkeep | 0 {wrapper => builder}/modifications/nhpatch.sh | 0 {wrapper => builder}/tools/__init__.py | 0 {wrapper => builder}/tools/cleaning.py | 4 +- {wrapper => builder}/tools/commands.py | 13 +- {wrapper => builder}/tools/fileoperations.py | 14 +- {wrapper => builder}/tools/messages.py | 0 {wrapper => builder}/utils/__init__.py | 0 {wrapper => builder}/utils/bridge.py | 8 +- .../utils/resource_manager.py | 8 +- conanfile.py | 4 +- docs/FLASHING.md | 2 +- docs/TODO.md | 3 +- poetry.lock | 124 +++++++++--------- pyproject.toml | 14 +- scripts/get_version.py | 2 +- scripts/multi_build.py | 2 +- scripts/run_tests.py | 4 +- .../unit/wrapper/core/test_kernel_builder.py | 2 +- tests/unit/wrapper/tools/test_commands.py | 2 +- tests/unit/wrapper/tools/test_messages.py | 4 +- wrapper/configs/__init__.py | 2 - 67 files changed, 212 insertions(+), 211 deletions(-) rename {wrapper => builder}/__main__.py (95%) rename {wrapper => builder}/clients/__init__.py (100%) rename {wrapper => builder}/clients/github.py (95%) rename {wrapper => builder}/clients/los.py (84%) rename {wrapper => builder}/clients/pa.py (92%) rename {wrapper => builder}/clients/rom_api.py (93%) rename {wrapper => builder}/commands/__init__.py (100%) rename {wrapper => builder}/commands/assets.py (83%) rename {wrapper => builder}/commands/bundle.py (95%) rename {wrapper => builder}/commands/kernel.py (84%) create mode 100644 builder/configs/__init__.py rename wrapper/configs/argument_config.py => builder/configs/arguments.py (90%) rename wrapper/configs/directory_config.py => builder/configs/directories.py (100%) rename {wrapper => builder}/core/__init__.py (100%) rename {wrapper => builder}/core/assets_collector.py (95%) rename {wrapper => builder}/core/kernel_builder.py (95%) rename {wrapper => builder}/engines/__init__.py (100%) rename {wrapper => builder}/engines/container_engine.py (95%) rename {wrapper => builder}/engines/docker_engine.py (86%) rename {wrapper => builder}/engines/podman_engine.py (51%) rename {wrapper => builder}/interfaces/__init__.py (100%) rename {wrapper => builder}/interfaces/clients.py (100%) rename {wrapper => builder}/interfaces/commands.py (100%) rename {wrapper => builder}/interfaces/engines.py (93%) rename {wrapper => builder}/interfaces/modules.py (98%) rename {wrapper => builder}/manifests/devices.json (100%) rename {wrapper => builder}/manifests/tools.json (97%) rename {wrapper => builder}/modifications/dumplinger/4.14/add-wifi-injection-4.14.patch (100%) rename {wrapper => builder}/modifications/dumplinger/4.14/fix-ath9k-naming-conflict.patch (100%) rename {wrapper => builder}/modifications/dumplinger/4.14/kernelsu-compat.patch (100%) rename {wrapper => builder}/modifications/dumplinger/4.4/add-wifi-injection-4.4.patch (100%) rename {wrapper => builder}/modifications/dumplinger/4.4/fix-ath9k-naming-conflict.patch (100%) rename {wrapper => builder}/modifications/dumplinger/4.4/fix-hci-uart.patch (100%) rename {wrapper => builder}/modifications/dumplinger/4.4/fix-rt2800-injection-4.04.patch (100%) rename {wrapper => builder}/modifications/dumplinger/4.4/kernelsu-compat.patch (100%) rename {wrapper => builder}/modifications/dumplinger/4.4/qcacld_pa.patch (100%) rename {wrapper => builder}/modifications/dumplinger/4.4/v2-2-6-mac80211-refactor-monitor-representation-in-sdata.patch (100%) rename {wrapper => builder}/modifications/dumplinger/anykernel3/anykernel.sh (100%) mode change 100755 => 100644 rename {wrapper => builder}/modifications/dumplinger/anykernel3/ramdisk/init.nethunter.rc (100%) mode change 100755 => 100644 rename {wrapper => builder}/modifications/dumplinger/anykernel3/ramdisk/keyboard-descriptor.bin (100%) mode change 100755 => 100644 rename {wrapper => builder}/modifications/dumplinger/anykernel3/ramdisk/mouse-descriptor.bin (100%) mode change 100755 => 100644 rename {wrapper => builder}/modifications/gki/.gitkeep (100%) rename {wrapper => builder}/modifications/lemonade/5.4/.gitkeep (100%) rename {wrapper => builder}/modifications/lemonadep/5.4/.gitkeep (100%) rename {wrapper => builder}/modifications/nhpatch.sh (100%) rename {wrapper => builder}/tools/__init__.py (100%) rename {wrapper => builder}/tools/cleaning.py (95%) mode change 100755 => 100644 rename {wrapper => builder}/tools/commands.py (81%) mode change 100755 => 100644 rename {wrapper => builder}/tools/fileoperations.py (90%) rename {wrapper => builder}/tools/messages.py (100%) rename {wrapper => builder}/utils/__init__.py (100%) rename {wrapper => builder}/utils/bridge.py (94%) rename {wrapper => builder}/utils/resource_manager.py (93%) delete mode 100644 wrapper/configs/__init__.py diff --git a/Dockerfile b/Dockerfile index 5338e2d..b180327 100755 --- a/Dockerfile +++ b/Dockerfile @@ -45,7 +45,7 @@ RUN python3 -m pip install pip --upgrade && \ # This significantly reduces the total build time, as each time we make a build call for a device, # only device-specific kernel source is being downloaded into the container. # -RUN python3 ${WDIR}/wrapper/utils/bridge.py --shared +RUN python3 ${WDIR}/builder/utils/bridge.py --shared # launch app CMD [ "/bin/bash" ] diff --git a/README.md b/README.md index 7584aff..0d13ff7 100755 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ # zero_kernel -An advanced Android kernel builder with Kali NetHunter support. +An advanced Android kernel builder with assets collection and Kali NetHunter support. ## Contents - [zero\_kernel](#zero_kernel) - [Contents](#contents) - - [**Important**](#important) + - [**Important to Read**](#important-to-read) - [Description](#description) - [Kernel Features](#kernel-features) - [Supported Devices \& ROMs](#supported-devices--roms) @@ -19,10 +19,10 @@ An advanced Android kernel builder with Kali NetHunter support. - [See also](#see-also) - [Credits](#credits) -## **Important** +## **Important to Read** > [!IMPORTANT] -> **\- Disclaimer \-** +> **\- DISCLAIMER \-** > > **This kernel is made for educational purposes only.** > @@ -33,7 +33,7 @@ An advanced Android kernel builder with Kali NetHunter support. > [!NOTE] > \- ROM artifacts in releases \- > -> The contents of each release include ROM builds compatible with corresponding kernel builds. These ROM files are **unmodified and mirrored from official sources**. +> The contents of each release include ROM builds compatible with corresponding kernel builds. These ROM files are **unmodified and mirrored from official sources**. > >This can be verified via the checksums, which should be identical to the ones presented on the ROM project's official web page. > @@ -41,7 +41,7 @@ An advanced Android kernel builder with Kali NetHunter support. ## Description -The codebase of this project is essentially an extensive wrapper automating the entire Android kernel build process, starting from kernel source collection and ending with artifact packaging. +The codebase of this project is an extensive build wrapper automating the entire Android kernel build process, starting from kernel source collection and ending with artifact packaging. The key goal is to modify the kernel in such a way that enables unique features of [Kali NetHunter](https://www.kali.org/docs/nethunter) — a ROM layer designed to add extended functionality for penetration testing in a mobile form factor. @@ -61,40 +61,41 @@ The kernel has the following features:
OnePlus 5/T -
+- 4.4 Linux kernel version: + - LineageOS; + - ParanoidAndroid; + - x_kernel supported (universal)`*`. -4.4 Linux kernel version: +- 4.14 Linux kernel version: + - ParanoidAndroid (unofficial & testing); + - x-ft_kernel supported (universal)`**`. -- LineageOS; -- ParanoidAndroid; -- x_kernel supported (universal)*. +`*` -- this is mostly relevant to ROMs based on LineageOS; however, technically speaking, this includes ParanoidAndroid as well, which makes x_kernel-based builds universal. -4.14 Linux kernel version: - -- ParanoidAndroid (unofficial & testing); -- x-ft_kernel supported (universal)**. - ---- - -\* -- this is mostly relevant to ROMs based on LineageOS; however, technically speaking, this includes ParanoidAndroid as well, which makes x_kernel-based builds universal. - -\** -- this, **in theory**, is relevant to all 4.14-based ROMs for this device in existence. +`**` -- this, **in theory**, is relevant to all 4.14-based ROMs for this device in existence.
## Usage -The custom build wrapper consists of 3 main components: +The custom build wrapper (aka "builder") consists of 2 core components and 3 primary commands: + +Components: - kernel builder; -- assets collector; -- kernel + assets bundler. +- assets collector. + +Commands: + +- kernel; +- assets; +- bundle. ```help -$ python3 wrapper --help -usage: wrapper [-h] [--clean] {kernel,assets,bundle} ... +$ python3 builder --help +usage: builder [-h] [--clean] {kernel,assets,bundle} ... -A custom wrapper for the zero_kernel. +A custom builder for the zero_kernel. positional arguments: {kernel,assets,bundle} @@ -112,7 +113,7 @@ optional arguments: **It is highly recommended to use `docker` option to run this tool.** For that you need Docker Engine or Docker Desktop, depending on your OS. > [!WARNING] -> Because of how *specific* Linux kernel source is, building it on Windows even with Docker might be challenging. +> Because of how *specific* Linux kernel source is, building it on Windows even with Docker (using WSL2 back-end) might be [challenging](https://stackoverflow.com/questions/76754956/how-to-clone-the-linux-kernel-repository-to-my-machine-i-keep-geting-errors). To run this tool in a `local` environment, you will need: @@ -122,18 +123,18 @@ To run this tool in a `local` environment, you will need: You will also need to configure your Python installation, including some of the packages installation: ```sh +export PYTHONPATH=$(pwd) python3 -m pip install poetry python3 -m poetry install --no-root -export PYTHONPATH=$(pwd) ``` ### Kernel -Kernel build process can be launched using the `kernel` subcommand of the wrapper. +Kernel build process can be launched using the `kernel` subcommand. ```help -$ python3 wrapper kernel --help -usage: wrapper kernel [-h] --build-env {local,docker,podman} --base +$ python3 builder kernel --help +usage: builder kernel [-h] --build-env {local,docker,podman} --base {los,pa,x,aosp} --codename CODENAME --lkv LKV [-c] [--clean-image] [--log-level {normal,verbose,quiet}] [-o OUTLOG] [--ksu] @@ -162,8 +163,8 @@ options: As mentioned, there is also an asset downloader, which can collect latest versions of ROM, TWRP, Magisk and it's modules, Kali Chroot etc. ```help -$ python3 wrapper assets --help -usage: wrapper assets [-h] --build-env {local,docker,podman} --base +$ python3 builder assets --help +usage: builder assets [-h] --build-env {local,docker,podman} --base {los,pa,x,aosp} --codename CODENAME --chroot {full,minimal} [--rom-only] [--clean-image] [--clean] [--log-level {normal,verbose,quiet}] [-o OUTLOG] [--ksu] @@ -190,11 +191,11 @@ options: ### Bundle -There is an option named `bundle` which combines build artifacts of both `kernel` and `assets` commands into a single package. +The `bundle` command is a combined usage of kernel builder and assets collector core modules. -This is especially useful for linking the kernel version with the appropriate ROM version. +This is especially useful for linking the kernel build with the appropriate ROM build. -There are cases when an old kernel version is used with the newer ROM version (adapted for the *newer* version of kernel). Such cases can ultimately lead to your system working improperly or breaking down completely, which is why it is important to use a specific kernel build with a corresponding ROM build. +There are cases when an old kernel build is used with the newer ROM build. Such cases can ultimately lead to your system working improperly or breaking down completely, which is why it is important to use a *specific* kernel build with a corresponding ROM build. Currently, there are three types of packaging available: @@ -204,11 +205,11 @@ Currently, there are three types of packaging available: Options `full` and `conan` collect all of the assets required to successfuly flash the kernel onto your device. The difference between the two is that `full` option places everything into a local directory, while `conan` organizes everything as a Conan package. -An option named `slim` is a much lighter version of `full` packaging, as only the ROM is collected from the asset list. This is done to reduce package sizes while ensuring the kernel+ROM compatibility. +Option named `slim` is a much lighter version of `full` packaging, as only the ROM is collected from the asset list. This is done to reduce package sizes while ensuring the kernel+ROM compatibility. ```help -$ python3 wrapper bundle --help -usage: wrapper bundle [-h] --build-env {local,docker,podman} --base +$ python3 builder bundle --help +usage: builder bundle [-h] --build-env {local,docker,podman} --base {los,pa,x,aosp} --codename CODENAME --lkv LKV --package-type {conan,slim,full} [--conan-upload] [--clean-image] [--log-level {normal,verbose,quiet}] @@ -241,19 +242,19 @@ Here are some examples of commands: **(Recommended)** Build kernel and collect ROM via Docker: ```sh -python3 wrapper bundle --build-env=docker --base=los --codename=dumpling --lkv=4.4 --package-type=slim +python3 builder bundle --build-env=docker --base=los --codename=dumpling --lkv=4.4 --package-type=slim ``` Build kernel locally: ```sh -python3 wrapper kernel --build-env=local --base=los --codename=dumpling --lkv=4.4 +python3 builder kernel --build-env=local --base=los --codename=dumpling --lkv=4.4 ``` Collect all of the assets locally: ```sh -python3 wrapper assets --build-env=local --base=los --codename=dumpling --package-type=full +python3 builder assets --build-env=local --base=los --codename=dumpling --package-type=full ``` ## See also diff --git a/wrapper/__main__.py b/builder/__main__.py similarity index 95% rename from wrapper/__main__.py rename to builder/__main__.py index dfdf362..c32dcca 100644 --- a/wrapper/__main__.py +++ b/builder/__main__.py @@ -4,17 +4,17 @@ import json import argparse -from wrapper.tools import cleaning as cm, messages as msg -from wrapper.configs import ArgumentConfig, DirectoryConfig as dcfg -from wrapper.engines import DockerEngine, PodmanEngine -from wrapper.commands import KernelCommand, AssetsCommand, BundleCommand +from builder.tools import cleaning as cm, messages as msg +from builder.configs import ArgumentConfig, DirectoryConfig as dcfg +from builder.engines import DockerEngine, PodmanEngine +from builder.commands import KernelCommand, AssetsCommand, BundleCommand def parse_args() -> argparse.Namespace: """Parse the script arguments.""" # show the 'help' message if no arguments supplied args = None if sys.argv[1:] else ["-h"] # parser and subparsers - parser_parent = argparse.ArgumentParser(description="A custom wrapper for the zero kernel.") + parser_parent = argparse.ArgumentParser(description="A custom builder for the zero kernel.") subparsers = parser_parent.add_subparsers(dest="command") parser_kernel = subparsers.add_parser("kernel", help="build the kernel") parser_assets = subparsers.add_parser("assets", help="collect assets") @@ -226,7 +226,7 @@ def main(args: argparse.Namespace) -> None: sys.exit(0) os.environ["LOGLEVEL"] = args.loglvl # define env variable with kernel version - with open(dcfg.root / "pyproject.toml") as f: + with open(dcfg.root / "pyproject.toml", encoding="utf-8") as f: os.environ["KVERSION"] = f.read().split("version = \"")[1].split("\"")[0] # create a config for argument check and storage arguments = vars(args) diff --git a/wrapper/clients/__init__.py b/builder/clients/__init__.py similarity index 100% rename from wrapper/clients/__init__.py rename to builder/clients/__init__.py diff --git a/wrapper/clients/github.py b/builder/clients/github.py similarity index 95% rename from wrapper/clients/github.py rename to builder/clients/github.py index afb04b7..bbee91b 100644 --- a/wrapper/clients/github.py +++ b/builder/clients/github.py @@ -5,8 +5,8 @@ from typing import Optional from pydantic import BaseModel -from wrapper.tools import cleaning as cm, commands as ccmd, messages as msg -from wrapper.configs import DirectoryConfig as dcfg +from builder.tools import cleaning as cm, commands as ccmd, messages as msg +from builder.configs import DirectoryConfig as dcfg class GitHubApi(BaseModel): diff --git a/wrapper/clients/los.py b/builder/clients/los.py similarity index 84% rename from wrapper/clients/los.py rename to builder/clients/los.py index 4bc2b52..897757e 100644 --- a/wrapper/clients/los.py +++ b/builder/clients/los.py @@ -1,4 +1,4 @@ -from wrapper.clients.rom_api import RomApi +from builder.clients.rom_api import RomApi class LineageOsApi(RomApi): diff --git a/wrapper/clients/pa.py b/builder/clients/pa.py similarity index 92% rename from wrapper/clients/pa.py rename to builder/clients/pa.py index 1ee2bf8..72d45dc 100644 --- a/wrapper/clients/pa.py +++ b/builder/clients/pa.py @@ -1,6 +1,6 @@ from typing import override -from wrapper.clients.rom_api import RomApi +from builder.clients.rom_api import RomApi class ParanoidAndroidApi(RomApi): diff --git a/wrapper/clients/rom_api.py b/builder/clients/rom_api.py similarity index 93% rename from wrapper/clients/rom_api.py rename to builder/clients/rom_api.py index 05ab756..712f4d4 100644 --- a/wrapper/clients/rom_api.py +++ b/builder/clients/rom_api.py @@ -1,8 +1,8 @@ import requests from pydantic import BaseModel -from wrapper.tools import messages as msg -from wrapper.interfaces import IRomApi +from builder.tools import messages as msg +from builder.interfaces import IRomApi class RomApi(BaseModel, IRomApi): diff --git a/wrapper/commands/__init__.py b/builder/commands/__init__.py similarity index 100% rename from wrapper/commands/__init__.py rename to builder/commands/__init__.py diff --git a/wrapper/commands/assets.py b/builder/commands/assets.py similarity index 83% rename from wrapper/commands/assets.py rename to builder/commands/assets.py index 2e08868..527b4dc 100644 --- a/wrapper/commands/assets.py +++ b/builder/commands/assets.py @@ -1,4 +1,4 @@ -from wrapper.core import AssetsCollector +from builder.core import AssetsCollector class AssetsCommand(AssetsCollector): diff --git a/wrapper/commands/bundle.py b/builder/commands/bundle.py similarity index 95% rename from wrapper/commands/bundle.py rename to builder/commands/bundle.py index dc6c815..3160989 100644 --- a/wrapper/commands/bundle.py +++ b/builder/commands/bundle.py @@ -4,10 +4,10 @@ import itertools from pydantic import BaseModel -from wrapper.core import KernelBuilder, AssetsCollector -from wrapper.tools import cleaning as cm, commands as ccmd, fileoperations as fo, messages as msg -from wrapper.configs import DirectoryConfig as dcfg -from wrapper.interfaces import IBundleCommand +from builder.core import KernelBuilder, AssetsCollector +from builder.tools import cleaning as cm, commands as ccmd, fileoperations as fo, messages as msg +from builder.configs import DirectoryConfig as dcfg +from builder.interfaces import IBundleCommand class BundleCommand(BaseModel, IBundleCommand): @@ -72,7 +72,7 @@ def _conan_sources(self) -> None: @staticmethod def _conan_options(json_file: str) -> dict: - with open(json_file) as f: + with open(json_file, encoding="utf-8") as f: json_data = json.load(f) return json_data diff --git a/wrapper/commands/kernel.py b/builder/commands/kernel.py similarity index 84% rename from wrapper/commands/kernel.py rename to builder/commands/kernel.py index 540635e..130fef6 100644 --- a/wrapper/commands/kernel.py +++ b/builder/commands/kernel.py @@ -1,4 +1,4 @@ -from wrapper.core import KernelBuilder +from builder.core import KernelBuilder class KernelCommand(KernelBuilder): diff --git a/builder/configs/__init__.py b/builder/configs/__init__.py new file mode 100644 index 0000000..04ba9a8 --- /dev/null +++ b/builder/configs/__init__.py @@ -0,0 +1,2 @@ +from .arguments import ArgumentConfig +from .directories import DirectoryConfig diff --git a/wrapper/configs/argument_config.py b/builder/configs/arguments.py similarity index 90% rename from wrapper/configs/argument_config.py rename to builder/configs/arguments.py index cb8338e..d9ec23c 100644 --- a/wrapper/configs/argument_config.py +++ b/builder/configs/arguments.py @@ -4,14 +4,14 @@ from typing import Optional from pydantic import BaseModel -from wrapper.tools import commands as ccmd, messages as msg +from builder.tools import commands as ccmd, messages as msg class ArgumentConfig(BaseModel): """A variable storage to use across the application. :param benv: Build environment. - :param command: Wrapper command to be launched. + :param command: Builder command to be launched. :param codename: Device codename. :param base: Kernel source base. :param lkv: Linux kernel version. @@ -52,7 +52,7 @@ def check_settings(self) -> None: except Exception: msg.error("Detected Linux distribution is not Debian-based.") # check if specified device is supported - with open(Path(__file__).absolute().parents[2] / "wrapper" / "manifests" / "devices.json") as f: + with open(Path(__file__).absolute().parents[2] / "builder" / "manifests" / "devices.json", encoding="utf-8") as f: devices = json.load(f) if self.codename not in devices.keys(): msg.error("Unsupported device codename specified.") diff --git a/wrapper/configs/directory_config.py b/builder/configs/directories.py similarity index 100% rename from wrapper/configs/directory_config.py rename to builder/configs/directories.py diff --git a/wrapper/core/__init__.py b/builder/core/__init__.py similarity index 100% rename from wrapper/core/__init__.py rename to builder/core/__init__.py diff --git a/wrapper/core/assets_collector.py b/builder/core/assets_collector.py similarity index 95% rename from wrapper/core/assets_collector.py rename to builder/core/assets_collector.py index b62a40f..81b4528 100644 --- a/wrapper/core/assets_collector.py +++ b/builder/core/assets_collector.py @@ -1,10 +1,10 @@ import os from pydantic import BaseModel -from wrapper.tools import cleaning as cm, fileoperations as fo, messages as msg -from wrapper.clients import GitHubApi, LineageOsApi, ParanoidAndroidApi -from wrapper.configs import DirectoryConfig as dcfg -from wrapper.interfaces import IAssetsCollector +from builder.tools import cleaning as cm, fileoperations as fo, messages as msg +from builder.clients import GitHubApi, LineageOsApi, ParanoidAndroidApi +from builder.configs import DirectoryConfig as dcfg +from builder.interfaces import IAssetsCollector class AssetsCollector(BaseModel, IAssetsCollector): diff --git a/wrapper/core/kernel_builder.py b/builder/core/kernel_builder.py similarity index 95% rename from wrapper/core/kernel_builder.py rename to builder/core/kernel_builder.py index 2e6ffd3..281677a 100644 --- a/wrapper/core/kernel_builder.py +++ b/builder/core/kernel_builder.py @@ -4,10 +4,10 @@ from pathlib import Path from pydantic import BaseModel -from wrapper.tools import cleaning as cm, commands as ccmd, fileoperations as fo, messages as msg -from wrapper.utils import ResourceManager -from wrapper.configs import DirectoryConfig as dcfg -from wrapper.interfaces import IKernelBuilder +from builder.tools import cleaning as cm, commands as ccmd, fileoperations as fo, messages as msg +from builder.utils import ResourceManager +from builder.configs import DirectoryConfig as dcfg +from builder.interfaces import IKernelBuilder class KernelBuilder(BaseModel, IKernelBuilder): @@ -32,7 +32,7 @@ def __init__(self, **kwargs) -> None: @staticmethod def _write_localversion() -> None: - with open("localversion", "w") as f: + with open("localversion", "w", encoding="utf-8") as f: f.write("~zero-kernel") @property @@ -219,7 +219,7 @@ def _patch_strict_prototypes(self) -> None: # start the patching process contents = "" for fname, funcnames in data.items(): - with open(fname, "r") as f: + with open(fname, "r", encoding="utf-8") as f: contents = f.read() # replace: "()" -> "(void)" for func in funcnames: @@ -232,11 +232,11 @@ def _patch_anykernel3(self) -> None: cm.remove(self._rcs.paths["AnyKernel3"]["path"] / "ramdisk") cm.remove(self._rcs.paths["AnyKernel3"]["path"] / "models") fo.ucopy( - dcfg.root / "wrapper" / "modifications" / self._ucodename / "anykernel3" / "ramdisk", + dcfg.root / "builder" / "modifications" / self._ucodename / "anykernel3" / "ramdisk", self._rcs.paths["AnyKernel3"]["path"] / "ramdisk" ) fo.ucopy( - dcfg.root / "wrapper" / "modifications" / self._ucodename / "anykernel3" / "anykernel.sh", + dcfg.root / "builder" / "modifications" / self._ucodename / "anykernel3" / "anykernel.sh", self._rcs.paths["AnyKernel3"]["path"] / "anykernel.sh" ) @@ -323,14 +323,14 @@ def _patch_rtl8812au(self) -> None: "arm64" /\ "configs" /\ self._defconfig - with open(makefile, "a") as f: + with open(makefile, "a", encoding="utf-8") as f: f.write("obj-$(CONFIG_88XXAU) += rtl8812au/") fo.insert_before_line( kconfig, "endif", "source \"drivers/net/wireless/realtek/rtl8812au/Kconfig\"" ) - with open(defconfig, "a") as f: + with open(defconfig, "a", encoding="utf-8") as f: extra_configs = ( "CONFIG_88XXAU=y", "CONFIG_MODULE_FORCE_LOAD=y", @@ -368,7 +368,7 @@ def _patch_ksu(self) -> None: "drivers" /\ "kernelsu" ) - with open(makefile, "a") as f: + with open(makefile, "a", encoding="utf-8") as f: f.write("obj-$(CONFIG_KSU) += kernelsu/\n") fo.insert_before_line( kconfig, @@ -378,7 +378,7 @@ def _patch_ksu(self) -> None: # either patch kernel or KernelSU sources, depending on Linux kernel version target_dir = dcfg.root / "KernelSU" if self._linux_kernel_version == "4.14" else self._rcs.paths[self.codename]["path"] fo.ucopy( - dcfg.root / "wrapper" / "modifications" / self._ucodename / self._linux_kernel_version / "kernelsu-compat.patch", + dcfg.root / "builder" / "modifications" / self._ucodename / self._linux_kernel_version / "kernelsu-compat.patch", target_dir ) os.chdir(target_dir) @@ -390,7 +390,7 @@ def _patch_ksu(self) -> None: "arm64" /\ "configs" /\ self._defconfig - with open(defconfig, "a") as f: + with open(defconfig, "a", encoding="utf-8") as f: extra_configs = ( "CONFIG_KSU=y", "CONFIG_MODULES=y", @@ -407,7 +407,7 @@ def _patch_ksu(self) -> None: def _patch_qcacld(self) -> None: goback = Path.cwd() fo.ucopy( - dcfg.root / "wrapper" / "modifications" / self._ucodename / self._linux_kernel_version / "qcacld_pa.patch", + dcfg.root / "builder" / "modifications" / self._ucodename / self._linux_kernel_version / "qcacld_pa.patch", self._rcs.paths[self.codename]["path"] ) os.chdir(self._rcs.paths[self.codename]["path"]) @@ -436,7 +436,7 @@ def _patch_kernel(self) -> None: self._patch_strict_prototypes() # apply .patch files fo.ucopy( - dcfg.root / "wrapper" / "modifications" / self._ucodename / self._linux_kernel_version, + dcfg.root / "builder" / "modifications" / self._ucodename / self._linux_kernel_version, self._rcs.paths[self.codename]["path"], ("kernelsu-compat.patch", "qcacld_pa.patch") ) @@ -447,9 +447,9 @@ def _patch_kernel(self) -> None: data = "" files = ("tx.c", "mlme.c") for fn in files: - with open(Path("net", "mac80211", fn), "r") as f: + with open(Path("net", "mac80211", fn), "r", encoding="utf-8") as f: data = f.read().replace("case IEEE80211_BAND_60GHZ:", "case NL80211_BAND_60GHZ:") - with open(Path("net", "mac80211", fn), "w") as f: + with open(Path("net", "mac80211", fn), "w", encoding="utf-8") as f: f.write(data) # some patches only for ParanoidAndroid if self.base == "pa": @@ -511,7 +511,7 @@ def _build(self) -> None: def _linux_kernel_version(self) -> str: data = "" version = [] - with open(self._rcs.paths[self.codename]["path"] / "Makefile") as f: + with open(self._rcs.paths[self.codename]["path"] / "Makefile", encoding="utf-8") as f: data = f.read() params = ("VERSION", "PATCHLEVEL") # find the required lines in a single data run-through diff --git a/wrapper/engines/__init__.py b/builder/engines/__init__.py similarity index 100% rename from wrapper/engines/__init__.py rename to builder/engines/__init__.py diff --git a/wrapper/engines/container_engine.py b/builder/engines/container_engine.py similarity index 95% rename from wrapper/engines/container_engine.py rename to builder/engines/container_engine.py index 2cc2e88..5fbc776 100644 --- a/wrapper/engines/container_engine.py +++ b/builder/engines/container_engine.py @@ -5,9 +5,9 @@ from pydantic import BaseModel from subprocess import CompletedProcess -from wrapper.tools import commands as ccmd, messages as msg -from wrapper.configs import DirectoryConfig as dcfg -from wrapper.interfaces import IContainerEngine +from builder.tools import commands as ccmd, messages as msg +from builder.configs import DirectoryConfig as dcfg +from builder.interfaces import IContainerEngine class ContainerEngine(BaseModel, IContainerEngine): @@ -24,7 +24,7 @@ class ContainerEngine(BaseModel, IContainerEngine): :param wdir_container: Working directory in the container. :param wdir_local: Working directory from the local environment (aka root of the repo). :param benv: Build environment. - :param command: Wrapper command to be launched. + :param command: Builder command to be launched. :param codename: Device codename. :param base: Kernel source base. :param lkv: Linux kernel version. @@ -67,9 +67,9 @@ def dir_bundle_conan(self) -> Path: return res @property - def wrapper_cmd(self) -> str: + def builder_cmd(self) -> str: # prepare launch command - cmd = f"python3 {Path('wrapper', 'utils', 'bridge.py')}" + cmd = f"python3 {Path('builder', 'utils', 'bridge.py')}" arguments = { "--command": self.command, "--codename": self.codename, @@ -167,7 +167,7 @@ def run(self) -> None: self.benv, " ".join(self.container_options), self.name_image, - self.wrapper_cmd + self.builder_cmd ) # prepare directories self.create_dirs() diff --git a/wrapper/engines/docker_engine.py b/builder/engines/docker_engine.py similarity index 86% rename from wrapper/engines/docker_engine.py rename to builder/engines/docker_engine.py index 66f8252..0d8b6df 100644 --- a/wrapper/engines/docker_engine.py +++ b/builder/engines/docker_engine.py @@ -1,10 +1,10 @@ import os from typing import override -from wrapper.tools import commands as ccmd, messages as msg -from wrapper.interfaces import IDockerEngine +from builder.tools import commands as ccmd, messages as msg +from builder.interfaces import IDockerEngine -from wrapper.engines.container_engine import ContainerEngine +from builder.engines.container_engine import ContainerEngine class DockerEngine(ContainerEngine, IDockerEngine): @@ -33,7 +33,7 @@ def run(self) -> None: self.benv, " ".join(self.container_options), self.name_image, - self.wrapper_cmd + self.builder_cmd ) # prepare directories self.create_dirs() diff --git a/wrapper/engines/podman_engine.py b/builder/engines/podman_engine.py similarity index 51% rename from wrapper/engines/podman_engine.py rename to builder/engines/podman_engine.py index bdca03f..e49dfd7 100644 --- a/wrapper/engines/podman_engine.py +++ b/builder/engines/podman_engine.py @@ -1,4 +1,4 @@ -from wrapper.engines.container_engine import ContainerEngine +from builder.engines.container_engine import ContainerEngine class PodmanEngine(ContainerEngine): diff --git a/wrapper/interfaces/__init__.py b/builder/interfaces/__init__.py similarity index 100% rename from wrapper/interfaces/__init__.py rename to builder/interfaces/__init__.py diff --git a/wrapper/interfaces/clients.py b/builder/interfaces/clients.py similarity index 100% rename from wrapper/interfaces/clients.py rename to builder/interfaces/clients.py diff --git a/wrapper/interfaces/commands.py b/builder/interfaces/commands.py similarity index 100% rename from wrapper/interfaces/commands.py rename to builder/interfaces/commands.py diff --git a/wrapper/interfaces/engines.py b/builder/interfaces/engines.py similarity index 93% rename from wrapper/interfaces/engines.py rename to builder/interfaces/engines.py index eb94bd7..874fd78 100644 --- a/wrapper/interfaces/engines.py +++ b/builder/interfaces/engines.py @@ -12,8 +12,8 @@ def dir_bundle_conan(self) -> Path: raise NotImplementedError() @property - def wrapper_cmd(self) -> str: - """Return the launch command for the wrapper.""" + def builder_cmd(self) -> str: + """Return the launch command for the builder.""" raise NotImplementedError() @property diff --git a/wrapper/interfaces/modules.py b/builder/interfaces/modules.py similarity index 98% rename from wrapper/interfaces/modules.py rename to builder/interfaces/modules.py index aa56663..223d93c 100644 --- a/wrapper/interfaces/modules.py +++ b/builder/interfaces/modules.py @@ -1,7 +1,7 @@ from pathlib import Path from abc import ABC, abstractmethod -from wrapper.clients import LineageOsApi, ParanoidAndroidApi +from builder.clients import LineageOsApi, ParanoidAndroidApi class IKernelBuilder(ABC): diff --git a/wrapper/manifests/devices.json b/builder/manifests/devices.json similarity index 100% rename from wrapper/manifests/devices.json rename to builder/manifests/devices.json diff --git a/wrapper/manifests/tools.json b/builder/manifests/tools.json similarity index 97% rename from wrapper/manifests/tools.json rename to builder/manifests/tools.json index 3db4244..2bf1166 100644 --- a/wrapper/manifests/tools.json +++ b/builder/manifests/tools.json @@ -29,7 +29,7 @@ "type": "git", "path": "KernelSU", "url": "https://github.com/tiann/KernelSU", - "branch": "v0.8.1", + "branch": "v0.9.2", "commit": "" } } diff --git a/wrapper/modifications/dumplinger/4.14/add-wifi-injection-4.14.patch b/builder/modifications/dumplinger/4.14/add-wifi-injection-4.14.patch similarity index 100% rename from wrapper/modifications/dumplinger/4.14/add-wifi-injection-4.14.patch rename to builder/modifications/dumplinger/4.14/add-wifi-injection-4.14.patch diff --git a/wrapper/modifications/dumplinger/4.14/fix-ath9k-naming-conflict.patch b/builder/modifications/dumplinger/4.14/fix-ath9k-naming-conflict.patch similarity index 100% rename from wrapper/modifications/dumplinger/4.14/fix-ath9k-naming-conflict.patch rename to builder/modifications/dumplinger/4.14/fix-ath9k-naming-conflict.patch diff --git a/wrapper/modifications/dumplinger/4.14/kernelsu-compat.patch b/builder/modifications/dumplinger/4.14/kernelsu-compat.patch similarity index 100% rename from wrapper/modifications/dumplinger/4.14/kernelsu-compat.patch rename to builder/modifications/dumplinger/4.14/kernelsu-compat.patch diff --git a/wrapper/modifications/dumplinger/4.4/add-wifi-injection-4.4.patch b/builder/modifications/dumplinger/4.4/add-wifi-injection-4.4.patch similarity index 100% rename from wrapper/modifications/dumplinger/4.4/add-wifi-injection-4.4.patch rename to builder/modifications/dumplinger/4.4/add-wifi-injection-4.4.patch diff --git a/wrapper/modifications/dumplinger/4.4/fix-ath9k-naming-conflict.patch b/builder/modifications/dumplinger/4.4/fix-ath9k-naming-conflict.patch similarity index 100% rename from wrapper/modifications/dumplinger/4.4/fix-ath9k-naming-conflict.patch rename to builder/modifications/dumplinger/4.4/fix-ath9k-naming-conflict.patch diff --git a/wrapper/modifications/dumplinger/4.4/fix-hci-uart.patch b/builder/modifications/dumplinger/4.4/fix-hci-uart.patch similarity index 100% rename from wrapper/modifications/dumplinger/4.4/fix-hci-uart.patch rename to builder/modifications/dumplinger/4.4/fix-hci-uart.patch diff --git a/wrapper/modifications/dumplinger/4.4/fix-rt2800-injection-4.04.patch b/builder/modifications/dumplinger/4.4/fix-rt2800-injection-4.04.patch similarity index 100% rename from wrapper/modifications/dumplinger/4.4/fix-rt2800-injection-4.04.patch rename to builder/modifications/dumplinger/4.4/fix-rt2800-injection-4.04.patch diff --git a/wrapper/modifications/dumplinger/4.4/kernelsu-compat.patch b/builder/modifications/dumplinger/4.4/kernelsu-compat.patch similarity index 100% rename from wrapper/modifications/dumplinger/4.4/kernelsu-compat.patch rename to builder/modifications/dumplinger/4.4/kernelsu-compat.patch diff --git a/wrapper/modifications/dumplinger/4.4/qcacld_pa.patch b/builder/modifications/dumplinger/4.4/qcacld_pa.patch similarity index 100% rename from wrapper/modifications/dumplinger/4.4/qcacld_pa.patch rename to builder/modifications/dumplinger/4.4/qcacld_pa.patch diff --git a/wrapper/modifications/dumplinger/4.4/v2-2-6-mac80211-refactor-monitor-representation-in-sdata.patch b/builder/modifications/dumplinger/4.4/v2-2-6-mac80211-refactor-monitor-representation-in-sdata.patch similarity index 100% rename from wrapper/modifications/dumplinger/4.4/v2-2-6-mac80211-refactor-monitor-representation-in-sdata.patch rename to builder/modifications/dumplinger/4.4/v2-2-6-mac80211-refactor-monitor-representation-in-sdata.patch diff --git a/wrapper/modifications/dumplinger/anykernel3/anykernel.sh b/builder/modifications/dumplinger/anykernel3/anykernel.sh old mode 100755 new mode 100644 similarity index 100% rename from wrapper/modifications/dumplinger/anykernel3/anykernel.sh rename to builder/modifications/dumplinger/anykernel3/anykernel.sh diff --git a/wrapper/modifications/dumplinger/anykernel3/ramdisk/init.nethunter.rc b/builder/modifications/dumplinger/anykernel3/ramdisk/init.nethunter.rc old mode 100755 new mode 100644 similarity index 100% rename from wrapper/modifications/dumplinger/anykernel3/ramdisk/init.nethunter.rc rename to builder/modifications/dumplinger/anykernel3/ramdisk/init.nethunter.rc diff --git a/wrapper/modifications/dumplinger/anykernel3/ramdisk/keyboard-descriptor.bin b/builder/modifications/dumplinger/anykernel3/ramdisk/keyboard-descriptor.bin old mode 100755 new mode 100644 similarity index 100% rename from wrapper/modifications/dumplinger/anykernel3/ramdisk/keyboard-descriptor.bin rename to builder/modifications/dumplinger/anykernel3/ramdisk/keyboard-descriptor.bin diff --git a/wrapper/modifications/dumplinger/anykernel3/ramdisk/mouse-descriptor.bin b/builder/modifications/dumplinger/anykernel3/ramdisk/mouse-descriptor.bin old mode 100755 new mode 100644 similarity index 100% rename from wrapper/modifications/dumplinger/anykernel3/ramdisk/mouse-descriptor.bin rename to builder/modifications/dumplinger/anykernel3/ramdisk/mouse-descriptor.bin diff --git a/wrapper/modifications/gki/.gitkeep b/builder/modifications/gki/.gitkeep similarity index 100% rename from wrapper/modifications/gki/.gitkeep rename to builder/modifications/gki/.gitkeep diff --git a/wrapper/modifications/lemonade/5.4/.gitkeep b/builder/modifications/lemonade/5.4/.gitkeep similarity index 100% rename from wrapper/modifications/lemonade/5.4/.gitkeep rename to builder/modifications/lemonade/5.4/.gitkeep diff --git a/wrapper/modifications/lemonadep/5.4/.gitkeep b/builder/modifications/lemonadep/5.4/.gitkeep similarity index 100% rename from wrapper/modifications/lemonadep/5.4/.gitkeep rename to builder/modifications/lemonadep/5.4/.gitkeep diff --git a/wrapper/modifications/nhpatch.sh b/builder/modifications/nhpatch.sh similarity index 100% rename from wrapper/modifications/nhpatch.sh rename to builder/modifications/nhpatch.sh diff --git a/wrapper/tools/__init__.py b/builder/tools/__init__.py similarity index 100% rename from wrapper/tools/__init__.py rename to builder/tools/__init__.py diff --git a/wrapper/tools/cleaning.py b/builder/tools/cleaning.py old mode 100755 new mode 100644 similarity index 95% rename from wrapper/tools/cleaning.py rename to builder/tools/cleaning.py index f42dbcf..08ce767 --- a/wrapper/tools/cleaning.py +++ b/builder/tools/cleaning.py @@ -5,8 +5,8 @@ from pathlib import Path from typing import Optional -from wrapper.tools import commands as ccmd -from wrapper.configs import DirectoryConfig as dcfg +from builder.tools import commands as ccmd +from builder.configs import DirectoryConfig as dcfg def remove(elements: str | Path | list[Path]) -> None: diff --git a/wrapper/tools/commands.py b/builder/tools/commands.py old mode 100755 new mode 100644 similarity index 81% rename from wrapper/tools/commands.py rename to builder/tools/commands.py index f90ea60..f99ab59 --- a/wrapper/tools/commands.py +++ b/builder/tools/commands.py @@ -1,17 +1,17 @@ import os import subprocess +from typing import Optional from subprocess import CompletedProcess -from wrapper.tools import messages as msg +from builder.tools import messages as msg def launch( cmd: str, - get_output: bool = False, + get_output: Optional[bool] = False, loglvl: str = os.getenv("LOGLEVEL", "normal") - ) -> str | CompletedProcess: - """ - A custom subprocess wrapper to launch commands. + ) -> str | CompletedProcess | None: + """A custom subprocess wrapper to launch commands. :param cmd: A command to launch. :param get_output: A switch to get the piped output of the command. @@ -28,12 +28,11 @@ def launch( msg.error("Cannot run 'quiet' build with file logging") elif loglvl == "verbose": print(f"[cmd] {cmd}") - # avoid using shell try: result = subprocess.run(cmd, shell=True, check=True, stdout=cstdout, stderr=subprocess.STDOUT) # return only output if required if get_output is True: - result = result.stdout.decode('utf-8').rstrip() + result = result.stdout.decode("utf-8").rstrip() except Exception: msg.error(f"Error executing command: {cmd}") # if output stream is a file -- close it diff --git a/wrapper/tools/fileoperations.py b/builder/tools/fileoperations.py similarity index 90% rename from wrapper/tools/fileoperations.py rename to builder/tools/fileoperations.py index b4ed0ca..1d99574 100644 --- a/wrapper/tools/fileoperations.py +++ b/builder/tools/fileoperations.py @@ -4,7 +4,7 @@ from typing import Tuple from pathlib import Path -from wrapper.tools import commands as ccmd, messages as msg +from builder.tools import commands as ccmd, messages as msg def ucopy(src: Path, dst: Path, exceptions: Tuple[str] = ()) -> None: @@ -49,7 +49,7 @@ def download(url: str) -> None: else: with requests.get(url, stream=True, headers={"referer": url}) as r: r.raise_for_status() - with open(fn, 'wb') as f: + with open(fn, "wb", encoding="utf-8") as f: for chunk in r.iter_content(chunk_size=8192): f.write(chunk) except Exception: @@ -65,8 +65,8 @@ def replace_lines(filename: Path, og_lines: Tuple[str], nw_lines: Tuple[str]) -> :param nw_lines: New lines in place of original lines. """ filename_new = Path(str(filename) + "_new") - with open(filename) as data: - with open(filename_new, 'w') as new_data: + with open(filename, encoding="utf-8") as data: + with open(filename_new, "w", encoding="utf-8") as new_data: for line in data: for indx, key in enumerate(og_lines): if key in line: @@ -85,8 +85,8 @@ def replace_nth(filename: Path, og_string: str, nw_string: str, occurence: int) :param occurence: The index of occurence to replace. """ filename_new = Path(str(filename) + "_new") - with open(filename) as data: - with open(filename_new, 'w') as new_data: + with open(filename, encoding="utf-8") as data: + with open(filename_new, "w", encoding="utf-8") as new_data: counter = 0 for line in data: if og_string in line: @@ -105,7 +105,7 @@ def insert_before_line(filename: str, pointer_line: str, new_line: str) -> None: :param pointer_line: The line before which new line will be inserted. :param new_line: The line being inserted. """ - with open(filename, "r+") as f: + with open(filename, "r+", encoding="utf-8") as f: a = [x.rstrip() for x in f] index = 0 for item in a: diff --git a/wrapper/tools/messages.py b/builder/tools/messages.py similarity index 100% rename from wrapper/tools/messages.py rename to builder/tools/messages.py diff --git a/wrapper/utils/__init__.py b/builder/utils/__init__.py similarity index 100% rename from wrapper/utils/__init__.py rename to builder/utils/__init__.py diff --git a/wrapper/utils/bridge.py b/builder/utils/bridge.py similarity index 94% rename from wrapper/utils/bridge.py rename to builder/utils/bridge.py index b69a5ca..56cbfca 100644 --- a/wrapper/utils/bridge.py +++ b/builder/utils/bridge.py @@ -1,9 +1,9 @@ import sys import argparse -from wrapper.tools import messages as msg -from wrapper.utils import ResourceManager -from wrapper.commands import KernelCommand, AssetsCommand, BundleCommand +from builder.tools import messages as msg +from builder.utils import ResourceManager +from builder.commands import KernelCommand, AssetsCommand, BundleCommand def parse_args() -> argparse.Namespace: @@ -20,7 +20,7 @@ def parse_args() -> argparse.Namespace: args = None if sys.argv[1:] else ["-h"] parser.add_argument( "--command", - help="select wrapper command", + help="select builder command", choices=("kernel", "assets", "bundle") ) parser.add_argument( diff --git a/wrapper/utils/resource_manager.py b/builder/utils/resource_manager.py similarity index 93% rename from wrapper/utils/resource_manager.py rename to builder/utils/resource_manager.py index 5598675..3b398bf 100644 --- a/wrapper/utils/resource_manager.py +++ b/builder/utils/resource_manager.py @@ -3,8 +3,8 @@ import tarfile from typing import Optional -from wrapper.tools import cleaning as cm, commands as ccmd, fileoperations as fo, messages as msg -from wrapper.configs import DirectoryConfig as dcfg +from builder.tools import cleaning as cm, commands as ccmd, fileoperations as fo, messages as msg +from builder.configs import DirectoryConfig as dcfg class ResourceManager: @@ -29,11 +29,11 @@ def path_gen(self) -> dict[str]: tools = "" device = "" # load JSON data - with open(dcfg.root / "wrapper" / "manifests" / "tools.json") as f: + with open(dcfg.root / "builder" / "manifests" / "tools.json", encoding="utf-8") as f: tools = json.load(f) # codename and ROM are undefined only when the Docker/Podman image is being prepared if self._codename and self._base: - with open(dcfg.root / "wrapper" / "manifests" / "devices.json") as f: + with open(dcfg.root / "builder" / "manifests" / "devices.json", encoding="utf-8") as f: data = json.load(f) # load data only for the required codename + linux kernel version combination try: diff --git a/conanfile.py b/conanfile.py index 05b1b9e..38ad0c0 100644 --- a/conanfile.py +++ b/conanfile.py @@ -25,8 +25,8 @@ def build(self): self.options.codename, self.options.chroot ) - cmd = "python3 wrapper kernel {0} &&"\ - "python3 wrapper assets {0} --clean"\ + cmd = "python3 builder kernel {0} &&"\ + "python3 builder assets {0} --clean"\ .format(shared_args) print(f"[cmd] {cmd}") self.run(cmd) diff --git a/docs/FLASHING.md b/docs/FLASHING.md index 29c9b0b..6296171 100755 --- a/docs/FLASHING.md +++ b/docs/FLASHING.md @@ -29,7 +29,7 @@ Listed below files are required: - Kali NetHunter Chroot (you can do this later, but it would be easier to download this beforehand); - ~~`nhpatch.sh` script from this repo (fixes NetHunter permissions for Android 12+)~~ with recent NetHunter app versions, `nhpatch.sh` usage is no longer required. -Currently, all of the mentioned assets can be collected via the `assets` subcommand in the wrapper (use `full` option). +Currently, all of the mentioned assets can be collected via the `assets` subcommand (use `full` option). ## **2. Flashing** diff --git a/docs/TODO.md b/docs/TODO.md index 995f2fe..2f904c6 100755 --- a/docs/TODO.md +++ b/docs/TODO.md @@ -64,4 +64,5 @@ - [ ] consider creating a separate "errors" subpackage for all errors; - [ ] add GKI kernels support; - [ ] separate "standard" kernel building from NetHunter-specific modifications; -- [ ] add a differentiator/parameter to indicate whether the specified kernel source already has NetHunter patches. +- [ ] add a differentiator/parameter to indicate whether the specified kernel source already has NetHunter patches; +- [ ] use logging facility for logs. diff --git a/poetry.lock b/poetry.lock index 8beccbd..aa1cfc7 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.7.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.8.2 and should not be changed by hand. [[package]] name = "annotated-types" @@ -180,12 +180,12 @@ files = [ [[package]] name = "conan" -version = "1.63.0" +version = "1.64.0" description = "Conan C/C++ package manager" optional = false python-versions = ">=3.6" files = [ - {file = "conan-1.63.0.tar.gz", hash = "sha256:4e2b8da8a68d18bc85e3f7512f72c2326a4806c352c5bd8affae667119de3704"}, + {file = "conan-1.64.0.tar.gz", hash = "sha256:0f9694f98d3fb9b62ca5869cd41c4cbd0434c5f5d9fb2da52e8a6f6b44300157"}, ] [package.dependencies] @@ -212,63 +212,63 @@ test = ["WebTest (>=2.0.18,<2.1.0)", "bottle", "mock (>=1.3.0,<1.4.0)", "paramet [[package]] name = "coverage" -version = "7.4.3" +version = "7.4.4" description = "Code coverage measurement for Python" optional = false python-versions = ">=3.8" files = [ - {file = "coverage-7.4.3-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:8580b827d4746d47294c0e0b92854c85a92c2227927433998f0d3320ae8a71b6"}, - {file = "coverage-7.4.3-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:718187eeb9849fc6cc23e0d9b092bc2348821c5e1a901c9f8975df0bc785bfd4"}, - {file = "coverage-7.4.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:767b35c3a246bcb55b8044fd3a43b8cd553dd1f9f2c1eeb87a302b1f8daa0524"}, - {file = "coverage-7.4.3-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ae7f19afe0cce50039e2c782bff379c7e347cba335429678450b8fe81c4ef96d"}, - {file = "coverage-7.4.3-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ba3a8aaed13770e970b3df46980cb068d1c24af1a1968b7818b69af8c4347efb"}, - {file = "coverage-7.4.3-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:ee866acc0861caebb4f2ab79f0b94dbfbdbfadc19f82e6e9c93930f74e11d7a0"}, - {file = "coverage-7.4.3-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:506edb1dd49e13a2d4cac6a5173317b82a23c9d6e8df63efb4f0380de0fbccbc"}, - {file = "coverage-7.4.3-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:fd6545d97c98a192c5ac995d21c894b581f1fd14cf389be90724d21808b657e2"}, - {file = "coverage-7.4.3-cp310-cp310-win32.whl", hash = "sha256:f6a09b360d67e589236a44f0c39218a8efba2593b6abdccc300a8862cffc2f94"}, - {file = "coverage-7.4.3-cp310-cp310-win_amd64.whl", hash = "sha256:18d90523ce7553dd0b7e23cbb28865db23cddfd683a38fb224115f7826de78d0"}, - {file = "coverage-7.4.3-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:cbbe5e739d45a52f3200a771c6d2c7acf89eb2524890a4a3aa1a7fa0695d2a47"}, - {file = "coverage-7.4.3-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:489763b2d037b164846ebac0cbd368b8a4ca56385c4090807ff9fad817de4113"}, - {file = "coverage-7.4.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:451f433ad901b3bb00184d83fd83d135fb682d780b38af7944c9faeecb1e0bfe"}, - {file = "coverage-7.4.3-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:fcc66e222cf4c719fe7722a403888b1f5e1682d1679bd780e2b26c18bb648cdc"}, - {file = "coverage-7.4.3-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b3ec74cfef2d985e145baae90d9b1b32f85e1741b04cd967aaf9cfa84c1334f3"}, - {file = "coverage-7.4.3-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:abbbd8093c5229c72d4c2926afaee0e6e3140de69d5dcd918b2921f2f0c8baba"}, - {file = "coverage-7.4.3-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:35eb581efdacf7b7422af677b92170da4ef34500467381e805944a3201df2079"}, - {file = "coverage-7.4.3-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:8249b1c7334be8f8c3abcaaa996e1e4927b0e5a23b65f5bf6cfe3180d8ca7840"}, - {file = "coverage-7.4.3-cp311-cp311-win32.whl", hash = "sha256:cf30900aa1ba595312ae41978b95e256e419d8a823af79ce670835409fc02ad3"}, - {file = "coverage-7.4.3-cp311-cp311-win_amd64.whl", hash = "sha256:18c7320695c949de11a351742ee001849912fd57e62a706d83dfc1581897fa2e"}, - {file = "coverage-7.4.3-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:b51bfc348925e92a9bd9b2e48dad13431b57011fd1038f08316e6bf1df107d10"}, - {file = "coverage-7.4.3-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:d6cdecaedea1ea9e033d8adf6a0ab11107b49571bbb9737175444cea6eb72328"}, - {file = "coverage-7.4.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3b2eccb883368f9e972e216c7b4c7c06cabda925b5f06dde0650281cb7666a30"}, - {file = "coverage-7.4.3-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:6c00cdc8fa4e50e1cc1f941a7f2e3e0f26cb2a1233c9696f26963ff58445bac7"}, - {file = "coverage-7.4.3-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b9a4a8dd3dcf4cbd3165737358e4d7dfbd9d59902ad11e3b15eebb6393b0446e"}, - {file = "coverage-7.4.3-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:062b0a75d9261e2f9c6d071753f7eef0fc9caf3a2c82d36d76667ba7b6470003"}, - {file = "coverage-7.4.3-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:ebe7c9e67a2d15fa97b77ea6571ce5e1e1f6b0db71d1d5e96f8d2bf134303c1d"}, - {file = "coverage-7.4.3-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:c0a120238dd71c68484f02562f6d446d736adcc6ca0993712289b102705a9a3a"}, - {file = "coverage-7.4.3-cp312-cp312-win32.whl", hash = "sha256:37389611ba54fd6d278fde86eb2c013c8e50232e38f5c68235d09d0a3f8aa352"}, - {file = "coverage-7.4.3-cp312-cp312-win_amd64.whl", hash = "sha256:d25b937a5d9ffa857d41be042b4238dd61db888533b53bc76dc082cb5a15e914"}, - {file = "coverage-7.4.3-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:28ca2098939eabab044ad68850aac8f8db6bf0b29bc7f2887d05889b17346454"}, - {file = "coverage-7.4.3-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:280459f0a03cecbe8800786cdc23067a8fc64c0bd51dc614008d9c36e1659d7e"}, - {file = "coverage-7.4.3-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6c0cdedd3500e0511eac1517bf560149764b7d8e65cb800d8bf1c63ebf39edd2"}, - {file = "coverage-7.4.3-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:9a9babb9466fe1da12417a4aed923e90124a534736de6201794a3aea9d98484e"}, - {file = "coverage-7.4.3-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:dec9de46a33cf2dd87a5254af095a409ea3bf952d85ad339751e7de6d962cde6"}, - {file = "coverage-7.4.3-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:16bae383a9cc5abab9bb05c10a3e5a52e0a788325dc9ba8499e821885928968c"}, - {file = "coverage-7.4.3-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:2c854ce44e1ee31bda4e318af1dbcfc929026d12c5ed030095ad98197eeeaed0"}, - {file = "coverage-7.4.3-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:ce8c50520f57ec57aa21a63ea4f325c7b657386b3f02ccaedeccf9ebe27686e1"}, - {file = "coverage-7.4.3-cp38-cp38-win32.whl", hash = "sha256:708a3369dcf055c00ddeeaa2b20f0dd1ce664eeabde6623e516c5228b753654f"}, - {file = "coverage-7.4.3-cp38-cp38-win_amd64.whl", hash = "sha256:1bf25fbca0c8d121a3e92a2a0555c7e5bc981aee5c3fdaf4bb7809f410f696b9"}, - {file = "coverage-7.4.3-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:3b253094dbe1b431d3a4ac2f053b6d7ede2664ac559705a704f621742e034f1f"}, - {file = "coverage-7.4.3-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:77fbfc5720cceac9c200054b9fab50cb2a7d79660609200ab83f5db96162d20c"}, - {file = "coverage-7.4.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6679060424faa9c11808598504c3ab472de4531c571ab2befa32f4971835788e"}, - {file = "coverage-7.4.3-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:4af154d617c875b52651dd8dd17a31270c495082f3d55f6128e7629658d63765"}, - {file = "coverage-7.4.3-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8640f1fde5e1b8e3439fe482cdc2b0bb6c329f4bb161927c28d2e8879c6029ee"}, - {file = "coverage-7.4.3-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:69b9f6f66c0af29642e73a520b6fed25ff9fd69a25975ebe6acb297234eda501"}, - {file = "coverage-7.4.3-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:0842571634f39016a6c03e9d4aba502be652a6e4455fadb73cd3a3a49173e38f"}, - {file = "coverage-7.4.3-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:a78ed23b08e8ab524551f52953a8a05d61c3a760781762aac49f8de6eede8c45"}, - {file = "coverage-7.4.3-cp39-cp39-win32.whl", hash = "sha256:c0524de3ff096e15fcbfe8f056fdb4ea0bf497d584454f344d59fce069d3e6e9"}, - {file = "coverage-7.4.3-cp39-cp39-win_amd64.whl", hash = "sha256:0209a6369ccce576b43bb227dc8322d8ef9e323d089c6f3f26a597b09cb4d2aa"}, - {file = "coverage-7.4.3-pp38.pp39.pp310-none-any.whl", hash = "sha256:7cbde573904625509a3f37b6fecea974e363460b556a627c60dc2f47e2fffa51"}, - {file = "coverage-7.4.3.tar.gz", hash = "sha256:276f6077a5c61447a48d133ed13e759c09e62aff0dc84274a68dc18660104d52"}, + {file = "coverage-7.4.4-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:e0be5efd5127542ef31f165de269f77560d6cdef525fffa446de6f7e9186cfb2"}, + {file = "coverage-7.4.4-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:ccd341521be3d1b3daeb41960ae94a5e87abe2f46f17224ba5d6f2b8398016cf"}, + {file = "coverage-7.4.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:09fa497a8ab37784fbb20ab699c246053ac294d13fc7eb40ec007a5043ec91f8"}, + {file = "coverage-7.4.4-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b1a93009cb80730c9bca5d6d4665494b725b6e8e157c1cb7f2db5b4b122ea562"}, + {file = "coverage-7.4.4-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:690db6517f09336559dc0b5f55342df62370a48f5469fabf502db2c6d1cffcd2"}, + {file = "coverage-7.4.4-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:09c3255458533cb76ef55da8cc49ffab9e33f083739c8bd4f58e79fecfe288f7"}, + {file = "coverage-7.4.4-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:8ce1415194b4a6bd0cdcc3a1dfbf58b63f910dcb7330fe15bdff542c56949f87"}, + {file = "coverage-7.4.4-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:b91cbc4b195444e7e258ba27ac33769c41b94967919f10037e6355e998af255c"}, + {file = "coverage-7.4.4-cp310-cp310-win32.whl", hash = "sha256:598825b51b81c808cb6f078dcb972f96af96b078faa47af7dfcdf282835baa8d"}, + {file = "coverage-7.4.4-cp310-cp310-win_amd64.whl", hash = "sha256:09ef9199ed6653989ebbcaacc9b62b514bb63ea2f90256e71fea3ed74bd8ff6f"}, + {file = "coverage-7.4.4-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:0f9f50e7ef2a71e2fae92774c99170eb8304e3fdf9c8c3c7ae9bab3e7229c5cf"}, + {file = "coverage-7.4.4-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:623512f8ba53c422fcfb2ce68362c97945095b864cda94a92edbaf5994201083"}, + {file = "coverage-7.4.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0513b9508b93da4e1716744ef6ebc507aff016ba115ffe8ecff744d1322a7b63"}, + {file = "coverage-7.4.4-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:40209e141059b9370a2657c9b15607815359ab3ef9918f0196b6fccce8d3230f"}, + {file = "coverage-7.4.4-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8a2b2b78c78293782fd3767d53e6474582f62443d0504b1554370bde86cc8227"}, + {file = "coverage-7.4.4-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:73bfb9c09951125d06ee473bed216e2c3742f530fc5acc1383883125de76d9cd"}, + {file = "coverage-7.4.4-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:1f384c3cc76aeedce208643697fb3e8437604b512255de6d18dae3f27655a384"}, + {file = "coverage-7.4.4-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:54eb8d1bf7cacfbf2a3186019bcf01d11c666bd495ed18717162f7eb1e9dd00b"}, + {file = "coverage-7.4.4-cp311-cp311-win32.whl", hash = "sha256:cac99918c7bba15302a2d81f0312c08054a3359eaa1929c7e4b26ebe41e9b286"}, + {file = "coverage-7.4.4-cp311-cp311-win_amd64.whl", hash = "sha256:b14706df8b2de49869ae03a5ccbc211f4041750cd4a66f698df89d44f4bd30ec"}, + {file = "coverage-7.4.4-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:201bef2eea65e0e9c56343115ba3814e896afe6d36ffd37bab783261db430f76"}, + {file = "coverage-7.4.4-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:41c9c5f3de16b903b610d09650e5e27adbfa7f500302718c9ffd1c12cf9d6818"}, + {file = "coverage-7.4.4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d898fe162d26929b5960e4e138651f7427048e72c853607f2b200909794ed978"}, + {file = "coverage-7.4.4-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3ea79bb50e805cd6ac058dfa3b5c8f6c040cb87fe83de10845857f5535d1db70"}, + {file = "coverage-7.4.4-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ce4b94265ca988c3f8e479e741693d143026632672e3ff924f25fab50518dd51"}, + {file = "coverage-7.4.4-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:00838a35b882694afda09f85e469c96367daa3f3f2b097d846a7216993d37f4c"}, + {file = "coverage-7.4.4-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:fdfafb32984684eb03c2d83e1e51f64f0906b11e64482df3c5db936ce3839d48"}, + {file = "coverage-7.4.4-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:69eb372f7e2ece89f14751fbcbe470295d73ed41ecd37ca36ed2eb47512a6ab9"}, + {file = "coverage-7.4.4-cp312-cp312-win32.whl", hash = "sha256:137eb07173141545e07403cca94ab625cc1cc6bc4c1e97b6e3846270e7e1fea0"}, + {file = "coverage-7.4.4-cp312-cp312-win_amd64.whl", hash = "sha256:d71eec7d83298f1af3326ce0ff1d0ea83c7cb98f72b577097f9083b20bdaf05e"}, + {file = "coverage-7.4.4-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:d5ae728ff3b5401cc320d792866987e7e7e880e6ebd24433b70a33b643bb0384"}, + {file = "coverage-7.4.4-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:cc4f1358cb0c78edef3ed237ef2c86056206bb8d9140e73b6b89fbcfcbdd40e1"}, + {file = "coverage-7.4.4-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8130a2aa2acb8788e0b56938786c33c7c98562697bf9f4c7d6e8e5e3a0501e4a"}, + {file = "coverage-7.4.4-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:cf271892d13e43bc2b51e6908ec9a6a5094a4df1d8af0bfc360088ee6c684409"}, + {file = "coverage-7.4.4-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a4cdc86d54b5da0df6d3d3a2f0b710949286094c3a6700c21e9015932b81447e"}, + {file = "coverage-7.4.4-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:ae71e7ddb7a413dd60052e90528f2f65270aad4b509563af6d03d53e979feafd"}, + {file = "coverage-7.4.4-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:38dd60d7bf242c4ed5b38e094baf6401faa114fc09e9e6632374388a404f98e7"}, + {file = "coverage-7.4.4-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:aa5b1c1bfc28384f1f53b69a023d789f72b2e0ab1b3787aae16992a7ca21056c"}, + {file = "coverage-7.4.4-cp38-cp38-win32.whl", hash = "sha256:dfa8fe35a0bb90382837b238fff375de15f0dcdb9ae68ff85f7a63649c98527e"}, + {file = "coverage-7.4.4-cp38-cp38-win_amd64.whl", hash = "sha256:b2991665420a803495e0b90a79233c1433d6ed77ef282e8e152a324bbbc5e0c8"}, + {file = "coverage-7.4.4-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:3b799445b9f7ee8bf299cfaed6f5b226c0037b74886a4e11515e569b36fe310d"}, + {file = "coverage-7.4.4-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:b4d33f418f46362995f1e9d4f3a35a1b6322cb959c31d88ae56b0298e1c22357"}, + {file = "coverage-7.4.4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:aadacf9a2f407a4688d700e4ebab33a7e2e408f2ca04dbf4aef17585389eff3e"}, + {file = "coverage-7.4.4-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7c95949560050d04d46b919301826525597f07b33beba6187d04fa64d47ac82e"}, + {file = "coverage-7.4.4-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ff7687ca3d7028d8a5f0ebae95a6e4827c5616b31a4ee1192bdfde697db110d4"}, + {file = "coverage-7.4.4-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:5fc1de20b2d4a061b3df27ab9b7c7111e9a710f10dc2b84d33a4ab25065994ec"}, + {file = "coverage-7.4.4-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:c74880fc64d4958159fbd537a091d2a585448a8f8508bf248d72112723974cbd"}, + {file = "coverage-7.4.4-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:742a76a12aa45b44d236815d282b03cfb1de3b4323f3e4ec933acfae08e54ade"}, + {file = "coverage-7.4.4-cp39-cp39-win32.whl", hash = "sha256:d89d7b2974cae412400e88f35d86af72208e1ede1a541954af5d944a8ba46c57"}, + {file = "coverage-7.4.4-cp39-cp39-win_amd64.whl", hash = "sha256:9ca28a302acb19b6af89e90f33ee3e1906961f94b54ea37de6737b7ca9d8827c"}, + {file = "coverage-7.4.4-pp38.pp39.pp310-none-any.whl", hash = "sha256:b2c5edc4ac10a7ef6605a966c58929ec6c1bd0917fb8c15cb3363f65aa40e677"}, + {file = "coverage-7.4.4.tar.gz", hash = "sha256:c901df83d097649e257e803be22592aedfd5182f07b3cc87d640bbb9afd50f49"}, ] [package.extras] @@ -679,13 +679,13 @@ tests = ["coverage[toml] (==5.0.4)", "pytest (>=6.0.0,<7.0.0)"] [[package]] name = "pyright" -version = "1.1.353" +version = "1.1.357" description = "Command line wrapper for pyright" optional = false python-versions = ">=3.7" files = [ - {file = "pyright-1.1.353-py3-none-any.whl", hash = "sha256:8d7e6719d0be4fd9f4a37f010237c6a74d91ec1e7c81de634c2f3f9965f8ab43"}, - {file = "pyright-1.1.353.tar.gz", hash = "sha256:24343bbc2a4f997563f966b6244a2e863473f1d85af6d24abcb366fcbb4abca9"}, + {file = "pyright-1.1.357-py3-none-any.whl", hash = "sha256:1cf29ee38e4928131895cd8e90eef37b5b77e2ed72a14e6e8e2405266f5f0aca"}, + {file = "pyright-1.1.357.tar.gz", hash = "sha256:7c66261116c78c5fa9629134fe85c54cc5302ab73e376be4b0a99d89c80a9403"}, ] [package.dependencies] @@ -920,13 +920,13 @@ files = [ [[package]] name = "typing-extensions" -version = "4.10.0" +version = "4.11.0" description = "Backported and Experimental Type Hints for Python 3.8+" optional = false python-versions = ">=3.8" files = [ - {file = "typing_extensions-4.10.0-py3-none-any.whl", hash = "sha256:69b1a937c3a517342112fb4c6df7e72fc39a38e7891a5730ed4985b5214b5475"}, - {file = "typing_extensions-4.10.0.tar.gz", hash = "sha256:b0abd7c89e8fb96f98db18d86106ff1d90ab692004eb746cf6eda2682f91b3cb"}, + {file = "typing_extensions-4.11.0-py3-none-any.whl", hash = "sha256:c1f94d72897edaf4ce775bb7558d5b79d8126906a14ea5ed1635921406c0387a"}, + {file = "typing_extensions-4.11.0.tar.gz", hash = "sha256:83f085bd5ca59c80295fc2a82ab5dac679cbe02b9f33f7d83af68e241bea51b0"}, ] [[package]] diff --git a/pyproject.toml b/pyproject.toml index 21875c6..1716d6f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,10 +1,10 @@ [tool.poetry] name = "zero-kernel" -version = "0.4.2" +version = "0.4.3" description = "An advanced Android kernel builder with Kali NetHunter support." authors = ["seppzer0"] readme = "README.md" -packages = [{include = "wrapper"}] +packages = [{include = "builder"}] [tool.poetry.dependencies] python = "^3.12" @@ -23,11 +23,11 @@ pyright = "^1.1" [tool.coverage.run] source = [ - "wrapper/clients", - "wrapper/commands", - "wrapper/configs", - "wrapper/engines", - "wrapper/utils" + "builder/clients", + "builder/commands", + "builder/configs", + "builder/engines", + "builder/utils" ] [tool.coverage.report] diff --git a/scripts/get_version.py b/scripts/get_version.py index ef7924a..eadc180 100644 --- a/scripts/get_version.py +++ b/scripts/get_version.py @@ -3,7 +3,7 @@ def main() -> None: rootpath = Path(__file__).absolute().parents[1] - with open(rootpath / "pyproject.toml") as f: + with open(rootpath / "pyproject.toml", encoding="utf-8") as f: print(f.read().split('version = "')[1].split('"')[0]) diff --git a/scripts/multi_build.py b/scripts/multi_build.py index 561f588..5d56241 100644 --- a/scripts/multi_build.py +++ b/scripts/multi_build.py @@ -100,7 +100,7 @@ def main(args: argparse.Namespace) -> None: # if the build is last, make it automatically remove the Docker/Podman image from runner clean_image = "--clean-image" if count == len(argsets) and args.env in ("docker", "podman") else "" # form and launch the command - cmd = f"python3 wrapper {argset['command']} {benv} {base} {codename} {lkv} {size} {ksu} {clean_image} {extra}" + cmd = f"python3 builder {argset['command']} {benv} {base} {codename} {lkv} {size} {ksu} {clean_image} {extra}" print(f"[CMD]: {cmd}") subprocess.run(cmd.strip(), shell=True, check=True) # copy artifacts into the shared directory diff --git a/scripts/run_tests.py b/scripts/run_tests.py index 3e6c54e..1bef0ad 100644 --- a/scripts/run_tests.py +++ b/scripts/run_tests.py @@ -16,11 +16,11 @@ def _launch_cmd(cmd: str) -> CompletedProcess: def pytest_checks(self) -> CompletedProcess: """Run unit tests with Pytest and coverage checks.""" os.environ["PYTHONPATH"] = ROOTPATH - return self._launch_cmd("python3 -m pytest tests/ --cov") + return self._launch_cmd("python3 -m pytest -vv tests/ --cov") def pyright_checks(self) -> CompletedProcess: """Run type (hint) checks with Pyright.""" - return self._launch_cmd("python3 -m pyright wrapper") + return self._launch_cmd("python3 -m pyright builder") def bandit_checks(self) -> list[CompletedProcess]: """Run SAST with Bandit.""" diff --git a/tests/unit/wrapper/core/test_kernel_builder.py b/tests/unit/wrapper/core/test_kernel_builder.py index 925982f..18204e4 100644 --- a/tests/unit/wrapper/core/test_kernel_builder.py +++ b/tests/unit/wrapper/core/test_kernel_builder.py @@ -1,7 +1,7 @@ import pytest from pathlib import Path -from wrapper.core import KernelBuilder +from builder.core import KernelBuilder @pytest.mark.parametrize( diff --git a/tests/unit/wrapper/tools/test_commands.py b/tests/unit/wrapper/tools/test_commands.py index 0555bdb..5833542 100644 --- a/tests/unit/wrapper/tools/test_commands.py +++ b/tests/unit/wrapper/tools/test_commands.py @@ -1,6 +1,6 @@ import pytest -from wrapper.tools import commands as ccmd +from builder.tools import commands as ccmd def test__launch__invalid_command(capfd) -> None: diff --git a/tests/unit/wrapper/tools/test_messages.py b/tests/unit/wrapper/tools/test_messages.py index 8624b44..08c25e8 100644 --- a/tests/unit/wrapper/tools/test_messages.py +++ b/tests/unit/wrapper/tools/test_messages.py @@ -1,6 +1,6 @@ import pytest -from wrapper.tools import messages as msg +from builder.tools import messages as msg def test__message_note__validate(capfd): @@ -29,7 +29,7 @@ def test__message_error__validate(capfd, dont_exit: bool) -> None: def test__message_done__validate(capfd) -> None: """Check "done" message construction.""" m = "This is a test message." - expected_result = f"[ + ] {m}" + expected_result = f"[ \u2713 ] {m}" msg.done(m) out, err = capfd.readouterr() assert out.rstrip() == expected_result diff --git a/wrapper/configs/__init__.py b/wrapper/configs/__init__.py deleted file mode 100644 index d2f4f62..0000000 --- a/wrapper/configs/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -from .argument_config import ArgumentConfig -from .directory_config import DirectoryConfig