pkg_install: modify log levels & print destdir by default. (#891)

After this change, log levels are defined by the following:
* -q: only print errors (not even warnings)
* (default): print errors, warnings, infos
* -v: print above & also debug logs.

There are no errors and warnings logs at this moment.
The existing verbose logs about file operations are
categorized as debug logs, so they are only printed
when -v is set.

By default (if no flag is set), the destdir is printed
as an INFO level log.

Also improve the logging format to be similar to bazel's output, e.g.

    INFO: Installing to /tmp/inst

Fixes #889

Co-authored-by: HONG Yifan <elsk@google.com>
1 file changed
tree: c52d8e4b53aa6610e192fd7bcde45feb871a35b0
  1. .bazelci/
  2. .bcr/
  3. .github/
  4. deb_packages/
  5. distro/
  6. doc_build/
  7. docs/
  8. examples/
  9. pkg/
  10. tests/
  11. toolchains/
  12. .bazelignore
  13. .gitignore
  14. .pre-commit-config.yaml
  15. AUTHORS
  16. BUILD
  17. CHANGELOG.md
  18. CODEOWNERS
  19. CONTRIBUTING.md
  20. CONTRIBUTORS
  21. deps.bzl
  22. developers.md
  23. LICENSE
  24. mappings.bzl
  25. MODULE.bazel
  26. patching.md
  27. pkg.bzl
  28. README.md
  29. version.bzl
  30. WORKSPACE
  31. WORKSPACE.bzlmod
README.md

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