rules_pkg
1.1.0
published 2 weeks ago
234 stars
191 forks
31 watchers
Apache License 2.0
public
1 assets
22,983,845 downloads
92 KB
Compatibility level 1
tyFcY28iwYSfHDFCxy9LlUuxK7jc88viKa5uacxkeds=
1.1.0
March 12, 2025

New Features

  • pkg_dep: Add the multi_arch option in make_deb.py in order to add the Multi-Arch field in debian control file. (#937)
  • pkg_rpm: Generic debuginfo RPM platform support (#942)
  • pkg_rpm: fix sub-RPM post_scriptlet and add %postun support (#934)
  • install: Add --wipe_destdir option (#894)
  • pkg_tar: Make compression_level configurable for .tar.gz (#888)
  • pkg_install: Add destdir attr & read rel paths. (#886)
  • pkg_install: Support TreeArtifacts. (#885)

Incompatible Changes

None that we know of.

Change Log

  • Modify the rich_structure example to set include_runfiles (#906)
  • Fix installing an installed running process (#941)
  • tar_writer.py: address duplicate dir warning regression (#900)
  • Add the multi_arch option in make_deb.py in order to add the Multi-Arch field in debian control file. (#937)
  • Generic debuginfo RPM platform support (#942)
  • rpm: fix sub-RPM post_scriptlet and add %postun support (#934)
  • Syntax highlight the readme as starlark (#939)
  • rpm: Consume group info for sub RPMs (#931)
  • ci: Check pre-commit hooks in CI (#922)
  • fix: Avoid else after return in mappings bzl (#923)
  • Add pre-commit hooks to format trailing whitespaces (#924)
  • Pre commit autoupdate and format files (#913)
  • Allow some common rule args in verify_archive_test (#917)
  • ci: Bump Ubuntu version in CI from 18 to 22 (#912)
  • Fix check_must_contain_regex in verify_archive.bzl (#910)
  • Delete deb_packages directory (#903)
  • install: Add --wipe_destdir option (#894)
  • Load py_binary from rules_python (#895)
  • make_rpm: suppress unconditional debug prints (#892)
  • pkg_install: modify log levels & print destdir by default. (#891)
  • Make compression_level configurable for .tar.gz (#888)
  • rpm: Refine prefix matching for sub RPMs to reduce fragility (#879)
  • pkg_install: Add destdir attr & read rel paths. (#886)
  • pkg_install: Support TreeArtifacts. (#885)
  • Add support for repo mapping (#878)

Thanks to all the contributors to this release: Andrea Nardelli, Chris Bachhuber, Dahan Gong, Eric Wieser, Ivo List, Luis Padron, Markus Hofbauer, Mateusz Krakowiak, Michael Kelly, Mike Kelly, Nic, Peter Collingbourne, Thomas Lam, Tony Aiuto, Yun Peng, jacky8hyf, hcw-g, njlr, Peter Woodman, wade-arista

MODULE.bazel setup

bazel_dep(name = "rules_pkg", version = "1.1.0")

WORKSPACE setup

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
    name = "rules_pkg",
    urls = [
        "https://mirror.bazel.build/github.com/bazelbuild/rules_pkg/releases/download/1.1.0/rules_pkg-1.1.0.tar.gz",
        "https://github.com/bazelbuild/rules_pkg/releases/download/1.1.0/rules_pkg-1.1.0.tar.gz",
    ],
    sha256 = "b7215c636f22c1849f1c3142c72f4b954bb12bb8dcf3cbe229ae6e69cc6479db",
)
load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies")
rules_pkg_dependencies()

Using the rules

See the source.

Deps:
Assets:

Bazel package building

Bazel rules for building tar, zip, deb, and rpm for packages.

For the latest version, see Releases (with WORKSPACE setup) / Documentation

Use rules-pkg-discuss@googlegroups.com for discussion.

CI: Build status

Basic rules

Package building rules

  • pkg - Rules for building packages of various types.
  • examples - Cookbook examples for using the rules.

As of Bazel 4.x, Bazel uses this rule set for packaging its distribution. Bazel still contains a limited version of pkg_tar but its feature set is frozen. Any new capabilities will be added here.

WORKSPACE setup

Sample, but see releases for the current release.

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
    name = "rules_pkg",
    urls = [
        "https://mirror.bazel.build/github.com/bazelbuild/rules_pkg/releases/download/0.9.1/rules_pkg-0.9.1.tar.gz",
        "https://github.com/bazelbuild/rules_pkg/releases/download/0.9.1/rules_pkg-0.9.1.tar.gz",
    ],
    sha256 = "8f9ee2dc10c1ae514ee599a8b42ed99fa262b757058f65ad3c384289ff70c4b8",
)
load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies")
rules_pkg_dependencies()

To use pkg_rpm(), you must provide a copy of rpmbuild. You can use the system installed rpmbuild with this stanza.

load("@rules_pkg//toolchains/rpm:rpmbuild_configure.bzl", "find_system_rpmbuild")

find_system_rpmbuild(
    name = "rules_pkg_rpmbuild",
    verbose = False,
)

MODULE.bazel setup

bazel_dep(name = "rules_pkg", version = "0.0.10")

To use pkg_rpm(), you must provide a copy of rpmbuild. You can use the system installed rpmbuild with this stanza.

find_rpm = use_extension("//toolchains/rpm:rpmbuild_configure.bzl", "find_system_rpmbuild_bzlmod")
use_repo(find_rpm, "rules_pkg_rpmbuild")
register_toolchains("@rules_pkg_rpmbuild//:all")

For developers

We hold an engineering status meeting on the first Monday of every month at 10am USA East coast time. Add to calendar / meeting notes