diff --git a/board/common/post-build.sh b/board/common/post-build.sh index 21e938635..807990a85 100755 --- a/board/common/post-build.sh +++ b/board/common/post-build.sh @@ -4,6 +4,37 @@ common=$(dirname "$(readlink -f "$0")") . "$BR2_CONFIG" 2>/dev/null . "$TARGET_DIR/usr/lib/os-release" +# Extract list of loaded YANG modules and their features for yangdoc.html +mkyangdoc() +{ + cmd="yangdoc -o $1 -p $TARGET_DIR/usr/share/yang" + + # shellcheck disable=SC2155 + export SYSREPO_SHM_PREFIX="yangdoc" + while IFS= read -r line; do + if echo "$line" | grep -q '^[a-z]'; then + module=$(echo "$line" | awk '{print $1}') + cmd="$cmd -m $module" + feature=$(echo "$line" | awk -F'|' '{print $8}' | sed 's/^ *//;s/ *$//') + if [ -n "$feature" ]; then + feature_list=$(echo "$feature" | tr ' ' '\n') + for feat in $feature_list; do + cmd="$cmd -e $feat" + done + fi + fi + done <> "$TARGET_DIR/etc/shells" + +# Create YANG documentation +if [ "$BR2_PACKAGE_HOST_PYTHON_YANGDOC" = "y" ]; then + mkyangdoc "$BINARIES_DIR/yangdoc.html" +fi diff --git a/configs/aarch64_defconfig b/configs/aarch64_defconfig index 5d5351d3e..d26e23bd0 100644 --- a/configs/aarch64_defconfig +++ b/configs/aarch64_defconfig @@ -157,6 +157,7 @@ BR2_PACKAGE_PODMAN_DRIVER_VFS=y BR2_PACKAGE_TETRIS=y BR2_PACKAGE_ROUSETTE=y BR2_PACKAGE_LIBINPUT=y +BR2_PACKAGE_HOST_PYTHON_YANGDOC=y DISK_IMAGE_BOOT_BIN=y TRUSTED_KEYS=y TRUSTED_KEYS_DEVELOPMENT=y diff --git a/configs/r2s_defconfig b/configs/r2s_defconfig index c82736249..3b5d58553 100644 --- a/configs/r2s_defconfig +++ b/configs/r2s_defconfig @@ -184,5 +184,6 @@ BR2_PACKAGE_PODMAN_DRIVER_VFS=y BR2_PACKAGE_TETRIS=y BR2_PACKAGE_ROUSETTE=y BR2_PACKAGE_LIBINPUT=y +BR2_PACKAGE_HOST_PYTHON_YANGDOC=y # SIGN_ENABLED is not set # GNS3_APPLIANCE is not set diff --git a/configs/x86_64_defconfig b/configs/x86_64_defconfig index e37dcaebd..600deceae 100644 --- a/configs/x86_64_defconfig +++ b/configs/x86_64_defconfig @@ -159,6 +159,7 @@ BR2_PACKAGE_PODMAN_DRIVER_DEVICEMAPPER=y BR2_PACKAGE_PODMAN_DRIVER_VFS=y BR2_PACKAGE_TETRIS=y BR2_PACKAGE_ROUSETTE=y +BR2_PACKAGE_HOST_PYTHON_YANGDOC=y TRUSTED_KEYS=y TRUSTED_KEYS_DEVELOPMENT=y GNS3_APPLIANCE_RAM=512