Skip to content
Snippets Groups Projects
ci-buildpackage 1.24 KiB
#!/bin/sh
# SPDX-License-Identifier: MPL-2.0
#
# Copyright © 2019 Collabora Ltd
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

set -ex

export DEBIAN_FRONTEND=noninteractive

apt-get -qy update
apt-get -qy -o APT::Get::Build-Dep-Automatic=yes \
  -o Acquire::http::Pipeline-Depth=0 \
  build-dep "$(pwd)"

dpkg-checkbuilddeps

dversion="$(dpkg-parsechangelog -S Version)"

case "$dversion" in
    *-*)
        pristine-lfs checkout -o _tmpbuild --auto
        ;;
    *)
        ;;
esac

POSTHOOK=""

if [ -z "${RELEASE}" ]; then
  POSTHOOK="deb-git-version-gen --distro=apertis --dch"
fi

export GBP_CONF_FILES=/dev/null # ignore any upstream gbp.conf shipped with the package

gbp buildpackage  --git-ignore-branch \
                  --git-export-dir=_tmpbuild \
                  --git-tarball-dir=_tmpbuild \
                  --git-ignore-new \
                  --git-postexport="${POSTHOOK}" \
                  --git-no-create-orig \
                  -uc -us \
                  "$@"

# Rename build folder as subsequent gitlab jobs expect it to be "_build"
[ -d _build ] && rm -rf _build
mv _tmpbuild _build