bazeldnfAPI docs @v0.99.2-rc1

@bazeldnf//:def.bzl

legacy API

Functions & Macros

bazeldnf
Parameters
args
kwargs

@bazeldnf//bazeldnf:defs.bzl

Public API to use bazeldnf from other repositories

Functions & Macros

bazeldnf
Parameters
kwargs
rpmtree

Creates a tar file from a list of rpm files.

Parameters
*name
kwargs
tar2files

Extracts files from a tar file.

Parameters
*name

The name of the tar file to be processed.

files

A dictionary where each key-value pair represents a file to be extracted.
If not provided, the function will fail.

Default: None
kwargs

Additional keyword arguments to be passed to the _tar2files function.

xattrs
Parameters
kwargs

Repository Rules

rpm
AttributeTypeDescription
*namename

A unique name for this repository.

repo_mappingdictionary: String → String

In WORKSPACE context only: a dictionary from local repository name to global repository name. This allows controls over workspace dependency resolution for dependencies of this repository.

For example, an entry "@foo": "@bar" declares that, for any time this repository depends on @foo (such as a dependency on @foo//some:target, it should actually resolve that dependency within globally-declared @bar (@bar//some:target).

This attribute is not supported in MODULE.bazel context (when invoking a repository rule inside a module extension's implementation function).

urlslist of strings
Default: []
sha256string
Default: ""
integritystring
Default: ""
dependencieslist of labels
Default: []
auth_patternsdictionary: String → String
Default: {}

@bazeldnf//bazeldnf:extensions.bzl

Module Extensions

bazeldnf_toolchain
Tag Classes
register

Allows registering a prebuilt bazeldnf toolchain

AttributeTypeDescription
namename

Base name for generated repositories, allowing more than one bazeldnf toolchain to be registered.
Overriding the default is only permitted in the root module.

Default: "bazeldnf"
disableboolean
Default: False
bazeldnf
Tag Classes
rpm

Allows registering a Bazel repository wrapping an RPM file

AttributeTypeDescription
namename

Name of the generated repository

Default: ""
urlslist of strings

URLs from which to download the RPM file

Default: []
sha256string

The expected SHA-256 of the file downloaded.
This must match the SHA-256 of the file downloaded.
It is a security risk to omit the SHA-256 as remote files can change.
At best omitting this field will make your build non-hermetic.
It is optional to make development easier but either this attribute or
integrity should be set before shipping.

Default: ""
integritystring

Expected checksum in Subresource Integrity format of the file downloaded.
This must match the checksum of the file downloaded.
It is a security risk to omit the checksum as remote files can change.
At best omitting this field will make your build non-hermetic.
It is optional to make development easier but either this attribute or
sha256 should be set before shipping.

Default: ""
config
AttributeTypeDescription
namename

Name of the generated proxy repository

Default: "bazeldnf_rpms"
cache_dirstring

Path of the bazeldnf cache repository

Default: ""
lock_filelabel

Label of the JSON file that contains the RPMs to expose, there's no legacy mode for RPMs defined by a lock file.

The lock file content is as:

{ "name": "optional name for the proxy repository, defaults to the file name", "cli-arguments": [ "cli", "arguments", "used", "for" "generation", ], "repositories": { "repo-name": [ "https://repo-url/path", ], }, "rpms": [ { "name": "<name of the rpm>", "urls": ["<url0>", ...], "sha256": "<sha256 of the file>", "integrity": "<integrity of the file>" } ], "targets": [ "target to install", ], "ignored": [ "ignored package", ], }
Default: None
ignore_missing_lockfileboolean

In case lockfile does not exist, create null rpm targets so that clients can still depend on them.

One won't be prompted with "please run bazel run @{repo}//:update-lock-file first".

Default: False
rpm_repository_prefixstring

A prefix to add to all generated rpm repositories

Default: ""
repofilelabel

YAML file that defines the repositories used for this lock file

Default: None
rpmslist of strings

name of the RPMs to install

Default: []
excludeslist of strings

Regex to pass to bazeldnf to exclude from the dependency tree

Default: []
nobestboolean

Allow picking versions which are not the newest

Default: False
ignore_depsboolean

Don't include dependencies in resulting repositories

Default: False
architecturestring

Single architecture to enable in addition to noarch

Default: ""
architectureslist of strings

Custom list of architectures (can't be used with architecture).

Can use more than one. The list defines architectures priority –
with the first one having the highest priority.
noarch is implicitly added at the end (if not present on the list).

Default: []

@bazeldnf//bazeldnf:platforms.bzl

Platforms definition for this repository

@bazeldnf//bazeldnf:repositories.bzl

Declare runtime dependencies

These are needed for local dev, and users must install them as well.
See https://docs.bazel.build/versions/main/skylark/deploying.html#dependencies

Functions & Macros

http_archive
Parameters
*name
kwargs
bazeldnf_dependencies
bazeldnf_register_toolchains

Convenience macro for users which does typical setup.

  • create a repository for each built-in platform like "bazeldnf_linux_amd64" -
    this repository is lazily fetched when node is needed for that platform.
  • TODO: create a convenience repository for the host platform like "bazeldnf_host"
  • create a repository exposing toolchains for each platform like "bazeldnf_platforms"
  • register a toolchain pointing at each platform

Users can avoid this macro and do these steps themselves, if they want more control.

Parameters
*name

base name for all created repos, like "bazeldnf1_14"

register

whether to call through to native.register_toolchains.
Should be True for WORKSPACE users, but false when used under bzlmod extension

Default: True
kwargs

passed to each node_repositories call

Repository Rules

bazeldnf_repositories

Fetch external tools needed for bazeldnf toolchain

AttributeTypeDescription
*namename

A unique name for this repository.

repo_mappingdictionary: String → String

In WORKSPACE context only: a dictionary from local repository name to global repository name. This allows controls over workspace dependency resolution for dependencies of this repository.

For example, an entry "@foo": "@bar" declares that, for any time this repository depends on @foo (such as a dependency on @foo//some:target, it should actually resolve that dependency within globally-declared @bar (@bar//some:target).

This attribute is not supported in MODULE.bazel context (when invoking a repository rule inside a module extension's implementation function).

*toolstring

@bazeldnf//bazeldnf:toolchain.bzl

Wraps bazeldnf tool binary through a toolchain

Rules

bazeldnf_toolchain
AttributeTypeDescription
*namename

A unique name for this target.

*toollabel

bazeldnf executable

@bazeldnf//internal:bazeldnf.bzl

Provides a wrapper to run bazeldnf as a run target

Functions & Macros

bazeldnf
Parameters
kwargs

@bazeldnf//internal:rpm.bzl

Exposes rpm files to a Bazel workspace

Rules

rpm_rule
AttributeTypeDescription
*namename

A unique name for this target.

*filelabel
depslist of labels
Default: []
null_rpm_rule
AttributeTypeDescription
*namename

A unique name for this target.

Repository Rules

rpm
AttributeTypeDescription
*namename

A unique name for this repository.

repo_mappingdictionary: String → String

In WORKSPACE context only: a dictionary from local repository name to global repository name. This allows controls over workspace dependency resolution for dependencies of this repository.

For example, an entry "@foo": "@bar" declares that, for any time this repository depends on @foo (such as a dependency on @foo//some:target, it should actually resolve that dependency within globally-declared @bar (@bar//some:target).

This attribute is not supported in MODULE.bazel context (when invoking a repository rule inside a module extension's implementation function).

urlslist of strings
Default: []
sha256string
Default: ""
integritystring
Default: ""
dependencieslist of labels
Default: []
auth_patternsdictionary: String → String
Default: {}

Providers

RpmInfo

Information about an RPM file

Used to pass information about an RPM file from the rpm rule to
other rules like rpmtree

Fields
deps

depset of other dependencies

file

label of the RPM file

@bazeldnf//internal:rpmtree.bzl

Provide helpers to convert rpm files into a single tar file

This file exposes rpmtree and tar2files to convert a group of
rpm files into either a .tar or extract files from that tar to
make available to bazel

Functions & Macros

rpmtree

Creates a tar file from a list of rpm files.

Parameters
*name
kwargs
tar2files

Extracts files from a tar file.

Parameters
*name

The name of the tar file to be processed.

files

A dictionary where each key-value pair represents a file to be extracted.
If not provided, the function will fail.

Default: None
kwargs

Additional keyword arguments to be passed to the _tar2files function.

@bazeldnf//internal:xattrs.bzl

Modify xattrs on tar file members

Functions & Macros

xattrs
Parameters
kwargs

@bazeldnf//tools:integrity.bzl

Generated during release by release_prep.sh, using integrity.jq

@bazeldnf//tools:version.bzl

Generated during release generate_tools_prebuilts.sh