Skip to content

Commit 2b678fe

Browse files
author
Kyle Kloberdanz
committed
CDRIVER-5488 Fix Debian Package Build on Evergreen (#1553)
The Debian build process has been updated such that the 'debian/' directory is now only in the 'debian/unstable' branch. This change fetches that directory for Evergreen builds to enable building Debian packages in CI.
1 parent effd95c commit 2b678fe

File tree

1 file changed

+31
-15
lines changed

1 file changed

+31
-15
lines changed

.evergreen/scripts/debian_package_build.sh

100644100755
Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,15 @@ on_exit () {
2121
trap on_exit EXIT
2222

2323
if [ "${IS_PATCH}" = "true" ]; then
24-
git diff HEAD -- . ':!debian' > ../upstream.patch
25-
git diff HEAD -- debian > ../debian.patch
24+
git diff HEAD > ../upstream.patch
2625
git clean -fdx
2726
git reset --hard HEAD
27+
git remote add upstream https://github.com/mongodb/mongo-c-driver
28+
git fetch upstream
29+
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
30+
git checkout upstream/debian/unstable
31+
git checkout ${CURRENT_BRANCH}
32+
git checkout upstream/debian/unstable -- ./debian/
2833
if [ -s ../upstream.patch ]; then
2934
[ -d debian/patches ] || mkdir debian/patches
3035
mv ../upstream.patch debian/patches/
@@ -33,20 +38,15 @@ if [ "${IS_PATCH}" = "true" ]; then
3338
git commit -m 'Evergreen patch build - upstream changes'
3439
git log -n1 -p
3540
fi
36-
if [ -s ../debian.patch ]; then
37-
git apply --index ../debian.patch
38-
git commit -m 'Evergreen patch build - Debian packaging changes'
39-
git log -n1 -p
40-
fi
4141
fi
4242

4343
cd ..
4444

4545
git clone https://salsa.debian.org/installer-team/debootstrap.git debootstrap.git
4646
export DEBOOTSTRAP_DIR=`pwd`/debootstrap.git
47-
sudo -E ./debootstrap.git/debootstrap unstable ./unstable-chroot/ http://cdn-aws.deb.debian.org/debian
47+
sudo -E ./debootstrap.git/debootstrap --variant=buildd unstable ./unstable-chroot/ http://cdn-aws.deb.debian.org/debian
4848
cp -a mongoc ./unstable-chroot/tmp/
49-
sudo chroot ./unstable-chroot /bin/bash -c "(\
49+
sudo chroot ./unstable-chroot /bin/bash -c '(\
5050
apt-get install -y build-essential git-buildpackage fakeroot debhelper cmake libssl-dev pkg-config python3-sphinx python3-sphinx-design zlib1g-dev libsasl2-dev libsnappy-dev libzstd-dev libmongocrypt-dev libjs-mathjax libutf8proc-dev furo && \
5151
chown -R root:root /tmp/mongoc && \
5252
cd /tmp/mongoc && \
@@ -55,11 +55,19 @@ sudo chroot ./unstable-chroot /bin/bash -c "(\
5555
python3 build/calc_release_version.py > VERSION_CURRENT && \
5656
python3 build/calc_release_version.py -p > VERSION_RELEASED && \
5757
git add --force VERSION_CURRENT VERSION_RELEASED && \
58-
git commit VERSION_CURRENT VERSION_RELEASED -m 'Set current/released versions' && \
58+
git commit VERSION_CURRENT VERSION_RELEASED -m "Set current/released versions" && \
59+
git remote remove upstream || true && \
60+
git remote add upstream https://github.com/mongodb/mongo-c-driver && \
61+
git fetch upstream && \
62+
export CURRENT_BRANCH="$(git rev-parse --abbrev-ref HEAD)" && \
63+
git checkout upstream/debian/unstable && \
64+
git checkout ${CURRENT_BRANCH} && \
65+
git checkout upstream/debian/unstable -- ./debian/ && \
66+
git commit -m "fetch debian directory from the debian/unstable branch" && \
5967
LANG=C /bin/bash ./debian/build_snapshot.sh && \
6068
debc ../*.changes && \
6169
dpkg -i ../*.deb && \
62-
gcc -I/usr/include/libmongoc-1.0 -I/usr/include/libbson-1.0 -o example-client src/libmongoc/examples/example-client.c -lmongoc-1.0 -lbson-1.0 )"
70+
gcc -I/usr/include/libmongoc-1.0 -I/usr/include/libbson-1.0 -o example-client src/libmongoc/examples/example-client.c -lmongoc-1.0 -lbson-1.0 )'
6371

6472
[ -e ./unstable-chroot/tmp/mongoc/example-client ] || (echo "Example was not built!" ; exit 1)
6573
(cd ./unstable-chroot/tmp/ ; tar zcvf ../../deb.tar.gz *.dsc *.orig.tar.gz *.debian.tar.xz *.build *.deb)
@@ -72,9 +80,9 @@ sudo chroot ./unstable-chroot /bin/bash -c "(\
7280
dpkg-buildpackage -b && dpkg-buildpackage -S )"
7381

7482
# And now do it all again for 32-bit
75-
sudo -E ./debootstrap.git/debootstrap --arch i386 unstable ./unstable-i386-chroot/ http://cdn-aws.deb.debian.org/debian
83+
sudo -E ./debootstrap.git/debootstrap --variant=buildd --arch i386 unstable ./unstable-i386-chroot/ http://cdn-aws.deb.debian.org/debian
7684
cp -a mongoc ./unstable-i386-chroot/tmp/
77-
sudo chroot ./unstable-i386-chroot /bin/bash -c "(\
85+
sudo chroot ./unstable-i386-chroot /bin/bash -c '(\
7886
apt-get install -y build-essential git-buildpackage fakeroot debhelper cmake libssl-dev pkg-config python3-sphinx python3-sphinx-design zlib1g-dev libsasl2-dev libsnappy-dev libzstd-dev libmongocrypt-dev libjs-mathjax libutf8proc-dev furo && \
7987
chown -R root:root /tmp/mongoc && \
8088
cd /tmp/mongoc && \
@@ -83,11 +91,19 @@ sudo chroot ./unstable-i386-chroot /bin/bash -c "(\
8391
python3 build/calc_release_version.py > VERSION_CURRENT && \
8492
python3 build/calc_release_version.py -p > VERSION_RELEASED && \
8593
git add --force VERSION_CURRENT VERSION_RELEASED && \
86-
git commit VERSION_CURRENT VERSION_RELEASED -m 'Set current/released versions' && \
94+
git commit VERSION_CURRENT VERSION_RELEASED -m "Set current/released versions" && \
95+
git remote remove upstream || true && \
96+
git remote add upstream https://github.com/mongodb/mongo-c-driver && \
97+
git fetch upstream && \
98+
export CURRENT_BRANCH="$(git rev-parse --abbrev-ref HEAD)" && \
99+
git checkout upstream/debian/unstable && \
100+
git checkout ${CURRENT_BRANCH} && \
101+
git checkout upstream/debian/unstable -- ./debian/ && \
102+
git commit -m "fetch debian directory from the debian/unstable branch" && \
87103
LANG=C /bin/bash ./debian/build_snapshot.sh && \
88104
debc ../*.changes && \
89105
dpkg -i ../*.deb && \
90-
gcc -I/usr/include/libmongoc-1.0 -I/usr/include/libbson-1.0 -o example-client src/libmongoc/examples/example-client.c -lmongoc-1.0 -lbson-1.0 )"
106+
gcc -I/usr/include/libmongoc-1.0 -I/usr/include/libbson-1.0 -o example-client src/libmongoc/examples/example-client.c -lmongoc-1.0 -lbson-1.0 )'
91107

92108
[ -e ./unstable-i386-chroot/tmp/mongoc/example-client ] || (echo "Example was not built!" ; exit 1)
93109
(cd ./unstable-i386-chroot/tmp/ ; tar zcvf ../../deb-i386.tar.gz *.dsc *.orig.tar.gz *.debian.tar.xz *.build *.deb)

0 commit comments

Comments
 (0)