mirror of
https://github.com/armbian/build
synced 2025-09-24 19:47:06 +07:00
118 lines
3.5 KiB
Bash
Executable File
118 lines
3.5 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
SRC="$(realpath "${BASH_SOURCE%/*}/../")"
|
|
|
|
# Dummy function for successful source
|
|
function display_alert() { :; }
|
|
function enable_extension() { :; }
|
|
function add_packages_to_image() { :; }
|
|
|
|
function run_hook() {
|
|
local hook_point="$1"
|
|
while read -r hook_point_function; do
|
|
"${hook_point_function}"
|
|
done < <(compgen -A function | grep "^${hook_point}__" | LC_ALL=C.UTF-8 sort)
|
|
}
|
|
|
|
# $1: board config
|
|
function generate_for_board() {
|
|
local board_config="$1"
|
|
(
|
|
BOARD="${board_config%.*}"
|
|
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"
|
|
|
|
run_hook "post_family_config"
|
|
run_hook "post_family_config_branch_${BRANCH,,}"
|
|
|
|
[[ -z $LINUXCONFIG ]] && LINUXCONFIG="linux-${LINUXFAMILY}-${BRANCH}"
|
|
[[ -z $KERNELPATCHDIR ]] && KERNELPATCHDIR="archive/${LINUXFAMILY}-${KERNEL_MAJOR_MINOR}"
|
|
[[ -z $BOOTPATCHDIR ]] && BOOTPATCHDIR="u-boot-${LINUXFAMILY}"
|
|
[[ -z $ATFPATCHDIR ]] && ATFPATCHDIR="atf-${LINUXFAMILY}"
|
|
|
|
cat <<-EOF
|
|
config/boards/${board_config} ${maintainers}
|
|
config/kernel/${LINUXCONFIG%-*}-*.config ${maintainers}
|
|
sources/families/${BOARDFAMILY}.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
|
|
|
|
if [[ -n "${BOOTCONFIG}" && "${BOOTCONFIG}" != "none" ]]; then
|
|
while read -r d; do
|
|
echo "patch/u-boot/${d}/ ${maintainers}"
|
|
done < <(echo "${BOOTPATCHDIR}" | xargs -n1)
|
|
fi
|
|
|
|
if [[ -n "${ATFSOURCE}" && "${ATFSOURCE}" != "none" ]]; then
|
|
echo "patch/atf/${ATFPATCHDIR}/ ${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 | LC_ALL=C.UTF-8 sort -u)
|
|
echo "${file} ${maintainers[*]}"
|
|
done < <(printf "%s\n" "${!codeowners[@]}" | LC_ALL=C.UTF-8 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
|