Skip to content

Commit

Permalink
chore(debian): add scripts to build debian package
Browse files Browse the repository at this point in the history
Signed-off-by: Romain Beuque <[email protected]>
  • Loading branch information
rbeuque74 committed Mar 15, 2022
1 parent 06205e5 commit 947a6b5
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
4 changes: 4 additions & 0 deletions scripts/build-debian-package-docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
set -euo pipefail

exec docker run -it --rm --name python-ovh-debian-builder -v python-ovh-debian-builder-output:/output -v "${PWD}:/python-ovh:ro" debian:buster /python-ovh/scripts/build-debian-package-recipe.sh
49 changes: 49 additions & 0 deletions scripts/build-debian-package-recipe.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/bash
set -e

mkdir -p /home/pkg/
cp -r /python-ovh/ /home/pkg/src
cd /home/pkg/src

export DEBIAN_FRONTEND="noninteractive"
apt-get update
# Add basic packages
apt-get install -y ca-certificates apt-transport-https

# Build package tooling
apt-get -yq install procps build-essential devscripts quilt debhelper
apt-get -yq install dh-systemd


DEBUILD_OPTIONS=--buildinfo-option=-O

mkdir -p /home/pkg/src/ovh
if [ ! -f /home/pkg/src/ovh/bbb ] && [ ! -f /home/pkg/src/ovh/build ]; then
echo "INFO: BuildBot is creating an executable file in ovh/bbb"
mkdir -p /home/pkg/src/ovh
cat > /home/pkg/src/ovh/bbb << EOF
set -e
debuild $DEBUILD_OPTIONS -us -uc -b -j$(nproc)
EOF

cat /home/pkg/src/ovh/bbb
chmod +x /home/pkg/src/ovh/bbb
fi

echo "BUILDBOT> Prepare the build process with Debian build dependencies (if debian/control file exists)"
if [ -f /home/pkg/src/debian/control ]; then
mk-build-deps -r -t "apt-get --no-install-recommends -y" -i /home/pkg/src/debian/control
else
echo "INFO: /home/pkg/src/debian/control is absent...skipping mk-build-deps"
fi
if [ -f /home/pkg/src/ovh/bbb ]; then
echo "BUILDBOT> Starting the build process via /home/pkg/src/ovh/bbb"
cd /home/pkg/src && ./ovh/bbb
elif [ -f /home/pkg/src/ovh/build ]; then
echo "BUILDBOT> Starting the build process via /home/pkg/src/ovh/build"
cd /home/pkg/src && ./ovh/build
fi

echo "BUILDBOT> Moving output to the artifact directory"
cd /home/pkg && find . -maxdepth 1 -type f -print -exec mv '{}' /output/ \;
chown -R 1000:1000 /output/

0 comments on commit 947a6b5

Please sign in to comment.