aboutsummarylogtreecommitdiffstats
path: root/Makefile
blob: 497f6826ef1cd731f2c09a2bb225944451aceab5 (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
PKG=pkg/p7zip-natspec
PKGINFO=$(PKG)/.PKGINFO
CI_IMAGE=buzztaiki/pkgbuild-p7zip-natspec-buildenv

.PHONY: all clean test check_upstream _test lint ci_test

all: lint $(PKGINFO) test .SRCINFO

.SRCINFO: PKGBUILD
	makepkg --printsrcinfo > .SRCINFO

$(PKGINFO): PKGBUILD
	makepkg -f

testfiles/:
	git archive --prefix $@ origin/testfiles | tar xf -

clean:
	rm -rf testfiles src pkg *.pkg.tar.*

check_upstream:
	./check_upstream

test: $(PKGINFO) testfiles/
	$(MAKE) -s _test LANG=ja_JP.UTF-8 TESTFILE=testfiles/SHIFT_JIS.zip PATTERN="解凍すると文字化けするかも.txt"
	$(MAKE) -s _test LANG=ja_JP.UTF-8 TESTFILE=testfiles/UTF8.zip PATTERN="UTF-8固有文字列_( ◕‿‿◕ ).txt"

_test: 
	$(PKG)/usr/lib/p7zip/7z l $(TESTFILE) | grep -qe "$(PATTERN)" && echo ok

lint:
	namcap PKGBUILD

ci_test:
	git fetch --depth=1 origin testfiles:remotes/origin/testfiles
	docker pull $(CI_IMAGE)
	docker run --rm -it -u travis -v $(CURDIR):/mnt $(CI_IMAGE) make lint test