Skip to content

Commit

Permalink
[debian/rules] Fail on script error during package build (sonic-net#1050
Browse files Browse the repository at this point in the history
)

It is required to have -e in .SHELLFLAGS to fail on such errors.

Also, fixed install pathes for python bindings and disabled python2 bindings when DEB_BUILD_PROFILES=nopython2 is passed.

Signed-off-by: Stepan Blyschak [stepanb@nvidia.com](mailto:stepanb@nvidia.com)
  • Loading branch information
stepanblyschak committed Jun 14, 2022
1 parent 48cccb4 commit b13d7d2
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .azure-pipelines/build-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ jobs:
set -ex
rm ../*.deb || true
./autogen.sh
fakeroot debian/rules DEB_CONFIGURE_EXTRA_FLAGS='--enable-code-coverage' CFLAGS="" CXXFLAGS="" binary-syncd-vs
DEB_BUILD_OPTIONS=nocheck fakeroot debian/rules DEB_CONFIGURE_EXTRA_FLAGS='--enable-code-coverage' CFLAGS="" CXXFLAGS="" binary-syncd-vs
mv ../*.deb .
displayName: "Compile sonic sairedis with coverage enabled"
- script: |
Expand Down
1 change: 1 addition & 0 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ Description: debugging symbols for libsaimetadata

Package: python-pysairedis
Architecture: any
Build-Profiles: <!nopython2>
Depends: ${shlibs:Depends}, ${misc:Pre-Depends}
Section: libs
Description: This package contains Switch State Service sairedis Python2 library.
Expand Down
2 changes: 1 addition & 1 deletion debian/python-pysairedis.install
Original file line number Diff line number Diff line change
@@ -1 +1 @@
usr/lib/python2.7/dist-packages/pysairedis/*
usr/lib/python2.7/dist-packages/sairedis/*
2 changes: 1 addition & 1 deletion debian/python3-pysairedis.install
Original file line number Diff line number Diff line change
@@ -1 +1 @@
usr/lib/python3/dist-packages/pysairedis/*
usr/lib/python3/dist-packages/sairedis/*
12 changes: 11 additions & 1 deletion debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

.ONESHELL:
SHELL = /bin/bash
.SHELLFLAGS += -x
.SHELLFLAGS += -ex

# see EXAMPLES in dpkg-buildflags(1) and read /usr/share/dpkg/*
DPKG_EXPORT_BUILDFLAGS = 1
Expand All @@ -29,6 +29,16 @@ endif
# package maintainers to append LDFLAGS
#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed

DOPACKAGES = $(shell dh_listpackages)

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

clean:
dh $@ --with autotools-dev

Expand Down

0 comments on commit b13d7d2

Please sign in to comment.