Skip to content

Commit

Permalink
Merge pull request #8968 from projectcalico/patchelf-only-for-deb
Browse files Browse the repository at this point in the history
Only patchelf felix for Debian packages
  • Loading branch information
hjiawei committed Jul 3, 2024
2 parents 795e2cb + c5d5464 commit 8e31795
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,23 @@
set -x
set -e

sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo
sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo
sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo

yum install -y epel-release
yum install -y rpm-build \
make \
git \
gcc \
python-setuptools \
python-pbr \
python2-devel \
python-urllib3 \
python3-setuptools \
python3-pbr \
python3-devel \
python3-urllib3 \
dbus-devel \
libidn-devel
yum install -y \
dbus-devel \
gcc \
git \
libidn-devel \
make \
python-pbr \
python-setuptools \
python-urllib3 \
python2-devel \
python3-devel \
python3-pbr \
python3-setuptools \
python3-urllib3 \
rpm-build
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,30 @@

# shellcheck disable=SC1091

set -x # Print commands as they're run
set -e # Exit immediately if a command returns non-zero
set -x # Print commands as they're run
set -e # Exit immediately if a command returns non-zero

apt-get -q update
DEBIAN_FRONTEND=noninteractive \
apt-get install -y -q build-essential \
devscripts \
debhelper \
dh-python \
python-all \
python-setuptools \
python3-all \
python3-setuptools \
libyajl2 \
libdatrie1 \
git \
libnetfilter-conntrack-dev \
libidn11-dev \
libdbus-1-dev \
libgmp-dev \
nettle-dev \
m4 \
texinfo

DEBIAN_FRONTEND=noninteractive apt-get install -y -q \
build-essential \
debhelper \
devscripts \
dh-python \
git \
libdatrie1 \
libdbus-1-dev \
libgmp-dev \
libidn11-dev \
libnetfilter-conntrack-dev \
libpcap-dev \
libyajl2 \
m4 \
nettle-dev \
python-all \
python-setuptools \
python3-all \
python3-setuptools \
texinfo

apt-get clean -y
7 changes: 2 additions & 5 deletions hack/release/packaging/utils/create-update-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,6 @@ function do_felix {
# RPM golang build dependencies that is exactly equivalent to our
# containerized builds.
make bin/calico-felix
# Felix is built with RHEL/UBI and links against libpcap.so.1. We need this patchelf
# until Debian changes the soname from .0.8 to .1.
# FIXME remove the following patchelf command once Debian dependency is updated.
patchelf --replace-needed libpcap.so.1 libpcap.so.0.8 bin/calico-felix
# Remove all the files that were added by that build, except for the
# bin/calico-felix binary.
rm -f bin/calico-felix-amd64
Expand All @@ -212,12 +208,13 @@ function do_felix {
rm -f Makefile
# Override dpkg's default file exclusions, otherwise our binaries won't get included (and some
# generated files will).
# Build rpm first and then deb because we need to patchelf bin/calico-felix for Debian.
PKG_NAME=felix \
NAME=Felix \
RPM_TAR_ARGS='--exclude=bin/calico-felix-* --exclude=.gitignore --exclude=*.d --exclude=*.ll --exclude=.go-pkg-cache --exclude=vendor --exclude=report' \
DPKG_EXCL="-I'bin/calico-felix-*' -I.git -I.gitignore -I'*.d' -I'*.ll' -I.go-pkg-cache -I.git -Ivendor -Ireport" \
DEB_EPOCH=2: \
${rootdir}/hack/release/packaging/utils/make-packages.sh deb rpm
${rootdir}/hack/release/packaging/utils/make-packages.sh rpm deb
git checkout Makefile


Expand Down
7 changes: 7 additions & 0 deletions hack/release/packaging/utils/make-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ for package_type in "$@"; do
case ${package_type} in

deb )
if [ "${PKG_NAME}" = felix ]; then
# Felix is built with RHEL/UBI and links against libpcap.so.1. We need this patchelf
# until Debian changes the soname from .0.8 to .1.
# FIXME remove the following patchelf command once Debian dependency is updated.
patchelf --replace-needed libpcap.so.1 libpcap.so.0.8 bin/calico-felix
fi

# The Debian version that we are about to generate.
debver=${FORCE_VERSION_DEB:-`git_version_to_deb ${version}`}
debver=`strip_v ${debver}`
Expand Down

0 comments on commit 8e31795

Please sign in to comment.