Repository navigation
Install on Ubuntu with apt from a repository of our own #153
Copy link
Copy link
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Why
On Ubuntu the formatter is a download from the release page that goes onto the PATH by hand, and nothing says when a new version is out. Ubuntu users expect apt install and apt upgrade. google-java-format was asked for the same in google/google-java-format#231; its maintainers did not take it on and offered to link a package made by someone else.
Proposal
.deb packages for amd64 and arm64, made from the release's open-java-format-linux-glibc_x86-64 and open-java-format-linux-glibc_aarch64 and installing /usr/bin/open-java-format, in a signed apt repository of our own:
sudo install -d -m 0755 /etc/apt/keyrings
curl -fsSL https://apt.openjavaformat.dev/key.asc | sudo tee /etc/apt/keyrings/open-java-format.asc > /dev/null
echo "deb [signed-by=/etc/apt/keyrings/open-java-format.asc] https://apt.openjavaformat.dev stable main" \
| sudo tee /etc/apt/sources.list.d/open-java-format.list
sudo apt update
sudo apt install open-java-formatFrom then on apt upgrade brings every release. The same lines work on Debian.
How it could work, in the shape of the Homebrew tap in #151:
- A repository,
openjavaformat/apt, published with GitHub Pages underapt.openjavaformat.dev. - An hourly workflow follows the latest release. It downloads the two Linux binaries, checks them against
checksums_sha256.txt, builds the two packages withdpkg-deb, writes the indexes withapt-ftparchive, signsInReleaseandRelease.gpg, and deploys the result as a Pages artifact, so no binary lands in Git history. - The repository carries the latest version only. Older versions stay on the release page as plain binaries.
To decide
- The oldest supported release. The Linux binaries are built on
ubuntu-latest, today Ubuntu 24.04, and onubuntu-24.04-arm, both with glibc 2.39. A program linked against glibc 2.34 or later needs at least 2.34 to run: that is the "GLIBC_2.34 not found" of google-java-format_linux-x86-64: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by ./google-java-format_linux-x86-64) google/google-java-format#1072, which google-java-format fixed by building on an older image. Read the real minimum off our binaries withobjdump -Tand declare it asDepends: libc6 (>= …). Ubuntu 22.04 has glibc 2.35 and Debian 12 has 2.36; Ubuntu 20.04 has 2.31 and is past its standard support. Whenubuntu-latestmoves to the next LTS, the minimum moves with it, sorelease.ymlshould name the image. - The signing key. The key that signs the release files, or one of its own for the repository, which keeps the release key out of another repository's secrets.
- Hosting. A GitHub Pages site may be up to 1 GB and has a soft limit of 100 GB of traffic a month. Two packages of one version are far below the first; the second matters only if apt becomes the main way to install.
Alternatives looked at
- A PPA on Launchpad. Launchpad builds every package from a source upload, without network access. GraalVM is not in the Ubuntu archive, so the prebuilt binary would have to travel inside the source package, and a PPA serves Ubuntu only.
- Snap. The Snap Store comes with Ubuntu and updates by itself, but a strictly confined snap sees only non-hidden files in the home directory and gets a
/tmpof its own, so it could not format a checkout in/workspaceor in a hidden directory. Classic confinement lifts that only after a manual review by the store. - The Ubuntu and Debian archives. A package there must build from source inside the distribution, against dependencies packaged there too. GraalVM is not packaged, and the jar would bring the formatter's whole dependency tree along. Out of reach for now.
.debfiles on the release page alone.sudo apt install ./open-java-format_<version>_amd64.debwould work, but nothing would bring updates.- Homebrew on Linux. The formula of Install with Homebrew from a tap of our own #151 covers Ubuntu users who already use Homebrew.
Done when
sudo apt install open-java-formatinstalls the latest release on amd64 and arm64, on every supported Ubuntu LTS release from the oldest one decided above, andopen-java-format --versionprints it;apt upgradesees a new release within the hour, without a hand edit;- the Command line page gets an apt section, and About lists the repository.
Related
- Request supporting apt google/google-java-format#231 and google-java-format_linux-x86-64: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by ./google-java-format_linux-x86-64) google/google-java-format#1072
- Install with Homebrew from a tap of our own #151 for Homebrew, Install on Windows with Scoop and winget #152 for Windows
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request
Activity