~aleteoryx/muditaos

8a61e57ffc890ae9bb4f3b7440e2e4c2ab702220 — Adam Dobrowolski 4 years ago 589dbd8
[EGD-7932] Added downloader for assets for Bell

With this all fonts and Luts bin are downloaed for other repo which
is closed from others. With minimum changes to our cmake and flow
Added cache dir as set in cmake for CI
CI has to use common cache to not download data all the time
Jenkinsfile updated to install lacking dependency
M CMakeLists.txt => CMakeLists.txt +1 -0
@@ 3,6 3,7 @@ set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_TRY_COMPILE_TARGET_TYPE "STATIC_LIBRARY")
set(MUDITA_CACHE_DIR "~/.mudita/" CACHE STRING "cache directory for our downloaded assets")
project(PureOS)
enable_language(C CXX ASM)


M cmake/modules/AddPackage.cmake => cmake/modules/AddPackage.cmake +2 -0
@@ 39,6 39,7 @@ function(add_standalone_image SOURCE_TARGET)
        COMMAND tar -ScJf ${STANDALONE_PKG} ${SOURCE_TARGET}.img
        WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
        DEPENDS ${BIN_FILE}
        DEPENDS json-target
        DEPENDS ecoboot.bin-target
        DEPENDS updater.bin-target
        DEPENDS ${SOURCE_TARGET}-version.json-target


