1#!/bin/bash -e 2# 3 4script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" 5obmc_dir=${script_dir}/../../ 6 7cd "$obmc_dir" 8 9# openbmc doesn't control what upstream poky, or any of the other layers do, 10# which do use patches as part of their upstreaming process. 11# meta-phosphor is also included such that patches that the community agrees to 12# hold onto will be allowed in that layer. 13 14patch_files_tmp=$(mktemp) 15allowed_patches_tmp=$(mktemp) 16trap 'rm $patch_files_tmp $allowed_patches_tmp' exit 17 18git ls-files -- \ 19 '*.patch' '*.dts' \ 20 ':!:poky/**' \ 21 ':!:meta-arm/**' \ 22 ':!:meta-security/**' \ 23 ':!:meta-raspberrypi/**' \ 24 ':!:meta-openembedded/**' \ 25 ':!:meta-phosphor/**' \ 26 | sort > "$patch_files_tmp" 27 28 29# The following patches were present on master at the time this test was 30# written. Their presence in this list should not be acknowlegement that they 31# are now allowed, but ignoring them is required in the intermediate time 32# between when this test was created, and when the maintainers of these repos 33# clean them up. 34# 35# https://github.com/openbmc/docs/blob/master/meta-layer-guidelines.md 36echo "\ 37meta-aspeed/recipes-aspeed/python/socsec/0001-otptool-Define-value_start-in-rev_id-path.patch 38meta-aspeed/recipes-bsp/u-boot/files/default-gcc.patch 39meta-facebook/meta-yosemitev2/recipes-bsp/u-boot/u-boot-aspeed-sdk/0001-board-aspeed-Add-Mux-for-yosemitev2.patch 40meta-facebook/meta-yosemitev2/recipes-bsp/u-boot/u-boot-aspeed-sdk/0002-spl-host-console-handle.patch 41meta-google/dynamic-layers/nuvoton-layer/recipes-bsp/images/npcm7xx-igps/0001-Set-FIU0_DRD_CFG-and-FIU_Clk_divider-for-gbmc-hoth.patch 42meta-google/recipes-extended/libconfig/files/0001-conf2struct-Use-the-right-perl.patch 43meta-google/recipes-extended/libconfig/files/0001-makefile-Add-missing-LDFLAGS.patch 44meta-google/recipes-phosphor/initrdscripts/obmc-phosphor-initfs/rwfs-clean-dev.patch 45meta-hpe/meta-dl360poc/recipes-kernel/linux/linux-obmc/gxp.dts 46meta-ingrasys/meta-zaius/recipes-bsp/u-boot/u-boot-aspeed/0001-board-aspeed-Add-reset_phy-for-Zaius.patch 47meta-nuvoton/recipes-bsp/images/npcm7xx-igps/0001-Adjust-paths-for-use-with-Bitbake.patch 48meta-yadro/meta-nicole/recipes-bsp/u-boot/files/0001-Add-system-reset-status-support.patch 49meta-yadro/meta-nicole/recipes-bsp/u-boot/files/0002-config-ast-common-set-fieldmode-to-true.patch 50meta-yadro/meta-nicole/recipes-bsp/u-boot/files/0003-aspeed-add-gpio-support.patch 51meta-yadro/meta-nicole/recipes-bsp/u-boot/files/0004-aspeed-add-bmc-position-support.patch 52meta-yadro/meta-nicole/recipes-kernel/linux/linux-aspeed/0001-Add-NCSI-channel-selector.patch 53meta-yadro/meta-nicole/recipes-phosphor/host/op-proc-control/0001-Stop-and-send-SRESET-for-one-thread-only.patch 54meta-yadro/recipes-phosphor/dbus/phosphor-dbus-interfaces/0001-Add-boot-initiator-mailbox-interface.patch 55meta-yadro/recipes-phosphor/ipmi/phosphor-ipmi-host/0001-Add-support-for-persistent-only-settings.patch 56meta-yadro/recipes-phosphor/ipmi/phosphor-ipmi-host/0002-Add-support-for-boot-initiator-mailbox.patch 57meta-yadro/recipes-phosphor/ipmi/phosphor-ipmi-host/0003-Fix-version-parsing-update-AUX-revision-info.patch 58" | sort > "$allowed_patches_tmp" 59 60files_diff=$(comm -23 "$patch_files_tmp" "$allowed_patches_tmp") 61 62files_count=$(echo -n "$files_diff" | grep -c '^' || true) 63if [[ $files_count -ne 0 ]]; then 64 echo "Patch or DTS files found not in allow list" 65 echo "$files_diff" 66 echo "Patches are not allowed on OpenBMC in these layers. Please upstream your changes and see \ 67 https://github.com/openbmc/docs/blob/master/meta-layer-guidelines.md" 68 exit 1 69fi 70 71# Now verify there are no kernel dts files being added in a patch 72# All dts files should be sent upstream and can be carried in the openbmc/linux 73# tree until they are accepted upstream 74dts_files_tmp=$(mktemp) 75allowed_dts_tmp=$(mktemp) 76trap 'rm $dts_files_tmp $allowed_dts_tmp' exit 77 78git ls-files -- \ 79 '*.dts' \ 80 ':!:poky/**' \ 81 ':!:meta-arm/**' \ 82 ':!:meta-security/**' \ 83 ':!:meta-raspberrypi/**' \ 84 ':!:meta-openembedded/**' \ 85 | sort > "$dts_files_tmp" 86 87# There is a single dts currently in the tree that we will exempt for now 88echo "\ 89meta-hpe/meta-dl360poc/recipes-kernel/linux/linux-obmc/gxp.dts 90" | sort > "$allowed_dts_tmp" 91 92files_diff=$(comm -23 "$dts_files_tmp" "$allowed_dts_tmp") 93 94files_count=$(echo -n "$files_diff" | grep -c '^' || true) 95if [[ $files_count -ne 0 ]]; then 96echo "Dts files found not in allow list" 97echo "$files_diff" 98echo "Dts files are not allowed on OpenBMC in these layers. Please upstream your changes and see \ 99 https://github.com/openbmc/docs/blob/master/kernel-development.md" 100exit 1 101fi 102 103lint_exempt="\ 104meta-phosphor/recipes-support/nss-pam-ldapd/files/nslcd.init 105" 106 107types=(json shell) 108# shellcheck disable=SC2034 109check_json="eslint --resolve-plugins-relative-to /usr/local/lib/node_modules" 110# shellcheck disable=SC2034 111check_shell="shellcheck -x" 112 113for t in "${types[@]}"; do 114 check_cmd="check_${t}" 115 if ! which "${!check_cmd%% *}" > /dev/null 2>&1; then 116 eval "${check_cmd}=\"echo WARNING: Skipping $t due to missing command:\"" 117 echo "${!check_cmd}" 118 fi 119done 120 121non_bbfiles=$(git ls-files -- \ 122 ':!:poky/**' \ 123 ':!:meta-arm/**' \ 124 ':!:meta-security/**' \ 125 ':!:meta-raspberrypi/**' \ 126 ':!:meta-openembedded/**' \ 127 | grep -v -e "\.patch$" -e "\.bb$" -e "\.bbappend$") 128 129for f in $non_bbfiles; do 130 unset file_type 131 file_info=$(file "$f") 132 case $file_info in 133 *shell\ script*) 134 file_type="shell" 135 ;; 136 137 *JSON\ data*) 138 file_type="json" 139 ;; 140 141 *) 142 case $f in 143 *.sh) 144 file_type="shell" 145 ;; 146 147 *.json) 148 file_type="json" 149 ;; 150 esac 151 esac 152 153 if [ -n "$file_type" ]; then 154 check_cmd="check_${file_type}" 155 if ! eval "${!check_cmd} $f"; then 156 if [[ $lint_exempt == *$f* ]]; then 157 echo "EXEMPT: $f" 158 else 159 echo "FAILED: $f" 160 false 161 fi 162 fi 163 fi 164 165done 166 167# Regenerate supported machines list. 168meta-phosphor/scripts/generate-machine-list 169if ! git --no-pager diff --exit-code ; then 170 echo "Changes to supported-machines.md necessary due to new meta-layer support." 171 exit 1 172fi 173 174echo "Repo test passed" 175