From 00ad51461568bb65a229cf632e9cb6d85c150ed9 Mon Sep 17 00:00:00 2001 From: fruffy Date: Thu, 8 Dec 2022 12:44:24 -0500 Subject: [PATCH 1/2] Clean up the Protobuf and GRPC installation. --- Dockerfile | 47 +---------------------------------------------- tools/run_tests | 1 + 2 files changed, 2 insertions(+), 46 deletions(-) diff --git a/Dockerfile b/Dockerfile index f3f8bf3..16178f2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -56,12 +56,10 @@ RUN apt-get update -qq && apt-get install -qq --no-install-recommends \ libmemcached-dev \ libpcap-dev \ libpcre3-dev \ - libprotobuf-c-dev \ libssl-dev \ libtool \ make \ pkg-config \ - protobuf-c-compiler \ python3 \ python3-dev \ python3-pip \ @@ -136,38 +134,7 @@ RUN ./autogen.sh && \ make && \ make DESTDIR=/output install-strip WORKDIR /protobuf/python/ -# Protobuf is using a deprecated technique to install Python package with -# easy install. This is causing issues since 2021-04-21. (https://discuss.python.org/t/pypi-org-recently-changed/8433) -# We have to install pip and install six ourselves so we do not trigger the -# broken protobuf install process. -RUN pip3 install --user --ignore-installed wheel six && \ - python3 setup.py install --user --cpp_implementation -# We'll finish up the process of building protobuf below, but first, a bit of -# explanation. -# -# Since we can't use `pip` with protobuf's `setup.py`, the package gets -# installed via setuptools in an "egg" - a directory which acts as a python -# module, but isn't a package and thus isn't automatically part of the package -# namespace. Eggs need their contents to be added to python's `sys.path` to -# become visible. Hooks that run early during python startup normally read -# `setuptools.pth` and other `.pth` files and add all of the directories -# referenced in those files to the path; egg contents are placed in those files -# to be made available to the rest of the python installation. -# -# In multistage builds this doesn't work so well, because those `.pth` files can -# easily be overwritten by other versions from a different image, and the eggs -# we're installing here will no longer appear in `sys.path`. To work around -# that, we just copy the contents of the existing `.pth` files into a new one -# with a name we're sure won't be overwritten. Python will read this new `.pth` -# file at startup and include the eggs in the path. -# -# If you're wondering why the `grep -v` is necessary, meditate upon the fact -# that these files aren't merely metadata but also executable code, and -# setuptools, by design, uses this feature to inject code into every python -# program that runs on your system. -RUN export PYTHON3_VERSION=`python3 -c 'import sys; version=sys.version_info[:3]; print("python{0}.{1}".format(*version))'` && \ - cd /output/usr/local/lib/$PYTHON3_VERSION/site-packages&& \ - cat *.pth | grep -v "import sys" | sort -u > docker_protobuf.pth +RUN python3 setup.py install --user --cpp_implementation # Build gRPC. # The gRPC build system should detect that a version of protobuf is already @@ -187,18 +154,6 @@ RUN cmake ../.. \ -DgRPC_SSL_PROVIDER=package && \ make DESTDIR=/output install WORKDIR /grpc/ -# `pip install --user` will place things in `site-packages`, but Ubuntu expects -# `dist-packages` by default, so we need to set configure `site-packages` as an -# additional "site-specific directory". -# Without this, our earlier installation of Protobuf will be ignored. -RUN export PYTHON3_VERSION=`python3 -c 'import sys; version=sys.version_info[:3]; print("python{0}.{1}".format(*version))'` && \ - echo "import site; site.addsitedir('/usr/local/lib/$PYTHON3_VERSION/site-packages')" \ - > /usr/local/lib/$PYTHON3_VERSION/dist-packages/use_site_packages.pth -# We don't use `--ignore-installed` here because otherwise we won't use the -# installed version of the protobuf python package that we copied from the -# protobuf build image. -RUN pip3 install --user -rrequirements.txt -RUN env GRPC_PYTHON_BUILD_WITH_CYTHON=1 pip3 install --user --ignore-installed . # Build libyang FROM base-builder as libyang diff --git a/tools/run_tests b/tools/run_tests index f6e985f..31fdd98 100755 --- a/tools/run_tests +++ b/tools/run_tests @@ -18,6 +18,7 @@ test_python_import "ptf" test_python_import "nnpy" test_python_import "thrift" test_python_import "google.protobuf" +test_python_import "google.rpc" test_python_import "grpc" exit $EXIT_STATUS From 8e87bc83769ffe150c20a337b5522bb19f2ab168 Mon Sep 17 00:00:00 2001 From: fruffy Date: Wed, 12 Apr 2023 17:47:22 -0400 Subject: [PATCH 2/2] Disable schedule. --- .github/workflows/build.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9748859..2d5e5e2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,15 +9,15 @@ on: branches: - main - stable - schedule: - # We run it once a week as we deem it sufficient to pick up updates to the - # base Ubuntu image. - # Note that this will only update the 'latest' tag (not the 'stable' tag) as - # these scheduled jobs run for the default branch, which is 'main'. It is - # not clear how much the 'stable' tag is used at the moment; if we want the - # 'stable' tag to be updated automatically as well, we can find a - # workaround. - - cron: '15 1 * * 0' # "At 01:15 on Sunday." + # schedule: + # # We run it once a week as we deem it sufficient to pick up updates to the + # # base Ubuntu image. + # # Note that this will only update the 'latest' tag (not the 'stable' tag) as + # # these scheduled jobs run for the default branch, which is 'main'. It is + # # not clear how much the 'stable' tag is used at the moment; if we want the + # # 'stable' tag to be updated automatically as well, we can find a + # # workaround. + # - cron: '15 1 * * 0' # "At 01:15 on Sunday." jobs: build: