blob: ad9689fab631e9bb2bb35b7e32a1fc7fae5ab5dd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#!/bin/sh
# Shared helpers for scripts/package-build/linux-kernel/build-*.sh.
# Source this file (". ${CWD}/common.sh"); it defines functions only.
# require_amd64 <component-name>
# Soft-exits (status 0) if not running on amd64.
require_amd64() {
if ! dpkg-architecture -iamd64; then
echo "${1} is only buildable on amd64 platforms"
exit 0
fi
}
# debian_version <raw-version-string>
# Sanitizes a git-describe-style string (e.g. "5.3-5-g5aeee02") into a
# version safe for a "3.0 (native)" Debian source package:
# - hyphens are replaced with "+", since debuild/dpkg-source treat any
# hyphen as "this needs a separate orig tarball" even for native
# packages, and reject the build asking for one that doesn't exist.
# - the result is prefixed with "0~" if it doesn't start with a digit,
# since Debian versions must start with a digit (a bare abbreviated
# git hash can start with a letter).
debian_version() {
v=$(echo "$1" | tr -- '-' '+')
case "$v" in
[0-9]*) echo "$v" ;;
*) echo "0~$v" ;;
esac
}
|