@@ 64,6 65,7 @@ function(add_update_package SOURCE_TARGET)

    add_custom_command(
        OUTPUT ${UPDATE_PKG}
        DEPENDS json-target
        DEPENDS ${SOURCE_TARGET}
        DEPENDS ${SOURCE_TARGET}-boot.bin
        DEPENDS ${SOURCE_TARGET}-version.json-target

M cmake/modules/DiskImage.cmake => cmake/modules/DiskImage.cmake +1 -0
@@ 60,6 60,7 @@ function(add_image)
    add_custom_command(
        OUTPUT ${DISK_IMAGE_NAME}
        DEPENDS ${COMMAND_DEPENDS}
        DEPENDS json-target
        COMMAND
            ${SCRIPT_PATH}
            ${DISK_IMAGE_NAME}

A cmake/modules/DownloadAsset2.cmake => cmake/modules/DownloadAsset2.cmake +10 -0
@@ 0,0 1,10 @@
function(download_asset2 json install_path cache_dir)
    add_custom_target(json-target
        COMMAND python3 ${CMAKE_SOURCE_DIR}/tools/download_asset2.py
            --json ${json}
            github
            --install_dir ${install_path}
            --cache_dir ${cache_dir}
        COMMENT "Download binary assets listed in json file"
        )
endfunction()

M products/BellHybrid/CMakeLists.txt => products/BellHybrid/CMakeLists.txt +2 -0
@@ 85,6 85,8 @@ add_hex_target(BellHybrid)

include(BinaryAssetsVersions.cmake)
include(DownloadAsset)
include(DownloadAsset2)
download_asset2(${CMAKE_CURRENT_SOURCE_DIR}/assets.json ${PROJECT_SOURCE_DIR} ${MUDITA_CACHE_DIR})
download_asset(PureUpdater_RT.bin updater.bin PureUpdater ${UPDATER_BIN_VERSION})
download_asset(ecoboot.bin ecoboot.bin ecoboot ${ECOBOOT_BIN_VERSION})


A products/BellHybrid/assets.json => products/BellHybrid/assets.json +59 -0
@@ 0,0 1,59 @@
{
    "comment": "This is kiss structure - asset path & sha",
    "assets": [
        {
            "name": "./fonts/bell/gt_pressura_regular_38.mpf",
            "output": "assets/fonts/gt_pressura_regular_38.mpf",
            "ref": "fd168040c5d1216d457e6cf223e8ea9bb76bf7b"
        },
        {
            "name": "./fonts/bell/gt_pressura_light_38.mpf",
            "output": "assets/fonts/gt_pressura_light_38.mpf",
            "ref": "10c74fcb09c2022325767cad735c0183b6f5393a"
        },
        {
            "name": "./fonts/bell/gt_pressura_regular_90.mpf",
            "ref": "10c74fcb09c2022325767cad735c0183b6f5393a",
            "output": "assets/fonts/gt_pressura_regular_90.mpf"
        },
        {
            "name": "./fonts/bell/gt_pressura_regular_190.mpf",
            "ref": "10c74fcb09c2022325767cad735c0183b6f5393a",
            "output": "assets/fonts/gt_pressura_regular_190.mpf"
        },
        {
            "name": "./fonts/common/gt_pressura_light_30.mpf",
            "ref": "10c74fcb09c2022325767cad735c0183b6f5393a",
            "output": "assets/fonts/gt_pressura_light_30.mpf"
        },
        {
            "name": "./fonts/common/gt_pressura_regular_30.mpf",
            "ref": "10c74fcb09c2022325767cad735c0183b6f5393a",
            "output": "assets/fonts/gt_pressura_regular_30.mpf"
        },
        {
            "name": "./fonts/common/gt_pressura_bold_30.mpf",
            "ref": "10c74fcb09c2022325767cad735c0183b6f5393a",
            "output": "assets/fonts/gt_pressura_bold_30.mpf"
        },
        {
            "name": "./fonts/common/gt_pressura_regular_46.mpf",
            "ref": "10c74fcb09c2022325767cad735c0183b6f5393a",
            "output": "assets/fonts/gt_pressura_regular_46.mpf"
        },
        {
            "name": "./fonts/common/gt_pressura_light_46.mpf",
            "ref": "10c74fcb09c2022325767cad735c0183b6f5393a",
            "output": "assets/fonts/gt_pressura_light_46.mpf"
        },
        {
            "name": "./fonts/common/gt_pressura_light_90.mpf",
            "ref": "10c74fcb09c2022325767cad735c0183b6f5393a",
            "output": "assets/fonts/gt_pressura_light_90.mpf"
        },
        {
            "name": "./image/Luts.bin",
            "output": "Luts.bin"
        }
    ]
}

M products/PurePhone/CMakeLists.txt => products/PurePhone/CMakeLists.txt +2 -0
@@ 102,6 102,8 @@ add_hex_target(PurePhone)

include(BinaryAssetsVersions.cmake)
include(DownloadAsset)
include(DownloadAsset2)
download_asset2(${CMAKE_CURRENT_SOURCE_DIR}/assets.json ${PROJECT_SOURCE_DIR} ${MUDITA_CACHE_DIR})
download_asset(PureUpdater_RT.bin updater.bin PureUpdater ${UPDATER_BIN_VERSION})
download_asset(ecoboot.bin ecoboot.bin ecoboot ${ECOBOOT_BIN_VERSION})


A products/PurePhone/assets.json => products/PurePhone/assets.json +74 -0
@@ 0,0 1,74 @@
{
    "assets": [
        {
            "name": "./fonts/pure/dejavu_sans_bold_27.mpf",
            "output":"assets/fonts/dejavu_sans_bold_27.mpf"
        },
        {
            "name": "./fonts/pure/gt_pressura_regular_20.mpf",
            "output":"assets/fonts/gt_pressura_regular_20.mpf"
        },
        {
            "name": "./fonts/pure/gt_pressura_bold_20.mpf",
            "output":"assets/fonts/gt_pressura_bold_20.mpf"
        },
        {
            "name": "./fonts/pure/gt_pressura_regular_24.mpf",
            "output":"assets/fonts/gt_pressura_regular_24.mpf"
        },
        {
            "name": "./fonts/pure/gt_pressura_bold_24.mpf",
            "output":"assets/fonts/gt_pressura_bold_24.mpf"
        },
        {
            "name": "./fonts/pure/gt_pressura_light_27.mpf",
            "output":"assets/fonts/gt_pressura_light_27.mpf"
        },
        {
            "name": "./fonts/pure/gt_pressura_regular_27.mpf",
            "output":"assets/fonts/gt_pressura_regular_27.mpf"
        },
        {
            "name": "./fonts/pure/gt_pressura_bold_27.mpf",
            "output":"assets/fonts/gt_pressura_bold_27.mpf"
        },
        {
            "name": "./fonts/pure/gt_pressura_bold_32.mpf",
            "output":"assets/fonts/gt_pressura_bold_32.mpf"
        },
        {
            "name": "./fonts/common/gt_pressura_light_30.mpf",
            "ref": "10c74fcb09c2022325767cad735c0183b6f5393a",
            "output": "assets/fonts/gt_pressura_light_30.mpf"
        },
        {
            "name": "./fonts/common/gt_pressura_regular_30.mpf",
            "ref": "10c74fcb09c2022325767cad735c0183b6f5393a",
            "output": "assets/fonts/gt_pressura_regular_30.mpf"
        },
        {
            "name": "./fonts/common/gt_pressura_bold_30.mpf",
            "ref": "10c74fcb09c2022325767cad735c0183b6f5393a",
            "output": "assets/fonts/gt_pressura_bold_30.mpf"
        },
        {
            "name": "./fonts/common/gt_pressura_regular_46.mpf",
            "ref": "10c74fcb09c2022325767cad735c0183b6f5393a",
            "output": "assets/fonts/gt_pressura_regular_46.mpf"
        },
        {
            "name": "./fonts/common/gt_pressura_light_46.mpf",
            "ref": "10c74fcb09c2022325767cad735c0183b6f5393a",
            "output": "assets/fonts/gt_pressura_light_46.mpf"
        },
        {
            "name": "./fonts/common/gt_pressura_light_90.mpf",
            "ref": "10c74fcb09c2022325767cad735c0183b6f5393a",
            "output": "assets/fonts/gt_pressura_light_90.mpf"
        },
        {
            "name": "./image/Luts.bin",
            "output": "Luts.bin"
        }
    ]
}

M tools/download_asset2.py => tools/download_asset2.py +1 -1
@@ 172,7 172,7 @@ class GitOps:
                output.parent.mkdir(parents=True, exist_ok=True)
                self.copy_file(cached, output)
            except HTTP404NotFoundError as ex:
                raise RuntimeError(f'file not found with: {data} err: {ex}  on path: {Path(".").absolute()} with cache dir: {self.cache.absolute()} for {val["name"]}')
                raise RuntimeError(f'file not found with: {data} err: {ex}')
            except HTTP403ForbiddenError as ex:
                # gh is messed up - if you get persistent error on this file, try renaming
                raise RuntimeError(f'something is wrong with: {data} err: {ex}')

M tools/requirements.txt => tools/requirements.txt +1 -0
@@ 7,3 7,4 @@ requests==2.26.0
smmap==4.0.0
tqdm==4.62.2
urllib3==1.26.6
ghapi