#!/bin/sh # vim: ft=sh . "$(dirname "$(readlink -f "$0")")/../job.common" ################################################### compile_params="-j$(nproc) -f" num_jobs="$(($(nproc) * 2))" make="force-make -j$num_jobs -d$num_jobs -f V=99 -- -l$(nproc) BUILD_LOG=1" ################################################### export IS_TTY=1 # TODO take lock so we won't run multiple instances of new builds curl "https://repo.turris.cz/$ANIMAL/$BOARD/packages/git-hash" > git-hash cat git-hash if [ -z "$CLEAN" ] && [ -f "$WORKSPACE/openwrt-git-hash" ] && cmp -s git-hash "$WORKSPACE/openwrt-git-hash"; then echo_info "Using previous version of SDK" tar -xzf "$WORKSPACE/openwrt.tar.gz" else echo_info "Building new version of SDK" echo_stage "Get turris-build" git_fetch_t "https://gitlab.labs.nic.cz/turris/turris-build.git" turris-build "$ANIMAL" ( cd turris-build "$FILES/turris_checkout_repo_branch.sh" "$ANIMAL" cat feeds.conf patch -Np1 -r - < "$FILES/openwrt-hash.patch" || true # just ignore if it fails ) echo_stage "Prepare SDK" mkdir openwrt ( cd openwrt cat > .turris-build.conf <<-EOF GIT_MIRROR="$TWORKSPACE/openwrt-git-mirror" DL_MIRROR="$TWORKSPACE/openwrt-dl-mirror" CCACHE_HOST_DIR="$TWORKSPACE/ccache-host" CCACHE_TARGET_DIR="$WORKSPACE/ccache-target" EOF ../turris-build/compile_pkgs -t "$BOARD" -p "$ANIMAL" $compile_params \ prepare_tools autopkg $make package/usign/host/compile ) tar -czf openwrt.tar.gz openwrt mv openwrt.tar.gz "$WORKSPACE/openwrt.tar.gz" mv git-hash "$WORKSPACE/openwrt-git-hash" fi cd openwrt echo_stage "Get personal repository feed" echo "src-git personal git@cynerd.cz:openwrt-personal-pkgs" >> feeds.conf ./scripts/feeds update personal find feeds/personal -type d -exec test -f '{}/Makefile' \; -prune -printf "%P\0" | \ xargs -0 ./scripts/feeds uninstall # Remove any package provided by personal feed ./scripts/feeds install -p personal -d y -f -a echo_stage "Compile packages from personal feed" find package/feeds/personal -mindepth 1 -maxdepth 1 -printf '%P\n' | \ while read -r package; do $make "package/$package/compile" || \ echo_error "Package build failed: $package" done echo_stage "Generate index and sign" $make package/index BUILD_KEY=~/openwrt-repo.sec echo_stage "Deploy" sftp -b - upload <