From 984c47af33a1c8c0110ca9ed51cfc53631fc0344 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Mon, 16 Sep 2024 06:15:05 -0400 Subject: [PATCH] libraries/zziplib: Simplify doinst.sh for mandb. Signed-off-by: B. Watson Signed-off-by: Willy Sudiarto Raharjo --- libraries/zziplib/doinst.sh | 34 ++++++++++++++++++++ libraries/zziplib/zziplib.SlackBuild | 48 ++-------------------------- 2 files changed, 37 insertions(+), 45 deletions(-) create mode 100644 libraries/zziplib/doinst.sh diff --git a/libraries/zziplib/doinst.sh b/libraries/zziplib/doinst.sh new file mode 100644 index 0000000000..6bca1a9d27 --- /dev/null +++ b/libraries/zziplib/doinst.sh @@ -0,0 +1,34 @@ +# 20240916 bkw: this may end up in the template, so explanation: +# +# The "man -k", "apropos", and "whatis" commands in Slackware's +# man-db rely on a database of man pages, that gets built nightly by +# /etc/cron.daily/man-db, which runs the mandb command. This means any +# man pages installed by SBo packages should get added to the database +# within 24 hours of the time they're installed. +# +# Well and good, except it doesn't always work: if the timestamps on +# the /usr/man/man* directories in the package are older than the last +# time the cron job ran, then the next time it runs, mandb will see +# that the timestamp is older than the database, and will not search +# for new man pages. In fact, when this happens, the man pages *never* +# get added to the database. +# +# If you only ever install packages right after building them, you +# won't have this problem. However, if you install an older package +# you built yesterday (last week, etc), its /usr/man/man* timestamps +# will be older than the man database... +# +# It's easy enough to avoid the problem. Duncan Roe came up with the +# idea for this on the mailing list: Touch the man directories in the +# doinst.sh script for any build that installs man pages. The new +# man pages will get added to the database the next time the cronjob +# runs. +# +# It does *not* mean that "man -k" will be able to find newly +# installed man pages *immediately* after installing a new +# package... but then, as pointed out by KB_SBo (aka King Beowulf) +# on the mailing list, "locate" can't find the new files immediately +# either (it updates nightly, same as mandb), and nobody complains +# about that. + +[ -d usr/man ] && find usr/man -type d -exec touch {} + diff --git a/libraries/zziplib/zziplib.SlackBuild b/libraries/zziplib/zziplib.SlackBuild index bcdd10b078..35a61b8e90 100644 --- a/libraries/zziplib/zziplib.SlackBuild +++ b/libraries/zziplib/zziplib.SlackBuild @@ -23,6 +23,7 @@ # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# 20240916 bkw: BUILD=3, simplify doinst.sh for mandb. # 20240909 bkw: BUILD=2, generate doinst.sh for mandb. # 20240823 bkw: update for v0.13.78. # 20240808 bkw: update for v0.13.77. @@ -33,18 +34,11 @@ # - switch to cmake. # - make slack-desc more concise. -# Note: 0.13.71 had the file "usr/lib64/pkgconfig/zzip-zlib-config.pc", -# and 0.13.72 doesn't have it. Dependees are alephone and milkytracker [*]. -# These build correctly without this .pc file. If anyone has issues -# with new builds because of this, please contact me. -# [*] desmume had zziplib listed in REQUIRES, but it doesn't actually -# use it (maybe it did at one time?). - cd $(dirname $0) ; CWD=$(pwd) PRGNAM=zziplib VERSION=${VERSION:-0.13.78} -BUILD=${BUILD:-2} +BUILD=${BUILD:-3} TAG=${TAG:-_SBo} PKGTYPE=${PKGTYPE:-tgz} @@ -121,43 +115,7 @@ cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild mkdir -p $PKG/install cat $CWD/slack-desc > $PKG/install/slack-desc +cat $CWD/doinst.sh > $PKG/install/doinst.sh cd $PKG - -# 20240909 bkw: This bit may get added to the SBo templates, so I'll -# comment it in excruciating detail. -# -# The idea is that, immediately after installing the package, the -# "man -k", "whatis", "apropos" commands should be able to find the -# newly-installed man pages. This means that, at package install time, -# they have to be added to the man database with the mandb command. -# -# We *could* run "mandb -c" in the doinst.sh, which would rebuild the -# whole cache, but it takes a long time to do in Slackware 15.0 (several -# minutes). Running "mandb" without the -c is much quicker, but -# doesn't always pick up the new man pages (see next paragraph). So -# instead, we have to add them one-by-one with "mandb -f" commands. -# -# In theory, we could run mandb with arguments in doinst.sh, or just -# rely /etc/cron.daily/man-db to pick up the new man pages every -# day... but in practice, it fails to pick up new ones, if the -# timestamp on /usr/man/man1 (man3, etc) is older than the mandb -# database file. This happens if we install or reinstall a package -# that was built yesterday or earlier, if it contains any man pages. -# -# Note that I'm *not* proposing removing the man pages from the -# database on package removal. It could be done with a simple "mandb" -# command in doinst.sh (takes ~10 seconds to run with an SSD, longer -# with a platter drive), but the daily cron job already handles this -# correctly, regardless of the timestamps on the man page dirs. So -# when you remove a package, you'll have to live with its man pages -# being in the database for up to 24 more hours. This is no worse -# than its files still being listed in the locate database, and nobody -# complains about that. - -find usr/man -type f -a -name '*.gz' | \ - sed -e 's,^,chroot . /usr/bin/mandb -f "/,' \ - -e 's,$," \&>/dev/null,' \ - >> install/doinst.sh - /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE