#!/bin/bash SRC="$(realpath "${BASH_SOURCE%/*}/../")" # Dummy function for successful source function display_alert() { : } function enable_extension() { : } # $1: board config function generate_for_board() { local board_config="$1" ( source "${SRC}/config/boards/${board_config}" LINUXFAMILY="${BOARDFAMILY}" [[ -n "${BOARD_MAINTAINER}" ]] || return maintainers="$(echo "${BOARD_MAINTAINER}" | xargs -n1 | sed -E 's|^.+$|@\0|' | tr '\n' ' ')" while read -r BRANCH; do ( source "${SRC}/config/sources/families/${LINUXFAMILY}.conf" source "${SRC}/config/sources/common.conf" source "${SRC}/config/sources/${ARCH}.conf" [[ -z $LINUXCONFIG ]] && LINUXCONFIG="linux-${LINUXFAMILY}-${BRANCH}" [[ -z $KERNELPATCHDIR ]] && KERNELPATCHDIR="$LINUXFAMILY-$BRANCH" cat <<-EOF config/boards/${board_config} ${maintainers} config/kernel/${LINUXCONFIG%-*}-*.config ${maintainers} sources/families/${LINUXFAMILY}.conf ${maintainers} patch/kernel/${KERNELPATCHDIR%-*}-*/ ${maintainers} EOF local patch_archive="$(readlink "patch/kernel/${KERNELPATCHDIR}" || true)" if [[ -n "${patch_archive}" ]]; then patch_archive="${patch_archive%/}" echo "patch/kernel/${patch_archive%-*}-*/ ${maintainers}" fi ) done < <(echo "${KERNEL_TARGET}" | tr ',' '\n') ) } function generate_for_all_board() { local board_config while read -r board_config; do local type="${board_config##*.}" [[ "conf wip csc eos tvb" == *"${type}"* ]] || continue generate_for_board "${board_config}" done < <(ls "${SRC}/config/boards/") } function merge() { local line declare -A codeowners while read -r line; do local file="$(echo "${line}" | tr -s '[:space:]' ' ' | cut -d' ' -f1)" local maintainers="$(echo "${line}" | tr -s '[:space:]' ' ' | cut -d' ' -f2-)" codeowners["$file"]+=" ${maintainers}" done local file while read -r file; do declare -a maintainers readarray -t maintainers < <(echo "${codeowners["$file"]}" | xargs -n1 | sort -u) echo "${file} ${maintainers[*]}" done < <(printf "%s\n" "${!codeowners[@]}" | sort) } cat <<-EOF >"${SRC}/.github/CODEOWNERS" # PLEASE DON'T EDIT THIS FILE # Auto generated by ".github/generate_CODEOWNERS.sh" # Default code owner * @igorpecovnik # the last matching pattern takes the most *.md @EvilOlaf @littlecxm @TheLinuxBug @TRSx80 @igorpecovnik .github/ @igorpecovnik @rpardini @hzyitc lib/ @armbian/build-scripts packages/ @armbian/build-scripts packages/bsp/jethub/ @armbian/build-scripts @adeepn tools/ @iav @neheb @hzyitc @mhoffrog # The following contents are generated by board configs $(generate_for_all_board | merge) EOF