aboutsummaryrefslogtreecommitdiff
path: root/system/rename.pl/rename.pl.SlackBuild
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2023-09-05 22:09:37 -0400
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2023-09-09 10:14:22 +0700
commita360d96339e6c4de9ac9300df0d14d11b5092bec (patch)
treef14506c02a2da6676e53d6b1d8e1337156c089cb /system/rename.pl/rename.pl.SlackBuild
parent5f2fc562fdd9e16e681ff295209430f9b854d4fa (diff)
system/rename.pl: Updated for version 1.14.
Signed-off-by: B. Watson <urchlay@slackware.uk> Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'system/rename.pl/rename.pl.SlackBuild')
-rw-r--r--system/rename.pl/rename.pl.SlackBuild39
1 files changed, 30 insertions, 9 deletions
diff --git a/system/rename.pl/rename.pl.SlackBuild b/system/rename.pl/rename.pl.SlackBuild
index 6f8858da51761..6888606c8168b 100644
--- a/system/rename.pl/rename.pl.SlackBuild
+++ b/system/rename.pl/rename.pl.SlackBuild
@@ -24,19 +24,25 @@
# added some new options that do look useful (-0, -d, -e, -E), but it
# doesn't look like a good tradeoff to me.
+# There's also a completely different rename.pl here:
+# https://github.com/kugland/rename.pl
+# ...which AUR ships at version 2.0.0, so repology keeps telling me
+# this is outdated. Wish there were a way to fix that.
+
# Since the name "rename" conflicts with util-linux, I've named this
# rename.pl, and gone to some trouble to make sure its documentation
# refers to rename.pl consistently (particularly the example commands,
# which wouldn't work if you copy/pasted them as-is).
-# This version of rename is still actively maintained, as of 20221113.
+# This version of rename is still actively maintained, as of 20230226.
+# 20230905 bkw: updated for v1.14, tweak man page, add shell completions.
# 20221228 bkw: updated for v1.12, fix PKGTYPE assignment.
cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=rename.pl
-VERSION=${VERSION:-1.12}
+VERSION=${VERSION:-1.14}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}
@@ -68,17 +74,14 @@ chmod 755 . bin
# rename => rename.pl in embedded docs. Tricky because the word
# "rename" is also used as a normal verb and shouldn't be changed in
-# that case.
+# that case. Also fix typos in embedded docs, and clean up the
+# shell completion.
sed -i \
-e '/^rename - renames/s,rename,rename.pl,' \
-e '/^ *rename /s,rename,rename.pl,' \
-e 's,rename prompts,rename.pl prompts,g' \
-e 's,<rename>,<rename.pl>,g' \
-e '/make sure rename doesn.t/s,rename,B<rename.pl>,' \
- bin/$SRCNAM.PL
-
-# Fix typos in embedded docs:
-sed -i \
-e 's,Us it,Use it,' \
-e 's,mv prompts,<rename.pl> prompts,' \
-e 's,fo details,for details,' \
@@ -88,13 +91,19 @@ sed -i \
-e 's,<-no-stdin>,<--no-stdin>,' \
-e 's,I<rename\.pl>,B<rename.pl>,' \
-e 's, <rename\.pl>, B<rename.pl>,' \
+ -e 's,destionation,destination,' \
+ -e 's,_comp_rename,_comp_rename_pl,' \
+ -e '/comp/s,rename;,rename.pl;,' \
bin/$SRCNAM.PL
perl Makefile.PL
make
-# Generated man page still calls itself RENAME.
-sed -i '/^\./s,\<RENAME\>,&.PL,' blib/man1/$SRCNAM.1
+# Generated man page still calls itself RENAME. Also, fix the
+# version info.
+sed -i -e '/^\./s,\<RENAME\>,&.PL,' \
+ -e '/^\.TH/s,"perl v5[^"]*","rename.pl-'$VERSION'",' \
+ blib/man1/$SRCNAM.1
# This really is just a perl script and a man page. 'make install'
# creates lib(64) dirs and a perllocal.pod that we don't need.
@@ -102,6 +111,18 @@ mkdir -p $PKG/usr/bin $PKG/usr/man/man1
install -m0755 bin/$SRCNAM $PKG/usr/bin/$PRGNAM
gzip -9c < blib/man1/$SRCNAM.1 > $PKG/usr/man/man1/$PRGNAM.1.gz
+# 20230905 bkw: go ahead and include shell completions in the pkg.
+# Thanks to TommyC on libera IRC for assistance with the zsh stuff.
+ZSHDIR=$PKG/usr/share/zsh/site-functions
+BASHDIR=$PKG/usr/share/bash-completion/completions
+mkdir -p $ZSHDIR $BASHDIR
+
+echo "#compdef $PRGNAM" > $ZSHDIR/_$PRGNAM
+./bin/$SRCNAM --shell-completion=zsh >> $ZSHDIR/_$PRGNAM
+
+mkdir -p $PKG/usr/share/bash-completion/completions
+./bin/$SRCNAM --shell-completion=bash > $BASHDIR/$PRGNAM
+
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a Changes README.md $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild