build-deb
1 #!/bin/bash 2 3 set -euo pipefail 4 5 rm -f ../radicle*_* 6 git clean -fdx 7 8 # Get name and version of source package. 9 name="$(dpkg-parsechangelog -SSource)" 10 version="$(dpkg-parsechangelog -SVersion)" 11 12 # Get upstream version: everything before the last dash. 13 uv="$(echo "$version" | sed 's/-[^-]*$//')" 14 orig="${name}_${uv}.orig.tar.xz" 15 16 # Create a tar ball without the Debian packaging. 17 tmp="$(mktemp -d)" 18 trap 'rm -rf "$tmp"' EXIT 19 git archive HEAD | tar -C "$tmp" -xf - 20 rm -rf "$tmp/debian" 21 tar -C "$tmp" -cf - . | xz >"../$orig" 22 23 # Actually build the package, without signing the .changes file. 24 dpkg-buildpackage -us -uc 25 26 # Dump some information to make it easier to visually verify 27 # everything looks OK. Also, test the package with the lintian tool. 28 arch="$(dpkg --print-architecture)" 29 deb="../${name}_${version}_${arch}.deb" 30 changes="../${name}_${version}_${arch}.changes" 31 32 rm -f "../${name}-dbgsym_${version}_${arch}.deb" 33 sed -i '/dbgsym/d' "$changes" 34 35 ls -l "$deb" 36 dpkg -c "$deb" 37 lintian -i "$changes"