From 53e6eb67cad2cd76fca09b1a5d1be424373ceda8 Mon Sep 17 00:00:00 2001 From: fruffy Date: Tue, 3 Dec 2024 10:38:53 -0500 Subject: [PATCH] CI installation refactoring. --- .github/workflows/ci-test-debian.yml | 6 +- poetry.lock | 376 +++++++++++++++++++++++++++ pyproject.toml | 39 +++ requirements.txt | 18 -- tools/ci-build.sh | 10 +- tools/install.sh | 214 +++++++++++++++ 6 files changed, 636 insertions(+), 27 deletions(-) create mode 100644 poetry.lock delete mode 100644 requirements.txt create mode 100755 tools/install.sh diff --git a/.github/workflows/ci-test-debian.yml b/.github/workflows/ci-test-debian.yml index ac2b2d5e4be..9a445ced29e 100644 --- a/.github/workflows/ci-test-debian.yml +++ b/.github/workflows/ci-test-debian.yml @@ -39,7 +39,8 @@ jobs: - name: Run tests (Ubuntu 22.04) # Need to use sudo for the eBPF kernel tests. - run: sudo -E ctest --output-on-failure --schedule-random + run: | + sudo -E poetry run ctest --output-on-failure --schedule-random working-directory: ./build # Build with GCC and test Tofino backend on Ubuntu 22.04. @@ -112,6 +113,7 @@ jobs: - name: Run tests (Ubuntu 20.04) # Need to use sudo for the eBPF kernel tests. - run: sudo -E ctest --output-on-failure --schedule-random + run: | + sudo -E poetry run ctest --output-on-failure --schedule-random working-directory: ./build if: matrix.unity == 'ON' && matrix.gtest == 'ON' diff --git a/poetry.lock b/poetry.lock new file mode 100644 index 00000000000..d7d956121aa --- /dev/null +++ b/poetry.lock @@ -0,0 +1,376 @@ +# This file is automatically @generated by Poetry 1.8.2 and should not be changed by hand. + +[[package]] +name = "black" +version = "24.3.0" +description = "The uncompromising code formatter." +optional = false +python-versions = ">=3.8" +files = [ + {file = "black-24.3.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:7d5e026f8da0322b5662fa7a8e752b3fa2dac1c1cbc213c3d7ff9bdd0ab12395"}, + {file = "black-24.3.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:9f50ea1132e2189d8dff0115ab75b65590a3e97de1e143795adb4ce317934995"}, + {file = "black-24.3.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e2af80566f43c85f5797365077fb64a393861a3730bd110971ab7a0c94e873e7"}, + {file = "black-24.3.0-cp310-cp310-win_amd64.whl", hash = "sha256:4be5bb28e090456adfc1255e03967fb67ca846a03be7aadf6249096100ee32d0"}, + {file = "black-24.3.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:4f1373a7808a8f135b774039f61d59e4be7eb56b2513d3d2f02a8b9365b8a8a9"}, + {file = "black-24.3.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:aadf7a02d947936ee418777e0247ea114f78aff0d0959461057cae8a04f20597"}, + {file = "black-24.3.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:65c02e4ea2ae09d16314d30912a58ada9a5c4fdfedf9512d23326128ac08ac3d"}, + {file = "black-24.3.0-cp311-cp311-win_amd64.whl", hash = "sha256:bf21b7b230718a5f08bd32d5e4f1db7fc8788345c8aea1d155fc17852b3410f5"}, + {file = "black-24.3.0-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:2818cf72dfd5d289e48f37ccfa08b460bf469e67fb7c4abb07edc2e9f16fb63f"}, + {file = "black-24.3.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:4acf672def7eb1725f41f38bf6bf425c8237248bb0804faa3965c036f7672d11"}, + {file = "black-24.3.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c7ed6668cbbfcd231fa0dc1b137d3e40c04c7f786e626b405c62bcd5db5857e4"}, + {file = "black-24.3.0-cp312-cp312-win_amd64.whl", hash = "sha256:56f52cfbd3dabe2798d76dbdd299faa046a901041faf2cf33288bc4e6dae57b5"}, + {file = "black-24.3.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:79dcf34b33e38ed1b17434693763301d7ccbd1c5860674a8f871bd15139e7837"}, + {file = "black-24.3.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:e19cb1c6365fd6dc38a6eae2dcb691d7d83935c10215aef8e6c38edee3f77abd"}, + {file = "black-24.3.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:65b76c275e4c1c5ce6e9870911384bff5ca31ab63d19c76811cb1fb162678213"}, + {file = "black-24.3.0-cp38-cp38-win_amd64.whl", hash = "sha256:b5991d523eee14756f3c8d5df5231550ae8993e2286b8014e2fdea7156ed0959"}, + {file = "black-24.3.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:c45f8dff244b3c431b36e3224b6be4a127c6aca780853574c00faf99258041eb"}, + {file = "black-24.3.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:6905238a754ceb7788a73f02b45637d820b2f5478b20fec82ea865e4f5d4d9f7"}, + {file = "black-24.3.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d7de8d330763c66663661a1ffd432274a2f92f07feeddd89ffd085b5744f85e7"}, + {file = "black-24.3.0-cp39-cp39-win_amd64.whl", hash = "sha256:7bb041dca0d784697af4646d3b62ba4a6b028276ae878e53f6b4f74ddd6db99f"}, + {file = "black-24.3.0-py3-none-any.whl", hash = "sha256:41622020d7120e01d377f74249e677039d20e6344ff5851de8a10f11f513bf93"}, + {file = "black-24.3.0.tar.gz", hash = "sha256:a0c9c4a0771afc6919578cec71ce82a3e31e054904e7197deacbc9382671c41f"}, +] + +[package.dependencies] +click = ">=8.0.0" +mypy-extensions = ">=0.4.3" +packaging = ">=22.0" +pathspec = ">=0.9.0" +platformdirs = ">=2" +tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""} +typing-extensions = {version = ">=4.0.1", markers = "python_version < \"3.11\""} + +[package.extras] +colorama = ["colorama (>=0.4.3)"] +d = ["aiohttp (>=3.7.4)", "aiohttp (>=3.7.4,!=3.9.0)"] +jupyter = ["ipython (>=7.8.0)", "tokenize-rt (>=3.2.0)"] +uvloop = ["uvloop (>=0.15.2)"] + +[[package]] +name = "clang-format" +version = "18.1.0" +description = "Clang-Format is an LLVM-based code formatting tool" +optional = false +python-versions = "*" +files = [ + {file = "clang-format-18.1.0.tar.gz", hash = "sha256:0b92fe203c28fda45078b977f003ad715a57e1c3feb98e7daa20619a0da74363"}, + {file = "clang_format-18.1.0-py2.py3-none-macosx_10_9_x86_64.whl", hash = "sha256:93c219eb7604bc6d1f83a278234d8421bf90b9f3f23a8381b065b052c4b72ce1"}, + {file = "clang_format-18.1.0-py2.py3-none-macosx_11_0_arm64.whl", hash = "sha256:9663fa55317062c36349622d2dc6f7e5a153c2fd4a3ba3001fb9c7aeb3127174"}, + {file = "clang_format-18.1.0-py2.py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c4149a0e6c5970882d97102b6917801e7b0998dc4f1902848ddeaeb799f406fa"}, + {file = "clang_format-18.1.0-py2.py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:01faf25df9e93511f87a956dffb020ee675ce75b1b5d57f49fd3335943059581"}, + {file = "clang_format-18.1.0-py2.py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:ea21827f84c4360077d8fc99216022d0628c8dbebab1dce5c855dd702485765f"}, + {file = "clang_format-18.1.0-py2.py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:3e32e56c9ee0ade40c87e423f29c14308719a4b2a7e404fc29d8656fe6b5a256"}, + {file = "clang_format-18.1.0-py2.py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9b3ab6dd9c7a3f22b2f1e5da0eada2afdcb9635875a0770dd92e4bd9ee29db07"}, + {file = "clang_format-18.1.0-py2.py3-none-musllinux_1_1_aarch64.whl", hash = "sha256:e27bd06e57598ee9d4dae73ffbd44ac8af151981e62f261d3ecd0250d2516ff4"}, + {file = "clang_format-18.1.0-py2.py3-none-musllinux_1_1_i686.whl", hash = "sha256:aff56678c13982332b5f0863002e0f0e90290c55e30a750dd12f3ab044fb2d34"}, + {file = "clang_format-18.1.0-py2.py3-none-musllinux_1_1_ppc64le.whl", hash = "sha256:5aab358811018144206563fcf8686c9907806405e279738c33c5ce53ce70cd42"}, + {file = "clang_format-18.1.0-py2.py3-none-musllinux_1_1_s390x.whl", hash = "sha256:0d3c9782d1ba57a839373702bd0a723ad2f3e057bcb9f46419c7d1b388e92c8f"}, + {file = "clang_format-18.1.0-py2.py3-none-musllinux_1_1_x86_64.whl", hash = "sha256:a155484eef592256de365813078618da41152e08e8490a18adab514ec74f9e5e"}, + {file = "clang_format-18.1.0-py2.py3-none-win32.whl", hash = "sha256:e503acd8940038de2972714eac8e4b0f1f9d2ad979844fc073658adcadbca3eb"}, + {file = "clang_format-18.1.0-py2.py3-none-win_amd64.whl", hash = "sha256:b998ee5e486e9251badc18dadcffbdeed54a93ee8c25e72f4cbf49abcfd31c97"}, +] + +[[package]] +name = "click" +version = "8.1.7" +description = "Composable command line interface toolkit" +optional = false +python-versions = ">=3.7" +files = [ + {file = "click-8.1.7-py3-none-any.whl", hash = "sha256:ae74fb96c20a0277a1d615f1e4d73c8414f5a98db8b799a7931d1582f3390c28"}, + {file = "click-8.1.7.tar.gz", hash = "sha256:ca9853ad459e787e2192211578cc907e7594e294c7ccc834310722b41b9ca6de"}, +] + +[package.dependencies] +colorama = {version = "*", markers = "platform_system == \"Windows\""} + +[[package]] +name = "colorama" +version = "0.4.6" +description = "Cross-platform colored terminal text." +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" +files = [ + {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, + {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, +] + +[[package]] +name = "grpcio" +version = "1.67.0" +description = "HTTP/2-based RPC framework" +optional = false +python-versions = ">=3.8" +files = [ + {file = "grpcio-1.67.0-cp310-cp310-linux_armv7l.whl", hash = "sha256:bd79929b3bb96b54df1296cd3bf4d2b770bd1df6c2bdf549b49bab286b925cdc"}, + {file = "grpcio-1.67.0-cp310-cp310-macosx_12_0_universal2.whl", hash = "sha256:16724ffc956ea42967f5758c2f043faef43cb7e48a51948ab593570570d1e68b"}, + {file = "grpcio-1.67.0-cp310-cp310-manylinux_2_17_aarch64.whl", hash = "sha256:2b7183c80b602b0ad816315d66f2fb7887614ead950416d60913a9a71c12560d"}, + {file = "grpcio-1.67.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:efe32b45dd6d118f5ea2e5deaed417d8a14976325c93812dd831908522b402c9"}, + {file = "grpcio-1.67.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:fe89295219b9c9e47780a0f1c75ca44211e706d1c598242249fe717af3385ec8"}, + {file = "grpcio-1.67.0-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:aa8d025fae1595a207b4e47c2e087cb88d47008494db258ac561c00877d4c8f8"}, + {file = "grpcio-1.67.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:f95e15db43e75a534420e04822df91f645664bf4ad21dfaad7d51773c80e6bb4"}, + {file = "grpcio-1.67.0-cp310-cp310-win32.whl", hash = "sha256:a6b9a5c18863fd4b6624a42e2712103fb0f57799a3b29651c0e5b8119a519d65"}, + {file = "grpcio-1.67.0-cp310-cp310-win_amd64.whl", hash = "sha256:b6eb68493a05d38b426604e1dc93bfc0137c4157f7ab4fac5771fd9a104bbaa6"}, + {file = "grpcio-1.67.0-cp311-cp311-linux_armv7l.whl", hash = "sha256:e91d154689639932305b6ea6f45c6e46bb51ecc8ea77c10ef25aa77f75443ad4"}, + {file = "grpcio-1.67.0-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:cb204a742997277da678611a809a8409657b1398aaeebf73b3d9563b7d154c13"}, + {file = "grpcio-1.67.0-cp311-cp311-manylinux_2_17_aarch64.whl", hash = "sha256:ae6de510f670137e755eb2a74b04d1041e7210af2444103c8c95f193340d17ee"}, + {file = "grpcio-1.67.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:74b900566bdf68241118f2918d312d3bf554b2ce0b12b90178091ea7d0a17b3d"}, + {file = "grpcio-1.67.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a4e95e43447a02aa603abcc6b5e727d093d161a869c83b073f50b9390ecf0fa8"}, + {file = "grpcio-1.67.0-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:0bb94e66cd8f0baf29bd3184b6aa09aeb1a660f9ec3d85da615c5003154bc2bf"}, + {file = "grpcio-1.67.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:82e5bd4b67b17c8c597273663794a6a46a45e44165b960517fe6d8a2f7f16d23"}, + {file = "grpcio-1.67.0-cp311-cp311-win32.whl", hash = "sha256:7fc1d2b9fd549264ae585026b266ac2db53735510a207381be509c315b4af4e8"}, + {file = "grpcio-1.67.0-cp311-cp311-win_amd64.whl", hash = "sha256:ac11ecb34a86b831239cc38245403a8de25037b448464f95c3315819e7519772"}, + {file = "grpcio-1.67.0-cp312-cp312-linux_armv7l.whl", hash = "sha256:227316b5631260e0bef8a3ce04fa7db4cc81756fea1258b007950b6efc90c05d"}, + {file = "grpcio-1.67.0-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:d90cfdafcf4b45a7a076e3e2a58e7bc3d59c698c4f6470b0bb13a4d869cf2273"}, + {file = "grpcio-1.67.0-cp312-cp312-manylinux_2_17_aarch64.whl", hash = "sha256:77196216d5dd6f99af1c51e235af2dd339159f657280e65ce7e12c1a8feffd1d"}, + {file = "grpcio-1.67.0-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:15c05a26a0f7047f720da41dc49406b395c1470eef44ff7e2c506a47ac2c0591"}, + {file = "grpcio-1.67.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3840994689cc8cbb73d60485c594424ad8adb56c71a30d8948d6453083624b52"}, + {file = "grpcio-1.67.0-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:5a1e03c3102b6451028d5dc9f8591131d6ab3c8a0e023d94c28cb930ed4b5f81"}, + {file = "grpcio-1.67.0-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:682968427a63d898759474e3b3178d42546e878fdce034fd7474ef75143b64e3"}, + {file = "grpcio-1.67.0-cp312-cp312-win32.whl", hash = "sha256:d01793653248f49cf47e5695e0a79805b1d9d4eacef85b310118ba1dfcd1b955"}, + {file = "grpcio-1.67.0-cp312-cp312-win_amd64.whl", hash = "sha256:985b2686f786f3e20326c4367eebdaed3e7aa65848260ff0c6644f817042cb15"}, + {file = "grpcio-1.67.0-cp313-cp313-linux_armv7l.whl", hash = "sha256:8c9a35b8bc50db35ab8e3e02a4f2a35cfba46c8705c3911c34ce343bd777813a"}, + {file = "grpcio-1.67.0-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:42199e704095b62688998c2d84c89e59a26a7d5d32eed86d43dc90e7a3bd04aa"}, + {file = "grpcio-1.67.0-cp313-cp313-manylinux_2_17_aarch64.whl", hash = "sha256:c4c425f440fb81f8d0237c07b9322fc0fb6ee2b29fbef5f62a322ff8fcce240d"}, + {file = "grpcio-1.67.0-cp313-cp313-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:323741b6699cd2b04a71cb38f502db98f90532e8a40cb675393d248126a268af"}, + {file = "grpcio-1.67.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:662c8e105c5e5cee0317d500eb186ed7a93229586e431c1bf0c9236c2407352c"}, + {file = "grpcio-1.67.0-cp313-cp313-musllinux_1_1_i686.whl", hash = "sha256:f6bd2ab135c64a4d1e9e44679a616c9bc944547357c830fafea5c3caa3de5153"}, + {file = "grpcio-1.67.0-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:2f55c1e0e2ae9bdd23b3c63459ee4c06d223b68aeb1961d83c48fb63dc29bc03"}, + {file = "grpcio-1.67.0-cp313-cp313-win32.whl", hash = "sha256:fd6bc27861e460fe28e94226e3673d46e294ca4673d46b224428d197c5935e69"}, + {file = "grpcio-1.67.0-cp313-cp313-win_amd64.whl", hash = "sha256:cf51d28063338608cd8d3cd64677e922134837902b70ce00dad7f116e3998210"}, + {file = "grpcio-1.67.0-cp38-cp38-linux_armv7l.whl", hash = "sha256:7f200aca719c1c5dc72ab68be3479b9dafccdf03df530d137632c534bb6f1ee3"}, + {file = "grpcio-1.67.0-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:0892dd200ece4822d72dd0952f7112c542a487fc48fe77568deaaa399c1e717d"}, + {file = "grpcio-1.67.0-cp38-cp38-manylinux_2_17_aarch64.whl", hash = "sha256:f4d613fbf868b2e2444f490d18af472ccb47660ea3df52f068c9c8801e1f3e85"}, + {file = "grpcio-1.67.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:0c69bf11894cad9da00047f46584d5758d6ebc9b5950c0dc96fec7e0bce5cde9"}, + {file = "grpcio-1.67.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b9bca3ca0c5e74dea44bf57d27e15a3a3996ce7e5780d61b7c72386356d231db"}, + {file = "grpcio-1.67.0-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:014dfc020e28a0d9be7e93a91f85ff9f4a87158b7df9952fe23cc42d29d31e1e"}, + {file = "grpcio-1.67.0-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:d4ea4509d42c6797539e9ec7496c15473177ce9abc89bc5c71e7abe50fc25737"}, + {file = "grpcio-1.67.0-cp38-cp38-win32.whl", hash = "sha256:9d75641a2fca9ae1ae86454fd25d4c298ea8cc195dbc962852234d54a07060ad"}, + {file = "grpcio-1.67.0-cp38-cp38-win_amd64.whl", hash = "sha256:cff8e54d6a463883cda2fab94d2062aad2f5edd7f06ae3ed030f2a74756db365"}, + {file = "grpcio-1.67.0-cp39-cp39-linux_armv7l.whl", hash = "sha256:62492bd534979e6d7127b8a6b29093161a742dee3875873e01964049d5250a74"}, + {file = "grpcio-1.67.0-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:eef1dce9d1a46119fd09f9a992cf6ab9d9178b696382439446ca5f399d7b96fe"}, + {file = "grpcio-1.67.0-cp39-cp39-manylinux_2_17_aarch64.whl", hash = "sha256:f623c57a5321461c84498a99dddf9d13dac0e40ee056d884d6ec4ebcab647a78"}, + {file = "grpcio-1.67.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:54d16383044e681f8beb50f905249e4e7261dd169d4aaf6e52eab67b01cbbbe2"}, + {file = "grpcio-1.67.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b2a44e572fb762c668e4812156b81835f7aba8a721b027e2d4bb29fb50ff4d33"}, + {file = "grpcio-1.67.0-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:391df8b0faac84d42f5b8dfc65f5152c48ed914e13c522fd05f2aca211f8bfad"}, + {file = "grpcio-1.67.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:cfd9306511fdfc623a1ba1dc3bc07fbd24e6cfbe3c28b4d1e05177baa2f99617"}, + {file = "grpcio-1.67.0-cp39-cp39-win32.whl", hash = "sha256:30d47dbacfd20cbd0c8be9bfa52fdb833b395d4ec32fe5cff7220afc05d08571"}, + {file = "grpcio-1.67.0-cp39-cp39-win_amd64.whl", hash = "sha256:f55f077685f61f0fbd06ea355142b71e47e4a26d2d678b3ba27248abfe67163a"}, + {file = "grpcio-1.67.0.tar.gz", hash = "sha256:e090b2553e0da1c875449c8e75073dd4415dd71c9bde6a406240fdf4c0ee467c"}, +] + +[package.extras] +protobuf = ["grpcio-tools (>=1.67.0)"] + +[[package]] +name = "isort" +version = "5.13.2" +description = "A Python utility / library to sort Python imports." +optional = false +python-versions = ">=3.8.0" +files = [ + {file = "isort-5.13.2-py3-none-any.whl", hash = "sha256:8ca5e72a8d85860d5a3fa69b8745237f2939afe12dbf656afbcb47fe72d947a6"}, + {file = "isort-5.13.2.tar.gz", hash = "sha256:48fdfcb9face5d58a4f6dde2e72a1fb8dcaf8ab26f95ab49fab84c2ddefb0109"}, +] + +[package.extras] +colors = ["colorama (>=0.4.6)"] + +[[package]] +name = "mypy-extensions" +version = "1.0.0" +description = "Type system extensions for programs checked with the mypy type checker." +optional = false +python-versions = ">=3.5" +files = [ + {file = "mypy_extensions-1.0.0-py3-none-any.whl", hash = "sha256:4392f6c0eb8a5668a69e23d168ffa70f0be9ccfd32b5cc2d26a34ae5b844552d"}, + {file = "mypy_extensions-1.0.0.tar.gz", hash = "sha256:75dbf8955dc00442a438fc4d0666508a9a97b6bd41aa2f0ffe9d2f2725af0782"}, +] + +[[package]] +name = "packaging" +version = "24.2" +description = "Core utilities for Python packages" +optional = false +python-versions = ">=3.8" +files = [ + {file = "packaging-24.2-py3-none-any.whl", hash = "sha256:09abb1bccd265c01f4a3aa3f7a7db064b36514d2cba19a2f694fe6150451a759"}, + {file = "packaging-24.2.tar.gz", hash = "sha256:c228a6dc5e932d346bc5739379109d49e8853dd8223571c7c5b55260edc0b97f"}, +] + +[[package]] +name = "pathspec" +version = "0.12.1" +description = "Utility library for gitignore style pattern matching of file paths." +optional = false +python-versions = ">=3.8" +files = [ + {file = "pathspec-0.12.1-py3-none-any.whl", hash = "sha256:a0d503e138a4c123b27490a4f7beda6a01c6f288df0e4a8b79c7eb0dc7b4cc08"}, + {file = "pathspec-0.12.1.tar.gz", hash = "sha256:a482d51503a1ab33b1c67a6c3813a26953dbdc71c31dacaef9a838c4e29f5712"}, +] + +[[package]] +name = "platformdirs" +version = "4.3.6" +description = "A small Python package for determining appropriate platform-specific dirs, e.g. a `user data dir`." +optional = false +python-versions = ">=3.8" +files = [ + {file = "platformdirs-4.3.6-py3-none-any.whl", hash = "sha256:73e575e1408ab8103900836b97580d5307456908a03e92031bab39e4554cc3fb"}, + {file = "platformdirs-4.3.6.tar.gz", hash = "sha256:357fb2acbc885b0419afd3ce3ed34564c13c9b95c89360cd9563f73aa5e2b907"}, +] + +[package.extras] +docs = ["furo (>=2024.8.6)", "proselint (>=0.14)", "sphinx (>=8.0.2)", "sphinx-autodoc-typehints (>=2.4)"] +test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=8.3.2)", "pytest-cov (>=5)", "pytest-mock (>=3.14)"] +type = ["mypy (>=1.11.2)"] + +[[package]] +name = "ply" +version = "3.11" +description = "Python Lex & Yacc" +optional = false +python-versions = "*" +files = [ + {file = "ply-3.11-py2.py3-none-any.whl", hash = "sha256:096f9b8350b65ebd2fd1346b12452efe5b9607f7482813ffca50c22722a807ce"}, + {file = "ply-3.11.tar.gz", hash = "sha256:00c7c1aaa88358b9c765b6d3000c6eec0ba42abca5351b095321aef446081da3"}, +] + +[[package]] +name = "protobuf" +version = "3.20.2" +description = "Protocol Buffers" +optional = false +python-versions = ">=3.7" +files = [ + {file = "protobuf-3.20.2-cp310-cp310-manylinux2014_aarch64.whl", hash = "sha256:09e25909c4297d71d97612f04f41cea8fa8510096864f2835ad2f3b3df5a5559"}, + {file = "protobuf-3.20.2-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:e8fbc522303e09036c752a0afcc5c0603e917222d8bedc02813fd73b4b4ed804"}, + {file = "protobuf-3.20.2-cp310-cp310-win32.whl", hash = "sha256:84a1544252a933ef07bb0b5ef13afe7c36232a774affa673fc3636f7cee1db6c"}, + {file = "protobuf-3.20.2-cp310-cp310-win_amd64.whl", hash = "sha256:2c0b040d0b5d5d207936ca2d02f00f765906622c07d3fa19c23a16a8ca71873f"}, + {file = "protobuf-3.20.2-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:3cb608e5a0eb61b8e00fe641d9f0282cd0eedb603be372f91f163cbfbca0ded0"}, + {file = "protobuf-3.20.2-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:84fe5953b18a383fd4495d375fe16e1e55e0a3afe7b4f7b4d01a3a0649fcda9d"}, + {file = "protobuf-3.20.2-cp37-cp37m-manylinux2014_aarch64.whl", hash = "sha256:384164994727f274cc34b8abd41a9e7e0562801361ee77437099ff6dfedd024b"}, + {file = "protobuf-3.20.2-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:e39cf61bb8582bda88cdfebc0db163b774e7e03364bbf9ce1ead13863e81e359"}, + {file = "protobuf-3.20.2-cp37-cp37m-win32.whl", hash = "sha256:18e34a10ae10d458b027d7638a599c964b030c1739ebd035a1dfc0e22baa3bfe"}, + {file = "protobuf-3.20.2-cp37-cp37m-win_amd64.whl", hash = "sha256:8228e56a865c27163d5d1d1771d94b98194aa6917bcfb6ce139cbfa8e3c27334"}, + {file = "protobuf-3.20.2-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:03d76b7bd42ac4a6e109742a4edf81ffe26ffd87c5993126d894fe48a120396a"}, + {file = "protobuf-3.20.2-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:f52dabc96ca99ebd2169dadbe018824ebda08a795c7684a0b7d203a290f3adb0"}, + {file = "protobuf-3.20.2-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:f34464ab1207114e73bba0794d1257c150a2b89b7a9faf504e00af7c9fd58978"}, + {file = "protobuf-3.20.2-cp38-cp38-win32.whl", hash = "sha256:5d9402bf27d11e37801d1743eada54372f986a372ec9679673bfcc5c60441151"}, + {file = "protobuf-3.20.2-cp38-cp38-win_amd64.whl", hash = "sha256:9c673c8bfdf52f903081816b9e0e612186684f4eb4c17eeb729133022d6032e3"}, + {file = "protobuf-3.20.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:291fb4307094bf5ccc29f424b42268640e00d5240bf0d9b86bf3079f7576474d"}, + {file = "protobuf-3.20.2-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:b4fdb29c5a7406e3f7ef176b2a7079baa68b5b854f364c21abe327bbeec01cdb"}, + {file = "protobuf-3.20.2-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:7a5037af4e76c975b88c3becdf53922b5ffa3f2cddf657574a4920a3b33b80f3"}, + {file = "protobuf-3.20.2-cp39-cp39-win32.whl", hash = "sha256:a9e5ae5a8e8985c67e8944c23035a0dff2c26b0f5070b2f55b217a1c33bbe8b1"}, + {file = "protobuf-3.20.2-cp39-cp39-win_amd64.whl", hash = "sha256:c184485e0dfba4dfd451c3bd348c2e685d6523543a0f91b9fd4ae90eb09e8422"}, + {file = "protobuf-3.20.2-py2.py3-none-any.whl", hash = "sha256:c9cdf251c582c16fd6a9f5e95836c90828d51b0069ad22f463761d27c6c19019"}, + {file = "protobuf-3.20.2.tar.gz", hash = "sha256:712dca319eee507a1e7df3591e639a2b112a2f4a62d40fe7832a16fd19151750"}, +] + +[[package]] +name = "ptf" +version = "0.10.0" +description = "The P4 Testing Framework" +optional = false +python-versions = ">=3.4" +files = [ + {file = "ptf-0.10.0-py3-none-any.whl", hash = "sha256:0c8f626e6d3a19efbb3da918849fa5e5a4e13315752e876822f2675bbf60edd6"}, + {file = "ptf-0.10.0.tar.gz", hash = "sha256:b149860196690a8f7ad5464d62c6ecc36ec53b18e3a5af845251f02c23a2f55c"}, +] + +[[package]] +name = "pyroute2" +version = "0.7.3" +description = "Python Netlink library" +optional = false +python-versions = "*" +files = [ + {file = "pyroute2-0.7.3-py3-none-any.whl", hash = "sha256:05050623a8155f28d7b19ccc2c38ae74b1e1aa22b64d9743851b3f125458b2f0"}, + {file = "pyroute2-0.7.3.tar.gz", hash = "sha256:7041040db1c2d187fbccd151485b1244c41d758be821785847946370eb6bb706"}, +] + +[package.dependencies] +win-inet-pton = {version = "*", markers = "platform_system == \"Windows\""} + +[[package]] +name = "scapy" +version = "2.5.0" +description = "Scapy: interactive packet manipulation tool" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <4" +files = [ + {file = "scapy-2.5.0.tar.gz", hash = "sha256:5b260c2b754fd8d409ba83ee7aee294ecdbb2c235f9f78fe90bc11cb6e5debc2"}, +] + +[package.extras] +basic = ["ipython"] +complete = ["cryptography (>=2.0)", "ipython", "matplotlib", "pyx"] +docs = ["sphinx (>=3.0.0)", "sphinx_rtd_theme (>=0.4.3)", "tox (>=3.0.0)"] + +[[package]] +name = "tomli" +version = "2.2.1" +description = "A lil' TOML parser" +optional = false +python-versions = ">=3.8" +files = [ + {file = "tomli-2.2.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:678e4fa69e4575eb77d103de3df8a895e1591b48e740211bd1067378c69e8249"}, + {file = "tomli-2.2.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:023aa114dd824ade0100497eb2318602af309e5a55595f76b626d6d9f3b7b0a6"}, + {file = "tomli-2.2.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ece47d672db52ac607a3d9599a9d48dcb2f2f735c6c2d1f34130085bb12b112a"}, + {file = "tomli-2.2.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6972ca9c9cc9f0acaa56a8ca1ff51e7af152a9f87fb64623e31d5c83700080ee"}, + {file = "tomli-2.2.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c954d2250168d28797dd4e3ac5cf812a406cd5a92674ee4c8f123c889786aa8e"}, + {file = "tomli-2.2.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:8dd28b3e155b80f4d54beb40a441d366adcfe740969820caf156c019fb5c7ec4"}, + {file = "tomli-2.2.1-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:e59e304978767a54663af13c07b3d1af22ddee3bb2fb0618ca1593e4f593a106"}, + {file = "tomli-2.2.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:33580bccab0338d00994d7f16f4c4ec25b776af3ffaac1ed74e0b3fc95e885a8"}, + {file = "tomli-2.2.1-cp311-cp311-win32.whl", hash = "sha256:465af0e0875402f1d226519c9904f37254b3045fc5084697cefb9bdde1ff99ff"}, + {file = "tomli-2.2.1-cp311-cp311-win_amd64.whl", hash = "sha256:2d0f2fdd22b02c6d81637a3c95f8cd77f995846af7414c5c4b8d0545afa1bc4b"}, + {file = "tomli-2.2.1-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:4a8f6e44de52d5e6c657c9fe83b562f5f4256d8ebbfe4ff922c495620a7f6cea"}, + {file = "tomli-2.2.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:8d57ca8095a641b8237d5b079147646153d22552f1c637fd3ba7f4b0b29167a8"}, + {file = "tomli-2.2.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4e340144ad7ae1533cb897d406382b4b6fede8890a03738ff1683af800d54192"}, + {file = "tomli-2.2.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:db2b95f9de79181805df90bedc5a5ab4c165e6ec3fe99f970d0e302f384ad222"}, + {file = "tomli-2.2.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:40741994320b232529c802f8bc86da4e1aa9f413db394617b9a256ae0f9a7f77"}, + {file = "tomli-2.2.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:400e720fe168c0f8521520190686ef8ef033fb19fc493da09779e592861b78c6"}, + {file = "tomli-2.2.1-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:02abe224de6ae62c19f090f68da4e27b10af2b93213d36cf44e6e1c5abd19fdd"}, + {file = "tomli-2.2.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:b82ebccc8c8a36f2094e969560a1b836758481f3dc360ce9a3277c65f374285e"}, + {file = "tomli-2.2.1-cp312-cp312-win32.whl", hash = "sha256:889f80ef92701b9dbb224e49ec87c645ce5df3fa2cc548664eb8a25e03127a98"}, + {file = "tomli-2.2.1-cp312-cp312-win_amd64.whl", hash = "sha256:7fc04e92e1d624a4a63c76474610238576942d6b8950a2d7f908a340494e67e4"}, + {file = "tomli-2.2.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:f4039b9cbc3048b2416cc57ab3bda989a6fcf9b36cf8937f01a6e731b64f80d7"}, + {file = "tomli-2.2.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:286f0ca2ffeeb5b9bd4fcc8d6c330534323ec51b2f52da063b11c502da16f30c"}, + {file = "tomli-2.2.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a92ef1a44547e894e2a17d24e7557a5e85a9e1d0048b0b5e7541f76c5032cb13"}, + {file = "tomli-2.2.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9316dc65bed1684c9a98ee68759ceaed29d229e985297003e494aa825ebb0281"}, + {file = "tomli-2.2.1-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e85e99945e688e32d5a35c1ff38ed0b3f41f43fad8df0bdf79f72b2ba7bc5272"}, + {file = "tomli-2.2.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:ac065718db92ca818f8d6141b5f66369833d4a80a9d74435a268c52bdfa73140"}, + {file = "tomli-2.2.1-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:d920f33822747519673ee656a4b6ac33e382eca9d331c87770faa3eef562aeb2"}, + {file = "tomli-2.2.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:a198f10c4d1b1375d7687bc25294306e551bf1abfa4eace6650070a5c1ae2744"}, + {file = "tomli-2.2.1-cp313-cp313-win32.whl", hash = "sha256:d3f5614314d758649ab2ab3a62d4f2004c825922f9e370b29416484086b264ec"}, + {file = "tomli-2.2.1-cp313-cp313-win_amd64.whl", hash = "sha256:a38aa0308e754b0e3c67e344754dff64999ff9b513e691d0e786265c93583c69"}, + {file = "tomli-2.2.1-py3-none-any.whl", hash = "sha256:cb55c73c5f4408779d0cf3eef9f762b9c9f147a77de7b258bef0a5628adc85cc"}, + {file = "tomli-2.2.1.tar.gz", hash = "sha256:cd45e1dc79c835ce60f7404ec8119f2eb06d38b1deba146f07ced3bbc44505ff"}, +] + +[[package]] +name = "typing-extensions" +version = "4.12.2" +description = "Backported and Experimental Type Hints for Python 3.8+" +optional = false +python-versions = ">=3.8" +files = [ + {file = "typing_extensions-4.12.2-py3-none-any.whl", hash = "sha256:04e5ca0351e0f3f85c6853954072df659d0d13fac324d0072316b67d7794700d"}, + {file = "typing_extensions-4.12.2.tar.gz", hash = "sha256:1a7ead55c7e559dd4dee8856e3a88b41225abfe1ce8df57b7c13915fe121ffb8"}, +] + +[[package]] +name = "win-inet-pton" +version = "1.1.0" +description = "Native inet_pton and inet_ntop implementation for Python on Windows (with ctypes)." +optional = false +python-versions = "*" +files = [ + {file = "win_inet_pton-1.1.0-py2.py3-none-any.whl", hash = "sha256:eaf0193cbe7152ac313598a0da7313fb479f769343c0c16c5308f64887dc885b"}, + {file = "win_inet_pton-1.1.0.tar.gz", hash = "sha256:dd03d942c0d3e2b1cf8bab511844546dfa5f74cb61b241699fa379ad707dea4f"}, +] + +[metadata] +lock-version = "2.0" +python-versions = "^3.8" +content-hash = "03095491a9b969e20c76b78d205d2406ef4f536490fcaf47a7ed7dee1a9f253f" diff --git a/pyproject.toml b/pyproject.toml index 368e195d59e..6fb9a581184 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -51,3 +51,42 @@ disable = [ "missing-function-docstring", "too-few-public-methods", ] + +[tool.poetry] +name = "p4c" +version = "1.2.5.1" +description = "" +authors = ["Your Name "] +license = "Apache" +readme = "README.md" +package-mode = false + +[tool.poetry.dependencies] +python = "^3.8" +pyroute2 = "0.7.3" +ply = "3.11" +ptf = "0.10.0" +scapy = "2.5.0" +clang-format = "18.1.0" +protobuf = [ + {version = "3.20.2", python = ">3.6"}, + {version = "3.19.2", python = "<=3.6"} +] +black = [ + {version = "24.3.0", python = ">3.6"}, + {version = "22.8.0", python = "<=3.6"} +] +isort = [ + {version = "5.13.2", python = ">3.6"}, + {version = "5.10.1", python = "<=3.6"} +] + +grpcio = [ + {version = "1.67.0", python = ">3.6"}, + {version = "1.48.2", python = "<=3.6"} +] + + +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 7df5e9fb622..00000000000 --- a/requirements.txt +++ /dev/null @@ -1,18 +0,0 @@ -###### Python3 dependencies with version specifiers ###### -# Install with pip3 install --user -r requirements.txt -pyroute2==0.7.3 -ply==3.11 -ptf==0.10.0 -scapy==2.5.0 -clang-format==18.1.0 -isort==5.13.2; python_version > '3.6' -black==24.3.0; python_version > '3.6' -protobuf==3.20.2; python_version > '3.6' -grpcio==1.67.0; python_version > '3.6' -googleapis-common-protos==1.53.0; python_version > '3.6' -# Ubuntu 18.04 uses Python 3.6, which is not supported by recent versions of Protobuf and Black. -protobuf==3.19.2; python_version <= '3.6' -googleapis-common-protos==1.53.0; python_version <= '3.6' -grpcio==1.48.2; python_version <= '3.6' -isort==5.10.1; python_version <= '3.6' -black==22.8.0; python_version <= '3.6' diff --git a/tools/ci-build.sh b/tools/ci-build.sh index 40549580f2d..83f11dbb4b7 100755 --- a/tools/ci-build.sh +++ b/tools/ci-build.sh @@ -104,8 +104,9 @@ fi sudo apt-get update sudo apt-get install -y --no-install-recommends ${P4C_DEPS} -sudo pip3 install --upgrade pip -sudo pip3 install -r ${P4C_DIR}/requirements.txt +sudo apt-get install -y python3-venv +curl -sSL https://install.python-poetry.org | python3 - +poetry install if [ "${BUILD_GENERATOR,,}" == "ninja" ] && [ ! $(command -v ninja) ] then @@ -155,11 +156,6 @@ function build_bmv2() { fi sudo apt-get update && sudo apt-get install -y --no-install-recommends ${P4C_RUNTIME_DEPS} - - if [[ "${DISTRIB_RELEASE}" != "18.04" ]] ; then - # To run PTF nanomsg tests. Not available on 18.04. - sudo pip3 install nnpy - fi } if [[ "${ENABLE_BMV2}" == "ON" ]] ; then diff --git a/tools/install.sh b/tools/install.sh new file mode 100755 index 00000000000..fbb656c9443 --- /dev/null +++ b/tools/install.sh @@ -0,0 +1,214 @@ +#!/bin/bash + +THIS_DIR=$( cd -- "$( dirname -- "${0}" )" &> /dev/null && pwd ) +P4C_DIR=$(readlink -f ${THIS_DIR}/..) + +# Get distribution info +DISTRO=$(lsb_release -i | awk -F: '{print $2}' | xargs) +VERSION=$(lsb_release -r | awk -F: '{print $2}' | xargs) + +# Define supported distributions and versions +SUPPORTED_DISTROS=("Ubuntu" "Pop") +SUPPORTED_UBUNTU_VERSIONS=("20.04" "22.04" "24.04") + +# Function to check if an element exists in an array +contains() { + local element + for element in "${@:2}"; do + if [[ "$element" == "$1" ]]; then + return 0 + fi + done + return 1 +} + +# Check distribution and version +if contains "$DISTRO" "${SUPPORTED_DISTROS[@]}"; then + if [[ "$DISTRO" == "Ubuntu" ]]; then + if contains "$VERSION" "${SUPPORTED_UBUNTU_VERSIONS[@]}"; then + echo "Supported distribution: $DISTRO $VERSION" + exit 0 + else + echo "Error: Unsupported Ubuntu version: $VERSION" + exit 1 + fi + else + # Assume all versions of Pop!_OS and Linux Mint are supported + echo "Supported distribution: $DISTRO $VERSION" + fi +else + echo "Error: Unsupported distribution: $DISTRO" + exit 1 +fi + +# Whether to install dependencies required to run PTF-ebpf tests +: "${INSTALL_PTF_EBPF_DEPENDENCIES:=OFF}" +# The build generator to use. Defaults to Make. +: "${BUILD_GENERATOR:="ninja"}" +# BMv2 is enable by default. +: "${ENABLE_BMV2:=ON}" +# eBPF is enabled by default. +: "${ENABLE_EBPF:=ON}" +# This is the list of back ends that can be enabled. +# Back ends can be enabled from the command line with "ENABLE_[backend]=TRUE/FALSE" +ENABLE_BACKENDS=("TOFINO" "BMV2" "EBPF" "UBPF" "DPDK" + "P4TC" "P4FMT" "P4TEST" "P4C_GRAPHS" + "TEST_TOOLS" +) +function build_cmake_enabled_backend_string() { + CMAKE_ENABLE_BACKENDS="" + for backend in "${ENABLE_BACKENDS[@]}"; + do + enable_var=ENABLE_${backend} + if [ -n "${!enable_var}" ]; then + echo "${enable_var}=${!enable_var} is set." + CMAKE_ENABLE_BACKENDS+="-D${enable_var}=${!enable_var} " + fi + done +} + + +. /etc/lsb-release + +# In Docker builds, sudo is not available. So make it a noop. +if [ "$IN_DOCKER" == "TRUE" ]; then + echo "Executing within docker container." + function sudo() { command "$@"; } +fi + + +# ! ------ BEGIN CORE ----------------------------------------------- +P4C_DEPS="bison \ + flex \ + cmake \ + build-essential \ + ccache \ + ninja-build \ + g++ \ + git \ + lld \ + libboost-graph-dev \ + libboost-iostreams-dev \ + libfl-dev \ + python3 \ + python3-pip \ + python3-setuptools" + +sudo apt-get update +sudo apt-get install -y --no-install-recommends ${P4C_DEPS} + +sudo apt-get install -y python3-poetry python3-venv +poetry install +poetry shell + +if [ "${BUILD_GENERATOR,,}" == "ninja" ] && [ ! $(command -v ninja) ] +then + echo "Selected ninja as build generator, but ninja could not be found." + exit 1 +fi + +# ! ------ END CORE ----------------------------------------------- + +ccache --set-config max_size=1G + +# ! ------ BEGIN BMV2 ----------------------------------------------- +function build_bmv2() { + P4C_RUNTIME_DEPS_BOOST="libboost-graph1.7* libboost-iostreams1.7*" + + P4C_RUNTIME_DEPS="cpp \ + ${P4C_RUNTIME_DEPS_BOOST} \ + libgc1* \ + libgmp-dev \ + libnanomsg-dev" + + sudo apt-get install -y wget ca-certificates + # Add the p4lang opensuse repository. + echo "deb http://download.opensuse.org/repositories/home:/p4lang/xUbuntu_${DISTRIB_RELEASE}/ /" | sudo tee /etc/apt/sources.list.d/home:p4lang.list + curl -fsSL https://download.opensuse.org/repositories/home:p4lang/xUbuntu_${DISTRIB_RELEASE}/Release.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/home_p4lang.gpg > /dev/null + P4C_RUNTIME_DEPS+=" p4lang-bmv2" + + sudo apt-get update && sudo apt-get install -y --no-install-recommends ${P4C_RUNTIME_DEPS} + +} + +if [[ "${ENABLE_BMV2}" == "ON" ]] ; then + build_bmv2 +fi +# ! ------ END BMV2 ----------------------------------------------- + +# ! ------ BEGIN EBPF ----------------------------------------------- +function build_ebpf() { + P4C_EBPF_DEPS="libpcap-dev \ + libelf-dev \ + zlib1g-dev \ + llvm \ + clang \ + tcpdump \ + iproute2 \ + iptables \ + net-tools" + + sudo apt-get install -y --no-install-recommends ${P4C_EBPF_DEPS} +} + +function install_ptf_ebpf_test_deps() ( + P4C_PTF_PACKAGES="gcc-multilib \ + python3-six \ + libgmp-dev \ + libjansson-dev" + sudo apt-get install -y --no-install-recommends ${P4C_PTF_PACKAGES} + + git clone --depth 1 --recursive --branch v0.3.1 https://github.com/NIKSS-vSwitch/nikss /tmp/nikss + pushd /tmp/nikss + ./build_libbpf.sh + mkdir build + cd build + cmake -DCMAKE_BUILD_TYPE=Release -G "${BUILD_GENERATOR}" .. + cmake --build . -- -j $(nproc) + sudo cmake --install . + + # install bpftool + git clone --recurse-submodules --branch v7.3.0 https://github.com/libbpf/bpftool.git /tmp/bpftool + cd /tmp/bpftool/src + make "-j$(nproc)" + sudo make install + popd +) + +if [[ "${ENABLE_EBPF}" == "ON" ]] ; then + build_ebpf + if [[ "${INSTALL_PTF_EBPF_DEPENDENCIES}" == "ON" ]] ; then + install_ptf_ebpf_test_deps + fi +fi +# ! ------ END EBPF ----------------------------------------------- + +# ! ------ BEGIN DPDK ----------------------------------------------- +function build_dpdk() { + # Replace existing Protobuf with one that works. + # TODO: Debug protobuf mismatch. + sudo -E pip3 uninstall -y protobuf + sudo pip3 install protobuf==3.20.3 netaddr==0.9.0 +} + +if [[ "${ENABLE_DPDK}" == "ON" ]]; then + build_dpdk +fi +# ! ------ END DPDK ----------------------------------------------- + +# ! ------ BEGIN TOFINO -------------------------------------------- + +function build_tofino() { + P4C_TOFINO_PACKAGES="rapidjson-dev" + sudo apt-get install -y --no-install-recommends ${P4C_TOFINO_PACKAGES} + sudo pip3 install jsl==0.2.4 pyinstaller==6.11.0 +} + +if [[ "${ENABLE_TOFINO}" == "ON" ]]; then + echo "Installing Tofino dependencies" + build_tofino +fi +# ! ------ END TOFINO ---------------------------------------------- + +echo "Test image ready" +