Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Use build profiles instead of distro version for Python 2 binding build #558

Merged
merged 4 commits into from
Nov 19, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .azure-pipelines/build-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
- script: |
set -ex
./autogen.sh
fakeroot debian/rules DEB_CONFIGURE_EXTRA_FLAGS='--enable-code-coverage' CFLAGS="" CXXFLAGS="--coverage -fprofile-abs-path" LDFLAGS="--coverage -fprofile-abs-path" binary && cp ../*.deb .
fakeroot debian/rules DEB_CONFIGURE_EXTRA_FLAGS='--enable-code-coverage' CFLAGS="" CXXFLAGS="--coverage -fprofile-abs-path" LDFLAGS="--coverage -fprofile-abs-path" DEB_BUILD_PROFILES=python2 binary && cp ../*.deb .
Copy link
Contributor

@qiluo-msft qiluo-msft Nov 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DEB_BUILD_PROFILES

Thanks for the fix!
Do we need to change the build process in buildimage/slave.mk? #Closed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There would need to be a change in rules/swss-common.mk, but slave.mk doesn't need to be fixed.

displayName: "Compile sonic swss common with coverage enabled"
- ${{ if eq(parameters.run_unit_test, true) }}:
- script: |
Expand Down
1 change: 1 addition & 0 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Description: This package contains development files for Switch State Service.

Package: python-swsscommon
Architecture: any
Build-Profiles: <python2>
Depends: ${shlibs:Depends}, ${misc:Pre-Depends}
Section: libs
Description: This package contains Switch State Service common Python2 library.
Expand Down
1 change: 1 addition & 0 deletions debian/python-swsscommon.dirs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
usr/lib/python2.7
1 change: 1 addition & 0 deletions debian/python-swsscommon.install
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
usr/lib/python2.7/dist-packages/swsscommon/*
20 changes: 6 additions & 14 deletions debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ include /usr/share/dpkg/default.mk

DEBIAN_DIST_CODENAME := $(shell lsb_release -sc | sed -e 's/\#/ /g')

DOPACKAGES = $(shell dh_listpackages)

# For Debian jessie, stretch, and buster, and Ubuntu bionic and focal, build
# Python 2 bindings.
ifneq (,$(filter jessie stretch buster bionic focal,$(DEBIAN_DIST_CODENAME)))
CONFIGURE_ARGS = --enable-python2
# Python 2 bindings. This is controlled by the build profile being used.
ifneq (,$(filter python-swsscommon,$(DOPACKAGES)))
DEB_CONFIGURE_EXTRA_FLAGS += --enable-python2
else
CONFIGURE_ARGS = --disable-python2
DEB_CONFIGURE_EXTRA_FLAGS += --disable-python2
endif

# main packaging script based on dh7 syntax
Expand All @@ -36,16 +38,6 @@ override_dh_auto_configure:
dh_auto_configure -- $(DEB_CONFIGURE_EXTRA_FLAGS)
# -DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH)

override_dh_auto_configure:
dh_auto_configure -- $(CONFIGURE_ARGS)

override_dh_auto_install:
dh_auto_install
if [ -d debian/tmp/usr/lib/python2.7/dist-packages/swsscommon ]; then \
dh_installdirs --package=python-swsscommon /usr/lib/python2.7/dist-packages/swsscommon/ ; \
cp -a debian/tmp/usr/lib/python2.7/dist-packages/swsscommon/* debian/python-swsscommon/usr/lib/python2.7/dist-packages/swsscommon/ ; \
fi

override_dh_clean:
dh_clean
rm -f pyext/swsscommon.py pyext/swsscommon_wrap.cpp
Expand Down