summaryrefslogtreecommitdiff
path: root/meta-phosphor/scripts/run-repotest
blob: d39cbb7014c332edb748c12f82fe2984435f6cbf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
#!/bin/bash -e
#

script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
obmc_dir=${script_dir}/../../

cd "$obmc_dir"

# openbmc doesn't control what upstream poky, or any of the other layers do,
# which do use patches as part of their upstreaming process.
# meta-phosphor is also included such that patches that the community agrees to
# hold onto will be allowed in that layer.

patch_files_tmp=$(mktemp)
allowed_patches_tmp=$(mktemp)
trap 'rm $patch_files_tmp $allowed_patches_tmp' exit

git ls-files -- \
  '*.patch' \
  ':!:poky/**' \
  ':!:meta-security/**' \
  ':!:meta-raspberrypi/**' \
  ':!:meta-openembedded/**' \
  ':!:meta-phosphor/**' \
  | sort > "$patch_files_tmp"


# The following patches were present on master at the time this test was
# written.  Their presence in this list should not be acknowlegement that they
# are now allowed, but ignoring them is required in the intermediate time
# between when this test was created, and when the maintainers of these repos
# clean them up.
#
# https://github.com/openbmc/docs/blob/master/meta-layer-guidelines.md
echo "\
meta-amd/meta-ethanolx/recipes-x86/chassis/x86-power-control/0001-Amd-power-control-modifications-for-EthanolX.patch
meta-ampere/meta-common/recipes-devtools/mtd/mtd-utils/0001-flashcp-support-offset-option.patch
meta-aspeed/recipes-bsp/u-boot/files/default-gcc.patch
meta-bytedance/meta-g220a/recipes-kernel/linux/linux-aspeed/0005-ARM-dts-aspeed-Enable-g220a-uart-route.patch
meta-bytedance/meta-g220a/recipes-phosphor/ipmi/phosphor-node-manager-proxy/0001-Remove-Total_Power-sensor.patch
meta-facebook/meta-bletchley/recipes-bsp/u-boot/u-boot-aspeed-sdk/0001-u-boot-ast2600-57600-baudrate-for-bletchley.patch
meta-facebook/meta-tiogapass/recipes-bsp/u-boot/u-boot-aspeed/0001-configs-ast-common-use-57600-baud-rate-to-match-Tiog.patch
meta-facebook/meta-yosemitev2/recipes-bsp/u-boot/u-boot-aspeed/0001-board-aspeed-Add-Mux-for-yosemitev2.patch
meta-facebook/meta-yosemitev2/recipes-bsp/u-boot/u-boot-aspeed/0002-spl-host-console-handle.patch
meta-google/dynamic-layers/nuvoton-layer/recipes-bsp/images/npcm7xx-igps/0001-Set-FIU0_DRD_CFG-and-FIU_Clk_divider-for-gbmc-hoth.patch
meta-google/recipes-extended/libconfig/files/0001-conf2struct-Use-the-right-perl.patch
meta-google/recipes-extended/libconfig/files/0001-makefile-Add-missing-LDFLAGS.patch
meta-google/recipes-phosphor/initrdscripts/obmc-phosphor-initfs/rwfs-clean-dev.patch
meta-ingrasys/meta-zaius/recipes-bsp/u-boot/u-boot-aspeed/0001-board-aspeed-Add-reset_phy-for-Zaius.patch
meta-nuvoton/recipes-bsp/images/npcm7xx-igps/0001-Adjust-paths-for-use-with-Bitbake.patch
meta-yadro/meta-nicole/recipes-bsp/u-boot/files/0001-Add-system-reset-status-support.patch
meta-yadro/meta-nicole/recipes-bsp/u-boot/files/0002-config-ast-common-set-fieldmode-to-true.patch
meta-yadro/meta-nicole/recipes-bsp/u-boot/files/0003-aspeed-add-gpio-support.patch
meta-yadro/meta-nicole/recipes-bsp/u-boot/files/0004-aspeed-add-bmc-position-support.patch
meta-yadro/meta-nicole/recipes-kernel/linux/linux-aspeed/0001-Add-NCSI-channel-selector.patch
meta-yadro/meta-nicole/recipes-phosphor/host/op-proc-control/0001-Stop-and-send-SRESET-for-one-thread-only.patch
meta-yadro/recipes-phosphor/dbus/phosphor-dbus-interfaces/0001-Add-boot-initiator-mailbox-interface.patch
meta-yadro/recipes-phosphor/ipmi/phosphor-ipmi-host/0001-Add-support-for-persistent-only-settings.patch
meta-yadro/recipes-phosphor/ipmi/phosphor-ipmi-host/0002-Add-support-for-boot-initiator-mailbox.patch
meta-yadro/recipes-phosphor/ipmi/phosphor-ipmi-host/0003-Fix-version-parsing-update-AUX-revision-info.patch
" | sort > "$allowed_patches_tmp"

files_diff=$(comm -23 "$patch_files_tmp" "$allowed_patches_tmp")

files_count=$(echo -n "$files_diff" | grep -c '^' || true)
if [[ $files_count -ne 0 ]]; then
  echo "Patch files found not in allow list"
  echo "$files_diff"
  echo "Patches are not allowed on OpenBMC in these layers.  Please upstream your changes and see \
    https://github.com/openbmc/docs/blob/master/meta-layer-guidelines.md"
  exit 1
fi

lint_exempt="\
meta-amd/recipes-amd/amd-fpga/files/ethanolx/fpgardu.sh
meta-bytedance/meta-g220a/recipes-network/network/static-mac-addr/mac-check
meta-bytedance/meta-g220a/recipes-phosphor/datetime/me-time-sync/me-time-sync.sh
meta-fii/meta-kudo/recipes-kudo/host/files/ampere_power_util.sh
meta-fii/meta-kudo/recipes-kudo/kudo-fw-utility/kudo-fw/kudo-fw-ver.sh
meta-fii/meta-kudo/recipes-kudo/kudo-fw-utility/kudo-fw/kudo-fw.sh
meta-fii/meta-kudo/recipes-kudo/kudo-fw-utility/kudo-fw/kudo-lib.sh
meta-fii/meta-kudo/recipes-kudo/kudo-sys-utility/kudo-boot/init_once.sh
meta-fii/meta-kudo/recipes-kudo/kudo-sys-utility/kudo-cmd/kudo-ras.sh
meta-fii/meta-kudo/recipes-kudo/kudo-sys-utility/kudo-cmd/kudo.sh
meta-fii/meta-kudo/recipes-kudo/network/usb-network/usb_network.sh
meta-fii/meta-kudo/recipes-phosphor/console/obmc-console/kudo_uart_mux_ctrl.sh
meta-google/recipes-google/gpio/gpio-ctrl/lib.sh
meta-google/recipes-google/host-power-ctrl/gpio-host-pwr/host_isoff.sh
meta-google/recipes-google/host-power-ctrl/gpio-host-pwr/host_powercycle.sh
meta-google/recipes-google/host-power-ctrl/gpio-host-pwr/host_poweroff.sh
meta-google/recipes-google/host-power-ctrl/gpio-host-pwr/host_poweron.sh
meta-google/recipes-google/host-power-ctrl/gpio-host-pwr/host_reset.sh
meta-google/recipes-google/host-power-ctrl/gpio-host-pwr/lib.sh
meta-google/recipes-google/ipmi/ipmi-fru-sh/lib.sh
meta-google/recipes-google/ncsi/files/gbmc-ncsi-ip-from-ra.sh.in
meta-google/recipes-google/networking/files/gbmc-ip-monitor-test.sh
meta-google/recipes-google/networking/files/gbmc-ip-monitor.sh
meta-google/recipes-google/networking/files/gbmc-mac-config.sh.in
meta-google/recipes-google/networking/gbmc-bridge/gbmc-br-from-ra.sh
meta-google/recipes-google/networking/gbmc-bridge/gbmc-br-gw-src.sh
meta-google/recipes-google/networking/gbmc-bridge/gbmc-br-nft.sh
meta-google/recipes-google/networking/gbmc-bridge/gbmc-br-ula.sh
meta-google/recipes-google/networking/google-usb-network/usb_network.sh
meta-google/recipes-google/networking/google-usb-network/usb_network_test.sh
meta-google/recipes-google/networking/network-sh/lib.sh
meta-google/recipes-google/networking/network-sh/test.sh
meta-google/recipes-google/nftables/files/nft-configure.sh
meta-google/recipes-google/ssh/authorized-keys-comp/authorized-keys-comp.sh
meta-google/recipes-google/test/test-sh/test.sh
meta-google/recipes-phosphor/flash/google-key/verify-bmc-image.sh
meta-google/recipes-phosphor/flash/inplace-gbmc-update/inplace-gbmc-verify.sh
meta-hpe/meta-common/recipes-hpe/host/host-boot-enable/host-boot-enable.sh
meta-hpe/meta-common/recipes-phosphor/initrdscripts/files/gxp-obmc-init.sh
meta-hpe/meta-dl360poc/recipes-hpe/host/host-boot-enable/host-boot-enable.sh
meta-ibm/meta-romulus/recipes-phosphor/chassis/vrm-control/vrm-control.sh
meta-ibm/meta-romulus/recipes-phosphor/gpio/id-button/toggle_identify_led.sh
meta-ibm/recipes-phosphor/chassis/power-workarounds/witherspoon/power-workarounds.sh
meta-ibm/recipes-phosphor/chassis/vrm-control/ibm-ac-server/ir35221-unbind-bind.sh
meta-ibm/recipes-phosphor/chassis/vrm-control/mihawk/ir35221-unbind-bind.sh
meta-ibm/recipes-phosphor/chassis/vrm-control/vrm-control.sh
meta-ibm/recipes-phosphor/dump/phosphor-debug-collector/plugins.d/ibm_elogall
meta-ibm/recipes-phosphor/dump/phosphor-debug-collector/plugins.d/pels
meta-ibm/recipes-phosphor/gpio/id-button/toggle_identify_led.sh
meta-ibm/recipes-phosphor/mboxd/mboxd/check_pnor_format.sh
meta-ingrasys/meta-zaius/recipes-phosphor/chassis/avsbus-control/zaius_avsbus.sh
meta-ingrasys/meta-zaius/recipes-phosphor/chassis/vcs-control/zaius_vcs.sh
meta-inventec/meta-transformers/recipes-phosphor/init/transformers-init/transformers-init.sh
meta-openpower/recipes-bsp/pdata/files/power-target.sh
meta-openpower/recipes-phosphor/dump/phosphor-debug-collector/plugins.d/guard
meta-openpower/recipes-phosphor/network/first-boot-set-hostname/first-boot-set-hostname.sh
meta-openpower/recipes-phosphor/network/first-boot-set-mac/first-boot-set-mac.sh
meta-openpower/recipes-phosphor/occ/openpower-occ-control/occ-active.sh
meta-phosphor/recipes-phosphor/initrdscripts/files/obmc-init.sh
meta-phosphor/recipes-phosphor/initrdscripts/files/obmc-shutdown.sh
meta-phosphor/recipes-phosphor/initrdscripts/files/obmc-update.sh
meta-phosphor/recipes-phosphor/initrdscripts/phosphor-mmc-init/mmc-init.sh
meta-phosphor/recipes-phosphor/interfaces/bmcweb/run-ptest
meta-phosphor/recipes-phosphor/preinit-mounts/preinit-mounts/init
meta-phosphor/recipes-support/nss-pam-ldapd/files/nslcd.init
meta-quanta/meta-common/recipes-quanta/network/usb-network/usb-network.sh
meta-quanta/meta-gbs/recipes-gbs/gbs-bios-update/files/bios-update.sh
meta-quanta/meta-gbs/recipes-gbs/gbs-bios-update/files/bios-verify.sh
meta-quanta/meta-gbs/recipes-gbs/gbs-bmc-update/files/bmc-verify.sh
meta-quanta/meta-gbs/recipes-gbs/gbs-detect-gpio-present/files/detect-gpio-present.sh
meta-quanta/meta-gbs/recipes-gbs/gbs-sysinit/files/gbs-sysinit.sh
meta-quanta/meta-gbs/recipes-gbs/hotswap-power-cycle/files/tray_powercycle.sh
meta-quanta/meta-gbs/recipes-google/acpi-power-state/acpi-power-state-daemon/gbs-check-host-state.sh
meta-quanta/meta-gbs/recipes-google/acpi-power-state/acpi-power-state-daemon/gbs-set-failsafe.sh
meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/fan-table-init.sh
meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-nvme/nvme_json_rewrite.sh
meta-quanta/meta-gsj/recipes-gsj/detect-fan-fail/files/detect-fan-fail.sh
meta-quanta/meta-gsj/recipes-gsj/gsj-hotswap-change-setting/files/gsj-hotswap-change-setting.sh
meta-quanta/meta-gsj/recipes-gsj/quanta-nvme-powerctrl/files/init_once.sh
meta-quanta/meta-gsj/recipes-gsj/quanta-nvme-powerctrl/files/nvme_powerctrl_library.sh
meta-quanta/meta-gsj/recipes-gsj/quanta-nvme-powerctrl/files/nvme_powermanager.sh
meta-quanta/meta-gsj/recipes-gsj/usb-network/files/usb_network.sh
meta-quanta/meta-gsj/recipes-phosphor/fans/phosphor-pid-control/fan-control.sh
meta-quanta/meta-gsj/recipes-phosphor/fans/phosphor-pid-control/fan-default-speed.sh
meta-quanta/meta-olympus-nuvoton/recipes-olympus-nuvoton/power/first-boot-set-psu/first-boot-set-psu.sh
meta-quanta/meta-olympus-nuvoton/recipes-phosphor/fans/phosphor-pid-control/fan-full-speed.sh
meta-quanta/meta-q71l/recipes-phosphor/quanta-powerctrl/files/init_once.sh
meta-quanta/meta-q71l/recipes-phosphor/quanta-powerctrl/files/poweroff.sh
meta-quanta/meta-q71l/recipes-phosphor/quanta-powerctrl/files/poweron.sh
meta-yadro/meta-nicole/recipes-phosphor/chassis/avsbus-control/avsbus-control.sh
"

