Skip to content

Pass exclude-libraries as env var to linuxdeploy plugins #283

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 12, 2025

Conversation

dantti
Copy link
Contributor

@dantti dantti commented Jun 13, 2024

Excluding libraries doesn't properly work as of now because plugins are not notified of such exclusions, by passing the env var and automatically reading it plugins just need to be recompiled.

This fixes linuxdeploy/linuxdeploy-plugin-qt#153

Copy link

@gegles gegles left a comment

Choose a reason for hiding this comment

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

Thanks!

@dantti
Copy link
Contributor Author

dantti commented Aug 8, 2024

@TheAssassin ping?

@dantti
Copy link
Contributor Author

dantti commented Aug 29, 2024

@TheAssassin friendly ping 😄

@TheAssassin
Copy link
Member

Thanks for the contribution and sorry for the delay.

@dantti dantti force-pushed the dantti/pass_exclude_libraries branch 2 times, most recently from 7295404 to 67115ea Compare November 18, 2024 02:18
@@ -656,7 +657,8 @@ namespace linuxdeploy {
AppDir::AppDir(const std::string& path) : AppDir(fs::path(path)) {}

void AppDir::setExcludeLibraryPatterns(const std::vector<std::string> &excludeLibraryPatterns) {
d->excludeLibraryPatterns = excludeLibraryPatterns;
d->excludeLibraryPatterns.insert(d->excludeLibraryPatterns.end(), excludeLibraryPatterns.begin(), excludeLibraryPatterns.end());
util::misc::stringVectorToEnv("LINUXDEPLOY_EXCLUDED_LIBRARIES", ';', d->excludeLibraryPatterns);
Copy link
Member

Choose a reason for hiding this comment

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

This line does not make sense. We should not influence the environment from a non-singleton class. As a user, you'd set the environment variable anyway, thus causing linuxdeploy-plugin-qt and subsequent runs of linuxdeploy from the script to pick up the environment variable. This is in line with all the other environment variables.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the whole reason of this patch.
user call ./ld --exclude-libraries foo --plugin qt
if linux deploy does not set the ENV var the qt plugin won't skipp foo library.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I makes no sense for
main ./linux-deploy --exclude-libraries foo works but for it's plugin the user has to manually set the env var.
Also there's no drawback from having duplicate items on the list, else we would use std::set and still doesn't mater for performance.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

@TheAssassin TheAssassin Feb 20, 2025

Choose a reason for hiding this comment

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

We do this for all other environment variables, though. If you want the values to apply to all the plugins, you use the env var, otherwise, you use the parameter. I do not see a reason to change this.

Choose a reason for hiding this comment

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

Hey @dantti, I also ran into this (but with the gtk plugin while working on a PR for Tauri), and from my reading, I believe @TheAssassin (correct me if I'm wrong) just wants you to remove line 661. I think it's just a consistency thing. The CLI params only apply to linuxdeploy. Env vars apply to linuxdeploy + plugins. Propagating the CLI params here is just inconsistent with how linuxdeploy normally behaves. They don't want to propagate cli parameters and want to configure plugins via environment variables, per the spec: https://github.com/linuxdeploy/linuxdeploy/wiki/Plugin-system#controlling-plugin-behavior

plus there is no ENV var that plugins read to exclude-libraries.

This PR to add $LINUXDEPLOY_EXCLUDED_LIBRARIES to linuxdeploy will be sufficient to add it to all plugins. The bash script based plugins will automatically work since they just bundle extra files and recall the original linuxdeploy package. linuxdeploy-plugin-qt will need to have it's linuxdeploy submodule bumped after this lands, but that's it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@DistractionRectangle I could change to remove the cli to ENV passing, but that's just bad UX, I call ./ld --exclude=foo and I expect that foo is going to be excluded, but it's not because plugins will still pick it, so instead I need to LD_EXCLUDE=foo ./ld and now I have it the way I wanted before, this to me is just bad UX. And users will still fill bug reports because --exclude didn't exclude...
I'd then say let's just remove all CLI options, otherwise you need to know how the magic works.

Copy link
Contributor Author

@dantti dantti Jul 15, 2025

Choose a reason for hiding this comment

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

This just boils down to "why would you ever want to exclude a library from linuxdeploy and not from it's plugins?", if the user is giving this CLI flag it's explicit that it should be excluded, if that's bad then it's the user's QA problem.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OTOH I'd suggest that all CLI options should be passed to plugins, or worst case have a --exclude-from-(all/plugins...) so that's discoverable...

Choose a reason for hiding this comment

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

I agree with you about the UX, but that's probably a separate issue/PR. It seems to be the blocker for getting this merged, and getting this merged certainly improves the UX vs the workarounds we have to do now.

Passing all cli options to plugins requires all plugins support them, or silently ignore invalid options, which hurts the UX and causes more overhead for the maintainer. It's also a 180 on the maintainers current stance, which is IMO a big ask and out of scope.

Copy link
Member

@TheAssassin TheAssassin left a comment

Choose a reason for hiding this comment

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

Please see my comment.

@dantti
Copy link
Contributor Author

dantti commented May 14, 2025

@TheAssassin how else do you want to have this fixed then? I want to start worrying about wayland+Qt now but this feature is sort of basic to ignore stuff I don't want to package

@dantti dantti force-pushed the dantti/pass_exclude_libraries branch 2 times, most recently from b4ff9f1 to b4c874c Compare July 16, 2025 22:01
@dantti
Copy link
Contributor Author

dantti commented Jul 16, 2025

@TheAssassin is it mergeable now?

@TheAssassin
Copy link
Member

Hi @dantti, I will have a look in a few minutes, thanks.

Excluding libraries doesn't properly work as of now
because plugins are not notified of such exclusions,
by passing the env var and automatically reading it
plugins just need to be recompiled or read it.
@dantti dantti force-pushed the dantti/pass_exclude_libraries branch from b4c874c to 882153f Compare July 17, 2025 13:47
@TheAssassin TheAssassin merged commit 160c700 into linuxdeploy:master Aug 12, 2025
6 checks passed
@TheAssassin
Copy link
Member

Thanks! And sorry for the delay!

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.

How to ignore a specific driver for QtSql?
4 participants