Page MenuHomeFreeBSD

Centralize qt-ports pkg-scripts
AcceptedPublic

Authored by adridg on Sun, Feb 21, 9:15 PM.

Details

Reviewers
tcberner
bapt
Summary

When a Qt port is installed, it may need to add a line to qconfig-modules.h. When it is uninstalled, it may need to remove a line. When its options change (and pkg-upgrade does a deinstall-reinstall) the line may need to be added or removed (may depend on port options, too).

When a Qt port is installed, if it has versionable binaries that share a name across Qt versions, it needs to update symlinks to qtchooser.

The ports framework handles this with a collection of @postexec and @postunexec and a PKGDEINSTALL script.

Known PRs are 253356 and 253360, where lines are duplicated, or not remove when needed. This PR centralizes the update actions to one script, admittedly a long-ish and generic one, that ensures that the qconfig-modules.h maintains consistency and the qtchooser symlinks are updated accordingly.

Diff Detail

Repository
rP FreeBSD ports repository
Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

Uses/qt-dist.mk
1

This is an artifact of pushing patches to ports through git and then across to Phab.

200

I'm not sure how much this costs; the script could possibly be split in two, or generated in a different way to be specifically-catering to the situation of this particular port. That would take a little bit more work, and right now, would obscure the point being made.

364

This chunk moves some variable settings outside of post-install (and the qtchooser update was misplaced outside the M5 block -- not a bad thing as long as we have only M5, though). We use these to massage the settings in the script.

An alternative would be to comment / filter the script based on settings here, generating a specialized install/uninstall script

380–381

This chunk is moved out of QT_DEFINES block because every Qt package now has a script. This is needed because a Qt package can have no DEFINES even if it previously did (ports OPTIONS change, for instance) and then it still needs to remove itself from qconfig-modules.h.

What could be done is specialize the script for the specific package: like in pkg-plist, introduce substitutions that produce a comment line (or not) depending on settings, and do those replacements and then filter out comment lines. The source script might then look something like this

@install POST-INSTALL)
@install@has_config add_config
@install@has_no_config remove_config
@install@has_binaries update_binaries
@install /usr/bin/true
@install ;;
@deinstall POST_DEINSTALL)
@deinstall remove_config
@deinstall@is_core clean_config
@deinstall@has_binaries update_binaries
@deinstall /usr/bin/true
@deinstall ;;

We could then do a substitution (@deinstall -> ##) and then a filter (deleting lines with ##) to specialize the script for the purpose of the package.

Chased all of my thoughts about minifying the scripts; there is now a "custom" version of the script for install- and deinstall, and the contents are tailored to the needs of the particular port.

adridg marked an inline comment as not done.Mon, Feb 22, 3:01 PM

What could be done is specialize the script for the specific package:

This is what I have done; it makes the "source" script a bit hard to read (although I've done my best to align it in column 25 with tabs and document that, too) but the specific parts that are needed for the port are picked up and used as the install- and deinstall-script. I've put some effort into "minifying" the script, using short constructions where possible (e.g. : instead of /usr/bin/true).

Moin moin

A quick rebuild of kf5-* and plasma5-* showed no issues.

mfg Tobias

Uses/qt-dist.mk
375

^ pkg-change.in ?

378

^ I think we can just drop this TODO while here...

Apart from those two comment issues mentioned above, this looks good to me.

This revision is now accepted and ready to land.Tue, Feb 23, 7:14 PM