diff --git a/.github/workflows/native-build.yml b/.github/workflows/native-build.yml new file mode 100644 index 0000000..26ceb14 --- /dev/null +++ b/.github/workflows/native-build.yml @@ -0,0 +1,27 @@ +name: Build Cable Modem Agent Component in Native Environment + +on: + push: + branches: [ main, 'sprint/**', 'release/**', develop ] + pull_request: + branches: [ main, 'sprint/**', 'release/**', topic/RDK*, develop ] + +jobs: + build-cable-modem-agent-on-pr: + name: Build Cable Modem Agent component in github rdkcentral + runs-on: ubuntu-latest + container: + image: ghcr.io/rdkcentral/docker-rdk-ci:latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: native build + run: | + chmod +x cov_docker_script/run_setup_dependencies.sh + ./cov_docker_script/run_setup_dependencies.sh + chmod +x cov_docker_script/run_native_build.sh + ./cov_docker_script/run_native_build.sh + env: + GITHUB_TOKEN: ${{ secrets.RDKCM_RDKE }} diff --git a/cov_docker_script/README.md b/cov_docker_script/README.md new file mode 100644 index 0000000..861ab98 --- /dev/null +++ b/cov_docker_script/README.md @@ -0,0 +1,402 @@ +# Component Native Build Configuration + +**Coverity/Native build configuration for RDK-B components.** + +--- + +## 📋 Overview + +This directory contains the configuration and wrapper scripts necessary for building RDK-B components in a native (non-Yocto) environment. This setup enables Coverity static analysis and validates that components can be built with explicitly declared dependencies. + +### Directory Contents + +``` +/cov_docker_script/ +├── README.md # This file +├── component_config.json # Dependency & build configuration +├── configure_options.conf # Autotools configure flags (optional) +├── run_setup_dependencies.sh # Wrapper: Setup build tools & dependencies +└── run_native_build.sh # Wrapper: Setup build tools & build component +``` + +### Important: Add to .gitignore + +Add the following to your component's `.gitignore` to exclude temporary build artifacts: + +```gitignore +# Build tools (downloaded by wrapper scripts) +build_tools_workflows/ + +# Dependency build artifacts +build/ +``` + +--- + +## 🚀 Quick Start + +### Prerequisites + +- Docker container with [docker-rdk-ci](https://github.com/rdkcentral/docker-rdk-ci) image +- All wrapper scripts have execute permissions + +### Build Commands + +#### Complete Build Pipeline + +```bash +# From your component root directory +cd /path/to/your-component + +# Run complete build pipeline +./cov_docker_script/run_setup_dependencies.sh +./cov_docker_script/run_native_build.sh + +# Clean build (removes previous artifacts) +CLEAN_BUILD=true ./cov_docker_script/run_setup_dependencies.sh +./cov_docker_script/run_native_build.sh +``` + +#### Individual Steps + +```bash +# Step 1: Setup dependencies only +./cov_docker_script/run_setup_dependencies.sh + +# Step 2: Build component only (requires Step 1 completed) +./cov_docker_script/run_native_build.sh +``` + +--- + +## 📖 Scripts Reference + +### 1. run_setup_dependencies.sh + +**Purpose:** Sets up build tools and runs dependency setup. + +**What it does:** +1. Clones `build_tools_workflows` repository (develop branch) +2. Verifies required scripts are present +3. Runs `setup_dependencies.sh` from build_tools_workflows with config path to: + - Clone all dependency repositories + - Copy headers to `$HOME/usr/include/rdkb/` + - Build and install dependency libraries +4. Leaves build_tools_workflows in place for run_native_build.sh + +**Usage:** +```bash +./run_setup_dependencies.sh + +# Clean build +CLEAN_BUILD=true ./run_setup_dependencies.sh +``` + +**Required files:** +- `component_config.json` (defines dependencies) + +**Outputs:** +- Downloads: `$HOME/build/` (dependency repositories) +- Headers: `$HOME/usr/include/rdkb/` +- Libraries: `$HOME/usr/local/lib/`, `$HOME/usr/lib/` +- build_tools_workflows: Remains in place for run_native_build.sh + +**Environment Variables:** +- `BUILD_DIR` - Override build directory (default: `$HOME/build`) +- `USR_DIR` - Override install directory (default: `$HOME/usr`) +- `CLEAN_BUILD` - Set to `true` to remove previous builds + +--- + +### 2. run_native_build.sh + +**Purpose:** Verifies build tools and builds the component. + +**What it does:** +1. Verifies `build_tools_workflows` directory exists (cloned by `run_setup_dependencies.sh`) +2. Verifies `build_native.sh` is present +3. Runs `build_native.sh` from build_tools_workflows with config and component paths to: + - Apply patches to source code + - Configure build environment + - Build component + - Install libraries +4. Cleans up build_tools_workflows directory + +**Usage:** +```bash +./run_native_build.sh +``` + +**Prerequisites:** +- `run_setup_dependencies.sh` must be run first (to clone build_tools_workflows) +- All dependency headers/libraries must be available + +**Required files:** +- `component_config.json` (defines component build settings) +- `configure_options.conf` (autotools configuration) + +**Outputs:** +- Component libraries in `$HOME/usr/local/lib/` +- Build artifacts in component root directory + +--- + +## 📝 Configuration Files + +### component_config.json + +**JSON configuration defining all dependencies and build settings.** + +**Key Sections:** + +1. **dependencies.repos[]** - External dependencies required by your component + ```json + { + "name": "rbus", + "repo": "https://github.com/rdkcentral/rbus.git", + "branch": "v2.7.0", + "header_paths": [...], + "build": {...} + } + ``` + +2. **native_component** - Component build configuration + ```json + { + "name": "your-component", + "build": { + "type": "autotools", + "configure_options_file": "cov_docker_script/configure_options.conf" + } + } + ``` + +**Example Dependencies:** +Your component may require dependencies such as: +- rbus +- rdk_logger +- safec +- common-library +- halinterface +- And other component-specific dependencies + +See [component_config.json](component_config.json) for your component's specific dependency configuration. + +--- + +### configure_options.conf + +**Autotools configuration file with preprocessor, compiler, and linker flags.** + +**Format:** +```properties +[CPPFLAGS] +-I$HOME/usr/include/rdkb/ +-DFEATURE_FLAG + +[CFLAGS] +-Wall -Wextra + +[LDFLAGS] +-L$HOME/usr/local/lib/ +``` + +**Sections:** +- `[CPPFLAGS]` - Preprocessor flags (includes `-I`, defines `-D`) +- `[CFLAGS]` - C compiler flags +- `[CXXFLAGS]` - C++ compiler flags +- `[LDFLAGS]` - Linker flags (library paths `-L`, linker options `-Wl`) + +**Component-Specific Flags:** +Customize flags based on your component's requirements: +- Platform defines: `_COSA_INTEL_USG_ARM_`, `_COSA_BCM_ARM_`, etc. +- Product defines: `_XB6_PRODUCT_REQ_`, `_XB7_PRODUCT_REQ_`, etc. +- Feature flags: `FEATURE_SUPPORT_RDKLOG`, component-specific features, etc. + +See [configure_options.conf](configure_options.conf) for your component's complete flag list. + +--- + +## 🔧 Build System Architecture + +``` +┌─────────────────────────────────────────────────────┐ +│ run_setup_dependencies.sh │ +│ ┌──────────────────────────────────────────────┐ │ +│ │ 1. Clone build_tools_workflows │ │ +│ │ (develop branch) │ │ +│ │ │ │ +│ │ 2. Verify required scripts present │ │ +│ │ │ │ +│ │ 3. Run setup_dependencies.sh from │ │ +│ │ build_tools_workflows with config path │ │ +│ │ - Read component_config.json │ │ +│ │ - Clone dependency repos │ │ +│ │ - Copy headers │ │ +│ │ - Build & install libraries │ │ +│ └──────────────────────────────────────────────┘ │ +└─────────────────────────────────────────────────────┘ + │ + ▼ +┌─────────────────────────────────────────────────────┐ +│ run_native_build.sh │ +│ ┌──────────────────────────────────────────────┐ │ +│ │ 1. Verify build_tools_workflows exists │ │ +│ │ (cloned by run_setup_dependencies.sh) │ │ +│ │ │ │ +│ │ 2. Run build_native.sh from │ │ +│ │ build_tools_workflows with config and │ │ +│ │ component directory paths │ │ +│ │ - Process component headers │ │ +│ │ - Apply source patches (if configured) │ │ +│ │ - Read configure_options.conf │ │ +│ │ - Configure build (autogen/configure) │ │ +│ │ - Build component (make/cmake/meson) │ │ +│ │ - Install libraries │ │ +│ │ │ │ +│ │ 3. Cleanup build_tools_workflows directory │ │ +│ └──────────────────────────────────────────────┘ │ +└─────────────────────────────────────────────────────┘ +``` + +--- + +## 🐛 Troubleshooting + +### Build Failures + +**Problem:** Missing headers + +```bash +# Solution: Check if dependencies were installed +ls -la $HOME/usr/include/rdkb/ + +# Verify component_config.json has correct header_paths +cat component_config.json | jq '.dependencies.repos[].header_paths' + +# Re-run dependency setup +CLEAN_BUILD=true ./cov_docker_script/run_setup_dependencies.sh +``` + +**Problem:** Missing libraries + +```bash +# Solution: Check library installation +ls -la $HOME/usr/local/lib/ +ls -la $HOME/usr/lib/ + +# Verify PKG_CONFIG_PATH +echo $PKG_CONFIG_PATH + +# Check if dependency build failed +cd $HOME/build/ +cat config.log # For autotools +cat build/meson-log.txt # For meson +``` + +**Problem:** Configure errors + +```bash +# Solution: Check configure_options.conf syntax +cat cov_docker_script/configure_options.conf + +# Verify flags are valid +./configure --help +``` + +### Script Errors + +**Problem:** Script not found + +```bash +# Solution: Ensure scripts are executable +chmod +x cov_docker_script/*.sh + +# Check if build_tools_workflows was cloned +ls -la ../build_tools_workflows/ +``` + +**Problem:** Permission denied + +```bash +# Solution: Fix container permissions +# (Run on host, not in container) +sudo docker exec rdkb-builder groupadd $USER --gid=$(id -g $USER) +sudo docker exec rdkb-builder useradd -m $USER -G users \ + --uid=$(id -u $USER) --gid=$(id -g $USER) +``` + +--- + +## 📚 Related Documentation + +- **Build Tools Repository:** [build_tools_workflows](https://github.com/rdkcentral/build_tools_workflows/tree/develop) +- **Docker Environment:** [docker-rdk-ci](https://github.com/rdkcentral/docker-rdk-ci) +- **Example Component:** [cable-modem-agent](https://github.com/rdkcentral/cable-modem-agent) (reference implementation) +- **Detailed Build Guide:** See `build_tools_workflows/cov_docker_script/README.md` + +--- + +## ⚠️ Important Notes + +### DO NOT Modify + +The following scripts are automatically copied from `build_tools_workflows` and **must not be modified locally**: + +- ❌ `build_native.sh` +- ❌ `common_build_utils.sh` +- ❌ `common_external_build.sh` +- ❌ `setup_dependencies.sh` + +Any changes will be overwritten when wrapper scripts run. + +### DO Modify + +The following files are component-specific and **should be customized**: + +- ✅ `component_config.json` - Dependency and build configuration +- ✅ `configure_options.conf` - Autotools flags +- ✅ `run_setup_dependencies.sh` - Wrapper script (if needed) +- ✅ `run_native_build.sh` - Wrapper script (if needed) + +--- + +## 🔄 Workflow Integration + +### Local Development + +```bash +# Make changes to source code +vim source/your_component.c + +# Rebuild component +CLEAN_BUILD=true ./cov_docker_script/run_native_build.sh +``` + +### CI/CD Integration + +This configuration is used by GitHub Actions to validate builds: + +```yaml +- name: Setup Dependencies + run: ./cov_docker_script/run_setup_dependencies.sh + +- name: Build Component + run: ./cov_docker_script/run_native_build.sh +``` + +See `.github/workflows/` for complete CI configuration. + +--- + +## 📞 Support + +For issues or questions: + +1. Check [Troubleshooting](#troubleshooting) section +2. Review [build_tools_workflows README](https://github.com/rdkcentral/build_tools_workflows/blob/develop/cov_docker_script/README.md) +3. Raise issue in your component repository or [build_tools_workflows](https://github.com/rdkcentral/build_tools_workflows/issues) + +--- + +**Last Updated:** January 2026 diff --git a/cov_docker_script/component_config.json b/cov_docker_script/component_config.json new file mode 100644 index 0000000..d152893 --- /dev/null +++ b/cov_docker_script/component_config.json @@ -0,0 +1,126 @@ +{ + "_comment": "Component Build Configuration for Coverity/Native Builds", + "_version": "2.0", + "_description": "Defines dependencies and build settings for the native component", + + "dependencies": { + "_comment": "External repositories needed by this component", + "repos": [ + { + "name": "safec", + "repo": "https://github.com/rurban/safeclib.git", + "branch": "master", + "header_paths": [ + { "source": "include", "destination": "$HOME/usr/include/rdkb" } + ] + }, + { + "name": "Utopia", + "repo": "https://github.com/rdkcentral/utopia.git", + "branch": "feature/cov_native_build", + "header_paths": [ + { "source": "source/include/sysevent", "destination": "$HOME/usr/include/rdkb/sysevent" }, + { "source": "source/include/syscfg", "destination": "$HOME/usr/include/rdkb/syscfg" }, + { "source": "source/include", "destination": "$HOME/usr/include/rdkb/utctx" }, + { "source": "source/include", "destination": "$HOME/usr/include/rdkb" }, + { "source": "source/utapi/lib", "destination": "$HOME/usr/include/rdkb/utapi" }, + { "source": "source/include/ulog", "destination": "$HOME/usr/include/rdkb/ulog" }, + { "source": "source/util/utils", "destination": "$HOME/usr/include/rdkb" }, + { "source": "source/sysevent/lib", "destination": "$HOME/usr/include/rdkb/sysevent" }, + { "source": "source/util/print_uptime", "destination": "$HOME/usr/include/rdkb" } + ], + "build": { + "type": "script", + "script": "cov_docker_script/common_external_build.sh" + } + }, + { + "name": "Utopia-headers", + "repo": "https://github.com/rdkcentral/utopia.git", + "branch": "main", + "header_paths": [ + { "source": "source/include/sysevent", "destination": "$HOME/usr/include/rdkb/sysevent" }, + { "source": "source/include/syscfg", "destination": "$HOME/usr/include/rdkb/syscfg" }, + { "source": "source/include/utctx", "destination": "$HOME/usr/include/rdkb/utctx" }, + { "source": "source/include", "destination": "$HOME/usr/include/rdkb" }, + { "source": "source/utapi/lib", "destination": "$HOME/usr/include/rdkb/utapi" }, + { "source": "source/include/ulog", "destination": "$HOME/usr/include/rdkb/ulog" }, + { "source": "source/util/utils", "destination": "$HOME/usr/include/rdkb" }, + { "source": "source/sysevent/lib", "destination": "$HOME/usr/include/rdkb/sysevent" }, + { "source": "source/util/print_uptime", "destination": "$HOME/usr/include/rdkb" } + ] + }, + { + "name": "rdkb-halif-vlan", + "repo": "https://github.com/rdkcentral/rdkb-halif-vlan.git", + "branch": "main", + "header_paths": [ + { "source": "include", "destination": "$HOME/usr/include" } + ] + }, + { + "name": "rdkb-halif-wifi", + "repo": "https://github.com/rdkcentral/rdkb-halif-wifi.git", + "branch": "develop", + "header_paths": [ + { "source": "include", "destination": "$HOME/usr/include" } + ] + }, + { + "name": "rdkb-halif-cm", + "repo": "https://github.com/rdkcentral/rdkb-halif-cm.git", + "branch": "main", + "header_paths": [ + { "source": "include", "destination": "$HOME/usr/include" } + ] + }, + { + "name": "hal-cm-generic", + "repo": "https://code.rdkcentral.com/r/rdkb/components/opensource/ccsp/hal.git", + "branch": "rdk-next", + "repo_dir": "hal-cm-generic/source/cm", + "include_path": "$HOME/usr/include/rdkb/", + "lib_output_path": "$HOME/usr/local/lib", + "build": { + "type": "commands", + "commands": [ + "echo \"${PWD}\"", + "cd source/cm", + "autoreconf -i", + "./configure", + "make CFLAGS=\"-Os -pipe -g -feliminate-unused-debug-types -I${HOME}/usr/include/rdkb -I${HOME}/build/rdkb-halif-cm/include\" LDFLAGS=\"-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed\"" + ] + } + } + ] + }, + + "native_component": { + "_comment": "Configuration for the main component being built", + "name": "cable-modem-agent", + "include_path": "$HOME/usr/include/rdkb", + "lib_output_path": "$HOME/usr/local/lib", + "pre_build_commands": [ + { + "description": "Generate dm_pack_datamodel.c from XML", + "command": "python3 $HOME/usr/include/rdkb/dm_pack_code_gen.py config-arm/TR181-CM.XML source/CMAgentSsp/dm_pack_datamodel.c" + } + ], + "header_sources": [ + { "source": "config.h", "destination": "$HOME/usr/include/rdkb" }, + { "source": "source/CMAgentSsp", "destination": "$HOME/usr/include/rdkb" }, + { "source": "source/Custom", "destination": "$HOME/usr/include/rdkb" }, + { "source": "source/TR-181/include", "destination": "$HOME/usr/include/rdkb" }, + { "source": "source/TR-181/middle_layer_src", "destination": "$HOME/usr/include/rdkb" }, + { "source": "source/test/CcspCMAgentDmlTest", "destination": "$HOME/usr/include/rdkb" } + ], + "build": { + "type": "autotools", + "build_dir": "build", + "configure_options_file": "cov_docker_script/configure_options.conf", + "configure_options": [ + "SRC_DIRS=$HOME/build/cable-modem-agent/source/CMAgentSsp/" + ] + } + } +} diff --git a/cov_docker_script/configure_options.conf b/cov_docker_script/configure_options.conf new file mode 100644 index 0000000..051356c --- /dev/null +++ b/cov_docker_script/configure_options.conf @@ -0,0 +1,142 @@ +# Cable Modem Agent Configure Options +# This file contains autotools configure options for the cable-modem-agent component +# Each section can be edited independently for better maintainability + +# ============================================================================ +# CPPFLAGS - Preprocessor flags (includes and defines) +# ============================================================================ +[CPPFLAGS] +# Autotools configuration +-DHAVE_CONFIG_H + +# Include paths +-I$HOME/usr/include +-I$HOME/usr/include/rdkb/ +-I/usr/include/dbus-1.0 +-I/usr/lib/x86_64-linux-gnu/dbus-1.0/include + +# Core system defines +-DSAFEC_DUMMY_API +-D_COSA_HAL_ +-U_COSA_SIM_ +-DCONFIG_SYSTEM_MOCA + +# ANSC framework defines +-D_ANSC_LINUX +-D_ANSC_USER +-D_ANSC_LITTLE_ENDIAN_ +-D_ANSC_USE_OPENSSL_ +-D_ANSC_AES_USED_ +-D_NO_ANSC_ZLIB_ +-U_ANSC_IPV6_COMPATIBLE_ + +# CCSP/Component defines +-D_CCSP_CWMP_TCP_CONNREQ_HANDLER +-D_DSLH_STUN_ +-D_NO_PKI_KB5_SUPPORT +-D_BBHM_SSE_FILE_IO +-DCCSP_SUPPORT_ENABLED + +# Product/Platform defines +-D_COSA_INTEL_USG_ARM_ +-D_COSA_FOR_COMCAST_ +-D_COSA_BCM_ARM_ +-D_XB6_PRODUCT_REQ_ +-D_XB7_PRODUCT_REQ_ +-D_XB8_PRODUCT_REQ_ + +# Vendor/Customer configuration +-DCONFIG_VENDOR_CUSTOMER_COMCAST +-DCONFIG_CISCO_HOTSPOT + +# Security and debugging +-DENABLE_SA_KEY +-D_NO_EXECINFO_H_ +-D_DEBUG +-DINCLUDE_BREAKPAD + +# System features +-DFEATURE_SUPPORT_RDKLOG +-DFEATURE_SUPPORT_SYSLOG +-DBUILD_WEB +-DUSE_NOTIFY_COMPONENT +-DNTPD_ENABLE +-DUTC_ENABLE +-DUTC_ENABLE_ATOM +-DXDNS_ENABLE + +# Cable Modem Agent specific +-DENABLE_LLD_SUPPORT + +# Network features +-DENABLE_ETH_WAN +-DEROUTER_DHCP_OPTION_MTA +-DETH_4_PORTS +-D_2_5G_ETHERNET_SUPPORT_ +-D_MACSEC_SUPPORT_ +-D_BRIDGE_UTILS_BIN_ +-DAUTOWAN_ENABLE +-DENABLE_WANMODECHANGE_NOREBOOT +-DFEATURE_RDKB_WAN_MANAGER +-DFEATURE_RDKB_CONFIGURABLE_WAN_INTERFACE +-DWAN_MANAGER_UNIFICATION_ENABLED +-DWAN_FAILOVER_SUPPORTED +-DGATEWAY_FAILOVER_SUPPORTED + +# WiFi features +-D_ENABLE_BAND_STEERING_ +-D_BEACONRATE_SUPPORT +-D_TRI_BAND_WIFI_ +-D_WIFI_AX_SUPPORT_ +-D_WIFI_CONSOLIDATED_STANDARDS_ +-DWIFI_HAL_VERSION_3 +-DFEATURE_SUPPORT_MESH +-DFEATURE_SUPPORT_WEBCONFIG +-DFEATURE_SUPPORT_INTERWORKING +-DFEATURE_SUPPORT_PASSPOINT +-DWIFI_STATS_DISABLE_SPEEDTEST_RUNNING +-DFEATURE_SUPPORT_RADIUSGREYLIST +-DFEATURE_SUPPORT_ACL_SELFHEAL +-DFEATURE_CSI +-DFEATURE_SUPPORT_ONBOARD_LOGGING +-DFEATURE_OFF_CHANNEL_SCAN_5G +-DRDK_ONEWIFI +-DWIFI_MANAGE_SUPPORTED + +# Advanced features +-D_PSM_TRANS_RDK_TRIGG_ +-D_CM_HIGHSPLIT_SUPPORTED_ +-DFEATURE_RDKB_INTER_DEVICE_MANAGER +-DFEATURE_SUPPORT_MAPT_NAT46 +-DMAPT_UNIFICATION_ENABLED +-DSPEED_BOOST_SUPPORTED +-DAMENITIES_NETWORK_ENABLED + +# Test/Development +-DCOLUMBO_HWTEST + +# Build system +-DRBUS_BUILD_FLAG_ENABLE + +# Standard defines +-D_GNU_SOURCE +-D__USE_XOPEN + +# ============================================================================ +# CFLAGS - Compiler flags +# ============================================================================ +[CFLAGS] +-ffunction-sections +-fdata-sections +-fomit-frame-pointer +-fno-strict-aliasing + +# ============================================================================ +# LDFLAGS - Linker flags +# ============================================================================ +[LDFLAGS] +-L$HOME/usr/local/lib/ +-Wl,--allow-shlib-undefined +-Wl,--unresolved-symbols=ignore-all +-ldbus-1 +-lccsp_common diff --git a/cov_docker_script/run_native_build.sh b/cov_docker_script/run_native_build.sh new file mode 100755 index 0000000..9d3aea3 --- /dev/null +++ b/cov_docker_script/run_native_build.sh @@ -0,0 +1,51 @@ +#!/usr/bin/env bash +set -e + +################################################################################ +# Native Build Wrapper Script +# Verifies build tools and runs build_native.sh +# Usage: ./run_native_build.sh +# Note: run_setup_dependencies.sh should be executed first +################################################################################ + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +NATIVE_COMPONENT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)" +BUILD_TOOLS_DIR="$NATIVE_COMPONENT_DIR/build_tools_workflows" + +# Basic logging functions +log() { echo "[INFO] $*"; } +ok() { echo "[OK] $*"; } +err() { echo "[ERROR] $*" >&2; } + +echo "" +echo "===== Native Build Pipeline =====" +echo "" + +# Verify build_tools_workflows exists (should be cloned by run_setup_dependencies.sh) +if [[ ! -d "$BUILD_TOOLS_DIR" ]]; then + err "build_tools_workflows directory not found. Please run run_setup_dependencies.sh first." + exit 1 +fi + +if [[ ! -f "$BUILD_TOOLS_DIR/cov_docker_script/build_native.sh" ]]; then + err "build_native.sh not found in build_tools_workflows. Please run run_setup_dependencies.sh first." + exit 1 +fi + +log "Build script found, proceeding with build..." + +# Run build_native.sh from build_tools_workflows +echo "" +log "Running build_native.sh from build_tools_workflows..." +cd "$NATIVE_COMPONENT_DIR" +"$BUILD_TOOLS_DIR/cov_docker_script/build_native.sh" "$SCRIPT_DIR/component_config.json" "$NATIVE_COMPONENT_DIR" + +echo "" +ok "Native build completed successfully!" + +# Cleanup build_tools_workflows directory +log "Cleaning up build_tools_workflows directory..." +rm -rf "$BUILD_TOOLS_DIR" +ok "Cleanup completed" + +echo "" diff --git a/cov_docker_script/run_setup_dependencies.sh b/cov_docker_script/run_setup_dependencies.sh new file mode 100755 index 0000000..5223c84 --- /dev/null +++ b/cov_docker_script/run_setup_dependencies.sh @@ -0,0 +1,67 @@ +#!/usr/bin/env bash +set -e + +################################################################################ +# Setup Dependencies Wrapper Script +# Sets up build tools and runs setup_dependencies.sh +# Usage: ./run_setup_dependencies.sh +################################################################################ + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +NATIVE_COMPONENT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)" +BUILD_TOOLS_REPO_URL="https://github.com/rdkcentral/build_tools_workflows" +BUILD_TOOLS_DIR="$NATIVE_COMPONENT_DIR/build_tools_workflows" +REQUIRED_SCRIPTS=("build_native.sh" "common_build_utils.sh" "common_external_build.sh" "setup_dependencies.sh") + +# Basic logging functions +log() { echo "[INFO] $*"; } +ok() { echo "[OK] $*"; } +err() { echo "[ERROR] $*" >&2; } + +echo "" +echo "===== Setup Dependencies Pipeline =====" +echo "" + +# Setup build tools +log "Setting up build tools..." + +# Clone build_tools_workflows +if [[ -d "$BUILD_TOOLS_DIR" ]]; then + log "build_tools_workflows already exists, skipping clone" +else + log "Cloning build_tools_workflows (develop)" + cd "$NATIVE_COMPONENT_DIR" + git clone -b develop "$BUILD_TOOLS_REPO_URL" || { err "Clone failed"; exit 1; } + ok "Repository cloned" +fi + +# Verify required scripts +[[ ! -d "$BUILD_TOOLS_DIR/cov_docker_script" ]] && { err "cov_docker_script not found"; exit 1; } + +log "Verifying required scripts..." +MISSING=() +for script in "${REQUIRED_SCRIPTS[@]}"; do + [[ -f "$BUILD_TOOLS_DIR/cov_docker_script/$script" ]] || MISSING+=("$script") +done + +if [[ ${#MISSING[@]} -gt 0 ]]; then + err "Missing scripts: ${MISSING[*]}" + exit 1 +fi +ok "All required scripts found" + +# Verify setup_dependencies.sh exists before running +if [[ ! -f "$BUILD_TOOLS_DIR/cov_docker_script/setup_dependencies.sh" ]]; then + err "setup_dependencies.sh not found in build_tools_workflows" + exit 1 +fi + +# Run setup_dependencies.sh from build_tools_workflows +echo "" +log "Running setup_dependencies.sh from build_tools_workflows..." +cd "$NATIVE_COMPONENT_DIR" +"$BUILD_TOOLS_DIR/cov_docker_script/setup_dependencies.sh" "$SCRIPT_DIR/component_config.json" + +echo "" +echo "[OK] Dependencies setup completed successfully!" +echo ""