This repository was archived by the owner on May 12, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
121 lines (93 loc) · 3.92 KB
/
Makefile
File metadata and controls
121 lines (93 loc) · 3.92 KB
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
SHELL := /bin/bash
PYTHON ?= python3
PYCOV := $(PYTHON) -mcoverage run --source apksigtool
PYCOVCLI := $(PYCOV) -a apksigtool/__init__.py
export PYTHONWARNINGS := default
.PHONY: all install test test-cli doctest coverage lint lint-extra clean cleanup
.PHONY: test-apks test-apks-apksigner test-apks-verify \
test-apks-verify-check-v1 test-apks-verify-v1 test-apks-parse \
test-apks-parse-v1 test-apks-parse-json test-apks-parse-json-v1 \
test-apks-clean-DESTRUCTIVE test-apks-clean-check-DESTRUCTIVE
all: # TODO: apksigtool.1
install:
$(PYTHON) -mpip install -e .
test: test-cli doctest lint lint-extra
test-cli:
# TODO
apksigtool --version
doctest:
# NB: uses test/apks/apks/*.apk
$(PYTHON) -m doctest apksigtool/__init__.py
coverage:
# NB: uses test/apks/apks/*.apk
mkdir -p .tmp
cp test/apks/apks/v3-only-with-stamp.apk .tmp/test.apk
$(PYCOV) -m doctest apksigtool/__init__.py
$(PYCOVCLI) verify --check-v1 test/apks/apks/golden-aligned-v1v2v3-out.apk
$(PYCOVCLI) verify-v1 test/apks/apks/golden-aligned-v1v2v3-out.apk
$(PYCOVCLI) parse --verbose test/apks/apks/golden-aligned-v1v2v3-out.apk >/dev/null
$(PYCOVCLI) parse-v1 --verbose test/apks/apks/golden-aligned-v1v2v3-out.apk >/dev/null
$(PYCOVCLI) parse --json test/apks/apks/golden-aligned-v1v2v3-out.apk >/dev/null
$(PYCOVCLI) parse-v1 --json test/apks/apks/golden-aligned-v1v2v3-out.apk >/dev/null
$(PYCOVCLI) clean .tmp/test.apk
$(PYTHON) -mcoverage html
$(PYTHON) -mcoverage report
test-apks: test-apks-apksigner test-apks-verify test-apks-verify-check-v1 \
test-apks-verify-v1 test-apks-parse test-apks-parse-v1 \
test-apks-parse-json test-apks-parse-json-v1
test-apks-apksigner:
cd test && diff -Naur test-apksigner.out <( ./test-apksigner.sh )
test-apks-verify:
cd test && diff -Naur test-verify.out <( ./test-verify.sh \
| grep -vF 'WARNING: verification is considered EXPERIMENTAL' )
test-apks-verify-check-v1:
cd test && diff -Naur test-verify-check-v1.out <( ./test-verify-check-v1.sh \
| grep -vF 'WARNING: verification is considered EXPERIMENTAL' )
test-apks-verify-v1:
cd test && diff -Naur test-verify-v1.out <( ./test-verify-v1.sh \
| grep -vF 'WARNING: verification is considered EXPERIMENTAL' )
test-apks-parse:
cd test && diff -Naur test-parse.out <( ./test-parse.sh \
| grep -vF 'WARNING: verification is considered EXPERIMENTAL' )
test-apks-parse-v1:
cd test && diff -Naur test-parse-v1.out <( ./test-parse-v1.sh \
| grep -vF 'WARNING: verification is considered EXPERIMENTAL' )
test-apks-parse-json:
cd test && diff -Naur test-parse-json.out <( ./test-parse-json.sh \
| grep -vF 'WARNING: verification is considered EXPERIMENTAL' )
test-apks-parse-json-v1:
cd test && diff -Naur test-parse-json-v1.out <( ./test-parse-json-v1.sh \
| grep -vF 'WARNING: verification is considered EXPERIMENTAL' )
test-apks-clean-DESTRUCTIVE:
# WARNING: modifies test/apks/apks/*.apk
cd test && diff -Naur test-clean.out <( ./test-clean.sh \
| grep -vF 'WARNING: verification is considered EXPERIMENTAL' )
test-apks-clean-check-DESTRUCTIVE:
# WARNING: modifies test/apks/apks/*.apk
cd test && diff -Naur test-clean-check.out <( ./test-clean-check.sh \
| grep -vF 'WARNING: verification is considered EXPERIMENTAL' )
lint:
flake8 apksigtool/__init__.py
pylint apksigtool/__init__.py
lint-extra:
# TODO
mypy --ignore-missing-imports apksigtool/__init__.py
clean: cleanup
rm -fr apksigtool.egg-info/
cleanup:
find -name '*~' -delete -print
rm -fr __pycache__/ .mypy_cache/
rm -fr build/ dist/
rm -fr .coverage htmlcov/
rm -fr apksigtool.1
rm -fr .tmp/
%.1: %.1.md
pandoc -s -t man -o $@ $<
.PHONY: _package _publish
_package:
SOURCE_DATE_EPOCH="$$( git log -1 --pretty=%ct )" \
$(PYTHON) setup.py sdist bdist_wheel
twine check dist/*
_publish: cleanup _package
read -r -p "Are you sure? "; \
[[ "$$REPLY" == [Yy]* ]] && twine upload dist/*