Skip to content

Commit 7629097

Browse files
authored
Remove Tofino-specific Python packages from requirements.txt (#4984)
* Remove Tofino-specific Python packages from requirements.txt Signed-off-by: fruffy <[email protected]> * Some more CI build clean ups. Signed-off-by: fruffy <[email protected]> --------- Signed-off-by: fruffy <[email protected]>
1 parent 2605767 commit 7629097

File tree

3 files changed

+41
-58
lines changed

3 files changed

+41
-58
lines changed

.github/workflows/disabled/ci-dpdk-ptf-p4testgen-tests.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ env:
2020
IPDK_INSTALL_DIR: ${{github.workspace}}/ipdk_install
2121
CMAKE_UNITY_BUILD: ON
2222
ENABLE_TEST_TOOLS: ON
23-
INSTALL_DPDK: ON
24-
INSTALL_BMV2: OFF
25-
INSTALL_EBPF: OFF
23+
ENABLE_DPDK: ON
24+
ENABLE_BMV2: OFF
25+
ENABLE_EBPF: OFF
2626
IMAGE_TYPE: test
2727
CTEST_PARALLEL_LEVEL: 4
2828

requirements.txt

-2
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,3 @@ googleapis-common-protos==1.53.0; python_version <= '3.6'
1616
grpcio==1.48.2; python_version <= '3.6'
1717
isort==5.10.1; python_version <= '3.6'
1818
black==22.8.0; python_version <= '3.6'
19-
jsl==0.2.4 # specific to Tofino backend
20-
pyinstaller==6.11.0 # specific to Tofino backend

tools/ci-build.sh

+38-53
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ P4C_DIR=$(readlink -f ${THIS_DIR}/..)
3333
: "${INSTALL_PTF_EBPF_DEPENDENCIES:=OFF}"
3434
# Whether to build and run GTest unit tests.
3535
: "${ENABLE_GTESTS:=ON}"
36-
# Whether to build the P4Tools back end and platform.
37-
: "${ENABLE_TEST_TOOLS:=OFF}"
3836
# Whether to treat warnings as errors.
3937
: "${ENABLE_WERROR:=ON}"
4038
# Compile with Clang compiler
@@ -48,14 +46,28 @@ P4C_DIR=$(readlink -f ${THIS_DIR}/..)
4846
# Build with -ftrivial-auto-var-init=pattern to catch more bugs caused by
4947
# uninitialized variables.
5048
: "${BUILD_AUTO_VAR_INIT_PATTERN:=OFF}"
51-
# Install BMv2 and its dependencies.
52-
: "${INSTALL_BMV2:=ON}"
53-
# Install eBPF and its dependencies.
54-
: "${INSTALL_EBPF:=ON}"
55-
# Install DPDK and its dependencies.
56-
: "${INSTALL_DPDK:=OFF}"
57-
# Install Tofino and its dependencies.
58-
: "${INSTALL_TOFINO:=ON}"
49+
# BMv2 is enable by default.
50+
: "${ENABLE_BMV2:=ON}"
51+
# eBPF is enabled by default.
52+
: "${ENABLE_EBPF:=ON}"
53+
# This is the list of back ends that can be enabled.
54+
# Back ends can be enabled from the command line with "ENABLE_[backend]=TRUE/FALSE"
55+
ENABLE_BACKENDS=("TOFINO" "BMV2" "EBPF" "UBPF" "DPDK"
56+
"P4TC" "P4FMT" "P4TEST" "P4C_GRAPHS"
57+
"TEST_TOOLS"
58+
)
59+
function build_cmake_enabled_backend_string() {
60+
CMAKE_ENABLE_BACKENDS=""
61+
for backend in "${ENABLE_BACKENDS[@]}";
62+
do
63+
enable_var=ENABLE_${backend}
64+
if [ -n "${!enable_var}" ]; then
65+
echo "${enable_var}=${!enable_var} is set."
66+
CMAKE_ENABLE_BACKENDS+="-D${enable_var}=${!enable_var} "
67+
fi
68+
done
69+
}
70+
5971

6072
. /etc/lsb-release
6173

@@ -103,6 +115,14 @@ fi
103115

104116
# ! ------ END CORE -----------------------------------------------
105117

118+
# TODO: Remove this check once 18.04 is deprecated.
119+
if [[ "${DISTRIB_RELEASE}" == "18.04" ]] ; then
120+
ccache --set-config cache_dir=.ccache
121+
# For Ubuntu 18.04 install the pypi-supplied version of cmake instead.
122+
sudo pip3 install cmake==3.16.3
123+
fi
124+
ccache --set-config max_size=1G
125+
106126
# ! ------ BEGIN BMV2 -----------------------------------------------
107127
function build_bmv2() {
108128
# TODO: Remove this check once 18.04 is deprecated.
@@ -136,21 +156,13 @@ function build_bmv2() {
136156

137157
sudo apt-get update && sudo apt-get install -y --no-install-recommends ${P4C_RUNTIME_DEPS}
138158

139-
# TODO: Remove this check once 18.04 is deprecated.
140-
if [[ "${DISTRIB_RELEASE}" == "18.04" ]] ; then
141-
ccache --set-config cache_dir=.ccache
142-
# For Ubuntu 18.04 install the pypi-supplied version of cmake instead.
143-
sudo pip3 install cmake==3.16.3
144-
fi
145-
ccache --set-config max_size=1G
146-
147159
if [[ "${DISTRIB_RELEASE}" != "18.04" ]] ; then
148160
# To run PTF nanomsg tests. Not available on 18.04.
149161
sudo pip3 install nnpy
150162
fi
151163
}
152164

153-
if [[ "${INSTALL_BMV2}" == "ON" ]] ; then
165+
if [[ "${ENABLE_BMV2}" == "ON" ]] ; then
154166
build_bmv2
155167
fi
156168
# ! ------ END BMV2 -----------------------------------------------
@@ -193,7 +205,7 @@ function install_ptf_ebpf_test_deps() (
193205
popd
194206
)
195207

196-
if [[ "${INSTALL_EBPF}" == "ON" ]] ; then
208+
if [[ "${ENABLE_EBPF}" == "ON" ]] ; then
197209
build_ebpf
198210
if [[ "${INSTALL_PTF_EBPF_DEPENDENCIES}" == "ON" ]] ; then
199211
install_ptf_ebpf_test_deps
@@ -209,7 +221,7 @@ function build_dpdk() {
209221
sudo pip3 install protobuf==3.20.3 netaddr==0.9.0
210222
}
211223

212-
if [[ "${INSTALL_DPDK}" == "ON" ]]; then
224+
if [[ "${ENABLE_DPDK}" == "ON" ]]; then
213225
build_dpdk
214226
fi
215227
# ! ------ END DPDK -----------------------------------------------
@@ -219,9 +231,10 @@ fi
219231
function build_tofino() {
220232
P4C_TOFINO_PACKAGES="rapidjson-dev"
221233
sudo apt-get install -y --no-install-recommends ${P4C_TOFINO_PACKAGES}
234+
sudo pip3 install jsl==0.2.4 pyinstaller==6.11.0
222235
}
223236

224-
if [[ "${INSTALL_TOFINO}" == "ON" ]]; then
237+
if [[ "${ENABLE_TOFINO}" == "ON" ]]; then
225238
echo "Installing Tofino dependencies"
226239
build_tofino
227240
fi
@@ -258,8 +271,6 @@ CMAKE_FLAGS+="-DSTATIC_BUILD_WITH_DYNAMIC_GLIBC=${STATIC_BUILD_WITH_DYNAMIC_GLIB
258271
CMAKE_FLAGS+="-DSTATIC_BUILD_WITH_DYNAMIC_STDLIB=${STATIC_BUILD_WITH_DYNAMIC_STDLIB} "
259272
# Enable GTest.
260273
CMAKE_FLAGS+="-DENABLE_GTESTS=${ENABLE_GTESTS} "
261-
# Toggle the installation of the tools back end.
262-
CMAKE_FLAGS+="-DENABLE_TEST_TOOLS=${ENABLE_TEST_TOOLS} "
263274
# RELEASE should be default, but we want to make sure.
264275
CMAKE_FLAGS+="-DCMAKE_BUILD_TYPE=Release "
265276
# Treat warnings as errors.
@@ -268,35 +279,9 @@ CMAKE_FLAGS+="-DENABLE_WERROR=${ENABLE_WERROR} "
268279
CMAKE_FLAGS+="-DENABLE_SANITIZERS=${ENABLE_SANITIZERS} "
269280
# Enable auto var initialization with pattern.
270281
CMAKE_FLAGS+="-DBUILD_AUTO_VAR_INIT_PATTERN=${BUILD_AUTO_VAR_INIT_PATTERN} "
271-
# Enable Tofino.
272-
if [ -n "${ENABLE_TOFINO}" ]; then
273-
CMAKE_FLAGS+="-DENABLE_TOFINO=${ENABLE_TOFINO} "
274-
fi
275-
if [ -n "${ENABLE_BMV2}" ]; then
276-
CMAKE_FLAGS+="-DENABLE_BMV2=${ENABLE_BMV2} "
277-
fi
278-
if [ -n "${ENABLE_EBPF}" ]; then
279-
CMAKE_FLAGS+="-DENABLE_EBPF=${ENABLE_EBPF} "
280-
fi
281-
if [ -n "${ENABLE_UBPF}" ]; then
282-
CMAKE_FLAGS+="-DENABLE_UBPF=${ENABLE_UBPF} "
283-
fi
284-
if [ -n "${ENABLE_DPDK}" ]; then
285-
CMAKE_FLAGS+="-DENABLE_DPDK=${ENABLE_DPDK} "
286-
fi
287-
if [ -n "${ENABLE_P4TC}" ]; then
288-
CMAKE_FLAGS+="-DENABLE_P4TC=${ENABLE_P4TC} "
289-
fi
290-
if [ -n "${ENABLE_P4FMT}" ]; then
291-
CMAKE_FLAGS+="-DENABLE_P4FMT=${ENABLE_P4FMT} "
292-
fi
293-
if [ -n "${ENABLE_P4TEST}" ]; then
294-
CMAKE_FLAGS+="-DENABLE_P4TEST=${ENABLE_P4TEST} "
295-
fi
296-
if [ -n "${ENABLE_P4C_GRAPHS}" ]; then
297-
CMAKE_FLAGS+="-DENABLE_P4C_GRAPHS=${ENABLE_P4C_GRAPHS} "
298-
fi
299-
282+
# Assemble the enabled back ends as a single CMake variable.
283+
build_cmake_enabled_backend_string
284+
CMAKE_FLAGS+="${CMAKE_ENABLE_BACKENDS} "
300285

301286
if [ "$ENABLE_SANITIZERS" == "ON" ]; then
302287
CMAKE_FLAGS+="-DENABLE_GC=OFF"

0 commit comments

Comments
 (0)