Ed Tanous | d5cea14 | 2021-09-09 11:42:05 -0700 | [diff] [blame] | 1 | #!/bin/bash -e |
| 2 | # |
| 3 | |
Ed Tanous | 7f8954e | 2021-09-09 11:46:43 -0700 | [diff] [blame] | 4 | script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" |
| 5 | obmc_dir=${script_dir}/../../ |
| 6 | |
Patrick Williams | 12a27b2 | 2021-10-26 16:07:31 -0500 | [diff] [blame] | 7 | cd "$obmc_dir" |
| 8 | |
Ed Tanous | 7f8954e | 2021-09-09 11:46:43 -0700 | [diff] [blame] | 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 | |
| 14 | patch_files_tmp=$(mktemp) |
| 15 | allowed_patches_tmp=$(mktemp) |
Patrick Williams | 693d3db | 2021-10-26 16:10:20 -0500 | [diff] [blame] | 16 | trap 'rm $patch_files_tmp $allowed_patches_tmp' exit |
Ed Tanous | 7f8954e | 2021-09-09 11:46:43 -0700 | [diff] [blame] | 17 | |
Patrick Williams | 12a27b2 | 2021-10-26 16:07:31 -0500 | [diff] [blame] | 18 | git ls-files -- \ |
Ed Tanous | 7f8954e | 2021-09-09 11:46:43 -0700 | [diff] [blame] | 19 | '*.patch' \ |
| 20 | ':!:poky/**' \ |
| 21 | ':!:meta-security/**' \ |
Ed Tanous | 7f8954e | 2021-09-09 11:46:43 -0700 | [diff] [blame] | 22 | ':!:meta-raspberrypi/**' \ |
| 23 | ':!:meta-openembedded/**' \ |
| 24 | ':!:meta-phosphor/**' \ |
Patrick Williams | 693d3db | 2021-10-26 16:10:20 -0500 | [diff] [blame] | 25 | | sort > "$patch_files_tmp" |
Ed Tanous | 7f8954e | 2021-09-09 11:46:43 -0700 | [diff] [blame] | 26 | |
| 27 | |
| 28 | # The following patches were present on master at the time this test was |
| 29 | # written. Their presence in this list should not be acknowlegement that they |
| 30 | # are now allowed, but ignoring them is required in the intermediate time |
| 31 | # between when this test was created, and when the maintainers of these repos |
| 32 | # clean them up. |
| 33 | # |
| 34 | # https://github.com/openbmc/docs/blob/master/meta-layer-guidelines.md |
| 35 | echo "\ |
| 36 | meta-amd/meta-ethanolx/recipes-x86/chassis/x86-power-control/0001-Amd-power-control-modifications-for-EthanolX.patch |
| 37 | meta-ampere/meta-common/recipes-devtools/mtd/mtd-utils/0001-flashcp-support-offset-option.patch |
Ed Tanous | 7f8954e | 2021-09-09 11:46:43 -0700 | [diff] [blame] | 38 | meta-aspeed/recipes-bsp/u-boot/files/default-gcc.patch |
Ed Tanous | 7f8954e | 2021-09-09 11:46:43 -0700 | [diff] [blame] | 39 | meta-bytedance/meta-g220a/recipes-kernel/linux/linux-aspeed/0005-ARM-dts-aspeed-Enable-g220a-uart-route.patch |
| 40 | meta-bytedance/meta-g220a/recipes-phosphor/ipmi/phosphor-node-manager-proxy/0001-Remove-Total_Power-sensor.patch |
| 41 | meta-facebook/meta-bletchley/recipes-bsp/u-boot/u-boot-aspeed-sdk/0001-u-boot-ast2600-57600-baudrate-for-bletchley.patch |
| 42 | meta-facebook/meta-tiogapass/recipes-bsp/u-boot/u-boot-aspeed/0001-configs-ast-common-use-57600-baud-rate-to-match-Tiog.patch |
| 43 | meta-facebook/meta-yosemitev2/recipes-bsp/u-boot/u-boot-aspeed/0001-board-aspeed-Add-Mux-for-yosemitev2.patch |
| 44 | meta-facebook/meta-yosemitev2/recipes-bsp/u-boot/u-boot-aspeed/0002-spl-host-console-handle.patch |
| 45 | meta-google/dynamic-layers/nuvoton-layer/recipes-bsp/images/npcm7xx-igps/0001-Set-FIU0_DRD_CFG-and-FIU_Clk_divider-for-gbmc-hoth.patch |
| 46 | meta-google/recipes-extended/libconfig/files/0001-conf2struct-Use-the-right-perl.patch |
| 47 | meta-google/recipes-extended/libconfig/files/0001-makefile-Add-missing-LDFLAGS.patch |
| 48 | meta-google/recipes-phosphor/initrdscripts/obmc-phosphor-initfs/rwfs-clean-dev.patch |
| 49 | meta-ingrasys/meta-zaius/recipes-bsp/u-boot/u-boot-aspeed/0001-board-aspeed-Add-reset_phy-for-Zaius.patch |
| 50 | meta-nuvoton/recipes-bsp/images/npcm7xx-igps/0001-Adjust-paths-for-use-with-Bitbake.patch |
| 51 | meta-yadro/meta-nicole/recipes-bsp/u-boot/files/0001-Add-system-reset-status-support.patch |
| 52 | meta-yadro/meta-nicole/recipes-bsp/u-boot/files/0002-config-ast-common-set-fieldmode-to-true.patch |
| 53 | meta-yadro/meta-nicole/recipes-bsp/u-boot/files/0003-aspeed-add-gpio-support.patch |
| 54 | meta-yadro/meta-nicole/recipes-bsp/u-boot/files/0004-aspeed-add-bmc-position-support.patch |
| 55 | meta-yadro/meta-nicole/recipes-kernel/linux/linux-aspeed/0001-Add-NCSI-channel-selector.patch |
| 56 | meta-yadro/meta-nicole/recipes-phosphor/host/op-proc-control/0001-Stop-and-send-SRESET-for-one-thread-only.patch |
| 57 | meta-yadro/recipes-phosphor/dbus/phosphor-dbus-interfaces/0001-Add-boot-initiator-mailbox-interface.patch |
| 58 | meta-yadro/recipes-phosphor/ipmi/phosphor-ipmi-host/0001-Add-support-for-persistent-only-settings.patch |
| 59 | meta-yadro/recipes-phosphor/ipmi/phosphor-ipmi-host/0002-Add-support-for-boot-initiator-mailbox.patch |
| 60 | meta-yadro/recipes-phosphor/ipmi/phosphor-ipmi-host/0003-Fix-version-parsing-update-AUX-revision-info.patch |
Patrick Williams | 693d3db | 2021-10-26 16:10:20 -0500 | [diff] [blame] | 61 | " | sort > "$allowed_patches_tmp" |
Ed Tanous | 7f8954e | 2021-09-09 11:46:43 -0700 | [diff] [blame] | 62 | |
Patrick Williams | 693d3db | 2021-10-26 16:10:20 -0500 | [diff] [blame] | 63 | files_diff=$(comm -23 "$patch_files_tmp" "$allowed_patches_tmp") |
Ed Tanous | 7f8954e | 2021-09-09 11:46:43 -0700 | [diff] [blame] | 64 | |
Ed Tanous | 4734c22 | 2021-09-20 11:11:34 -0700 | [diff] [blame] | 65 | files_count=$(echo -n "$files_diff" | grep -c '^' || true) |
Ed Tanous | 7f8954e | 2021-09-09 11:46:43 -0700 | [diff] [blame] | 66 | if [[ $files_count -ne 0 ]]; then |
| 67 | echo "Patch files found not in allow list" |
| 68 | echo "$files_diff" |
| 69 | echo "Patches are not allowed on OpenBMC in these layers. Please upstream your changes and see \ |
| 70 | https://github.com/openbmc/docs/blob/master/meta-layer-guidelines.md" |
| 71 | exit 1 |
| 72 | fi |
| 73 | |
Patrick Williams | 12a27b2 | 2021-10-26 16:07:31 -0500 | [diff] [blame] | 74 | lint_exempt="\ |
| 75 | meta-amd/recipes-amd/amd-fpga/files/ethanolx/fpgardu.sh |
Patrick Williams | 12a27b2 | 2021-10-26 16:07:31 -0500 | [diff] [blame] | 76 | meta-bytedance/meta-g220a/recipes-network/network/static-mac-addr/mac-check |
| 77 | meta-bytedance/meta-g220a/recipes-phosphor/datetime/me-time-sync/me-time-sync.sh |
Patrick Williams | 12a27b2 | 2021-10-26 16:07:31 -0500 | [diff] [blame] | 78 | meta-fii/meta-kudo/recipes-kudo/host/files/ampere_power_util.sh |
| 79 | meta-fii/meta-kudo/recipes-kudo/kudo-fw-utility/kudo-fw/kudo-fw-ver.sh |
| 80 | meta-fii/meta-kudo/recipes-kudo/kudo-fw-utility/kudo-fw/kudo-fw.sh |
| 81 | meta-fii/meta-kudo/recipes-kudo/kudo-fw-utility/kudo-fw/kudo-lib.sh |
| 82 | meta-fii/meta-kudo/recipes-kudo/kudo-sys-utility/kudo-boot/init_once.sh |
| 83 | meta-fii/meta-kudo/recipes-kudo/kudo-sys-utility/kudo-cmd/kudo-ras.sh |
| 84 | meta-fii/meta-kudo/recipes-kudo/kudo-sys-utility/kudo-cmd/kudo.sh |
| 85 | meta-fii/meta-kudo/recipes-kudo/network/usb-network/usb_network.sh |
| 86 | meta-fii/meta-kudo/recipes-phosphor/console/obmc-console/kudo_uart_mux_ctrl.sh |
| 87 | meta-google/recipes-google/gpio/gpio-ctrl/lib.sh |
| 88 | meta-google/recipes-google/host-power-ctrl/gpio-host-pwr/host_isoff.sh |
| 89 | meta-google/recipes-google/host-power-ctrl/gpio-host-pwr/host_powercycle.sh |
| 90 | meta-google/recipes-google/host-power-ctrl/gpio-host-pwr/host_poweroff.sh |
| 91 | meta-google/recipes-google/host-power-ctrl/gpio-host-pwr/host_poweron.sh |
| 92 | meta-google/recipes-google/host-power-ctrl/gpio-host-pwr/host_reset.sh |
| 93 | meta-google/recipes-google/host-power-ctrl/gpio-host-pwr/lib.sh |
| 94 | meta-google/recipes-google/ipmi/ipmi-fru-sh/lib.sh |
| 95 | meta-google/recipes-google/ncsi/files/gbmc-ncsi-ip-from-ra.sh.in |
| 96 | meta-google/recipes-google/networking/files/gbmc-ip-monitor-test.sh |
| 97 | meta-google/recipes-google/networking/files/gbmc-ip-monitor.sh |
| 98 | meta-google/recipes-google/networking/files/gbmc-mac-config.sh.in |
Patrick Williams | 521d8f6 | 2021-10-27 09:30:41 -0500 | [diff] [blame] | 99 | meta-google/recipes-google/networking/gbmc-bridge/gbmc-br-from-ra.sh |
| 100 | meta-google/recipes-google/networking/gbmc-bridge/gbmc-br-gw-src.sh |
| 101 | meta-google/recipes-google/networking/gbmc-bridge/gbmc-br-nft.sh |
| 102 | meta-google/recipes-google/networking/gbmc-bridge/gbmc-br-ula.sh |
Patrick Williams | 12a27b2 | 2021-10-26 16:07:31 -0500 | [diff] [blame] | 103 | meta-google/recipes-google/networking/google-usb-network/usb_network.sh |
| 104 | meta-google/recipes-google/networking/google-usb-network/usb_network_test.sh |
| 105 | meta-google/recipes-google/networking/network-sh/lib.sh |
| 106 | meta-google/recipes-google/networking/network-sh/test.sh |
| 107 | meta-google/recipes-google/nftables/files/nft-configure.sh |
| 108 | meta-google/recipes-google/ssh/authorized-keys-comp/authorized-keys-comp.sh |
| 109 | meta-google/recipes-google/test/test-sh/test.sh |
| 110 | meta-google/recipes-phosphor/flash/google-key/verify-bmc-image.sh |
| 111 | meta-google/recipes-phosphor/flash/inplace-gbmc-update/inplace-gbmc-verify.sh |
| 112 | meta-hpe/meta-common/recipes-hpe/host/host-boot-enable/host-boot-enable.sh |
| 113 | meta-hpe/meta-common/recipes-phosphor/initrdscripts/files/gxp-obmc-init.sh |
| 114 | meta-hpe/meta-dl360poc/recipes-hpe/host/host-boot-enable/host-boot-enable.sh |
| 115 | meta-ibm/meta-romulus/recipes-phosphor/chassis/vrm-control/vrm-control.sh |
| 116 | meta-ibm/meta-romulus/recipes-phosphor/gpio/id-button/toggle_identify_led.sh |
| 117 | meta-ibm/recipes-phosphor/chassis/power-workarounds/witherspoon/power-workarounds.sh |
| 118 | meta-ibm/recipes-phosphor/chassis/vrm-control/ibm-ac-server/ir35221-unbind-bind.sh |
| 119 | meta-ibm/recipes-phosphor/chassis/vrm-control/mihawk/ir35221-unbind-bind.sh |
| 120 | meta-ibm/recipes-phosphor/chassis/vrm-control/vrm-control.sh |
| 121 | meta-ibm/recipes-phosphor/dump/phosphor-debug-collector/plugins.d/ibm_elogall |
| 122 | meta-ibm/recipes-phosphor/dump/phosphor-debug-collector/plugins.d/pels |
| 123 | meta-ibm/recipes-phosphor/gpio/id-button/toggle_identify_led.sh |
| 124 | meta-ibm/recipes-phosphor/mboxd/mboxd/check_pnor_format.sh |
| 125 | meta-ingrasys/meta-zaius/recipes-phosphor/chassis/avsbus-control/zaius_avsbus.sh |
| 126 | meta-ingrasys/meta-zaius/recipes-phosphor/chassis/vcs-control/zaius_vcs.sh |
| 127 | meta-inventec/meta-transformers/recipes-phosphor/init/transformers-init/transformers-init.sh |
Patrick Williams | 521d8f6 | 2021-10-27 09:30:41 -0500 | [diff] [blame] | 128 | meta-openpower/recipes-bsp/pdata/files/power-target.sh |
Patrick Williams | 12a27b2 | 2021-10-26 16:07:31 -0500 | [diff] [blame] | 129 | meta-openpower/recipes-phosphor/dump/phosphor-debug-collector/plugins.d/guard |
| 130 | meta-openpower/recipes-phosphor/network/first-boot-set-hostname/first-boot-set-hostname.sh |
| 131 | meta-openpower/recipes-phosphor/network/first-boot-set-mac/first-boot-set-mac.sh |
| 132 | meta-openpower/recipes-phosphor/occ/openpower-occ-control/occ-active.sh |
| 133 | meta-phosphor/recipes-phosphor/initrdscripts/files/obmc-init.sh |
| 134 | meta-phosphor/recipes-phosphor/initrdscripts/files/obmc-shutdown.sh |
| 135 | meta-phosphor/recipes-phosphor/initrdscripts/files/obmc-update.sh |
| 136 | meta-phosphor/recipes-phosphor/initrdscripts/phosphor-mmc-init/mmc-init.sh |
| 137 | meta-phosphor/recipes-phosphor/interfaces/bmcweb/run-ptest |
| 138 | meta-phosphor/recipes-phosphor/preinit-mounts/preinit-mounts/init |
| 139 | meta-phosphor/recipes-support/nss-pam-ldapd/files/nslcd.init |
Patrick Williams | 12a27b2 | 2021-10-26 16:07:31 -0500 | [diff] [blame] | 140 | meta-quanta/meta-common/recipes-quanta/network/usb-network/usb-network.sh |
| 141 | meta-quanta/meta-gbs/recipes-gbs/gbs-bios-update/files/bios-update.sh |
| 142 | meta-quanta/meta-gbs/recipes-gbs/gbs-bios-update/files/bios-verify.sh |
| 143 | meta-quanta/meta-gbs/recipes-gbs/gbs-bmc-update/files/bmc-verify.sh |
| 144 | meta-quanta/meta-gbs/recipes-gbs/gbs-detect-gpio-present/files/detect-gpio-present.sh |
| 145 | meta-quanta/meta-gbs/recipes-gbs/gbs-sysinit/files/gbs-sysinit.sh |
| 146 | meta-quanta/meta-gbs/recipes-gbs/hotswap-power-cycle/files/tray_powercycle.sh |
| 147 | meta-quanta/meta-gbs/recipes-google/acpi-power-state/acpi-power-state-daemon/gbs-check-host-state.sh |
| 148 | meta-quanta/meta-gbs/recipes-google/acpi-power-state/acpi-power-state-daemon/gbs-set-failsafe.sh |
| 149 | meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/fan-table-init.sh |
| 150 | meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-nvme/nvme_json_rewrite.sh |
| 151 | meta-quanta/meta-gsj/recipes-gsj/detect-fan-fail/files/detect-fan-fail.sh |
| 152 | meta-quanta/meta-gsj/recipes-gsj/gsj-hotswap-change-setting/files/gsj-hotswap-change-setting.sh |
| 153 | meta-quanta/meta-gsj/recipes-gsj/quanta-nvme-powerctrl/files/init_once.sh |
| 154 | meta-quanta/meta-gsj/recipes-gsj/quanta-nvme-powerctrl/files/nvme_powerctrl_library.sh |
| 155 | meta-quanta/meta-gsj/recipes-gsj/quanta-nvme-powerctrl/files/nvme_powermanager.sh |
| 156 | meta-quanta/meta-gsj/recipes-gsj/usb-network/files/usb_network.sh |
| 157 | meta-quanta/meta-gsj/recipes-phosphor/fans/phosphor-pid-control/fan-control.sh |
Patrick Williams | 521d8f6 | 2021-10-27 09:30:41 -0500 | [diff] [blame] | 158 | meta-quanta/meta-gsj/recipes-phosphor/fans/phosphor-pid-control/fan-default-speed.sh |
Patrick Williams | 12a27b2 | 2021-10-26 16:07:31 -0500 | [diff] [blame] | 159 | meta-quanta/meta-olympus-nuvoton/recipes-olympus-nuvoton/power/first-boot-set-psu/first-boot-set-psu.sh |
Patrick Williams | 521d8f6 | 2021-10-27 09:30:41 -0500 | [diff] [blame] | 160 | meta-quanta/meta-olympus-nuvoton/recipes-phosphor/fans/phosphor-pid-control/fan-full-speed.sh |
Patrick Williams | 12a27b2 | 2021-10-26 16:07:31 -0500 | [diff] [blame] | 161 | meta-quanta/meta-q71l/recipes-phosphor/quanta-powerctrl/files/init_once.sh |
| 162 | meta-quanta/meta-q71l/recipes-phosphor/quanta-powerctrl/files/poweroff.sh |
| 163 | meta-quanta/meta-q71l/recipes-phosphor/quanta-powerctrl/files/poweron.sh |
| 164 | meta-yadro/meta-nicole/recipes-phosphor/chassis/avsbus-control/avsbus-control.sh |
Patrick Williams | 12a27b2 | 2021-10-26 16:07:31 -0500 | [diff] [blame] | 165 | " |
| 166 | |
Patrick Williams | 2ed00d8 | 2021-10-27 09:33:53 -0500 | [diff] [blame] | 167 | types=(json shell) |
| 168 | # shellcheck disable=SC2034 |
| 169 | check_json="eslint --resolve-plugins-relative-to /usr/local/lib/node_modules" |
Patrick Williams | 521d8f6 | 2021-10-27 09:30:41 -0500 | [diff] [blame] | 170 | # shellcheck disable=SC2034 |
| 171 | check_shell="shellcheck -x" |
| 172 | |
| 173 | for t in "${types[@]}"; do |
| 174 | check_cmd="check_${t}" |
| 175 | if ! which "${!check_cmd%% *}" > /dev/null 2>&1; then |
| 176 | eval "${check_cmd}=\"echo WARNING: Skipping $t due to missing command:\"" |
| 177 | echo "${!check_cmd}" |
| 178 | fi |
| 179 | done |
| 180 | |
Patrick Williams | 12a27b2 | 2021-10-26 16:07:31 -0500 | [diff] [blame] | 181 | non_bbfiles=$(git ls-files -- \ |
| 182 | ':!:poky/**' \ |
| 183 | ':!:meta-security/**' \ |
| 184 | ':!:meta-raspberrypi/**' \ |
| 185 | ':!:meta-openembedded/**' \ |
| 186 | | grep -v -e "\.patch$" -e "\.bb$" -e "\.bbappend$") |
| 187 | |
| 188 | for f in $non_bbfiles; do |
Patrick Williams | 521d8f6 | 2021-10-27 09:30:41 -0500 | [diff] [blame] | 189 | unset file_type |
| 190 | file_info=$(file "$f") |
| 191 | case $file_info in |
Patrick Williams | 12a27b2 | 2021-10-26 16:07:31 -0500 | [diff] [blame] | 192 | *shell\ script*) |
Patrick Williams | 521d8f6 | 2021-10-27 09:30:41 -0500 | [diff] [blame] | 193 | file_type="shell" |
Patrick Williams | 12a27b2 | 2021-10-26 16:07:31 -0500 | [diff] [blame] | 194 | ;; |
| 195 | |
Patrick Williams | 2ed00d8 | 2021-10-27 09:33:53 -0500 | [diff] [blame] | 196 | *JSON\ data*) |
| 197 | file_type="json" |
| 198 | ;; |
| 199 | |
Patrick Williams | 12a27b2 | 2021-10-26 16:07:31 -0500 | [diff] [blame] | 200 | *) |
Patrick Williams | 521d8f6 | 2021-10-27 09:30:41 -0500 | [diff] [blame] | 201 | case $f in |
| 202 | *.sh) |
| 203 | file_type="shell" |
| 204 | ;; |
| 205 | |
Patrick Williams | 2ed00d8 | 2021-10-27 09:33:53 -0500 | [diff] [blame] | 206 | *.json) |
| 207 | file_type="json" |
| 208 | ;; |
Patrick Williams | 521d8f6 | 2021-10-27 09:30:41 -0500 | [diff] [blame] | 209 | esac |
Patrick Williams | 12a27b2 | 2021-10-26 16:07:31 -0500 | [diff] [blame] | 210 | esac |
Patrick Williams | 521d8f6 | 2021-10-27 09:30:41 -0500 | [diff] [blame] | 211 | |
| 212 | if [ -n "$file_type" ]; then |
| 213 | check_cmd="check_${file_type}" |
| 214 | if ! eval "${!check_cmd} $f"; then |
| 215 | if [[ $lint_exempt == *$f* ]]; then |
| 216 | echo "EXEMPT: $f" |
| 217 | else |
| 218 | echo "FAILED: $f" |
| 219 | false |
| 220 | fi |
| 221 | fi |
| 222 | fi |
| 223 | |
Patrick Williams | 12a27b2 | 2021-10-26 16:07:31 -0500 | [diff] [blame] | 224 | done |
| 225 | |
Ed Tanous | d5cea14 | 2021-09-09 11:42:05 -0700 | [diff] [blame] | 226 | echo "Repo test passed" |
Ed Tanous | 7f8954e | 2021-09-09 11:46:43 -0700 | [diff] [blame] | 227 | |