Page MenuHomeFreeBSD

Framework: add L10NDIR and PORTL10N analogous to DOCSDIR/PORTDOCS
AbandonedPublic

Authored by tcberner on Jul 6 2021, 6:45 AM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 16 2024, 9:29 AM
Unknown Object (File)
Feb 5 2024, 9:51 PM
Unknown Object (File)
Jan 27 2024, 8:55 AM
Unknown Object (File)
Jan 18 2024, 1:11 PM
Unknown Object (File)
Dec 30 2023, 10:48 AM
Unknown Object (File)
Dec 20 2023, 2:47 AM
Unknown Object (File)
Nov 11 2023, 4:07 AM
Unknown Object (File)
Nov 10 2023, 6:59 AM

Details

Reviewers
mat
Group Reviewers
portmgr
kde
Summary

When updating for example the KDE Gear ports the most tedious and
time consuming part at the moment is chasing minor changes in the
localization part of the plist.

Make the framework support porters in that area, by providing a
new glob pattern PORTL10N and directory L10NDIR.

Analogously to PORTDOCS and PORTEXAMPLES this will auto-add
all files matching the corresponding glob PORTL10N to the plist
under L10NDIR.

L10NDIR defaults to ${PREFIX}/share/locale.

editors/kate: Example Conversion to using PORTL10N

Diff Detail

Repository
rP FreeBSD ports repository
Lint
No Lint Coverage
Unit
No Test Coverage
Build Status
Buildable 40345
Build 37234: arc lint + arc unit

Event Timeline

A little bit of bikeshedding. Since the localization feature is currently controlled by NLS variable in our ports, how about renaming PORTL10N&L10NDIR to PORTNLS&NLSDIR?

A little bit of bikeshedding. Since the localization feature is currently controlled by NLS variable in our ports, how about renaming PORTL10N&L10NDIR to PORTNLS&NLSDIR?

Yes, I though about using the existing NLS option too, but there are around 830 ports with an NLS option, so I got scared :D. But you're right, if portmgr also sees no issue with reusing NLS I'll rename it.

to be honnest I never like at all NLS, PORTDOCS, PORTEXAMPLES etc macros, if we are to accept glob to ease packaging, I think we should do it at the pkg level aka allow glob in the plist.
That would clean out lots of code from bsd.port.mk while making it really generic.

So now the question is do we want that? (note that this is quite straight forward to do in pkg)

In D31072#698971, @bapt wrote:

to be honnest I never like at all NLS, PORTDOCS, PORTEXAMPLES etc macros, if we are to accept glob to ease packaging, I think we should do it at the pkg level aka allow glob in the plist.
That would clean out lots of code from bsd.port.mk while making it really generic.

So now the question is do we want that? (note that this is quite straight forward to do in pkg)

I'm open to having it solved in pkg -- if you can do it. The main disadvantage of doing it there, is that it will take a while for it to be supported everywhere, while in the ports tree it's instantaneous.

How would it be used in for example editors/kate when using your proposed pkg solution? Would everyhting look the same (to the porters), just with an automatically added share/locale/* to the plist instead of the enumeration of all the files?

In D31072#698971, @bapt wrote:

to be honnest I never like at all NLS, PORTDOCS, PORTEXAMPLES etc macros, if we are to accept glob to ease packaging, I think we should do it at the pkg level aka allow glob in the plist.
That would clean out lots of code from bsd.port.mk while making it really generic.

So now the question is do we want that? (note that this is quite straight forward to do in pkg)

I'm open to having it solved in pkg -- if you can do it. The main disadvantage of doing it there, is that it will take a while for it to be supported everywhere, while in the ports tree it's instantaneous.

How would it be used in for example editors/kate when using your proposed pkg solution? Would everyhting look the same (to the porters), just with an automatically added share/locale/* to the plist instead of the enumeration of all the files?

Hmm, so if adding support to pkg to have share/locale/* (and analogous for e.g. PORTEXAMPLES), it would also make it clear for people who manually look at pkg-plist that the port installs files there (just not which). Once this feature hits pkg (the non-devel version) we can bump the minimum version of pkg to use in the ports tree.

Mk/Scripts/check-stagedir.sh
75

If you don't rename the variable here, you don't need most of the changes afterwards.
The variable already has a pretty long name, no need to make it longer.

Mk/bsd.options.mk
440–448

I don't like this bit, the old %%PORTDOCS%%, %%PORTEXAMPLES%% are here for compatibility reasons, modern ports should probably use %%DOCS%% and %%EXAMPLES%%, I don't think adding a new compat shim for something that never existed is a good idea.

  • l10n: revert variable name change of 'sed_portdocsexamples'
  • l10n: revert addition of PORTL10N
  • l10n: revert addition of PORTL10N - use %%L10N%% sub
tcberner marked 2 inline comments as done.
  • l10n: revert addition of PORTL10N - revert comment change

Following @mat's suggestion, I will rewrite it to add the target depending on the option's state , and just glob the whole L10NDIR (so there will be no need for the manual glob setting additional to the option).

  • l10n: split out handling of l10n from PORTEXAMPLES and PORTDOCS -- always adds the full tree under

I wonder what happens when you run make makeplist in a port with, and in a port without L10N option, do you get the share/locale files in both cases ?

Mk/bsd.port.mk
4597–4598

invert those two lines, so the target is only created if the option is on.

In D31072#699106, @mat wrote:

I wonder what happens when you run make makeplist in a port with, and in a port without L10N option, do you get the share/locale files in both cases ?

You'll get (e.g. devel/kf5-kcmutils):

%%L10N%%%%L10NDIR%%/af/LC_MESSAGES/kcmutils5.mo
%%L10N%%%%L10NDIR%%/ar/LC_MESSAGES/kcmutils5.mo
[...]

so, setup_plist_seds should likely check the option too...

  • l10n: only check for target existence after the option-set test
  • l10n: remove check-stagedir.sh part -- l10n is always auto generated
  • l10n: add options subs for the option
  • l10n: directly write the correct plist entries depending on the option value in its presence
  • l10n: only add L10NDIR to the PLIST_SUB if the option is defined
  • l10n: hide auto added files from makeplist

@mat I added PLIST_AUTO_L10N to the CO_ENV now the results of make makeplist are the following:

  1. port has *no* L10N option: share/locale/foo appear cleanly in output
  1. port has L10N option ON/OFF: %%L10NDIR%%/foo is filtered from the output

This was before or after its time :D