Warning: there may be occasional oddness due to css and blog edits. **KNOWN ISSUE: possible hidden text**

Tuesday, March 26, 2024

Sed on a plist adjusts fvwm install

Sed can be a beast but its easy to be distracted by a silly solution you find online somewhere.  Whether it is a linuxism or simply an inaccurate solution, attempting to adapt it to your need could send you down the wrong road.  I recently cleaned up my unofficial port of fvwm3-dev to better comply via portclippy and to add options I may have missed.  After all of that, I discovered that the GO option causes some things to be present or not whether it is enabled.  This meant the pkg-plist needed a different mechanism for a few things.  I chose to have GO as a default option and with it selected when I re-verify the pkg-plist each time I update.  Since GO is enabled, there will need to be two lines added and this is what had me stuck, until I finally realized I could include newlines in the subsitution for the line prior to the added lines.  One small test proved that I could include the newline within the substitution and after that I knew the issue was solved with a little bit more editing.

I don't choose to manually edit all these things, just rename the present pkg-plist as pkg-plist-old, and after I generate a new pkg-plist, I use my plist-fix script to add all the conditional %TAG% to lines needing them, now with other adjustments as well.

Here is the script, this one is a bit more complex but many of my unofficial ports have a similar script in the files directory for the same purpose, specific to each port.

#!/bin/sh
rm /var/tmp/fvwm3-dev_pkg-plist 2>/dev/null
rm /var/tmp/fvwm3-dev_pkg-plist-fixed 2>/dev/null
cp ../pkg-plist /var/tmp/fvwm3-dev_pkg-plist

echo "adding conditional list tags"

cat /var/tmp/fvwm3-dev_pkg-plist | \
sed \
-e 's#^\/you\/have\/to\/check\/what\/makeplist\/gives\/you##' \
-e '/^$/d' \
-e 's#^bin\/FvwmPrompt#\%\%GOLANG\%\%\bin\/FvwmPrompt#g' \
-e 's#^bin\/fvwm-convert-2.6#\%\%PERL\%\%\bin\/fvwm-convert-2.6#g' \
-e 's#^bin\/fvwm-menu-directory#\%\%PERL\%\%\bin\/fvwm-menu-directory#g' \
-e 's#^bin\/fvwm-menu-xlock#\%\%PERL\%\%\bin\/fvwm-menu-xlock#g' \
-e 's#^bin\/fvwm-perllib#\%\%PERL\%\%\bin\/fvwm-perllib#g' \
-e 's#^libexec\/fvwm3\/\([0-9]\.[0-9]\.[0-9])*\)\/FvwmCommandS#\%\%GOLANG\%\%\libexec\/fvwm3\/\1\/FvwmCommandS \
\%\%NO_GOLANG\%\%\libexec\/fvwm3\/\1\/FvwmConsoleC\n\%\%NO_GOLANG\%\%\libexec\/fvwm3\/\1\/FvwmConsole#g' \
-e 's#^libexec\/fvwm3\/\([0-9]\.[0-9]\.[0-9])*\)\/FvwmPerl#\%\%PERL\%\%\libexec\/fvwm3\/\1\/FvwmPerl#g' \
-e 's#^share\/man\/man1\/fvwm-convert-2.6#\%\%MANPAGES\%\%\%\%PERL\%\%\share\/man\/man1\/fvwm-convert-2.6#g' \
-e 's#^share\/man\/man1\/fvwm-menu-directory#\%\%MANPAGES\%\%\%\%PERL\%\%\share\/man\/man1\/fvwm-menu-directory#g' \
-e 's#^share\/man\/man1\/fvwm-menu-xlock#\%\%MANPAGES\%\%\%\%PERL\%\%\share\/man\/man1\/fvwm-menu-xlock#g' \
-e 's#^share\/man\/man1\/fvwm-perllib#\%\%MANPAGES\%\%\%\%PERL\%\%\share\/man\/man1\/fvwm-perllib#g' \
-e 's#^share\/man\/man1\/fvwmPerl#\%\%MANPAGES\%\%\%\%PERL\%\%\share\/man\/man1\/fvwmperl#g' \
-e 's#^share\/man\/man1\/fvwm-perllib#\%\%MANPAGES\%\%\%\%PERL\%\%\share\/man\/man1\/fvwm-perllib#g' \
-e 's#\%\%MANPAGES\%\%share\/man\/man1\/FvwmConsole#\%\%GOLANG\%\%\%\%MANPAGES\%\%share\/man\/man1\/FvwmConsole#g' \
-e 's#^share\/man\/man1#\%\%MANPAGES\%\%share\/man\/man1#g' \
-e 's#^\%\%DATADIR\%\%\/fvwm-menu-desktop-config.fpl#\%\%PERL\%\%\%\%DATADIR\%\%\/fvwm-menu-desktop-config.fpl#g' \
-e 's#^\%\%DATADIR\%\%\/fvwm-script-ComExample.pl#\%\%PERL\%\%\%\%DATADIR\%\%\/fvwm-script-ComExample.pl#g' \
-e 's#^\%\%DATADIR\%\%/locale#\%\%NLS\%\%\%\%DATADIR\%\%/locale#g' \
-e 's#^\%\%DATADIR\%\%/perllib#\%\%PERL\%\%\%\%DATADIR\%\%/perllib#g' \
> /var/tmp/fvwm-dev_pkg-plist-fixed
cp /var/tmp/fvwm-dev_pkg-plist-fixed ../pkg-plist

