Skip to content

Commit 8bc151f

Browse files
ader1990yonghong-song
authored andcommitted
docker: ubuntu: remove py2 package and build 22.04 docker image
This change was required because current stable Ubuntu versions have limited support for Python 2.7 (EOL 2020) and the upcoming ones do not even have Python 2.7 (Ubuntu 23 and Ubuntu 24 do not support it). Code changes: * remove python3-bcc package and use python 3 for the python-bcc * remove python2 packages * remove Ubuntu 18/20 deb Dockerfile support and add 22.04 support * use clang / llvm 11, supported by Ubuntu 22.04
1 parent 8093be6 commit 8bc151f

File tree

7 files changed

+20
-63
lines changed

7 files changed

+20
-63
lines changed

SPECS/bcc+clang.spec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Source1: http://llvm.org/releases/%{llvmver}/llvm-%{llvmver}.src.tar.xz
1515
Source2: http://llvm.org/releases/%{llvmver}/cfe-%{llvmver}.src.tar.xz
1616

1717
BuildArch: x86_64
18-
BuildRequires: bison, cmake >= 2.8.7, flex, gcc, gcc-c++, libxml2-devel, python2-devel, elfutils-libelf-devel-static
18+
BuildRequires: bison, cmake >= 2.8.7, flex, gcc, gcc-c++, libxml2-devel, python3-devel, elfutils-libelf-devel-static
1919

2020
%description
2121
Python bindings for BPF Compiler Collection (BCC). Control a BPF program from

SPECS/bcc.spec

Lines changed: 7 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -13,29 +13,16 @@
1313
%bcond_with llvm_shared
1414
%endif
1515

16-
# Build python3 support for distributions that have it
17-
%if 0%{?fedora} >= 28 || 0%{?rhel} > 7
18-
%bcond_without python3
19-
%else
20-
%bcond_with python3
21-
%endif
22-
2316
# Build with debuginfod support for Fedora >= 32
2417
%if 0%{?fedora} >= 32
2518
%bcond_without libdebuginfod
2619
%else
2720
%bcond_with libdebuginfod
2821
%endif
2922

30-
%if %{with python3}
31-
%global __python %{__python3}
32-
%global python_bcc python3-bcc
33-
%global python_cmds python2;python3
34-
%else
35-
%global __python %{__python2}
36-
%global python_bcc python2-bcc
37-
%global python_cmds python2
38-
%endif
23+
%global __python3
24+
%global python_bcc
25+
%global python_cmds,python3
3926

4027
%define debug_package %{nil}
4128
%define _unpackaged_files_terminate_build 0
@@ -57,11 +44,7 @@ BuildRequires: gcc gcc-c++ elfutils-libelf-devel-static
5744
%if %{with libdebuginfod}
5845
BuildRequires: elfutils-debuginfod-client-devel
5946
%endif
60-
%if %{with python3}
6147
BuildRequires: python3-devel
62-
%else
63-
BuildRequires: python2-devel
64-
%endif
6548
%if %{with_lua}
6649
BuildRequires: luajit luajit-devel
6750
%endif
@@ -116,21 +99,12 @@ Requires: elfutils-debuginfod-client
11699
%description -n libbcc
117100
Shared Library for BPF Compiler Collection (BCC)
118101

119-
%package -n python2-bcc
120-
Summary: Python2 bindings for BPF Compiler Collection (BCC)
121-
Requires: libbcc = %{version}-%{release}
122-
%{?python_provide:%python_provide python2-bcc}
123-
%description -n python2-bcc
124-
Python bindings for BPF Compiler Collection (BCC)
125-
126-
%if %{with python3}
127-
%package -n python3-bcc
102+
%package -n python-bcc
128103
Summary: Python3 bindings for BPF Compiler Collection (BCC)
129104
Requires: libbcc = %{version}-%{release}
130-
%{?python_provide:%python_provide python3-bcc}
131-
%description -n python3-bcc
105+
%{?python_provide:%python_provide python-bcc}
106+
%description -n python-bcc
132107
Python bindings for BPF Compiler Collection (BCC)
133-
%endif
134108

