summaryrefslogtreecommitdiff
path: root/packaging/ng/buildscripts/generic.sh
blob: 85235c65133cd4b4b3113355bc5c6b8c0184bb64 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/sh
# This file is in the public domain.
# Helper script to build the latest DEB packages in the container.

set -eu
unset LD_LIBRARY_PATH

PACKAGE=$1
# Path of the debian/ folder in the repository
DEBIANPATH=${2:-.}

echo Building $1 with generic build logic >&2

cd /pkgdir
dpkg-scanpackages . | xz - > /pkgdir/Packages.xz
echo "deb [trusted=yes] file:/pkgdir ./" >/etc/apt/sources.list.d/taler-packaging-local.list
apt-get update

mkdir -p /build
cd /build

TAG=$(cat /buildconfig/$PACKAGE.tag)
GITURL=$(cat /buildconfig/$PACKAGE.giturl)

git config --global advice.detachedHead false
git clone --depth=1 --branch=$TAG "$GITURL" "$PACKAGE"

cd "/build/$PACKAGE/$DEBIANPATH"

# Get current version from debian/control file.
DEB_VERSION=$(dpkg-parsechangelog -S Version)

echo "Current version of $PACKAGE/$DEBIANPATH is $DEB_VERSION"

apt-cache show "$PACKAGE" | grep "Version: $DEB_VERSION" >/dev/null && found=true || found=false
if [ $found = true ]; then
  echo "$PACKAGE version $DEB_VERSION already built, skipping"
  exit 0
fi

cd "/build/$PACKAGE"
./bootstrap

cd "/build/$PACKAGE/$DEBIANPATH"

# Install build-time dependencies.
mk-build-deps --install --tool='apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends --yes' debian/control

# We do a sparse checkout, so we need to hint
# the version to the build system.
echo $DEB_VERSION > .version
dpkg-buildpackage -rfakeroot -b -uc -us

cp ../*.deb /pkgdir/