diff options
author | B. Watson <yalhcru@gmail.com> | 2022-01-06 15:06:26 -0500 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2022-01-17 09:03:24 +0700 |
commit | 27967f8d16c541ba1ccacafeb78b1fd1a71c9ed3 (patch) | |
tree | e3530423b9a76e37ec0c31e845e561a20bdfc9f6 /system/rename.pl | |
parent | 27800b2e544ca62c177e3335e86b1dcc55a8e8ab (diff) |
system/rename.pl: Added (rename multiple files).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'system/rename.pl')
-rw-r--r-- | system/rename.pl/README | 10 | ||||
-rw-r--r-- | system/rename.pl/rename.pl.SlackBuild | 110 | ||||
-rw-r--r-- | system/rename.pl/rename.pl.info | 10 | ||||
-rw-r--r-- | system/rename.pl/slack-desc | 19 |
4 files changed, 149 insertions, 0 deletions
diff --git a/system/rename.pl/README b/system/rename.pl/README new file mode 100644 index 0000000000000..119b57a21c96a --- /dev/null +++ b/system/rename.pl/README @@ -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. diff --git a/system/rename.pl/rename.pl.SlackBuild b/system/rename.pl/rename.pl.SlackBuild new file mode 100644 index 0000000000000..2e09be060e42c --- /dev/null +++ b/system/rename.pl/rename.pl.SlackBuild @@ -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} diff --git a/system/rename.pl/rename.pl.info b/system/rename.pl/rename.pl.info new file mode 100644 index 0000000000000..b2ea7271512a1 --- /dev/null +++ b/system/rename.pl/rename.pl.info @@ -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" diff --git a/system/rename.pl/slack-desc b/system/rename.pl/slack-desc new file mode 100644 index 0000000000000..9ed163d1646f4 --- /dev/null +++ b/system/rename.pl/slack-desc @@ -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: |