LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   A patch to get libreoffice-{help,lang}pack.SlackBuild to properly generate slack-desc files. (https://www.linuxquestions.org/questions/slackware-14/a-patch-to-get-libreoffice-%7Bhelp-lang%7Dpack-slackbuild-to-properly-generate-slack-desc-files-4175662477/)

luvr 10-13-2019 10:28 AM

A patch to get libreoffice-{help,lang}pack.SlackBuild to properly generate slack-desc files.
 
The ‘libreoffice-helppack’ and ‘libreoffice-langpack’ SlackBuilds do not properly generate their package description files, ‘slack-desc’. They simply install a fixed copy of the file, in which the base package name is invariably set to “libreoffice-helppack” and “libreoffice-langpack”, respectively. Since this package name is incorrect, the package description will not get displayed while such a package is being installed.

The following patches will dynamically generate the package description files, with the correct base package names. I tested the patched SlackBuild scripts on the longest occurring language name, “ca-valencia”, to verify that they would not produce any excessively long output lines.

Patch for ‘libreoffice-helppack’.
Code:

--- libreoffice-helppack.SlackBuild.orig        2019-10-13 16:24:54.593156985 +0200
+++ libreoffice-helppack.SlackBuild        2019-10-13 16:36:08.444184022 +0200
@@ -90,7 +90,31 @@
 cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
 
 mkdir -p $PKG/install
-cat $CWD/slack-desc > $PKG/install/slack-desc
+SLACKDESC_BASENAME="${PRGNAM}"'_'"${PKG_LANG}"
+SLACKDESC_SPACENAM=$(echo "${SLACKDESC_BASENAME}" | sed 's/./ /g')
+LANGNAMES_JS="$PKG"'/opt/libreoffice'"${SRCSHORT}"'/help/'"${LOLANG}"'/langnames.js'
+SLACKDESC_LANGNAME=$(sed -nre 's~^ *"'"${LOLANG}"'" *: *"([^"]+)".*$~\1~p' "${LANGNAMES_JS}" 2> /dev/null || echo "${LOLANG}")
+cat > "$PKG"'/install/slack-desc' <<//*END_OF_SLACK_DESC
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description.
+# Line up the first '|' above the ':' following the base package name, and
+# the '|' on the right side marks the last column you can put a character in.
+# You must make exactly 11 lines for the formatting to be correct.  It's also
+# customary to leave one space after the ':' except on otherwise blank lines.
+
+${SLACKDESC_SPACENAM}|-----handy-ruler------------------------------------------------------|
+${SLACKDESC_BASENAME}: ${SLACKDESC_BASENAME} (for LibreOffice Productivity Suite)
+${SLACKDESC_BASENAME}:
+${SLACKDESC_BASENAME}: Built-in Help Pack for LibreOffice productivity suite.
+${SLACKDESC_BASENAME}: Language: ${SLACKDESC_LANGNAME}.
+${SLACKDESC_BASENAME}:
+${SLACKDESC_BASENAME}: Homepage: https://www.libreoffice.org
+${SLACKDESC_BASENAME}:
+${SLACKDESC_BASENAME}:
+${SLACKDESC_BASENAME}:
+${SLACKDESC_BASENAME}:
+${SLACKDESC_BASENAME}:
+//*END_OF_SLACK_DESC
 
 # Fix ownership and permissions and make the package
 chown -R root:root .

NOTE: In addition to getting the base package name right, this patch will include a line that shows the full name of the language to which the package applies. (It gets this name from the ‘langnames.js’ file extracted from the RPM).

Patch for ‘libreoffice-langpack’.
Code:

--- libreoffice-langpack.SlackBuild.orig        2019-10-13 16:42:19.642198915 +0200
+++ libreoffice-langpack.SlackBuild        2019-10-13 16:44:49.833204942 +0200
@@ -95,7 +95,29 @@
 cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
 
 mkdir -p $PKG/install
-cat $CWD/slack-desc > $PKG/install/slack-desc
+SLACKDESC_BASENAME="${PRGNAM}"'_'"${PKG_LANG}"
+SLACKDESC_SPACENAM=$(echo "${SLACKDESC_BASENAME}" | sed 's/./ /g')
+cat > "$PKG"'/install/slack-desc' <<//*END_OF_SLACK_DESC
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description.
+# Line up the first '|' above the ':' following the base package name, and
+# the '|' on the right side marks the last column you can put a character in.
+# You must make exactly 11 lines for the formatting to be correct.  It's also
+# customary to leave one space after the ':' except on otherwise blank lines.
+
+${SLACKDESC_SPACENAM}|-----handy-ruler------------------------------------------------------|
+${SLACKDESC_BASENAME}: ${SLACKDESC_BASENAME} (for LibreOffice Productivity Suite)
+${SLACKDESC_BASENAME}:
+${SLACKDESC_BASENAME}: Built-in Help Pack for LibreOffice productivity suite.
+${SLACKDESC_BASENAME}:
+${SLACKDESC_BASENAME}: Homepage: https://www.libreoffice.org
+${SLACKDESC_BASENAME}:
+${SLACKDESC_BASENAME}:
+${SLACKDESC_BASENAME}:
+${SLACKDESC_BASENAME}:
+${SLACKDESC_BASENAME}:
+${SLACKDESC_BASENAME}:
+//*END_OF_SLACK_DESC
 
 # Fix ownership and permissions and make the package
 chown -R root:root .

(Unfortunately, the language pack RPMs do not come with something like the ‘langnames.js’ file, so the package description cannot show the full language name.)

chris.willing 10-13-2019 04:59 PM

Since this relates to a SlackBuilds.org SlackBuild (rather than Slackware itself), suggestions like this are better posted to SlackBuilds-users@slackbuilds.org or, better still, emailed directly to the maintainer - who is always shown in the relevant .info file.


All times are GMT -5. The time now is 05:23 AM.