Skip to content

Conversation

@manuelnaranjo
Copy link
Collaborator

RPM dependency tree is insane, it has cycles in it, for instance for
bash depends on glibc which depends on glibc-common which depends on
bash ( °-° ). Bazel wants DAGs as any decent build system, so the cycles
need to be fixed.

On the other hand consumers of bazeldnf don't care about glibc they want
to add bash to their setups (or whatever they wanted to add which may or
may not depend on something else and have a circular dependency), so we
can flatten the dependencies and avoid the loops for them.

Now the generated intermediate bazel repo will have 2 targets:

  • blob: contains the downloaded file per se
  • rpm: which may have a flat dependency list into blobs of other rpms
    or not depend on anything at all and just be the facade to make
    Bazel and RPM happy together.

When building the depset of the RpmInfo we will have cases where file
will be defined in the case of blob entries or not be defined in the
case of publicly facing RPM entries. Depsets are strict in terms of type
if the first entry is a file then everything is a file, same if it's
None so we need to hack things a little bit.

Only the alias entry in the public repository will depend on the rpm
target which will contain the dependency tree. We're creating a bunch
of rpm useless targets for those dependencies that are pure transitive,
and most likely this is pure tech debt we could clean up. But that would
mean in the rpm repository rule to be able to make a distinction between
a rpm_rule that's public with no dependencies from a pure transitive
dependency. Consumers of bazeldnf will not be able to depend on the
transitive dependencies anyway as those targets will not become aliased

@manuelnaranjo manuelnaranjo force-pushed the mnaranjo/ignore-circular-dependencies-in-starlark branch from 6e07b72 to 4985351 Compare January 23, 2026 22:44
We're not ready for bazel 9, most likely due to bazel flags, we need
to migrate to out of aspect_bazel_lib into bazel_lib and preset.bzl
Now we should be able to pass the circular dependencies test
RPM dependency tree is insane, it has cycles in it, for instance for
bash depends on glibc which depends on glibc-common which depends on
bash ( °-° ). Bazel wants DAGs as any decent build system, so the cycles
need to be fixed.

On the other hand consumers of bazeldnf don't care about glibc they want
to add bash to their setups (or whatever they wanted to add which may or
may not depend on something else and have a circular dependency), so we
can flatten the dependencies and avoid the loops for them.

Now the generated intermediate bazel repo will have 2 targets:
* blob: contains the downloaded file per se
* rpm: which may have a flat dependency list into blobs of other rpms
    or not depend on anything at all and just be the facade to make
    Bazel and RPM happy together.

When building the depset of the RpmInfo we will have cases where file
will be defined in the case of blob entries or not be defined in the
case of publicly facing RPM entries. Depsets are strict in terms of type
if the first entry is a file then everything is a file, same if it's
None so we need to hack things a little bit.

Only the alias entry in the public repository will depend on the rpm
target which will contain the dependency tree. We're creating a bunch
of rpm useless targets for those dependencies that are pure transitive,
and most likely this is pure tech debt we could clean up. But that would
mean in the rpm repository rule to be able to make a distinction between
a rpm_rule that's public with no dependencies from a pure transitive
dependency. Consumers of bazeldnf will not be able to depend on the
transitive dependencies anyway as those targets will not become aliased
@manuelnaranjo manuelnaranjo force-pushed the mnaranjo/ignore-circular-dependencies-in-starlark branch from 4985351 to c8199d8 Compare January 23, 2026 23:34
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.

1 participant