135109
%if %{with_lua}
136110
%package -n bcc-lua
@@ -159,13 +133,8 @@ Command line tools for BPF Compiler Collection (BCC)
159133
/usr/lib64/*
160134
/usr/include/bcc/*
161135

162-
%files -n python2-bcc
163-
%{python2_sitelib}/bcc*
164-
165-
%if %{with python3}
166-
%files -n python3-bcc
136+
%files -n python-bcc
167137
%{python3_sitelib}/bcc*
168-
%endif
169138

170139
%if %{with_lua}
171140
%files -n bcc-lua

debian/control

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@ Section: misc
44
Priority: optional
55
Standards-Version: 3.9.5
66
Build-Depends: debhelper (>= 9), cmake,
7-
libllvm9 | libllvm8 | libllvm6.0 | libllvm3.8 [!arm64] | libllvm3.7 [!arm64],
8-
llvm-9-dev | llvm-8-dev | llvm-6.0-dev | llvm-3.8-dev [!arm64] | llvm-3.7-dev [!arm64],
9-
libclang-9-dev | libclang-8-dev | libclang-6.0-dev | libclang-3.8-dev [!arm64] | libclang-3.7-dev [!arm64],
10-
clang-format-9 | clang-format-8 | clang-format-6.0 | clang-format-3.8 [!arm64] | clang-format-3.7 [!arm64] | clang-format,
7+
libllvm11,
8+
llvm-11-dev,
9+
libclang-11-dev,
10+
clang-format-11,
1111
libelf-dev, bison, flex, libfl-dev, libedit-dev, zlib1g-dev, git,
12-
python (>= 2.7), python-netaddr, python-pyroute2 | python3-pyroute2, luajit,
12+
python3, python3-netaddr, python3-pyroute2, python3-setuptools, python3-pip,
13+
luajit,
1314
libluajit-5.1-dev, arping, inetutils-ping | iputils-ping, iperf, netperf,
14-
ethtool, devscripts, python3, dh-python
15+
ethtool, devscripts, dh-python, zip
1516
# add 'libdebuginfod-dev' to Build-Depends for libdebuginfod support
1617
Homepage: https://github.com/iovisor/bcc
1718

@@ -33,14 +34,6 @@ Description: Examples for BPF Compiler Collection (BCC)
3334
Package: python-bcc
3435
Architecture: all
3536
Provides: python-bpfcc
36-
Conflicts: python-bpfcc
37-
Depends: libbcc (= ${binary:Version}), python, binutils
38-
Description: Python wrappers for BPF Compiler Collection (BCC)
39-
40-
Package: python3-bcc
41-
Architecture: all
42-
Provides: python3-bpfcc
43-
Conflicts: python3-bpfcc
4437
Depends: libbcc (= ${binary:Version}), python3, binutils
4538
Description: Python3 wrappers for BPF Compiler Collection (BCC)
4639

debian/python-bcc.install

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
usr/lib/python2*
1+
lib/python3*

debian/python3-bcc.install

Lines changed: 0 additions & 1 deletion
This file was deleted.

debian/rules

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ DEBIAN_REVISION := $(shell dpkg-parsechangelog | sed -rne "s,^Version: ([0-9.]+)
99
UPSTREAM_VERSION := $(shell dpkg-parsechangelog | sed -rne "s,^Version: ([0-9.]+)(~|-)(.*),\1,p")
1010

1111
%:
12-
dh $@ --buildsystem=cmake --parallel --with python2,python3
12+
dh $@ --buildsystem=cmake --parallel --with python3
1313

1414
# tests cannot be run in parallel
1515
override_dh_auto_test:
1616
dh_auto_test -O--buildsystem=cmake -O--no-parallel
1717

1818
# FIXME: LLVM_DEFINITIONS is broken somehow in LLVM cmake upstream
1919
override_dh_auto_configure:
20-
dh_auto_configure -- -DREVISION_LAST=$(UPSTREAM_VERSION) -DREVISION=$(UPSTREAM_VERSION) -DLLVM_DEFINITIONS="-D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS" -DPYTHON_CMD="python2;python3"
20+
dh_auto_configure -- -DREVISION_LAST=$(UPSTREAM_VERSION) -DREVISION=$(UPSTREAM_VERSION) -DLLVM_DEFINITIONS="-D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS" -DPYTHON_CMD="python3"

docker/Dockerfile.ubuntu

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG OS_TAG=18.04
1+
ARG OS_TAG=22.04
22
FROM ubuntu:${OS_TAG} as builder
33

44
ARG OS_TAG
@@ -23,10 +23,6 @@ COPY --from=builder /root/bcc/*.deb /root/bcc/
2323

2424
RUN \
2525
apt-get update -y && \
26-
DEBIAN_FRONTEND=noninteractive apt-get install -y python python3 python3-pip binutils libelf1 kmod && \
27-
if [ ${OS_TAG} = "18.04" ];then \
28-
apt-get -y install python-pip && \
29-
pip install dnslib cachetools ; \
30-
fi ; \
26+
DEBIAN_FRONTEND=noninteractive apt-get install -y python3 python3-pip python-is-python3 binutils libelf1 kmod && \
3127
pip3 install dnslib cachetools && \
3228
dpkg -i /root/bcc/*.deb

0 commit comments

Comments
 (0)