From 54a970925bdd6c23e489345aab269879f83271c6 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Mon, 12 Feb 2024 11:49:01 +0200 Subject: ambient.yaml: rework to build .deb of radicle-native-ci Signed-off-by: Lars Wirzenius Sponsored-by: author --- ambient.yaml | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 55 insertions(+), 7 deletions(-) diff --git a/ambient.yaml b/ambient.yaml index ae5c944..26d427f 100644 --- a/ambient.yaml +++ b/ambient.yaml @@ -468,17 +468,34 @@ projects: radicle-native-ci: image: ~/tmp/ambient/ambient-boot.qcow2 source: ~/radicle/radicle-native-ci - # pre_plan: - # - action: cargo_fetch + pre_plan: + - action: cargo_fetch plan: - - action: rustup_setup - - action: cargo_fmt +# - action: rustup_setup +# - action: cargo_fmt # - action: cargo_clippy - - action: cargo_build - - action: cargo_test +# - action: cargo_build +# - action: cargo_test - action: shell shell: | + + # FIXME: Put this in the Ambient `deb` action. + export PATH="/root/.cargo/bin:$PATH" + export CARGO_HOME=/workspace/deps + mkdir /workspace/cargo + export CARGO_TARGET_DIR=/workspace/cargo + export DEBEMAIL=liw@liw.fi + export DEBFULLNAME="Lars Wirzenius" + env + + command -v cargo + command -v rustc + + cargo --version + rustc --version + + cargo check --offline git status --ignored git clean -fdx @@ -488,7 +505,38 @@ projects: version="$V.ci$T-1" dch -v "$version" "CI build under Ambient." dch -r '' - - action: deb + + # Get name and version of source package. + name="$(dpkg-parsechangelog -SSource)" + version="$(dpkg-parsechangelog -SVersion)" + + # Get upstream version: everything before the last dash. + uv="$(echo "$version" | sed 's/-[^-]*$//')" + orig="${name}_${uv}.orig.tar.xz" + + # Create a tar ball without the Debian packaging. + tmp="$(mktemp -d)" + trap 'rm -rf "$tmp"' EXIT + git archive HEAD | tar -C "$tmp" -xf - + rm -rf "$tmp/debian" + tar -C "$tmp" -cf - . | xz >"../$orig" + + # Actually build the package, without signing the .changes file. + dpkg-buildpackage -us -uc + + # Dump some information to make it easier to visually verify + # everything looks OK. Also, test the package with the lintian tool. + arch="$(dpkg --print-architecture)" + deb="../${name}_${version}_${arch}.deb" + changes="../${name}_${version}_${arch}.changes" + + ls -l "$deb" + dpkg -c "$deb" + lintian -i "$changes" + + mv ../*_* /workspace/artifacts + +# - action: deb post_plan: - action: dput -- cgit v1.2.1