summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: eaa7942cd18396fcf6947d98a8d8ea497eb501c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# Maintainer: Daniel Peukert <daniel@peukert.cc>
# Contributor: Michał Wojdyła < micwoj9292 at gmail dot com >
# Contributor: Thomas Heinemann <thomas@nipha.de>
# Contributor: Jean Lucas < jean at 4ray dot co>
pkgname='parsedmarc'
pkgver='8.18.1'
pkgrel='1'
pkgdesc='Python package and CLI for parsing aggregate and forensic DMARC reports'
arch=('any')
url="https://github.com/domainaware/$pkgname"
license=('Apache-2.0')
depends=('python' 'python-azure-core' 'python-azure-identity>=1.8.0' 'python-azure-monitor-ingestion>=1.0.0' 'python-boto3>=1.16.63' 'python-dateutil' 'python-dnspython>=2.0.0' 'python-elasticsearch7.13' 'python-elasticsearch-dsl7>=7.4.0' 'python-expiringdict>=1.1.4' 'python-geoip2>=3.0.0' 'python-google-api-python-client>=2.35.0' 'python-google-auth-oauthlib>=0.4.6' 'python-google-auth>=2.3.3' 'python-imapclient>=2.1.0' 'python-kafka-ng>=2.2.2' 'python-lxml>=4.4.0' 'mailparser' 'python-mailsuite' 'python-msgraph-core0.2>=0.2.2' 'python-opensearch>=2.4.2' 'python-publicsuffixlist>=0.10.0' 'python-pygelf>=0.4.2' 'python-requests>=2.22.0' 'python-tqdm>=4.31.1' 'python-urllib3>=1.25.7' 'python-xmltodict>=0.12.0')
makedepends=('python-build' 'python-hatchling>=1.27.0' 'python-installer' 'python-wheel')
checkdepends=('python-pytest')
optdepends=(
	'perl-email-outlook-message: Microsoft Outlook email parsing'
	'perl-email-address: Microsoft Outlook email parsing'
	'geoip2-database: for using an up-to-date IP to Country database'
)
source=(
	"$pkgname-$pkgver.tar.gz::$url/archive/$pkgver.tar.gz"
	'run-tests-offline.diff'
)
b2sums=('a869d7da09a317ff773dd53d91e5b9bf8708796327be2a58287e3c3315e5e3cd4ded1301df43a871748c22e79a60de3f1a03795cbed68e9e66891cba4ae93ec7'
        '72b3826cb1a61eb4004e4763aefd9996a0c28bee387a36ecd8d4837f1b33a265c1691ff0e11478d10ce30adeb49c277f24eb737067d6ca090bb9967e0895429d')

_sourcedirectory="$pkgname-$pkgver"

prepare() {
	cd "$srcdir/$_sourcedirectory/"

	# Force tests to run offline
	patch --forward -p1 < '../run-tests-offline.diff'
}

build() {
	cd "$srcdir/$_sourcedirectory/"
	python -m build --wheel --no-isolation
}

check() {
	cd "$srcdir/$_sourcedirectory/"

	# Run unit tests
	pytest 'tests.py' --full-trace

	# Create a config file for testing
	cat << EOF > 'test.ini'
[general]
save_aggregate = True
save_forensic = True
save_smtp_tls = True
debug = True
offline = True
EOF

	# Test sample reports
	python -B -m 'parsedmarc.cli' --config-file 'test.ini' --output 'test_aggregate/' 'samples/aggregate/'*
	python -B -m 'parsedmarc.cli' --config-file 'test.ini' --output 'test_extract_report/' 'samples/extract_report/'*
	python -B -m 'parsedmarc.cli' --config-file 'test.ini' --output 'test_forensic/' 'samples/forensic/'*
	python -B -m 'parsedmarc.cli' --config-file 'test.ini' --output 'test_smtp_tls/' 'samples/smtp_tls/'*
}

package() {
	cd "$srcdir/$_sourcedirectory/"
	python -m installer --destdir="$pkgdir" 'dist/'*'.whl'

	install -dm755 "$pkgdir/usr/share/doc/$pkgname/"
	install -Dm644 'README.md' "$pkgdir/usr/share/doc/$pkgname/README.md"
}