Skip to content

Conversation

@Taumille
Copy link
Contributor

Implements package blacklisting for diet builds, this allows the user to create a list of packages to exclude from the target. This will recursively avoid installing a package and all its dependencies on the target even if this package comes as a dependency of another package.
This must be carefully used as it can create packages with lacking dependencies.

This pull-request conflict with #451 that removes the part of the documentation on target package blacklisting

Copy link
Contributor

@t-8ch t-8ch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you also try to use the existing tighten mode, which ignores dependencies completely?

FYI I am about to pick up #451, so you'll need to rebase for that and adapt the docs for it.



def getalldeps(c, pkgname):
def getalldeps(c, pkgname, blacklist=[]):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mutable default arguments are problematic, as any mutation will persist between function invocations.
While this won't happen here, it is still a red flag.

Use an empty tuple () instead.

<element name="target" type="rfs:pkg-list" minOccurs="0" maxOccurs="unbounded">
<annotation>
<documentation>
avoid installing the specified packages into the target
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please mention that it only works for diet builds.


if xml.tgt.has('diet'):
if xml.has('target/pkg-blacklist/'):
blacklist = [p.et.text for p in xml.node('target/pkg-blacklist/target')]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of silently ignoring the entry for non-diet builds, please throw an error instead.

for p in pkglist:
deps = cache.get_dependencies(p)
if p in blacklist:
continue
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of having multiple places checking the blacklist, IMO it would be cleaner to move all the blacklist checking into cache.get_dependencies() by also having it return the original package and drop the withdeps += [p] below.

@Taumille
Copy link
Contributor Author

Taumille commented Jan 5, 2026

Hello @t-8ch, thank you for the review. Sadly tighten remove all dependencies for all packages.

My use case is specifically for packages coming from an unofficial source (ROS2 packages). Those packages may be incorrectly written and, in my case, tend to use the Depends tag for everything even what should be tagged as only Recommends.

This result in the fact that downloading a ROS package for a Lidar will download all the useless debugging and visualization tools for it, Qt packages to run those apps and a bunch of display related packages.

Using the tighten directive would force me to recursively search by hand for each and every needed dependencies for all my official packages which would be a painful step just to fix a bad package.

@t-8ch
Copy link
Contributor

t-8ch commented Jan 5, 2026

I see. On the other hand having to maintain special logic in ELBE only to account for those broken packages is undesirable from my perspective.
Looking at the file you linked, it seems they do try to make different components usable somewhat independently.
Maybe they are unaware about the issue and willing to fix it on their side? Did you report the issue to them?

@Taumille
Copy link
Contributor Author

Taumille commented Jan 5, 2026

I see. On the other hand having to maintain special logic in ELBE only to account for those broken packages is undesirable from my perspective.

Understandable, however I think that my use case is one of a long list of potential ones for this feature.
As Debian is a binary distribution we probably have a lot of packages built with all their features but where the user may only wants some of them because he care for the disk space but doesn't for broken dependencies.
Moreover in the end it will probably end up being a 10 line feature.

Looking at the file you linked, it seems they do try to make different components usable somewhat independently.
Maybe they are unaware about the issue and willing to fix it on their side? Did you report the issue to them?

Indeed, I didn't report the issue, it is probably linked to the way ROS automatically creates debian packages.

@Taumille Taumille force-pushed the package_blacklisting branch 2 times, most recently from cbcc124 to 53c4e2c Compare January 5, 2026 15:21
@t-8ch
Copy link
Contributor

t-8ch commented Jan 5, 2026

I think that my use case is one of a long list of potential ones for this feature.

So far non of them have come up :-)

Moreover in the end it will probably end up being a 10 line feature.

Implementing the feature won't be that big of a problem. Having to maintain it however, I'd like to avoid.

Indeed, I didn't report the issue, it is probably linked to the way ROS automatically creates debian packages.

Please do report it.

@Taumille
Copy link
Contributor Author

Taumille commented Jan 5, 2026

Implementing the feature won't be that big of a problem. Having to maintain it however, I'd like to avoid.

Ok, I understand, so do you want me to close the PR ? or are you interested in the feature ?
If it becomes hard to maintain the feature at some point isn't it possible to drop it ?

Please do report it.

I will, (first I need to understand in depth why it exists)

@t-8ch
Copy link
Contributor

t-8ch commented Jan 5, 2026

so do you want me to close the PR ?

Leave it open for now, please.

If it becomes hard to maintain the feature at some point isn't it possible to drop it ?

Maintaining it properly would require the addition of new testcases. And these need to be written and then run all the time.
Without them it will just silently break at some point. Also removing the feature would break users workflows which I'd like to avoid.

@Taumille
Copy link
Contributor Author

Taumille commented Jan 5, 2026

Maintaining it properly would require the addition of new testcases. And these need to be written and then run all the time. Without them it will just silently break at some point.

If needed, I can spend some times creating a test case and include it in the PR

…et builds

Implements package blacklisting for diet builds, this allows the user to
create a list of packages to exclude from the target.
This will recursively avoid installing a package and all its
dependencies on the target even if this package comes as a dependency of
another package.
This must be carefully used as it can create packages with lacking
dependencies.

Signed-off-by: Thomas Bonnefille <thomas.bonnefille@bootlin.com>
@Taumille Taumille force-pushed the package_blacklisting branch from 53c4e2c to da20aba Compare January 5, 2026 16:29
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.

2 participants