Ignore circular dependencies in starlark #184
Draft
+522
−284
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
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