mirror of
https://github.com/mudita/MuditaOS.git
synced 2025-12-23 22:17:57 -05:00
* Fix for the issue that resulted in race condition between target creating and populating databases and the one copying created databases to required directories. The issue was caused by lack of dependency between those targets, what allowed CMake engine to parallelize them. As a result, databases were copied before their creation has been finished, what resulted in weird discrepancies in databases content and occasional rsync errors. * Removed unused multicomp_install function. * Refactored DB tests readContent helper.
39 lines
1.3 KiB
CMake
39 lines
1.3 KiB
CMake
set(ASSETS_SOURCE_DIR ${CMAKE_SOURCE_DIR}/image)
|
|
|
|
function(add_assets_target)
|
|
cmake_parse_arguments(
|
|
_ASSETS
|
|
""
|
|
"TARGET;SOURCE_DIR;SYSTEM_DEST_DIR;USER_DEST_DIR;DEVEL;"
|
|
"DEPENDS"
|
|
${ARGN}
|
|
)
|
|
|
|
add_custom_target(
|
|
${_ASSETS_TARGET}
|
|
DEPENDS ${_ASSETS_DEPENDS}
|
|
|
|
# Copy user assets
|
|
COMMAND mkdir -p ${_ASSETS_USER_DEST_DIR}
|
|
COMMAND rsync -qau
|
|
${_ASSETS_SOURCE_DIR}/user/
|
|
${_ASSETS_USER_DEST_DIR}
|
|
COMMAND find ${_ASSETS_USER_DEST_DIR} -name "*-devel*" | sed "\"s,\\(.*\\)-devel\\(.*\\),& \\1\\2,\"" | xargs --no-run-if-empty -L1 mv
|
|
|
|
# Copy system assets
|
|
COMMAND mkdir -p ${_ASSETS_SYSTEM_DEST_DIR}
|
|
COMMAND rsync -qau
|
|
${_ASSETS_SOURCE_DIR}/system_a/data
|
|
${_ASSETS_SOURCE_DIR}/system_a/db
|
|
${_ASSETS_SYSTEM_DEST_DIR}
|
|
|
|
# Create 'golden copy' of DBs
|
|
# 'v' flag intentionally left for debugging purposes, can be removed if you're sure it's no longer needed
|
|
COMMAND rsync -vlptgoDu
|
|
${_ASSETS_SYSTEM_DEST_DIR}/db/*
|
|
${_ASSETS_SYSTEM_DEST_DIR}/db/factory
|
|
|
|
COMMENT "Copying assets... add_assets_target (${_ASSETS_TARGET}) <- ${_ASSETS_DEPENDS}"
|
|
)
|
|
endfunction()
|