This repository has been archived on 2025-03-20. You can view files and clone it, but cannot push or open issues or pull requests.
sonic-buildimage/src/ntp/Makefile
lguohan 45b724fe76 [build]: fix dpkg admindir corruption issue in parallel build (#6408)
Fix #119

when parallel build is enable, multiple dpkg-buildpackage
instances are running at the same time. /var/lib/dpkg is shared
by all instances and the /var/lib/dpkg/updates could be corrupted
and cause the build failure.

the fix is to use overlay fs to mount separate /var/lib/dpkg
for each dpkg-buildpackage instance so that they are not affecting
each other.

Signed-off-by: Guohan Lu <lguohan@gmail.com>
2021-01-12 06:22:51 -08:00

49 lines
1.7 KiB
Makefile

.ONESHELL:
SHELL = /bin/bash
.SHELLFLAGS += -e
MAIN_TARGET = $(NTP)
$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
# Remove any stale files
rm -rf ./ntp-$(NTP_VERSION) ./ntp_$(NTP_VERSION).orig.tar.xz ./ntp_$(NTP_VERSION)-4.debian.tar.xz
# Get ntp release, debian files
wget http://deb.debian.org/debian/pool/main/n/ntp/ntp_$(NTP_VERSION).orig.tar.xz
wget http://deb.debian.org/debian/pool/main/n/ntp/ntp_$(NTP_VERSION)-4.debian.tar.xz
# UnTar ntp release
xzcat ntp_$(NTP_VERSION).orig.tar.xz | tar -xvf -
pushd ./ntp-4.2.8p12
# UnTar debian files
xzcat ../ntp_$(NTP_VERSION)-4.debian.tar.xz | tar -xvf -
# Add the additional patch
cp ../patch/bug1970-UNLINK_EXPR_SLIST_empty_list.patch debian/patches/
cp ../patch/update_ENOBUFS_log_level.patch debian/patches/
cat ../patch/series >> debian/patches/series
# Update the changelog
cat ../patch/changelog debian/changelog > debian/changelog.new
rm debian/changelog ; mv debian/changelog.new debian/changelog
# The debian mirror build likely took place on a system without
# libevent installed, thus adding the below for SONiC
sed -i 's/--with-locfile=legacy/--with-locfile=legacy --enable-local-libevent/' debian/rules
# Fix the apparmor profile to avoid the following message
# "Failed name lookup - disconnected path"
# and go into learning mode.
sed -i 's/\/usr\/sbin\/ntpd {/\/usr\/sbin\/ntpd flags=(attach_disconnected complain) {/' debian/apparmor-profile
# Build source and Debian packages with the symbols
dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) --admindir $(SONIC_DPKG_ADMINDIR)
popd
# Move the newly-built .deb packages to the destination directory
mv $* $(DEST)/