summaryrefslogtreecommitdiff
path: root/packaging/ng/buildscripts/generic.sh
diff options
context:
space:
mode:
Diffstat (limited to 'packaging/ng/buildscripts/generic.sh')
-rw-r--r--packaging/ng/buildscripts/generic.sh54
1 files changed, 54 insertions, 0 deletions
diff --git a/packaging/ng/buildscripts/generic.sh b/packaging/ng/buildscripts/generic.sh
new file mode 100644
index 0000000..85235c6
--- /dev/null
+++ b/packaging/ng/buildscripts/generic.sh
@@ -0,0 +1,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/