Subject: [alpine-aports] [PATCH] community/john: fix subpackages

From: Ivan Tham <[email-masked]>
Date: Thu, 2 Mar 2017 16:07:41 +0800

---
 community/john/APKBUILD | 147 ++++++++++++++++--------------------------------
 1 file changed, 49 insertions(+), 98 deletions(-)

diff --git a/community/john/APKBUILD b/community/john/APKBUILD
index 52bd797..76b2788 100644
--- a/community/john/APKBUILD
+++ b/community/john/APKBUILD
@@ -1,3 +1,4 @@
+# Contributor: Ivan Tham <[email-masked]>
 # Contributor: Francesco Colista <[email-masked]>
 # Maintainer: Francesco Colista <[email-masked]>
 pkgname=john
@@ -19,6 +20,7 @@ subpackages="$pkgname-doc
 	$pkgname-misc::noarch
 	$pkgname-zsh-completion:zshcomp:noarch
 	$pkgname-bash-completion:bashcomp:noarch
+	$pkgname-jumbo:jumbo:noarch
 	"
 source="$pkgname-$pkgver.tar.gz::https://github.com/magnumripper/JohnTheRipper/archive/$pkgver-$_pkgrel.tar.gz
 	truecrypt_fmt_plug.patch
@@ -26,14 +28,14 @@ source="$pkgname-$pkgver.tar.gz::https://github.com/magnumripper/JohnTheRipper/a
 	gcc5-support.patch
 	libressl.patch
 	"
-
 builddir="$srcdir/JohnTheRipper-$pkgver-$_pkgrel"
+
 build() {
 	cd "$builddir"/src
 	sed -i -e "s/ac_default_prefix.*/ac_default_prefix=\/usr/g" configure
 	export OPENSSL_LIBS="-lssl -lcrypto"
 	./configure \
-		--disable-openmp 
+		--disable-openmp
 	make || return 1
 }
 
