commit 7c48c27b1cc5b603e3ae77c320107e31bb5b358c
parent efbb450a9a44be291d4df5cbea7d52cd4a84f535
Author: Antoine A <>
Date: Thu, 20 Nov 2025 10:23:07 +0100
improve config, ci and deb
Diffstat:
21 files changed, 170 insertions(+), 141 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -7,5 +7,5 @@ debian/robocop/
debian/robocop.substvars
debian/tmp/
release/
-target/
-Makefile
+target
+*.mk
+\ No newline at end of file
diff --git a/.gitmodules b/.gitmodules
@@ -2,3 +2,6 @@
path = doc/prebuilt
url = git@git.taler.net:taler-docs
branch = prebuilt
+[submodule "build-system/taler-build-scripts"]
+ path = build-system/taler-build-scripts
+ url = git@git.taler.net:build-common
diff --git a/Makefile b/Makefile
@@ -0,0 +1,37 @@
+# This Makefile has been placed under the public domain
+-include build-system/config.mk
+
+# Absolute DESTDIR or empty string if DESTDIR unset/empty
+abs_destdir=$(abspath $(DESTDIR))
+
+man_dir=$(abs_destdir)$(prefix)/share/man
+bin_dir=$(abs_destdir)$(prefix)/bin
+
+all: build
+
+.PHONY: check
+check:
+ cargo test
+
+.PHONY: build
+build:
+ cargo build --release
+
+.PHONY: install
+install: build
+ install -D -t $(bin_dir) target/release/robocop
+ install -D -t $(bin_dir) robocop-ch-to-json
+ install -D -t $(bin_dir) robocop-json-postprocess
+ install -m 644 -D doc/prebuilt/man/robocop.1 $(man_dir)/man1
+
+.PHONY: doc
+doc:
+ cargo doc
+
+.PHONY: deb
+deb:
+ dpkg-buildpackage -b -uc -us
+
+.PHONY: ci
+ci:
+ contrib/ci/run-all-jobs.sh
+\ No newline at end of file
diff --git a/Makefile.in b/Makefile.in
@@ -1,15 +0,0 @@
-PREFIX=%PREFIX%
-install:
- cargo install --path . --root $(PREFIX)
- cp robocop-ch-to-json $(PREFIX)/bin
- cp robocop-json-postprocess $(PREFIX)/bin
- install -Dm644 doc/prebuilt/man/robocop.1 $(PREFIX)/share/man/man1/robocop.1
-
-test:
- RUST_BACKTRACE=full cargo run --profile dev --bin instrumentation -- offline
-
-check:
- cargo check
-
-msrv:
- cargo msrv --min 1.70.0
diff --git a/bootstrap b/bootstrap
@@ -1,4 +1,20 @@
#!/bin/sh
-# This file is in the public domain.
-chmod +x configure
-exit 0
+
+# Bootstrap the repository. Used when the repository is checked out from git.
+# When using the source tarball, running this script is not necessary.
+
+set -eu
+
+if ! git --version >/dev/null; then
+ echo "git not installed"
+ exit 1
+fi
+
+# Make sure that "git pull" et al. also update
+# submodules to avoid accidental rollbacks.
+git config --local submodule.recurse true
+
+git submodule sync
+git submodule update --init
+rm -f ./configure
+cp build-system/taler-build-scripts/configure ./configure
+\ No newline at end of file
diff --git a/build-system/configure.py b/build-system/configure.py
@@ -0,0 +1,10 @@
+# This configure.py.template file is in the public domain.
+
+from talerbuildconfig import *
+
+b = BuildConfig()
+b.enable_prefix()
+b.enable_configmk()
+b.add_tool(PosixTool("rustup"))
+b.add_tool(PosixTool("cargo"))
+b.run()
diff --git a/build-system/taler-build-scripts b/build-system/taler-build-scripts
@@ -0,0 +1 @@
+Subproject commit 884e13fe65b584f63d4cf92348fab1136af4bd69
diff --git a/configure b/configure
@@ -1,72 +1,60 @@
#!/bin/sh
-# This file is in the public domain.
-# Minimal GNU-style configure script
-# Default values
-prefix="/usr/local"
-# Function to display help
-show_help() {
- cat << EOF
-Usage: $0 [OPTION]...
+# This file is part of GNU Taler.
+# (C) 2020 Taler Systems S.A.
+#
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE
+# LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+# ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
+# THIS SOFTWARE.
+#
+# SPDX-License-Identifier: 0BSD
+
+# This script checks if a suitable python3 executable is installed and then
+# executes the actual configure logic written in Python.
+
+build_system_dir=build-system
+
+if ! test -d "$build_system_dir"; then
+ # Maybe this is not a top-level configure invocation
+ # For monorepos, try location from top-level
+ build_system_dir=../../build-system
+fi
-Configuration options:
- --help display this help and exit
- --prefix=PREFIX install files under this PREFIX
- [default: /usr/local]
+if ! test -d "$build_system_dir"; then
+ echo "fatal error: build-system directory not found" >&2
+ echo "hint: are you running this script from the right directory?" >&2
+ exit 1
+fi
-Report bugs to https://bugs.taler.net/
-EOF
-}
+scriptpath=$build_system_dir/taler-build-scripts
+if ! test -d "$build_system_dir"; then
+ echo "fatal error: taler-build-scripts directory not found at $scriptpath" >&2
+ echo "hint: did you run './bootstrap'?" >&2
+ exit 1
+fi
-# Parse command line arguments
-while test $# -gt 0; do
- case "$1" in
- --help | -h)
- show_help
- exit 0
- ;;
- --prefix=*)
- prefix=$(echo "$1" | sed 's/--prefix=//')
- ;;
- --prefix)
- shift
- if test $# -eq 0; then
- echo "configure: error: option '--prefix' requires an argument" >&2
- exit 1
- fi
- prefix="$1"
- ;;
- *)
- echo "configure: error: unrecognized option: '$1'" >&2
- echo "Try '$0 --help' for more information." >&2
- exit 1
- ;;
- esac
- shift
-done
+export TALERBUILDSYSTEMDIR=$build_system_dir
-# Check if Makefile.in exists
-if test ! -f Makefile.in; then
- echo "configure: error: Makefile.in not found" >&2
- exit 1
+# Check that the python3 executable is on the PATH.
+# This follows PEP 394 (https://www.python.org/dev/peps/pep-0394/).
+if ! python3 --version >/dev/null 2>&1; then
+ echo "error: python3 not found" >&2
+ exit 1
fi
-# Generate Makefile from Makefile.in
-echo "configuring with prefix: $prefix"
-echo "generating Makefile..."
+# Let python3 check that its own version is okay for us.
+python3 "$scriptpath/pyvercheck.py" || exit $?
-# Use sed to replace %PREFIX% with the actual prefix value
-sed "s|%PREFIX%|$prefix|g" Makefile.in > Makefile
+# Allow Python to find libraries that are checked into the build system git.
+export PYTHONPATH="$scriptpath:${PYTHONPATH:-}"
-if test $? -eq 0;
-then
- echo "configure: Makefile created successfully"
- echo ""
- echo "Configuration summary:"
- echo " Install prefix: $prefix"
- echo ""
- echo "Now run 'make' to build the project."
-else
- echo "configure: error: failed to create Makefile" >&2
- exit 1
-fi
+# Call configure.py, assuming all went well.
+python3 $TALERBUILDSYSTEMDIR/configure.py "$@"
diff --git a/contrib/ci/Containerfile b/contrib/ci/Containerfile
@@ -4,25 +4,14 @@ ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update -yqq && \
apt-get install -yqq \
- git \
- rustc \
- cargo \
- python3 \
- python3-lxml \
- jq
-
-# Debian packaging tools
-RUN apt-get install -yqq \
- po-debconf \
- build-essential \
- debhelper-compat \
- devscripts \
- git-buildpackage
-
-RUN echo '\
-Package: * \n\
-Pin: origin "deb.taler.net" \n\
-Pin-Priority: 999' > /etc/apt/preferences.d/taler
+ rustup \
+ python3 \
+ python3-lxml \
+ jq \
+ po-debconf \
+ build-essential \
+ debhelper && \
+ rustup default stable
WORKDIR /workdir
diff --git a/contrib/ci/ci.sh b/contrib/ci/ci.sh
@@ -6,7 +6,8 @@ set -exvuo pipefail
OCI_RUNTIME=$(which podman)
REPO_NAME=$(basename "${PWD}")
JOB_NAME="${1}"
-JOB_ARCH=$((grep CONTAINER_ARCH contrib/ci/jobs/${JOB_NAME}/config.ini | cut -d' ' -f 3) || echo "${2:-amd64}")
+NATIVE_ARCH=$(dpkg --print-architecture)
+JOB_ARCH=$((grep CONTAINER_ARCH contrib/ci/jobs/${JOB_NAME}/config.ini | cut -d' ' -f 3) || echo "${2:-$NATIVE_ARCH}")
JOB_CONTAINER=$((grep CONTAINER_NAME contrib/ci/jobs/${JOB_NAME}/config.ini | cut -d' ' -f 3) || echo "localhost/${REPO_NAME}:${JOB_ARCH}")
CONTAINER_BUILD=$((grep CONTAINER_BUILD contrib/ci/jobs/${JOB_NAME}/config.ini | cut -d' ' -f 3) || echo "True")
diff --git a/contrib/ci/jobs/0-codespell/config.ini b/contrib/ci/jobs/0-codespell/config.ini
@@ -3,4 +3,3 @@ HALT_ON_FAILURE = False
WARN_ON_FAILURE = True
CONTAINER_BUILD = False
CONTAINER_NAME = nixery.dev/shell/codespell
-CONTAINER_ARCH = amd64
diff --git a/contrib/ci/jobs/0-codespell/job.sh b/contrib/ci/jobs/0-codespell/job.sh
@@ -4,6 +4,11 @@ set -exuo pipefail
job_dir=$(dirname "${BASH_SOURCE[0]}")
skip=$(cat <<EOF
+*/doc/prebuilt/*
+*/.git/*
+*/.ci/*
+*/target/*
+./files/*
EOF
);
diff --git a/contrib/ci/jobs/1-build/build.sh b/contrib/ci/jobs/1-build/build.sh
@@ -1,4 +0,0 @@
-#!/bin/bash
-set -exuo pipefail
-
-cargo build
diff --git a/contrib/ci/jobs/1-build/job.sh b/contrib/ci/jobs/1-build/job.sh
@@ -1,9 +1,9 @@
#!/bin/bash
set -exuo pipefail
+# Update system
apt-get update -yq
apt-get upgrade -yq
-job_dir=$(dirname "${BASH_SOURCE[0]}")
-
-"${job_dir}"/build.sh
+# Build for release
+make build
+\ No newline at end of file
diff --git a/contrib/ci/jobs/2-deb-package/job.sh b/contrib/ci/jobs/2-deb-package/job.sh
@@ -1,23 +1,16 @@
#!/bin/bash
set -exuo pipefail
-# This file is in the public domain.
-# Helper script to build the latest DEB packages in the container.
+# Update system
+apt-get update -yq
+apt-get upgrade -yq
-unset LD_LIBRARY_PATH
-
-# Install build-time dependencies.
-# Update apt cache first
-apt-get update
-apt-get upgrade -y
-mk-build-deps --install --tool='apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends --yes' debian/control
-
+# Build package
export VERSION="$(./contrib/ci/jobs/4-deb-package/version.sh)"
echo "Building package version ${VERSION}"
-EMAIL=none gbp dch --ignore-branch --debian-tag="%(version)s" --git-author --new-version="${VERSION}"
-./bootstrap
-dpkg-buildpackage -rfakeroot -b -uc -us
+make deb
+# Move to artifact
ls -alh ../*.deb
mkdir -p /artifacts/robocop/${CI_COMMIT_REF} # Variable comes from CI environment
mv ../*.deb /artifacts/robocop/${CI_COMMIT_REF}/
diff --git a/contrib/ci/jobs/3-deploy-package/config.ini b/contrib/ci/jobs/3-deploy-package/config.ini
@@ -2,5 +2,4 @@
HALT_ON_FAILURE = True
WARN_ON_FAILURE = True
CONTAINER_BUILD = False
-CONTAINER_NAME = nixery.dev/shell/rsync
-CONTAINER_ARCH = amd64
+CONTAINER_NAME = nixery.dev/shell/rsync
+\ No newline at end of file
diff --git a/contrib/ci/run-all-jobs.sh b/contrib/ci/run-all-jobs.sh
@@ -0,0 +1,5 @@
+#!/bin/bash
+set -eax
+for JOB in $(ls $(dirname $0)/jobs | sort -n); do
+ $(dirname $0)/ci.sh $JOB;
+done;
diff --git a/debian/control b/debian/control
@@ -5,9 +5,7 @@ Maintainer: Christian Grothoff <grothoff@gnu.org>
Rules-Requires-Root: no
Build-Depends:
debhelper-compat (= 13),
- debhelper,
- cargo,
- rustc
+ rustup
Standards-Version: 4.7.2
Homepage: https://taler.net/
#Vcs-Browser: https://salsa.debian.org/debian/robocop
diff --git a/debian/robocop.install b/debian/robocop.install
@@ -1 +1,4 @@
-usr/bin/*
+robocop-ch-to-json /usr/bin
+robocop-json-postprocess /usr/bin
+target/release/robocop /usr/bin
+doc/prebuilt/man/robocop.1 /usr/share/man/man1/
+\ No newline at end of file
diff --git a/debian/rules b/debian/rules
@@ -1,20 +1,16 @@
#!/usr/bin/make -f
%:
- dh $@
-
-override_dh_auto_test:
- true
+ dh $@ --no-parallel
override_dh_auto_configure:
- true
+ rustup default stable
override_dh_auto_build:
- cargo build
+ make build
+
+override_dh_auto_test:
+ true
override_dh_auto_install:
- cargo install --path . --root debian/tmp/usr/
- cp robocop-ch-to-json debian/tmp/usr/bin
- cp robocop-json-postprocess debian/tmp/usr/bin
- rm -rf debian/tmp/usr/.crates*
- install -Dm644 doc/prebuilt/man/robocop.1 $(PREFIX)/share/man/man1/robocop.1
+ true
diff --git a/debian/source/format b/debian/source/format
@@ -1 +0,0 @@
-3.0 (quilt)