app-dicts/dictd-devils: new package

Package-Manager: Portage-3.0.19, Repoman-3.0.3
Signed-off-by: Alessandro Barbieri <lssndrbarbieri@gmail.com>
This commit is contained in:
Alessandro Barbieri
2021-06-06 02:23:44 +02:00
parent 5f11bdd50c
commit 39f91c1131
4 changed files with 184 additions and 0 deletions

View File

@@ -0,0 +1,65 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
DESCRIPTION="The Devil's Dictionary for dict"
HOMEPAGE="http://www.dict.org"
SRC_URI="http://www.gutenberg.org/files/972/972.zip -> ${P}.zip"
S="$WORKDIR"
LICENSE="public-domain"
SLOT="0"
KEYWORDS="~amd64"
DEPEND=">=app-text/dictd-1.5.5"
PATCHES=( "${FILESDIR}/format.patch" )
src_prepare() {
eapply_user
sed -e 's/\r//g' -i 972.txt
sed -e "/^ *THE DEVIL'S DICTIONARY/,/^End of Project Gutenberg's The Devil's Dictionary/!{w COPYING.gutenberg" -e 'd}' -i 972.txt
sed -e '/^\S/{: l;N;s/\n *\(.\)/ \1/g;t l}' -i 972.txt
sed -e "s/^\\([A-Zor .'?-]*[^,A-Zor .'?-]\\)/ \1/" -i 972.txt
sed -e '/^ /y/,/\a/' -i 972.txt
}
src_compile() {
head -n -6 972.txt | dictfmt -u "${SRC_URI% ->*}" \
-s "The Devil's Dictionary (2015-08-22 Project Gutenberg version)" \
--headword-separator " or " \
--columns 80 \
-h devils
sed -e 'y/\a/,/' -i devils.dict
dictzip devils.dict
}
src_install() {
insinto /var/dict
doins devils.dict.dz devils.index
}
pkg_preinst() {
HAS_OLD_VERSION="$(has_version app-dicts/${PN})"
}
pkg_postinst() {
if "${HAS_OLD_VERSION}" ; then
elog "You must restart your dictd server before the ${PN} dictionary is"
elog "completely updated. If you are using OpenRC, this may be accomplished by"
elog "running '/etc/init.d/dictd restart'."
else
elog "You must register ${PN} and restart your dictd server before the"
elog "dictionary is available for use. If you are using OpenRC, both tasks may be"
elog "accomplished by running '/etc/init.d/dictd restart'."
fi
}
pkg_postrm() {
if ! "${HAS_OLD_VERSION}" ; then
elog "You must unregister ${PN} and restart your dictd server before the"
elog "dictionary is completely removed. If you are using OpenRC, both tasks may be"
elog "accomplished by running '/etc/init.d/dictd restart'."
fi
}