|
9 | 9 | description: The native binary, for Linux on x86-64 or AArch64 |
10 | 10 | required: true |
11 | 11 | version: |
12 | | - description: The package version, which the binary must print as its own |
| 12 | + description: The version that the binary prints, which is the package version too (with 0~ in front when it does not start with a digit) |
13 | 13 | required: true |
14 | 14 | out-dir: |
15 | 15 | description: The directory to write the package into |
|
38 | 38 | COPYRIGHT: ${{ github.action_path }}/copyright |
39 | 39 | run: | |
40 | 40 | set -euo pipefail |
41 | | - # Debian's rule for an upstream version without an epoch: a digit first, then these characters. |
42 | | - if ! [[ $VERSION =~ ^[0-9][A-Za-z0-9.+~-]*$ ]]; then |
43 | | - echo "Not a Debian package version: $VERSION" >&2 |
| 41 | + # Debian's rule for an upstream version without an epoch: a digit first, then these characters. Outside |
| 42 | + # a tag the binary's version can be a bare commit hash, which may start with a letter: 0~ in front makes |
| 43 | + # it a version that sorts below every release. |
| 44 | + deb_version=$VERSION |
| 45 | + if ! [[ $deb_version =~ ^[0-9] ]]; then |
| 46 | + deb_version=0~$deb_version |
| 47 | + fi |
| 48 | + if ! [[ $deb_version =~ ^[0-9][A-Za-z0-9.+~-]*$ ]]; then |
| 49 | + echo "Not a Debian package version: $deb_version" >&2 |
44 | 50 | exit 1 |
45 | 51 | fi |
46 | 52 |
|
|
69 | 75 | mkdir "$root/DEBIAN" |
70 | 76 | cat > "$root/DEBIAN/control" <<CONTROL |
71 | 77 | Package: open-java-format |
72 | | - Version: $VERSION |
| 78 | + Version: $deb_version |
73 | 79 | Architecture: $arch |
74 | 80 | Maintainer: Alexey Abashev <alexey@openjavaformat.dev> |
75 | 81 | Installed-Size: $(du -sk --apparent-size "$root/usr" | cut -f 1) |
|
85 | 91 | epoch=${SOURCE_DATE_EPOCH:-$(date +%s)} |
86 | 92 | find "$root" -exec touch --no-dereference --date "@$epoch" {} + |
87 | 93 | mkdir -p "$OUT_DIR" |
88 | | - package=$OUT_DIR/open-java-format_${VERSION}_$arch.deb |
| 94 | + package=$OUT_DIR/open-java-format_${deb_version}_$arch.deb |
89 | 95 | # xz, which every dpkg reads: dpkg-deb's default, zstd, needs dpkg 1.21.18 or later. |
90 | 96 | SOURCE_DATE_EPOCH=$epoch dpkg-deb --root-owner-group -Zxz --build "$root" "$package" |
91 | 97 | rm -rf "$root" |
|
0 commit comments