<commit_before>BUILDCACHE=$(shell /bin/pwd)/buildcache

tests: test1 test2 test3 test4

test1:
	rm -fr cache data output.bak
	mkdir -p output data
	cp -f /etc/motd data
	BUILDCACHE_CACHEDIR=./cache/test1 \
	BUILDCACHE_OUTPUTDIR=./output \
	$(BUILDCACHE) sort data/motd -o output/dmot
	mv output output.bak
	BUILDCACHE_CACHEDIR=./cache/test1 \
	BUILDCACHE_OUTPUTDIR=./output \
	$(BUILDCACHE) sort data/motd -o output/dmot
	diff -urN output.bak output
	find cache

## verify that BUILDCACHE_OUTPUTDIR is not needed
test2:
	rm -fr test2dir data
	mkdir -p test2dir/output data
	cp -f /etc/motd data
	cd test2dir; \
	BUILDCACHE_CACHEDIR=./cache/test2 \
	$(BUILDCACHE) sort ../data/motd -o output/dmot; \
	mv output output.bak; \
	BUILDCACHE_CACHEDIR=./cache/test2 \
	$(BUILDCACHE) sort ../data/motd -o output/dmot; \
	diff -urN output.bak output

## make sure it works even if a file is written and removed
test3:
	rm -fr test3dir data
	mkdir -p test3dir/output data
	cp -f /etc/motd data
	cd test3dir; \
	BUILDCACHE_CACHEDIR=./cache/test3 \
	$(BUILDCACHE) ../test3.sh ../data/motd output/dmot; \
	mv output output.bak; \
	BUILDCACHE_CACHEDIR=./cache/test3 \
	$(BUILDCACHE) ../test3.sh ../data/motd output/dmot; \
	diff -urN output.bak output

## make sure it works even if BUILDCACHE_CACHEDIR is unset
test4:
	rm -fr test4dir data
	mkdir -p test4dir/output data
	cp -f /etc/motd data
	cd test4dir; \
	unset BUILDCACHE_CACHEDIR; \
	$(BUILDCACHE) sort ../data/motd -o output/dmot
	diff -urN output.bak output


all:
	true

INSTALL_DIRS = buildcache

install:
	install -d -m755 $(DESTDIR)/usr/share/buildcache
	install -m755 buildcache $(DESTDIR)/usr/share/buildcache/buildcache

VERSION=16.02.1

dpkg:
	git buildpackage --git-ignore-new --git-upstream-branch=master --git-debian-branch=ubuntu/trusty -tc<commit_msg>version 18.05.1<commit_after>BUILDCACHE=$(shell /bin/pwd)/buildcache

tests: test1 test2 test3 test4

test1:
	rm -fr cache data output.bak
	mkdir -p output data
	cp -f /etc/motd data
	BUILDCACHE_CACHEDIR=./cache/test1 \
	BUILDCACHE_OUTPUTDIR=./output \
	$(BUILDCACHE) sort data/motd -o output/dmot
	mv output output.bak
	BUILDCACHE_CACHEDIR=./cache/test1 \
	BUILDCACHE_OUTPUTDIR=./output \
	$(BUILDCACHE) sort data/motd -o output/dmot
	diff -urN output.bak output
	find cache

## verify that BUILDCACHE_OUTPUTDIR is not needed
test2:
	rm -fr test2dir data
	mkdir -p test2dir/output data
	cp -f /etc/motd data
	cd test2dir; \
	BUILDCACHE_CACHEDIR=./cache/test2 \
	$(BUILDCACHE) sort ../data/motd -o output/dmot; \
	mv output output.bak; \
	BUILDCACHE_CACHEDIR=./cache/test2 \
	$(BUILDCACHE) sort ../data/motd -o output/dmot; \
	diff -urN output.bak output

## make sure it works even if a file is written and removed
test3:
	rm -fr test3dir data
	mkdir -p test3dir/output data
	cp -f /etc/motd data
	cd test3dir; \
	BUILDCACHE_CACHEDIR=./cache/test3 \
	$(BUILDCACHE) ../test3.sh ../data/motd output/dmot; \
	mv output output.bak; \
	BUILDCACHE_CACHEDIR=./cache/test3 \
	$(BUILDCACHE) ../test3.sh ../data/motd output/dmot; \
	diff -urN output.bak output

## make sure it works even if BUILDCACHE_CACHEDIR is unset
test4:
	rm -fr test4dir data
	mkdir -p test4dir/output data
	cp -f /etc/motd data
	cd test4dir; \
	unset BUILDCACHE_CACHEDIR; \
	$(BUILDCACHE) sort ../data/motd -o output/dmot
	diff -urN output.bak output


all:
	true

INSTALL_DIRS = buildcache

install:
	install -d -m755 $(DESTDIR)/usr/share/buildcache
	install -m755 buildcache $(DESTDIR)/usr/share/buildcache/buildcache

VERSION=18.05.1

dpkg:
	git buildpackage --git-ignore-new --git-upstream-branch=master --git-debian-branch=ubuntu/trusty -tc
{'fraction_non_alphanumeric': 0.11988950276243093, 'fraction_numerical': 0.021270718232044197, 'mean_word_length': 3.4484029484029484, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5535484', 'n_tokens_mistral': 1483, 'n_tokens_neox': 1505, 'n_words': 368}