Always copy qt plugins and qml when creating NSIS installer
ClosedPublic

Authored by tfry on May 22 2017, 4:03 PM.

Details

Reviewers
vonreth
kfunk
Group Reviewers
Craft
Summary

See also https://mail.kde.org/pipermail/kde-windows/2017-May/010129.html .

When deploying Windows applications, Qt will not be able to find its plugins, including the essential "windows" platform plugin. Packages work around this by adding

utils.mergeTree(os.path.join(archiveDir, "plugins"), binPath)

in preArchive(). Doing this separately in each packaged application seems neither efficient nor future-proof (should default paths change, for instance). This patch moves the adjustment into the NullsoftInstallerPackager class.

The patch is not complete, in that it does not yet take care of removing the workarounds in the individual craft scripts. I'll do that, if the patch is considered a valid approach.

More fundamental notes:

  • Also moves the "qml" directory. Several craft-scripts do that, although they all seem to share the bug that "bin" is appended twice, which probably means this was not working, so far.
  • The only(?) current craft script that references the NullsoftInstallerPackager, but does not use a similar workaround is gammaray. Unfortunately I did not get gammaray to build, yet, and have not tested, how it would react to this change.

Diff Detail

Repository
R138 Craft
Lint
Lint Skipped
Unit
Unit Tests Skipped
tfry created this revision.May 22 2017, 4:03 PM
kfunk added a subscriber: kfunk.May 22 2017, 4:09 PM

NullsoftInstallerPackager is not the right place either. This should be done for every packager.

@vonreth Ideas?

vonreth edited edge metadata.May 22 2017, 9:32 PM

Maybe the CollectionPackageBase would be the place?
Regardless of where to put it, I think this should be called before preArchive().
Some packages might want to get rid of the bin folder so the bin and merge it with the archiveDir or the structure already changed during preArchive.

Hm, would it be possible to configure qt to install the plugins directly to bin? In that case all plugins, including the KDE plugins (KDE_INSTALL_USE_QT_SYS_PATHS) would end up in the correct directory.

tfry updated this revision to Diff 14771.May 23 2017, 6:44 AM
tfry added a reviewer: kfunk.

Move code to CollectionPackagerBase::internalCreatePackage(), instead. That's both before preArchive() gets called, and one level higher up the food-chain. I don't think the patch would apply to "non-collection" packagers (and it would not be trivial to add there), but perhaps I don't really understand, what these are used for.

Regarding fixing the installation dirs in the first place: Yes that would seem preferable, but I really don't know near enough to be comfortable with such a change. I do note that the problem is long-standing, too. What I'm looking for, here, is a pragmatic solution such that projects can in fact get going with creating standalone installers, without having to worry about any gory details. If a better solution is found, later, at least there will be only one place to fix up, not every single craft recipe.

When going into this, nonetheless, from the little understanding I have, I believe the problem is likely to be that Qt on Windows considers the topmost directory the "root", while KDE considers "bin" to be the root. I'm not sure this can be resolved, easily. Supplying qt.conf might be an option, though, and at any rate, its documentation seems to be pretty relevant info for any alternative attempts: http://doc.qt.io/qt-5/qt-conf.html .

vonreth added inline comments.May 23 2017, 7:41 PM
bin/Packager/CollectionPackagerBase.py
237

Please check whether those paths exist.

tfry updated this revision to Diff 14800.May 24 2017, 11:37 AM

Check paths for existence before moving.

Also, clean up existing workarounds in portage. Note that several port recipes also try to move paths like lib/plugins. I suspect those do not have any effect, but I have not touched those.

vonreth accepted this revision.May 24 2017, 2:51 PM

Looks got to me :)

This revision is now accepted and ready to land.May 24 2017, 2:51 PM
tfry closed this revision.May 24 2017, 6:14 PM
tfry marked an inline comment as done.

Oh my. Sorry! This revision is committed, but I had a typo in the differential number. Commits added manually, above.