Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,7 @@ jobs:
- run:
name: Build Debian package
command: |
./dev-scripts/build-debian-pkg \
--build-targets linux/arm/v7
./dev-scripts/build-debian-pkg
- run:
name: Print Debian package contents
command: dpkg --contents debian-pkg/releases/tinypilot*.deb
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ Once your dev system is configured for multi-architecture Docker builds, you can
TARGET_PLATFORM='linux/arm/v7'

(rm debian-pkg/releases/tinypilot*.deb || true) && \
./dev-scripts/build-debian-pkg --build-targets "${TARGET_PLATFORM}" && \
./dev-scripts/build-debian-pkg && \
mv debian-pkg/releases/tinypilot*.deb bundler/bundle && \
./bundler/create-bundle
```
Expand Down
7 changes: 2 additions & 5 deletions bundler/create-bundle
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,8 @@ cd ./bundler
readonly BUNDLE_DIR='bundle'
readonly OUTPUT_DIR='dist'

# Exclude the AMD64 package from the production bundle.
rm -f "${BUNDLE_DIR}/tinypilot"*amd64.deb

# Ensure that a TinyPilot Debian package exists.
if ! ls "${BUNDLE_DIR}/tinypilot"*armhf.deb 1> /dev/null 2>&1; then
if ! ls "${BUNDLE_DIR}/tinypilot"*arm64.deb 1> /dev/null 2>&1; then
echo 'Failed to create bundle: no TinyPilot Debian package found.' >&2
exit 1
fi
Expand All @@ -50,7 +47,7 @@ print_tinypilot_version() {
dpkg-deb \
--show \
--showformat '${Tinypilot-Version}' \
"${BUNDLE_DIR}/tinypilot"*armhf.deb
"${BUNDLE_DIR}/tinypilot"*arm64.deb
}

# Compose bundle file name, which consists of these hyphen-separated parts:
Expand Down
2 changes: 1 addition & 1 deletion bundler/verify-bundle
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ if [[ ! -f install ]]; then
fi

# List Debian package contents.
dpkg --contents tinypilot*armhf.deb
dpkg --contents tinypilot*arm64.deb
7 changes: 2 additions & 5 deletions debian-pkg/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,8 @@ ARG PKG_BUILD_NUMBER='1'
RUN cat | bash <<'EOF'
set -exu
case "${TARGETPLATFORM}" in
'linux/amd64')
PKG_ARCH='amd64'
;;
'linux/arm/v7')
PKG_ARCH='armhf'
'linux/arm64')
PKG_ARCH='arm64'
;;
*)
echo "Unrecognized target platform: ${TARGETPLATFORM}" >&2
Expand Down
1 change: 1 addition & 0 deletions debian-pkg/debian/tinypilot.lintian-overrides
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ tinypilot: script-not-executable [opt/tinypilot/venv/lib/python*/site-packages/p
tinypilot: script-not-executable [opt/tinypilot/venv/lib/python*/site-packages/pkg_resources/_vendor/appdirs.py]
tinypilot: script-not-executable [opt/tinypilot/venv/lib/python*/site-packages/setuptools/command/easy_install.py]
tinypilot: national-encoding opt/tinypilot/venv/lib/python*/site-packages/passlib/tests/sample1c.cfg
tinypilot: embedded-library libyaml opt/tinypilot/venv/lib/python3.9/site-packages/yaml/_yaml.cpython-39-aarch64-linux-gnu.so

# Lintian doesn't recognize the Python interpreter when it's within the
# virtualenv.
Expand Down
16 changes: 2 additions & 14 deletions dev-scripts/build-debian-pkg
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,9 @@ set -u

print_help() {
cat <<EOF
Usage: ${0##*/} [--help] [--build-targets BUILD_TARGETS] [--tinypilot-version TINYPILOT_VERSION]
Usage: ${0##*/} [--help] [--tinypilot-version TINYPILOT_VERSION]
Build a TinyPilot Debian package.
--help Optional. Display this help and exit.
--build-targets BUILD_TARGETS Optional. A comma-separated list of architectures
that Docker accepts for its --platform argument.
If omitted, defaults to "linux/arm/v7,linux/amd64".
The only supported targets are "linux/arm/v7" and
"linux/amd64".
--tinypilot-version TINYPILOT_VERSION Optional. The version identifier that shall be
assigned. If omitted, determines the version string
automatically, in the "x.y.z-i+hhhhhhh" format that
Expand All @@ -34,19 +29,13 @@ print_tinypilot_version() {
}

# Parse command-line arguments.
BUILD_TARGETS='linux/arm/v7,linux/amd64'
TINYPILOT_VERSION="$(print_tinypilot_version)"
while (( "$#" > 0 )); do
case "$1" in
--help)
print_help
exit
;;
--build-targets)
BUILD_TARGETS="$2"
shift # For flag name.
shift # For flag value.
;;
--tinypilot-version)
TINYPILOT_VERSION="$2"
shift # For flag name.
Expand All @@ -59,7 +48,6 @@ while (( "$#" > 0 )); do
;;
esac
done
readonly BUILD_TARGETS
readonly TINYPILOT_VERSION

# Echo commands before executing them, by default to stderr.
Expand All @@ -77,7 +65,7 @@ readonly DOCKER_PROGRESS

DOCKER_BUILDKIT=1 docker buildx build \
--file debian-pkg/Dockerfile \
--platform "${BUILD_TARGETS}" \
--platform 'linux/arm64' \
--build-arg TINYPILOT_VERSION="${TINYPILOT_VERSION}" \
--build-arg PKG_VERSION="${PKG_VERSION}" \
--target=artifact \
Expand Down
2 changes: 1 addition & 1 deletion dev-scripts/device/install-from-source
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
readonly SCRIPT_DIR
cd "${SCRIPT_DIR}/../.."

./dev-scripts/build-debian-pkg --build-targets 'linux/arm/v7'
./dev-scripts/build-debian-pkg

# Shellcheck recommends find instead of ls for non-alphanumeric filenames, but
# we don't expect non-alphanumeric filenames, and the find equivalent is more
Expand Down