Skip to content

Commit 461678f

Browse files
authored
Revert "Make changes to building and packaging sairedis (#1116)" (#1141)
This may be causing or exposing some issues during tests. This reverts commit 7b39fc4.
1 parent 7b39fc4 commit 461678f

12 files changed

Lines changed: 125 additions & 400 deletions

File tree

.azure-pipelines/build-template.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ jobs:
150150
set -ex
151151
rm ../*.deb || true
152152
./autogen.sh
153-
DEB_BUILD_OPTIONS=nocheck DEB_CONFIGURE_EXTRA_FLAGS='--enable-code-coverage' dpkg-buildpackage -us -uc -b -Psyncd,vs -j$(nproc)
153+
DEB_BUILD_OPTIONS=nocheck fakeroot debian/rules DEB_CONFIGURE_EXTRA_FLAGS='--enable-code-coverage' CFLAGS="" CXXFLAGS="" binary-syncd-vs
154154
mv ../*.deb .
155155
displayName: "Compile sonic sairedis with coverage enabled"
156156
- script: |
@@ -209,6 +209,6 @@ jobs:
209209
contents: 'syslog-all.tgz'
210210
targetFolder: $(Build.ArtifactStagingDirectory)
211211
- publish: $(Build.ArtifactStagingDirectory)/
212-
artifact: ${{ parameters.syslog_artifact_name }}@$(System.JobAttempt)
212+
artifact: ${{ parameters.syslog_artifact_name }}
213213
displayName: "Publish syslog artifacts"
214214
condition: always()

configure.ac

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ AC_PROG_CC
1010
AC_PROG_CXX
1111
AC_PROG_LIBTOOL
1212
AC_HEADER_STDC
13+
AM_PATH_PYTHON
1314
AM_PATH_PYTHON3
14-
AX_PYTHON3_DEVEL
1515
AX_CODE_COVERAGE
1616
AX_ADD_AM_MACRO_STATIC([])
1717

@@ -101,14 +101,6 @@ AC_ARG_ENABLE(asan,
101101
*) AC_MSG_ERROR(bad value ${enableval} for --enable-asan) ;;
102102
esac],[asan_enabled=false])
103103

104-
AC_ARG_ENABLE(python2,
105-
[ --enable-python2 Generate Python 2 bindings],
106-
[case "${enableval}" in
107-
yes) python2=true ;;
108-
no) python2=false ;;
109-
*) AC_MSG_ERROR(bad value ${enableval} for --enable-python2) ;;
110-
esac],[python2=true])
111-
112104
if test "x$asan_enabled" = "xtrue"; then
113105
CFLAGS_ASAN+=" -fsanitize=address"
114106
CFLAGS_ASAN+=" -DASAN_ENABLED"
@@ -119,26 +111,13 @@ if test "x$asan_enabled" = "xtrue"; then
119111
AC_SUBST(LDFLAGS_ASAN)
120112
fi
121113

122-
if test "x$python2" = "xtrue"; then
123-
m4_define_default([_AM_PYTHON_INTERPRETER_LIST],
124-
[python2 python2.7 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0])
125-
AM_PATH_PYTHON
126-
AX_PYTHON_DEVEL([< '3'])
127-
PYTHON2_CPPFLAGS=$PYTHON_CPPFLAGS
128-
PYTHON2_LIBS=$PYTHON_LIBS
129-
AC_SUBST(PYTHON2_CPPFLAGS)
130-
AC_SUBST(PYTHON2_LIBS)
131-
fi
132-
133114
AM_CONDITIONAL(ASAN_ENABLED, test x$asan_enabled = xtrue)
134-
AM_CONDITIONAL(PYTHON2, test x$python2 = xtrue)
135115

136116
AC_PATH_PROGS(SWIG, [swig3.0 swig])
137117

138118
CXXFLAGS_COMMON=""
139119
CXXFLAGS_COMMON+=" -ansi"
140120
CXXFLAGS_COMMON+=" -fPIC"
141-
CXXFLAGS_COMMON+=" -pipe"
142121
CXXFLAGS_COMMON+=" -std=c++14"
143122
CXXFLAGS_COMMON+=" -Wall"
144123
CXXFLAGS_COMMON+=" -Wcast-align"

debian/compat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
12
1+
10

debian/control

Lines changed: 58 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,24 @@ Source: sonic
22
Maintainer: Kamil Cudnik <kcudnik@microsoft.com>
33
Section: net
44
Priority: optional
5-
Build-Depends: debhelper (>= 12), autotools-dev, libzmq5-dev
5+
Build-Depends: debhelper (>=9), autotools-dev, libzmq5-dev
66
Standards-Version: 1.0.0
77

88
Package: syncd
99
Architecture: any
10-
Build-Profiles: <syncd !rpc !vs>
11-
Depends: ${misc:Pre-Depends}
12-
Recommends: ${shlibs:Depends}
1310
Conflicts: syncd-rpc, syncd-vs
1411
Description: This package contains sync daemon for SONiC project.
1512
This sync daemon syncs the ASIC_DB in Redis database and the real ASIC via SAI.
1613

1714
Package: syncd-rpc
1815
Architecture: any
19-
Build-Profiles: <syncd rpc !vs>
20-
Depends: ${misc:Pre-Depends}
21-
Recommends: ${shlibs:Depends}
2216
Conflicts: syncd, syncd-vs
2317
Description: This package contains sync daemon with rpc for SONiC project.
2418
This sync daemon syncs the ASIC_DB in Redis database and the real ASIC via SAI.
2519
This daemon contains saithrift rpc library for remote control of an ASIC.
2620

2721
Package: syncd-vs
2822
Architecture: any
29-
Build-Profiles: <syncd !rpc vs>
30-
Depends: ${misc:Pre-Depends}
31-
Recommends: ${shlibs:Depends}
3223
Conflicts: syncd-rpc, syncd
3324
Description: This package contains sync daemon for SONiC project linked with virtual switch.
3425
This sync daemon syncs the ASIC_DB in Redis database and the real ASIC via SAI.
@@ -47,7 +38,6 @@ Description: This package contains development files for SAI-Redis.
4738

4839
Package: libsaivs
4940
Architecture: any
50-
Depends: ${shlibs:Depends}, ${misc:Pre-Depends}
5141
Section: libs
5242
Description: This package contains SAI-VirtualSwitch implementation for SONiC project.
5343

@@ -59,7 +49,6 @@ Description: This package contains development files for SAI-VirtualSwitch.
5949

6050
Package: libsaimetadata
6151
Architecture: any
62-
Depends: ${shlibs:Depends}, ${misc:Pre-Depends}
6352
Section: libs
6453
Description: This package contains SAI-Metadata implementation for SONiC project.
6554

@@ -69,6 +58,63 @@ Depends: libsaimetadata (= ${binary:Version})
6958
Section: libdevel
7059
Description: This package contains development files for SAI-Metadata.
7160

61+
Package: syncd-dbg
62+
Architecture: any
63+
Section: debug
64+
Priority: extra
65+
Conflicts: syncd-rpc-dbg, syncd-vs
66+
Depends:
67+
syncd (= ${binary:Version}),
68+
${misc:Depends}
69+
Description: debugging symbols for syncd
70+
71+
Package: syncd-rpc-dbg
72+
Architecture: any
73+
Section: debug
74+
Priority: extra
75+
Conflicts: syncd-dbg, syncd-vs
76+
Depends:
77+
syncd-rpc (= ${binary:Version}),
78+
${misc:Depends}
79+
Description: debugging symbols for syncd-rpc
80+
81+
Package: syncd-vs-dbg
82+
Architecture: any
83+
Section: debug
84+
Priority: extra
85+
Conflicts: syncd-dbg, syncd-rpc-dbg
86+
Depends:
87+
syncd-vs (= ${binary:Version}),
88+
${misc:Depends}
89+
Description: debugging symbols for syncd-vs
90+
91+
Package: libsairedis-dbg
92+
Architecture: any
93+
Section: debug
94+
Priority: extra
95+
Depends:
96+
libsairedis (= ${binary:Version}),
97+
${misc:Depends}
98+
Description: debugging symbols for libsairedis
99+
100+
Package: libsaivs-dbg
101+
Architecture: any
102+
Section: debug
103+
Priority: extra
104+
Depends:
105+
libsaivs (= ${binary:Version}),
106+
${misc:Depends}
107+
Description: debugging symbols for libsaivs
108+
109+
Package: libsaimetadata-dbg
110+
Architecture: any
111+
Section: debug
112+
Priority: extra
113+
Depends:
114+
libsaimetadata (= ${binary:Version}),
115+
${misc:Depends}
116+
Description: debugging symbols for libsaimetadata
117+
72118
Package: python-pysairedis
73119
Architecture: any
74120
Build-Profiles: <!nopython2>

debian/libsaimetadata-dev.install

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
meta/sai*.h usr/include/sai
22
meta/Sai*.h usr/include/sai
33
SAI/meta/sai*.h usr/include/sai
4-
usr/lib/*/libsaimetadata.so
5-
usr/lib/*/libsaimeta.so

debian/libsairedis-dev.install

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
lib/sairedis.h usr/include/sai
2-
usr/lib/*/libsairedis.so

debian/rules

Lines changed: 57 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@
33
# output every command that modifies files on the build system.
44
#export DH_VERBOSE = 1
55

6+
.ONESHELL:
7+
SHELL = /bin/bash
8+
.SHELLFLAGS += -ex
9+
10+
# see EXAMPLES in dpkg-buildflags(1) and read /usr/share/dpkg/*
11+
DPKG_EXPORT_BUILDFLAGS = 1
12+
include /usr/share/dpkg/default.mk
13+
614
ifneq (${SWSS_COMMON_INC},)
715
SWSS_COMMON_CONFIG = "--with-swss-common-inc=${SWSS_COMMON_INC}"
816
endif
@@ -13,7 +21,7 @@ ifneq (${SWSS_COMMON_LIB},)
1321
endif
1422

1523
# see FEATURE AREAS in dpkg-buildflags(1)
16-
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
24+
#export DEB_BUILD_MAINT_OPTIONS = hardening=+all
1725

1826
# see ENVIRONMENT in dpkg-buildflags(1)
1927
# package maintainers to append CFLAGS
@@ -23,53 +31,78 @@ export DEB_BUILD_MAINT_OPTIONS = hardening=+all
2331

2432
DOPACKAGES = $(shell dh_listpackages)
2533

26-
configure_opts = --disable-static
27-
ifeq ($(ENABLE_ASAN), y)
28-
configure_opts += --enable-asan
29-
endif
30-
3134
# For Debian jessie, stretch, and buster, and Ubuntu bionic and focal, build
3235
# Python 2 bindings. This is controlled by the build profile being used.
33-
ifeq (,$(filter nopython2,$(DEB_BUILD_PROFILES)))
36+
ifneq (,$(filter python-pysairedis,$(DOPACKAGES)))
3437
configure_opts += --enable-python2
3538
else
3639
configure_opts += --disable-python2
3740
endif
3841

39-
ifneq ($(filter syncd,$(DEB_BUILD_PROFILES)),)
40-
ifneq ($(filter rpc,$(DEB_BUILD_PROFILES)),)
41-
configure_opts += --enable-rpcserver
42-
endif
43-
ifneq ($(filter vs,$(DEB_BUILD_PROFILES)),)
44-
configure_opts += --with-sai=vs
45-
endif
46-
else
47-
configure_opts += --disable-syncd
48-
endif
42+
clean:
43+
dh $@ --with autotools-dev
44+
45+
build:
46+
echo build stage is skipped. Please use binary to generate debian packages
4947

50-
%:
51-
dh $@
48+
binary: binary-syncd-rpc binary-syncd
49+
50+
binary-sairedis:
51+
echo '--enable-syncd=no' > /tmp/syncd-build
52+
ENABLESYNCD=no dh clean --with autotools-dev
53+
dh build -N syncd -N syncd-dbg -N syncd-rpc -N syncd-rpc-dbg -N syncd-vs -N syncd-vs-dbg --with autotools-dev
54+
dh binary -N syncd -N syncd-dbg -N syncd-rpc -N syncd-rpc-dbg -N syncd-vs -N syncd-vs-dbg --with autotools-dev
55+
56+
binary-syncd:
57+
echo > /tmp/syncd-build
58+
dh clean --with autotools-dev
59+
dh build -N syncd-rpc -N syncd-rpc-dbg -N syncd-vs -N syncd-vs-dbg --with autotools-dev
60+
dh binary -N syncd-rpc -N syncd-rpc-dbg -N syncd-vs -N syncd-vs-dbg --with autotools-dev
61+
62+
binary-syncd-rpc: | binary-syncd
63+
echo '--enable-rpcserver=yes' > /tmp/syncd-build
64+
dh clean --with autotools-dev
65+
dh build -N syncd -N syncd-dbg -N syncd-vs -N syncd-vs-dbg --with autotools-dev
66+
dh binary -N syncd -N syncd-dbg -N syncd-vs -N syncd-vs-dbg --with autotools-dev
67+
68+
binary-syncd-vs:
69+
echo '--with-sai=vs' > /tmp/syncd-build
70+
dh clean --with autotools-dev
71+
dh build -N syncd -N syncd-dbg -N syncd-rpc -N syncd-rpc-dbg --with autotools-dev
72+
dh binary -N syncd -N syncd-dbg -N syncd-rpc -N syncd-rpc-dbg --with autotools-dev
5273

5374
# dh_make generated override targets
5475
# This is example for Cmake (See https://bugs.debian.org/641051 )
5576
#override_dh_auto_configure:
5677
# dh_auto_configure -- \
5778
# -DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH)
5879

80+
configure_opts =
81+
ifeq ($(ENABLE_ASAN), y)
82+
configure_opts += --enable-asan
83+
endif
84+
5985
override_dh_auto_configure:
60-
dh_auto_configure -- ${SWSS_COMMON_CONFIG} $(configure_opts)
86+
./autogen.sh
87+
dh_auto_configure -- $(DEB_CONFIGURE_EXTRA_FLAGS) $(shell cat /tmp/syncd-build) ${SWSS_COMMON_CONFIG} $(configure_opts)
6188

6289
override_dh_install:
6390
dh_install
6491
# Note: escape $ with an extra $ symbol
65-
ifneq ($(filter rpc,$(DEB_BUILD_PROFILES)),)
66-
if [ -f debian/syncd-rpc/usr/bin/syncd_init_common.sh ] ; then
92+
if egrep -q '(^| )--enable-rpcserver=yes( |$$)' /tmp/syncd-build && [ -f debian/syncd-rpc/usr/bin/syncd_init_common.sh ] ; then
6793
sed -i 's|ENABLE_SAITHRIFT=0|ENABLE_SAITHRIFT=1 # Add a comment to fix https://github.com/Azure/sonic-buildimage/issues/2694 |' debian/syncd-rpc/usr/bin/syncd_init_common.sh
6894
fi
69-
endif
7095

7196
override_dh_installinit:
7297
dh_installinit --init-script=syncd
7398

7499
override_dh_shlibdeps:
75-
$(LD_LIBRARY_PATH_CONFIG) dh_shlibdeps -- --ignore-missing-info -xlibsai
100+
$(LD_LIBRARY_PATH_CONFIG) dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info
101+
102+
override_dh_strip:
103+
dh_strip -psyncd-rpc --dbg-package=syncd-rpc-dbg
104+
dh_strip -psyncd --dbg-package=syncd-dbg
105+
dh_strip -psyncd-vs --dbg-package=syncd-vs-dbg
106+
dh_strip -plibsairedis --dbg-package=libsairedis-dbg
107+
dh_strip -plibsaivs --dbg-package=libsaivs-dbg
108+
dh_strip -plibsaimetadata --dbg-package=libsaimetadata-dbg

0 commit comments

Comments
 (0)