There are a few other things in the Makefile that I add simply because we often do not realize caMelcaSe is used and expect all lowercase manpages.

# This detail has been annoying, why are some manpages all lowercase and some
# have an initial capital? Whether there was a purpose, the vast majority of
# man1 manpages are all lowercase. Cure this here. Also fix the recent change
# from /usr/local/man to /usr/local/share/man  It is a mistake to change all
# these manpages to lowercase only because fvwm scripts use those camelcased,
# instead, for convenience create symbolic links.

post-stage:
    @${MV} ${STAGEDIR}${LOCALBASE}/man/man1/* \
        ${STAGEDIR}${LOCALBASE}/share/man/man1/
    @${LN} ${STAGEDIR}${LOCALBASE}/share/man/man1/FvwmAnimate.1 \
        ${STAGEDIR}${LOCALBASE}/share/man/man1/fvwmanimate.1
    @${LN} ${STAGEDIR}${LOCALBASE}/share/man/man1/FvwmAuto.1 \
        ${STAGEDIR}${LOCALBASE}/share/man/man1/fvwmauto.1
    @${LN} ${STAGEDIR}${LOCALBASE}/share/man/man1/FvwmBacker.1 \
        ${STAGEDIR}${LOCALBASE}/share/man/man1/fvwmbacker.1
    @${LN} ${STAGEDIR}${LOCALBASE}/share/man/man1/FvwmButtons.1 \
        ${STAGEDIR}${LOCALBASE}/share/man/man1/fvwmbuttons.1
    @${LN} ${STAGEDIR}${LOCALBASE}/share/man/man1/FvwmCommand.1 \
        ${STAGEDIR}${LOCALBASE}/share/man/man1/fvwmcommand.1
#   @${LN} ${STAGEDIR}${LOCALBASE}/share/man/man1/FvwmConsole.1 \
#       ${STAGEDIR}${LOCALBASE}/share/man/man1/fvwmconsole.1
    @${LN} ${STAGEDIR}${LOCALBASE}/share/man/man1/FvwmEvent.1 \
        ${STAGEDIR}${LOCALBASE}/share/man/man1/fvwmevent.1
    @${LN} ${STAGEDIR}${LOCALBASE}/share/man/man1/FvwmForm.1 \
        ${STAGEDIR}${LOCALBASE}/share/man/man1/fvwmform.1
    @${LN} ${STAGEDIR}${LOCALBASE}/share/man/man1/FvwmIconMan.1 \
        ${STAGEDIR}${LOCALBASE}/share/man/man1/fvwmiconMan.1
    @${LN} ${STAGEDIR}${LOCALBASE}/share/man/man1/FvwmIdent.1 \
        ${STAGEDIR}${LOCALBASE}/share/man/man1/fvwmident.1
    @${LN} ${STAGEDIR}${LOCALBASE}/share/man/man1/FvwmMFL.1 \
        ${STAGEDIR}${LOCALBASE}/share/man/man1/fvwmmfl.1
    @${LN} ${STAGEDIR}${LOCALBASE}/share/man/man1/FvwmPager.1 \
        ${STAGEDIR}${LOCALBASE}/share/man/man1/fvwmpager.1
    @${LN} ${STAGEDIR}${LOCALBASE}/share/man/man1/FvwmPerl.1 \
        ${STAGEDIR}${LOCALBASE}/share/man/man1/fvwmperl.1
    @${LN} ${STAGEDIR}${LOCALBASE}/share/man/man1/FvwmRearrange.1 \
        ${STAGEDIR}${LOCALBASE}/share/man/man1/fvwmrearrange.1
    @${LN} ${STAGEDIR}${LOCALBASE}/share/man/man1/FvwmScript.1 \
        ${STAGEDIR}${LOCALBASE}/share/man/man1/fvwmscript.1

These particular adjustments that I figured out may lead to finally succeeding with the dbeaver reproducible install, avoiding the generated date stamp inserted into many file or directory names which would cause pkg to fail because the pkg-plist would be different the first time it was used after an update.

No comments:

Post a Comment

Thank you for your interest!

Frequently viewed this week