types=(json shell)
# shellcheck disable=SC2034
check_json="eslint --resolve-plugins-relative-to /usr/local/lib/node_modules"
# shellcheck disable=SC2034
check_shell="shellcheck -x"

for t in "${types[@]}"; do
    check_cmd="check_${t}"
    if ! which "${!check_cmd%% *}" > /dev/null 2>&1; then
        eval "${check_cmd}=\"echo WARNING: Skipping $t due to missing command:\""
        echo "${!check_cmd}"
    fi
done

non_bbfiles=$(git ls-files -- \
  ':!:poky/**' \
  ':!:meta-security/**' \
  ':!:meta-raspberrypi/**' \
  ':!:meta-openembedded/**' \
  | grep -v -e "\.patch$" -e "\.bb$" -e "\.bbappend$")

for f in $non_bbfiles; do
    unset file_type
    file_info=$(file "$f")
    case $file_info in
        *shell\ script*)
            file_type="shell"
            ;;

        *JSON\ data*)
            file_type="json"
            ;;

        *)
            case $f in
                *.sh)
                    file_type="shell"
                    ;;

                *.json)
                    file_type="json"
                    ;;
            esac
    esac

    if [ -n "$file_type" ]; then
        check_cmd="check_${file_type}"
        if ! eval "${!check_cmd} $f"; then
            if [[ $lint_exempt == *$f* ]]; then
                echo "EXEMPT: $f"
            else
                echo "FAILED: $f"
                false
            fi
        fi
    fi

done

echo "Repo test passed"