@@ -42,112 +44,64 @@ package() {
 	mkdir -p "$pkgdir"/usr/bin
 	mkdir -p "$pkgdir"/usr/share/doc/$pkgname
 
-	install -Dm644 run/john.conf ${pkgdir}/etc/john/john.conf
-	install -Dm644 run/john.local.conf ${pkgdir}/etc/john/john.local.conf
-	install -Dm644 doc/* ${pkgdir}/usr/share/doc/$pkgname
-	install -Dm644 doc/LICENSE ${pkgdir}/usr/share/licenses/$pkgname/LICENSE
+	install -Dm644 run/john.conf "$pkgdir"/etc/john/john.conf
+	install -Dm644 run/john.local.conf "$pkgdir"/etc/john/john.local.conf
+	install -Dm644 doc/* "$pkgdir"/usr/share/doc/$pkgname
+	install -Dm644 doc/LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
+	rm "$pkgdir"/usr/share/doc/$pkgname/LICENSE*
 
-	local john_bins="john calc_stat genmkvpwd mkvcalcproba \
-				relbench tgtsnarf raw2dyna"
-	for bin in $(echo ${john_bins}); do
-		install -Dm755 run/${bin} -t "${pkgdir}/usr/bin"
+	local john_bins="john calc_stat genmkvpwd mkvcalcproba relbench
+			tgtsnarf raw2dyna"
+	for bin in ${john_bins}; do
+		install -Dm755 run/${bin} "$pkgdir"/usr/bin
 	done
 
-	cd "${pkgdir}/usr/bin"
-	local john_links="hccap2john keepass2john mozilla2john  \
-					pdf2john pfx2john pwsafe2john racf2john \
-					rar2john ssh2john unafs unique unsahdow \
-					undrop zip2john"
-	for link in $(echo ${john_links}); do
-		ln -s john ${link}
+	local john_links="hccap2john keepass2john mozilla2john pdf2john
+			pfx2john pwsafe2john racf2john rar2john ssh2john
+			unafs unique unsahdow undrop zip2john"
+	for link in ${john_links}; do
+		ln -s john "$pkgdir"/usr/bin/${link}
 	done
 }
 
 py() {
-	pkgdesc="Python Scripts for John the Ripper"
-	depends="python2 libxml2 libgsf"
-	install_if="$pkgname=$pkgver-r$pkgrel"
-
-	cd "$builddir" 
-	local john_scripts="1password2john.py ecryptfs2john.py 		\
-		kwallet2john.py openssl2john.py 7z2john.py efs2john.py  \
-		lotus2john.py pcap2john.py aix2john.py encfs2john.py 	\
-		mcafee_epo2john.py pdf2john.py androidfde2john.py 		\
-		htdigest2john.py ml2john.py sipdump2john.py 			\
-		apex2john.py ikescan2john.py mozilla2john.py 			\
-		ssh2sshng.py bitcoin2john.py kdcdump2john.py 			\
-		netscreen.py sshng2john.py blockchain2john.py 			\
-		keychain2john.py odf2john.py strip2john.py 				\
-		cracf2john.py keystore2john.py office2john.py 			\
-		sxc2john.py dmg2john.py known_hosts2john.py 			\
-		openbsd_softraid2john.py"
-
-	for john_script in $(echo ${john_scripts}); do
-		install -D -m755 run/${john_script} \
-			"$subpkgdir"/usr/share/john
-	done	
+	depends="libxml2 libgsf"
+	_script python "*.py"
 }
 
 perl() {
-	pkgdesc="Perl Scripts for John the Ripper"
-	depends="perl"
-	install_if="$pkgname=$pkgver-r$pkgrel"
-
-	cd "$builddir" 
-	local john_scripts="aix2john.pl ios7tojohn.pl	\
-		lion2john-alt.pl pass_gen.pl sap2john.pl	\
-		cisco2john.pl ldif2john.pl lion2john.pl		\
-	radius2john.pl sha-dump.pl hextoraw.pl 		\
-		leet.pl netntlm.pl rexgen2rules.pl 			\
-		sha-test.pl benchmark-unify"
-	for john_script in $(echo ${john_scripts}); do
-		install -D -m755 run/${john_script} \
-			"$subpkgdir"/usr/share/john
-	done
+	_script perl "*.pl benchmark-unify"
 }
 
 ruby() {
-	pkgdesc="Ruby Scripts for John the Ripper"
-	depends="ruby"
-	install_if="$pkgname=$pkgver-r$pkgrel"
+	_script ruby "*.rb"
+}
 
-	cd "$builddir"
-	local john_scripts="genincstats.rb"
-	for john_script in $(echo ${john_scripts}); do
-		install -D -m755 run/${john_script} \
-			"$subpkgdir"/usr/share/john
-	done
+_script() {
+	local lang="$1"
+
+	depends="$depends $lang"
+	pkgdesc="John the Ripper ($lang scripts)"
+	_install 755 "$2"
 }
 
 misc() {
 	pkgdesc="Misc tools for John the Ripper: password list and charset files"
-	install_if="$pkgname=$pkgver-r$pkgrel"
+	local john_pwd="password.lst dictionary.rfc2865 stats"
+	local john_chr="*.chr"
+	local john_cfg="dumb*.conf repeats*.conf dynamic*.conf
+			korelogic.conf regex_alphabets.conf"
+	_install 644 "$john_pwd $john_cfg $john_chr"
+}
 
-	cd "$builddir"
-	mkdir -p ${subpkgdir}/usr/share/john/kernels/
-
-	local john_pwdfiles="password.lst dictionary.rfc2865 stats"
-	local john_conffiles="dumb16.conf dumb32.conf dynamic.conf 		\
-		dynamic_flat_sse_formats.conf regex_alphabets.conf 		\
-		repeats16.conf repeats32.conf"
-	local john_chrfiles="lowernum.chr alnum.chr upper.chr lower.chr 	\
-		alpha.chr ascii.chr latin1.chr lanman.chr 			\
-		lowerspace.chr digits.chr lm_ascii.chr utf8.chr 		\
-		uppernum.chr makechr alnumspace.chr"
-
-	for john_pwdfiles in $(echo ${john_pwdfiles}); do
-		install -D -m644 run/${john_pwdfiles} \
-			"$subpkgdir"/usr/share/john
-	done
+_install() {
+	local perm="$1"
+	local files="$2"
 
-	for john_conffiles in $(echo ${john_conffiles}); do
-		install -D -m644 run/${john_conffiles} \
-			"$subpkgdir"/usr/share/john
-	done
-
-	for john_chrfiles in $(echo ${john_chrfiles}); do
-		install -D -m644 run/${john_chrfiles} \
-			"$subpkgdir"/usr/share/john
+	mkdir -p "$subpkgdir"/usr/share/$pkgname
+	cd "$builddir"/run
+	for f in ${files}; do
+		install -Dm${perm} ${f} "$subpkgdir"/usr/share/john
 	done
 }
 
@@ -171,16 +125,13 @@ zshcomp() {
 		"$subpkgdir"/usr/share/zsh/site-functions/$pkgname || return 1
 }
 
-md5sums="2e80ec877e78d0c6ce72febb8844e0e2  john-1.8.0.tar.gz
-e6e158d946783b14e1109bd96d54bb64  truecrypt_fmt_plug.patch
-d6ab104062b9ce84b172ad7ecdd08226  params-h.patch
-b1f6ab678caabf4d3adb253735f46def  gcc5-support.patch
-b20aa081f750286be0c9664f5853dbfc  libressl.patch"
-sha256sums="95bbd3ecfbe51c6263317b3009bede98f20689a26c7aee191458ed9b26d5c9f6  john-1.8.0.tar.gz
-91731241b644dc8cf64d55260801277b168dcd38c5585c10120c75393f0c35fa  truecrypt_fmt_plug.patch
-2b2396bf9e344bb28fcf91088d5dc12b0c91de3da74a4241d32c44496a291851  params-h.patch
-7abd8b061055f7c81de8cadc021050ac113f0f71a0bcfb83680f10d8ca6e04df  gcc5-support.patch
-d02ce505b7f01f3b415aa7d42b73da289bf73277c1d1e0e4933ea266c10ae777  libressl.patch"
+jumbo() {
+	pkgdesc="$pkgdesc (jumbo pack)"
+	depends="$pkgname-scripts-py $pkgname-scripts-perl
+		$pkgname-scripts-ruby $pkgname-misc"
+	mkdir "$subpkgdir"
+}
+
 sha512sums="8b7fad7a6330b5ff1afc306218ba698aaa27776b566f82c2e76102d5ceb10aeafa69d71fa6fff67c81996ea2c6a04384bab4696ed192306c6d074873562e7089  john-1.8.0.tar.gz
 80be6cc1b1b35c6a85392008638b2f8b6d8a518ee35f59405e2f5682e025e4b8beecf964148311e6f62d76b59153f04427024fa81aaf56ee2062ac2dbf0a9bcb  truecrypt_fmt_plug.patch
 a5c22feb8bf11509c306a2f236f2bd4891fdfc3b01882f07d85015e0895d82f28df0dff78ba8d3a3862d8d95877a88a9eb8138e6c407b40881fa1455079b98fc  params-h.patch
-- 
2.11.1

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---

---

From: Leonardo Arena <[email-masked]>
Date: Thu, 02 Mar 2017 10:16:25 +0100

Hi,

thank you for your contribution!

>  community/john/APKBUILD | 147 ++++++++++++++++--------------------

Committed.

Please remember to bump pkgrel whenever you touch the APKBUILD and
pkgver is not increased.

Thank you!

|_eo