taler-deployment

Deployment scripts and configuration files
Log | Files | Refs | README

build.sh (2630B)


      1 #!/bin/bash
      2 # This file is part of TALER
      3 # (C) 2026 Taler Systems SA
      4 #
      5 # TALER is free software; you can redistribute it and/or
      6 # modify it under the terms of the GNU Affero General Public
      7 # License as published by the Free Software Foundation; either
      8 # version 3, or (at your option) any later version.
      9 #
     10 # TALER is distributed in the hope that it will be useful,
     11 # but WITHOUT ANY WARRANTY; without even the implied warranty
     12 # of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     13 # See the GNU General Public License for more details.
     14 #
     15 # You should have received a copy of the GNU General Public
     16 # License along with TALER; see the file COPYING.  If not,
     17 # see <http://www.gnu.org/licenses/>
     18 #
     19 
     20 
     21 set -euo pipefail
     22 repo_dir=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/../.." && pwd)
     23 overlay="$repo_dir/packaging/ng/buildscripts/debian-overlays/libmicrohttpd2"
     24 # shellcheck source=packaging/ng/buildscripts/debian-overlays/libmicrohttpd2/source.conf
     25 source "$overlay/source.conf"
     26 : "${CI_COMMIT_REF:?CI_COMMIT_REF is required}"
     27 arch=$(dpkg --print-architecture)
     28 artifact_dir="${MHD2_ARTIFACT_ROOT:-/artifacts}/libmicrohttpd2/$CI_COMMIT_REF/$arch"
     29 workdir=$(mktemp -d)
     30 trap 'rm -rf "$workdir"' EXIT
     31 
     32 git init -q "$workdir/upstream"
     33 git -C "$workdir/upstream" fetch --depth=1 "$MHD2_REPOSITORY" "refs/tags/$MHD2_TAG"
     34 actual=$(git -C "$workdir/upstream" rev-parse 'FETCH_HEAD^{commit}')
     35 if [[ "$actual" != "$MHD2_COMMIT" ]]; then
     36     echo "MHD2 tag $MHD2_TAG resolved to $actual, expected $MHD2_COMMIT" >&2
     37     exit 1
     38 fi
     39 export SOURCE_DATE_EPOCH
     40 author_epoch=$(git -C "$workdir/upstream" show -s --format=%ct "$actual")
     41 SOURCE_DATE_EPOCH=$author_epoch
     42 mkdir "$workdir/source"
     43 git -C "$workdir/upstream" archive "$actual" | tar -x -C "$workdir/source"
     44 cp -a "$overlay/debian" "$workdir/source/debian"
     45 cd "$workdir/source"
     46 apt-get update
     47 mk-build-deps --install --remove \
     48     --tool='apt-get --no-install-recommends --yes' debian/control
     49 # dh runs autoreconf and the upstream test suite; a failed test is fatal.
     50 dpkg-buildpackage -b -us -uc -j"${MHD2_BUILD_JOBS:-4}"
     51 # Exercise the packaged headers and library, with MHD1 installed alongside them.
     52 apt-get install -y "$workdir"/libmicrohttpd2-0_*.deb "$workdir"/libmicrohttpd2-dev_*.deb
     53 debian/tests/build
     54 
     55 mkdir -p "$artifact_dir"
     56 # Publish only this invocation's packages, never leftovers from an earlier run.
     57 : > "$artifact_dir/packages.list"
     58 for package in "$workdir"/*.deb; do
     59     cp "$package" "$artifact_dir/"
     60     basename "$package" >> "$artifact_dir/packages.list"
     61 done
     62 cp debian/changelog "$artifact_dir/changelog"
     63 printf '%s\n' "$actual" > "$artifact_dir/source-commit"