system/rename.pl: Added (rename multiple files).

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
B. Watson 2022-01-06 15:06:26 -05:00 committed by Willy Sudiarto Raharjo
parent 27800b2e54
commit 27967f8d16
No known key found for this signature in database
GPG key ID: 3F617144D7238786
4 changed files with 149 additions and 0 deletions

10
system/rename.pl/README Normal file
View file

@ -0,0 +1,10 @@
rename.pl (rename multiple files, perl style)
Rename.pl renames the filenames supplied according to the rule
specified as the first argument. The argument is a Perl expression
which is expected to modify the $_ string for at least some of the
filenames specified.
This replaces the system/perl-rename that was formerly available.
See also: system/rename (Python version), system/mmv.

View file

@ -0,0 +1,110 @@
#!/bin/bash
# Slackware build script for rename.pl
# Written by B. Watson (yalhcru@gmail.com)
# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
# This replaces the former perl-rename from the SBo repo. The
# maintainer of perl-rename asked me to take over the build, and I
# decided I like the name "rename.pl" better. Also, the old one was in
# the perl/ category, implying it was a perl library. It's not. Just
# because an application is *written* in perl, doesn't mean it should
# be in the perl/ category (same goes for python/, people).
# This is a completely new SlackBuild (shares no code with
# perl-rename.SlackBuild).
# This is the "classic" rename, that used to ship with the perl source
# ages ago. It's also the same "rename" as Debian used to ship. I'm
# aware of the existence of https://metacpan.org/release/File-Rename
# but it's not the same: it's missing a lot of options (--no-stdin,
# -i, -l, -v, and all the options relating to backups). It also
# added some new options that do look useful (-0, -d, -e, -E), but it
# doesn't look like a good tradeoff to me.
# 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 from 2014. It's either "feature complete"
# or "unmaintained", depending on whether you love or hate it.
cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=rename.pl
VERSION=${VERSION:-1.9}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
SRCNAM=rename
ARCH=noarch
if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
exit 0
fi
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
set -e
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $SRCNAM-$VERSION
tar xvf $CWD/$SRCNAM-$VERSION.tar.gz
cd $SRCNAM-$VERSION
chown -R root:root .
chmod 644 bin/* *
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.
sed -i \
-e '/^rename - renames/s,rename,rename.pl,' \
-e '/^ *rename /s,rename,rename.pl,' \
-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,' \
-e 's,insted,instead,' \
-e 's,wheter,whether,' \
-e 's,reame,rename,' \
-e 's,<-no-stdin>,<--no-stdin>,' \
-e 's,I<rename\.pl>,B<rename.pl>,' \
-e 's, <rename\.pl>, B<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
# 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.
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
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
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}

View file

@ -0,0 +1,10 @@
PRGNAM="rename.pl"
VERSION="1.9"
HOMEPAGE="https://metacpan.org/pod/release/PEDERST/rename-1.9/bin/rename.PL"
DOWNLOAD="https://cpan.metacpan.org/authors/id/P/PE/PEDERST/rename-1.9.tar.gz"
MD5SUM="16df2adde955a6867701564e3d7c6a52"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
REQUIRES=""
MAINTAINER="B. Watson"
EMAIL="yalhcru@gmail.com"

View file

@ -0,0 +1,19 @@
# 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.
|-----handy-ruler------------------------------------------------------|
rename.pl: rename.pl (rename multiple files, perl style)
rename.pl:
rename.pl: Rename.pl renames the filenames supplied according to the rule
rename.pl: specified as the first argument. The argument is a Perl expression
rename.pl: which is expected to modify the $_ string for at least some of the
rename.pl: filenames specified.
rename.pl:
rename.pl:
rename.pl:
rename.pl:
rename.pl: