Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Debian packages #563

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

jwnimmer-tri
Copy link
Contributor

@jwnimmer-tri jwnimmer-tri commented Mar 23, 2024

Add rules to create Debian packages.

There are two new outputs to the build:

  • bazel-bin/deb/bazelisk-amd64.deb
  • bazel-bin/deb/bazelisk-arm64.deb

When stamping is on (with --config=release), the version number in the packages will reflect the git tag. Otherwise, the version number will be 0.0.0 so that build caching remains unaffected by git details.

Relatedly, we change the output of stamp.sh when not building from a release tag. Previously it would output the full git hash (e.g., 8f5d7bc98b54d78b96780837887d83abd9a864d6), which is not a valid version number in many packaging systems (e.g., it might start with a letter instead of a number) and doesn't have good version-comparison properties. Now, we use the nice logic in git describe to end up with e.g. v1.19.0-9-g8f5d7bc so that it's based off of the git tag, but still reflects how many commits past we are, and still concludes with the (short) git hash for precision.

My hope is that future releases of bazelisk will upload these two new artifacts as GitHub release attachments, at which point I could also update this project's documentation to mention their availability.

(In an ideal world, these Debian packages would also be uploaded to the Bazel apt site documented at https://bazel.build/install/ubuntu#install-on-ubuntu, but at least having them as attachments here would be a good start.)

The new outputs are in a separate package (//deb) so that they are easy to skip over when not wanted (e.g., bazel build //:all will not even load the rules_pkg dependency).


Why are Debian packages useful? On Debian and platforms derived from Debian (Ubuntu, etc.), *.deb files are the nominal way to manage versioned software that's installed system-wide (in /usr). Instead of asking users to "... download Bazelisk binary ... and add it to your PATH manually ..." (which many users will struggle to accomplish), we can give them a package format they are already familiar with. This will ease the onboarding of new developers who want to use Bazel but struggle to get it installed properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant