From 3d2593eceeb76a12f8f370339853fbb6d0000dd4 Mon Sep 17 00:00:00 2001 From: Bruno Martins Date: Fri, 18 Oct 2024 18:36:48 +0100 Subject: [PATCH] salami: Adopt Python extract utils Change-Id: Ie9d629ab91bae60a1b9a60e62477de60ea2973f6 --- extract-files.py | 38 ++++++++++++++++++++++++++++++++++++++ extract-files.sh | 21 --------------------- setup-makefiles.py | 1 + setup-makefiles.sh | 21 --------------------- 4 files changed, 39 insertions(+), 42 deletions(-) create mode 100755 extract-files.py delete mode 100755 extract-files.sh create mode 100755 setup-makefiles.py delete mode 100755 setup-makefiles.sh diff --git a/extract-files.py b/extract-files.py new file mode 100755 index 0000000..dcae177 --- /dev/null +++ b/extract-files.py @@ -0,0 +1,38 @@ +#!/usr/bin/env -S PYTHONPATH=../../../tools/extract-utils python3 +# +# SPDX-FileCopyrightText: 2024 The LineageOS Project +# SPDX-License-Identifier: Apache-2.0 +# + +from extract_utils.fixups_blob import ( + blob_fixup, + blob_fixups_user_type, +) +from extract_utils.main import ( + ExtractUtils, + ExtractUtilsModule, +) + +namespace_imports = [ + 'vendor/oneplus/sm8550-common', +] + +blob_fixups: blob_fixups_user_type = { + 'odm/etc/camera/CameraHWConfiguration.config': blob_fixup() + .regex_replace('SystemCamera = 0; 0; 0; 1; 0; 1;', 'SystemCamera = 0; 0; 0; 0; 0; 0;') +} # fmt: skip + +module = ExtractUtilsModule( + 'salami', + 'oneplus', + namespace_imports=namespace_imports, + blob_fixups=blob_fixups, + check_elf=True, + add_firmware_proprietary_file=True, +) + +if __name__ == '__main__': + utils = ExtractUtils.device_with_common( + module, 'sm8550-common', module.vendor + ) + utils.run() diff --git a/extract-files.sh b/extract-files.sh deleted file mode 100755 index 1f600bc..0000000 --- a/extract-files.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -# -# SPDX-FileCopyrightText: 2016 The CyanogenMod Project -# SPDX-FileCopyrightText: 2017-2024 The LineageOS Project -# SPDX-License-Identifier: Apache-2.0 -# - -# If we're being sourced by the common script that we called, -# stop right here. No need to go down the rabbit hole. -if [ "${BASH_SOURCE[0]}" != "${0}" ]; then - return -fi - -set -e - -export DEVICE=salami -export DEVICE_COMMON=sm8550-common -export VENDOR=oneplus -export VENDOR_COMMON=${VENDOR} - -"./../../${VENDOR_COMMON}/${DEVICE_COMMON}/extract-files.sh" "$@" diff --git a/setup-makefiles.py b/setup-makefiles.py new file mode 100755 index 0000000..32947cf --- /dev/null +++ b/setup-makefiles.py @@ -0,0 +1 @@ +#!./extract-files.py --regenerate_makefiles diff --git a/setup-makefiles.sh b/setup-makefiles.sh deleted file mode 100755 index 5a0d369..0000000 --- a/setup-makefiles.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -# -# SPDX-FileCopyrightText: 2016 The CyanogenMod Project -# SPDX-FileCopyrightText: 2017-2024 The LineageOS Project -# SPDX-License-Identifier: Apache-2.0 -# - -# If we're being sourced by the common script that we called, -# stop right here. No need to go down the rabbit hole. -if [ "${BASH_SOURCE[0]}" != "${0}" ]; then - return -fi - -set -e - -export DEVICE=salami -export DEVICE_COMMON=sm8550-common -export VENDOR=oneplus -export VENDOR_COMMON=${VENDOR} - -"./../../${VENDOR_COMMON}/${DEVICE_COMMON}/setup-makefiles.sh" "$@"