| 1 |
VERSION=0.24 |
| 2 |
|
| 3 |
BIN_OPT:= \ |
| 4 |
create-graph.native \ |
| 5 |
print-stats.native \ |
| 6 |
bin2src.native \ |
| 7 |
src2bin.native \ |
| 8 |
build-fixpoint.native \ |
| 9 |
clean-repository.native \ |
| 10 |
buildgraph2srcgraph.native \ |
| 11 |
annotate-strong.native \ |
| 12 |
partial-order.native \ |
| 13 |
find-fvs.native \ |
| 14 |
collapse-srcgraph.native \ |
| 15 |
optuniv.native \ |
| 16 |
calculate-fas.native \ |
| 17 |
buildcheck-more-problems.native \ |
| 18 |
distcheck-more-problems.native |
| 19 |
|
| 20 |
BIN_BYTE:=$(patsubst %.native, %.byte, $(BIN_OPT)) |
| 21 |
BIN_DEBUG:=$(patsubst %.native, %.d.byte, $(BIN_OPT)) |
| 22 |
BIN_PROF:=$(patsubst %.native, %.p.native, $(BIN_OPT)) |
| 23 |
|
| 24 |
BIN_PYTOOLS:=$(patsubst tools/%.py, %, $(filter-out tools/util.py tools/debarch.py,$(wildcard tools/*.py))) |
| 25 |
BIN_OCTOOLS:=$(patsubst %.native, %, $(BIN_OPT)) |
| 26 |
BIN_SHTOOLS:=$(patsubst tools/%.sh, %, $(wildcard tools/*.sh)) |
| 27 |
|
| 28 |
BIN_TOOLS:=$(BIN_PYTOOLS) $(BIN_OCTOOLS) $(BIN_SHTOOLS) |
| 29 |
MANPAGES:=$(patsubst %, doc/man/botch-%.1, $(BIN_TOOLS)) |
| 30 |
|
| 31 |
OCAMLBUILD_BEST ?= $(if $(wildcard /usr/bin/ocamlopt),native,byte) |
| 32 |
|
| 33 |
PWD := $(shell pwd) |
| 34 |
BUILD = $(PWD)/dose/_build |
| 35 |
DOSELIBS = $(PWD)/dose/_build/dose3 |
| 36 |
CUDFLIBS = $(PWD)/dose/_build/cudf |
| 37 |
DOSEBYTELIBS = \ |
| 38 |
_build/doselibs/common.cma \ |
| 39 |
_build/doselibs/debian.cma \ |
| 40 |
_build/doselibs/versioning.cma \ |
| 41 |
_build/doselibs/csw.cma \ |
| 42 |
_build/doselibs/pef.cma \ |
| 43 |
_build/doselibs/algo.cma \ |
| 44 |
_build/doselibs/doseparse.cma \ |
| 45 |
_build/doselibs/doseparseNoRpm.cma |
| 46 |
# we turn on all warnings but turn off: |
| 47 |
# 4 Fragile pattern matching: matching that will remain complete even if additional constructors are added to one of the variant types matched. |
| 48 |
# 9 Missing fields in a record pattern. |
| 49 |
# 24 Bad module name: the source file name is not a valid OCaml module name. |
| 50 |
CFLAGS=-cflags "-w +a-4-9-24" |
| 51 |
bindir=/usr/bin |
| 52 |
datadir=/usr/share/botch |
| 53 |
mandir=/usr/share/man |
| 54 |
|
| 55 |
# we have to export PYTHONHASHSEED because otherwise networkx will create |
| 56 |
# content with random output order |
| 57 |
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=749710 |
| 58 |
# https://github.com/networkx/networkx/issues/1181 |
| 59 |
# on the other hand, the generated hashes are not the same on 32 vs 64 arches |
| 60 |
# http://bugs.python.org/issue22621 |
| 61 |
# http://bugs.debian.org/778373 |
| 62 |
export PYTHONHASHSEED=0 |
| 63 |
# to make the sort order in the tests locale independent |
| 64 |
export LC_COLLATE=C.UTF-8 |
| 65 |
export LC_ALL=C.UTF-8 |
| 66 |
# because dose2html outputs utf8 on standard output |
| 67 |
export PYTHONIOENCODING=utf-8 |
| 68 |
|
| 69 |
.PHONY: all |
| 70 |
all: $(OCAMLBUILD_BEST) wiki man |
| 71 |
|
| 72 |
.PHONY: native |
| 73 |
native: atdgen |
| 74 |
OCAMLPATH=$(BUILD) ocamlbuild -lflags -runtime-variant,_pic -classic-display -use-ocamlfind $(CFLAGS) $(BIN_OPT) |
| 75 |
|
| 76 |
.PHONY: byte |
| 77 |
byte: atdgen |
| 78 |
OCAMLPATH=$(BUILD) ocamlbuild -classic-display -use-ocamlfind $(CFLAGS) $(BIN_BYTE) |
| 79 |
|
| 80 |
.PHONY: debug |
| 81 |
debug: atdgen |
| 82 |
OCAMLPATH=$(BUILD) ocamlbuild -classic-display -use-ocamlfind $(CFLAGS) $(BIN_DEBUG) |
| 83 |
|
| 84 |
# profiling for use of native executables with gprof |
| 85 |
.PHONY: profile |
| 86 |
profile: atdgen |
| 87 |
OCAMLPATH=$(BUILD) ocamlbuild -classic-display -use-ocamlfind $(CFLAGS) $(BIN_PROF) |
| 88 |
|
| 89 |
doc/man/botch.1: $(MANPAGES) |
| 90 |
./doc/man/generate-botch-manpage.py | pod2man --section 1 --center="botch tools" --name botch > $@ |
| 91 |
|
| 92 |
.PHONY: man |
| 93 |
man: $(MANPAGES) doc/man/botch.1 |
| 94 |
|
| 95 |
.PHONY: wiki |
| 96 |
wiki: |
| 97 |
$(MAKE) -C doc/wiki |
| 98 |
|
| 99 |
doc/man/%.1: doc/man/%.pod |
| 100 |
pod2man --section 1 --center="botch tools" $< > $@ |
| 101 |
|
| 102 |
.PHONY: doselib |
| 103 |
doselib: |
| 104 |
(cd dose && ./configure --with-zip --with-bz2 && make clean libs $(DOSEBYTELIBS)) |
| 105 |
rm -Rf $(DOSELIBS) |
| 106 |
mkdir -p $(DOSELIBS) |
| 107 |
cp dose/META $(DOSELIBS) |
| 108 |
for i in \ |
| 109 |
dose/_build/*/common.* \ |
| 110 |
dose/_build/*/versioning.* \ |
| 111 |
dose/_build/*/debian.* \ |
| 112 |
dose/_build/*/algo.* \ |
| 113 |
dose/_build/*/csw.* \ |
| 114 |
dose/_build/*/pef.* \ |
| 115 |
dose/_build/*/doseparseNoRpm.* \ |
| 116 |
dose/_build/*/doseparse.*; do \ |
| 117 |
if [ -e $$i ]; then \ |
| 118 |
cp $$i $(DOSELIBS) ; \ |
| 119 |
rm -f $(DOSELIBS)/*.mlpack $(DOSELIBS)/*.cmx ; \ |
| 120 |
fi ; \ |
| 121 |
done |
| 122 |
rm -Rf $(CUDFLIBS) |
| 123 |
mkdir -p $(CUDFLIBS) |
| 124 |
cp dose/cudf/META $(CUDFLIBS) |
| 125 |
cp dose/_build/doselibs/cudf*.cmi $(CUDFLIBS) |
| 126 |
for i in dose/_build/doselibs/cudf.*; do \ |
| 127 |
if [ -e $$i ]; then \ |
| 128 |
cp $$i $(CUDFLIBS) ; \ |
| 129 |
rm -f $(CUDFLIBS)/*.mlpack $(CUDFLIBS)/*.cmx ; \ |
| 130 |
fi ; \ |
| 131 |
done |
| 132 |
|
| 133 |
%_j.ml: %.atd |
| 134 |
atdgen -j -j-std $< |
| 135 |
|
| 136 |
%_t.ml: %.atd |
| 137 |
atdgen -t $< |
| 138 |
|
| 139 |
.PHONY: atdgen |
| 140 |
atdgen: datatypes_j.ml datatypes_t.ml |
| 141 |
|
| 142 |
# the "while : ; do" loop around graph-difference is a temporary fix to work |
| 143 |
# around random segmentation faults. See http://bugs.python.org/issue24605 |
| 144 |
define diff_tmp_out |
| 145 |
for t in tmp out; do \ |
| 146 |
for f in tests/$(1)/$$t/* $$t/*; do basename "$$f"; done | sort | uniq | while read f; do \ |
| 147 |
echo checking $$f; \ |
| 148 |
case "$$f" in \ |
| 149 |
*.xml|*.dot) \ |
| 150 |
echo "+ ./tools/graph-difference.py \"tests/$(1)/$$t/$$f\" \"$$t/$$f\""; \ |
| 151 |
while : ; do ./tools/graph-difference.py "tests/$(1)/$$t/$$f" "$$t/$$f"; exit=$$?; if [ $$exit -eq 139 ]; then echo segfault; continue; fi; if [ $$exit -ne 0 ]; then exit 1; else break; fi; done;; \ |
| 152 |
*) \ |
| 153 |
echo "+ diff -u \"tests/$(1)/$$t/$$f\" \"$$t/$$f\""; \ |
| 154 |
cmp --silent "tests/$(1)/$$t/$$f" "$$t/$$f" || { diff -u "tests/$(1)/$$t/$$f" "$$t/$$f" | head --lines 100 && exit 1; };; \ |
| 155 |
esac; \ |
| 156 |
done; \ |
| 157 |
done |
| 158 |
endef |
| 159 |
|
| 160 |
.PHONY: test-misc |
| 161 |
test-misc: $(OCAMLBUILD_BEST) |
| 162 |
rm -rf tmp out |
| 163 |
mkdir -p tmp out |
| 164 |
$(eval packages := tests/sid-amd64-packages-20160830T000000Z) |
| 165 |
$(eval sources := tests/sid-sources-20160830T000000Z) |
| 166 |
grep-dctrl --exact-match --field Package build-essential $(packages) \ |
| 167 |
| ./tools/latest-version.py - - > tmp/build-essential |
| 168 |
./bin2src.$(OCAMLBUILD_BEST) --deb-native-arch=amd64 tmp/build-essential $(sources) \ |
| 169 |
> tmp/build-essential-src |
| 170 |
./create-graph.$(OCAMLBUILD_BEST) --deb-native-arch=amd64 --bg $(sources) $(packages) tmp/build-essential-src \ |
| 171 |
> tmp/selfcontained_repo.xml |
| 172 |
./tools/buildgraph2packages.py tmp/selfcontained_repo.xml $(packages) \ |
| 173 |
> tmp/packages |
| 174 |
./bin2src.$(OCAMLBUILD_BEST) --deb-native-arch=amd64 tmp/packages $(sources) \ |
| 175 |
> tmp/sources |
| 176 |
# test botch-calcportsmetric |
| 177 |
./create-graph.$(OCAMLBUILD_BEST) --deb-drop-b-d-indep --deb-native-arch=amd64 tmp/packages tmp/sources --strongtype > tmp/strongbuildgraph.xml |
| 178 |
./buildgraph2srcgraph.$(OCAMLBUILD_BEST) tmp/strongbuildgraph.xml --deb-drop-b-d-indep --deb-native-arch=amd64 tmp/packages tmp/sources > tmp/strongsrcgraph.xml |
| 179 |
./create-graph.$(OCAMLBUILD_BEST) --deb-drop-b-d-indep --deb-native-arch=amd64 tmp/packages tmp/sources --closuretype > tmp/closurebuildgraph.xml |
| 180 |
./buildgraph2srcgraph.$(OCAMLBUILD_BEST) tmp/closurebuildgraph.xml --deb-drop-b-d-indep --deb-native-arch=amd64 tmp/packages tmp/sources > tmp/closuresrcgraph.xml |
| 181 |
./tools/calcportsmetric.py tmp/strongsrcgraph.xml tmp/closuresrcgraph.xml > out/importance_metric.txt |
| 182 |
# test botch-multiarch-interpreter-problem |
| 183 |
dose-ceve --deb-drop-b-d-indep --deb-native-arch=amd64 -G pkg -T grml deb://tmp/packages debsrc://tmp/sources > tmp/ma_interpreter.xml |
| 184 |
./tools/multiarch-interpreter-problem.py --packages tmp/packages tmp/ma_interpreter.xml > out/ma_interpreter.txt |
| 185 |
# test y-u-b-d-transitive-essential |
| 186 |
./tools/y-u-b-d-transitive-essential.sh --debug --verbose --develop --tmp tmp --output out amd64 tmp/packages tmp/sources acl |
| 187 |
# remove svg because graphviz changes its output format slightly every other version |
| 188 |
rm out/acl_2.2.52-3_n20.svg |
| 189 |
# test botch-buildcheck-more-problems |
| 190 |
./buildcheck-more-problems.$(OCAMLBUILD_BEST) --verbose --progress --checkonly=plasma-desktop,haskell-hledger-ui --deb-native-arch=amd64 --explain --failures $(packages) $(sources) > out/buildcheck.yaml || [ $$? -eq 1 ] |
| 191 |
# test botch-buildcheck-more-problems cross because we want to be able |
| 192 |
# to check yaml output that contains a depchain with an implicit |
| 193 |
# dependency on a package that is Essential:yes (and thus there is no |
| 194 |
# "depends" field) |
| 195 |
./tools/convert-arch.py amd64 armhf tmp/packages - | grep-dctrl -X \( --not -FArchitecture all --and --not -FMulti-Arch foreign \) > tmp/packages_armhf_noall_nomaforeign |
| 196 |
./buildcheck-more-problems.$(OCAMLBUILD_BEST) --verbose --progress --checkonly=apache2,ant --deb-native-arch=amd64 --deb-host-arch=armhf --explain --failures tmp/packages_armhf_noall_nomaforeign tests/crossbuild-essential-armhf tmp/packages tmp/sources > out/buildcheck_cross.yaml || [ $$? -eq 1 ] |
| 197 |
# test botch-distcheck-more-problems |
| 198 |
./distcheck-more-problems.$(OCAMLBUILD_BEST) --verbose --progress --checkonly=task-kde-desktop:amd64,libghc-hledger-dev:amd64 --deb-native-arch=amd64 --explain --failures deb://$(packages) > out/distcheck.yaml || [ $$? -eq 1 ] |
| 199 |
# test dose2html |
| 200 |
./tools/dose2html.py --srcsdir=out --wwwroot=out/ --packages=$(packages) out/distcheck.yaml out/distcheck.html |
| 201 |
./tools/dose2html.py --srcsdir=out --wwwroot=out/ --packages=$(packages) out/buildcheck.yaml out/buildcheck.html |
| 202 |
./tools/dose2html.py --srcsdir=out --wwwroot=out/ --packages=tmp/packages_armhf_noall_nomaforeign --packages=tests/crossbuild-essential-armhf --packages=tmp/packages out/buildcheck_cross.yaml out/buildcheck_cross.html |
| 203 |
# test networkx dot read/write because there constantly seem to be |
| 204 |
# problems with that: |
| 205 |
# - endless loop for graphs with attributes in pygraphviz |
| 206 |
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=794444 |
| 207 |
# https://github.com/pygraphviz/pygraphviz/issues/65 |
| 208 |
# - pygraphviz cannot handle graph attributes |
| 209 |
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=819739 |
| 210 |
# - networkx cannot store graph in dot format where a node name contains a colon |
| 211 |
# https://github.com/networkx/networkx/issues/2050 |
| 212 |
# - python3 support |
| 213 |
# https://github.com/erocarrera/pydot/issues/76 |
| 214 |
# - dead pydot upstream and too many forks |
| 215 |
# https://github.com/carlos-jenkins/pydotplus/issues/1 |
| 216 |
# - exclusive use of non-packaged pydotplus fork by networkx |
| 217 |
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=819480 |
| 218 |
# - undeterministic output order |
| 219 |
# https://github.com/networkx/networkx/issues/1181 |
| 220 |
# https://github.com/networkx/networkx/issues/1267 |
| 221 |
# - unicode encode/decode problems |
| 222 |
# https://github.com/erocarrera/pydot/issues/24 |
| 223 |
# - networkx API breakages: removal of nx.write_dot and nx.read_dot |
| 224 |
# http://networkx.readthedocs.io/en/stable/reference/api_1.11.html |
| 225 |
# - pygraphviz API breakages: AGraph dropped the file parameter |
| 226 |
# https://github.com/pygraphviz/pygraphviz/commit/21d9153c25ff5d8047c46f48f043f0788ab10da5 |
| 227 |
# - pygraphviz segfauls when reading from a io.StringIO |
| 228 |
# https://github.com/pygraphviz/pygraphviz/issues/101 |
| 229 |
# - pygraphviz adds the input filename as a graph attribute |
| 230 |
# https://github.com/pygraphviz/pygraphviz/issues/102 |
| 231 |
# - networkx doesn't parse dot data from memory |
| 232 |
# https://github.com/networkx/networkx/issues/2249 |
| 233 |
dose-ceve --deb-drop-b-d-indep -c "src:acl" --deb-native-arch=amd64 -G pkg -T dot deb://tmp/packages debsrc://tmp/sources > tmp/aclbd.dot |
| 234 |
./tools/graph-shortest-path.py tmp/aclbd.dot --all --source __ID__:"src:acl (= 2.2.52-3)" --target __ID__:"multiarch-support:amd64 (= 2.23-5)" > out/acl-ma-path.dot |
| 235 |
./tools/graph-ancestors.py --target __ID__:"perl:amd64 (= 5.22.2-3)" tmp/aclbd.dot > out/acl_pred.dot |
| 236 |
./tools/graph-descendants.py --source __ID__:"perl:amd64 (= 5.22.2-3)" tmp/aclbd.dot > out/acl_succ.dot |
| 237 |
./tools/graph-neighborhood.py --depth=2 --center __ID__:"perl:amd64 (= 5.22.2-3)" tmp/aclbd.dot > out/acl_neighbors.dot |
| 238 |
# test y-u-no-bootstrap |
| 239 |
# Remove yui-compressor to make src:doxygen bd-uninstallable |
| 240 |
grep-dctrl --not --field Package yui-compressor tmp/packages > tmp/packages_noyui |
| 241 |
./tools/y-u-no-bootstrap.sh --debug --verbose --develop --tmp tmp --output out amd64 tmp/packages_noyui tmp/sources |
| 242 |
# remove svg because graphviz changes its output format slightly every other version |
| 243 |
rm out/doxygen_1.8.11-3.svg |
| 244 |
# verify results |
| 245 |
$(call diff_tmp_out,misc) |
| 246 |
|
| 247 |
.PHONY: test-default |
| 248 |
test-default: $(OCAMLBUILD_BEST) |
| 249 |
rm -rf tmp out |
| 250 |
./tools/native.sh --debug --verbose --develop --output out --tmp tmp --deb-drop-b-d-indep amd64 tests/sid-amd64-packages-20160830T000000Z tests/sid-sources-20160830T000000Z |
| 251 |
$(call diff_tmp_out,default) |
| 252 |
|
| 253 |
.PHONY: test-selfcontained |
| 254 |
test-selfcontained: $(OCAMLBUILD_BEST) |
| 255 |
rm -rf tmp out |
| 256 |
./tools/native.sh --debug --verbose --develop --output out --tmp tmp --deb-drop-b-d-indep --optgraph --latest --clean --self-contained --optuniv --sapsb --strong --no-drop amd64 tests/sid-amd64-packages-20160830T000000Z tests/sid-sources-20160830T000000Z |
| 257 |
$(call diff_tmp_out,selfcontained) |
| 258 |
|
| 259 |
.PHONY: test-cross |
| 260 |
test-cross: $(OCAMLBUILD_BEST) |
| 261 |
rm -rf tmp out |
| 262 |
mkdir out |
| 263 |
cp tests/cross-ma.diff out/ma.diff |
| 264 |
./tools/cross.sh --debug --verbose --develop --output=out --tmp=tmp --deb-drop-b-d-indep --optgraph amd64 armhf tests/sid-amd64-packages-20160830T000000Z tests/sid-sources-20160830T000000Z |
| 265 |
$(call diff_tmp_out,cross) |
| 266 |
|
| 267 |
.PHONY: test-man |
| 268 |
test-man: $(OCAMLBUILD_BEST) |
| 269 |
# test whether there is no manpage without a program by |
| 270 |
# normalizing program and manpage names and only printing |
| 271 |
# those names which are not duplicate but unique |
| 272 |
ls tools/*.py *.$(OCAMLBUILD_BEST) tools/*.sh doc/man/botch-*.pod \ |
| 273 |
| grep -v tools/util.py \ |
| 274 |
| grep -v tools/debarch.py \ |
| 275 |
| while read pkg; do \ |
| 276 |
pkg=`basename $$pkg .$(OCAMLBUILD_BEST)`; \ |
| 277 |
pkg=`basename $$pkg .py`; \ |
| 278 |
pkg=`basename $$pkg .sh`; \ |
| 279 |
pkg=`basename $$pkg .pod`; \ |
| 280 |
echo $${pkg#botch-}; \ |
| 281 |
done | sort | uniq -u | while read pkg; do \ |
| 282 |
echo doc/man/botch-$${pkg}.pod is superfluous >&2; \ |
| 283 |
exit 1; \ |
| 284 |
done |
| 285 |
# check that every pod file includes a synopsis and a description |
| 286 |
# section and that the synopsis includes the right program name |
| 287 |
for f in doc/man/*.pod; do \ |
| 288 |
grep -q '^=head1 SYNOPSIS$$' "$$f"; \ |
| 289 |
grep -q '^=head1 DESCRIPTION$$' "$$f"; \ |
| 290 |
name=$$(basename "$$f" .pod); \ |
| 291 |
ret=0; \ |
| 292 |
awk '/^=head1 SYNOPSIS$$/{flag=1;next}/^=head1 DESCRIPTION$$/{flag=0}flag' \ |
| 293 |
"$$f" | grep -q '^=item B<'"$$name"'> ' || ret=1; \ |
| 294 |
if [ $$ret -ne 0 ]; then \ |
| 295 |
echo "wrong synopsis in $$f" >&2; \ |
| 296 |
exit 1; \ |
| 297 |
fi; \ |
| 298 |
done |
| 299 |
# now that we know that there is one man page for every program, check |
| 300 |
# whether the man page documents all the program options |
| 301 |
ls tools/*.py *.$(OCAMLBUILD_BEST) tools/*.sh \ |
| 302 |
| grep -v tools/util.py \ |
| 303 |
| grep -v tools/debarch.py \ |
| 304 |
| grep -v buildcheck-more-problems | grep -v distcheck-more-problems \ |
| 305 |
| while read pkg; do \ |
| 306 |
shortopts=`./$$pkg --help 2>&1 | sed -ne 's/^ \+-\([^ =-]\).*$$/\1/p' | sort`; \ |
| 307 |
longopts=`./$$pkg --help 2>&1 | sed -ne 's/^ \+\(-[^ =-]\+,\)\? --\([^ =]\+\)\([ =].*\)\?$$/\2/p' | sort`; \ |
| 308 |
echo "compare \`./$$pkg --help\` with man page..."; \ |
| 309 |
man=`basename $$pkg .$(OCAMLBUILD_BEST)`; \ |
| 310 |
man=`basename $$man .py`; \ |
| 311 |
man=`basename $$man .sh`; \ |
| 312 |
man=`basename $$man .pod`; \ |
| 313 |
longman=`sed -ne 's/=item B<[^>]*--\([^>=]\+\)=\?>.*$$/\1/p' doc/man/botch-$${man}.pod | sort`; \ |
| 314 |
shortman=`sed -ne 's/=item B<-\([^>,-]\)[^>]*>.*$$/\1/p' doc/man/botch-$${man}.pod | sort`; \ |
| 315 |
if [ "$$shortopts" != "$$shortman" ]; then \ |
| 316 |
echo "\`./$$pkg --help\` and man page ./$$man disagree:"; \ |
| 317 |
echo "$$shortopts != $$shortman"; \ |
| 318 |
exit 1; \ |
| 319 |
fi; \ |
| 320 |
if [ "$$longopts" != "$$longman" ]; then \ |
| 321 |
echo "\`./$$pkg --help\` and man page ./$$man disagree:"; \ |
| 322 |
echo "$$longopts != $$longman"; \ |
| 323 |
exit 1; \ |
| 324 |
fi; \ |
| 325 |
done |
| 326 |
|
| 327 |
.PHONY: test-python |
| 328 |
test-python: |
| 329 |
# FIXME: add more tests |
| 330 |
#./tests.py |
| 331 |
#OCAMLPATH=$(BUILD) ocamlbuild -classic-display -use-ocamlfind $(CFLAGS) tests.$(OCAMLBUILD_BEST) |
| 332 |
#./tests.$(OCAMLBUILD_BEST) |
| 333 |
pyflakes3 tools/*.py |
| 334 |
# E402 is triggered by the sys.path.append() statement in front of import of utils |
| 335 |
# see https://github.com/PyCQA/pycodestyle/issues/264 |
| 336 |
# W503 is not PEP8 compliant |
| 337 |
# E203 is not PEP8 compliant |
| 338 |
pycodestyle --max-line-length=88 --ignore=E402,E203,W503 tools/*.py |
| 339 |
black --check tools/*.py |
| 340 |
|
| 341 |
.PHONY: test |
| 342 |
test: test-python test-man test-default test-selfcontained test-cross test-misc |
| 343 |
|
| 344 |
.PHONY: install-man |
| 345 |
install-man: man |
| 346 |
mkdir -p $(DESTDIR)$(mandir)/man1/ |
| 347 |
cp $(MANPAGES) $(DESTDIR)$(mandir)/man1/ |
| 348 |
cp doc/man/botch.1 $(DESTDIR)$(mandir)/man1/ |
| 349 |
|
| 350 |
.PHONY: install-wiki |
| 351 |
install-wiki: wiki |
| 352 |
$(MAKE) -C doc/wiki install |
| 353 |
|
| 354 |
.PHONY: install-bin |
| 355 |
install-bin: $(OCAMLBUILD_BEST) |
| 356 |
mkdir -p $(DESTDIR)$(bindir) |
| 357 |
for octool in $(BIN_OCTOOLS); do \ |
| 358 |
cp _build/$$octool.$(OCAMLBUILD_BEST) $(DESTDIR)$(bindir)/botch-$$octool; \ |
| 359 |
done |
| 360 |
for shtool in $(BIN_SHTOOLS); do \ |
| 361 |
cp tools/$$shtool.sh $(DESTDIR)$(bindir)/botch-$$shtool; \ |
| 362 |
done |
| 363 |
for pytool in $(BIN_PYTOOLS); do \ |
| 364 |
cp tools/$$pytool.py $(DESTDIR)$(bindir)/botch-$$pytool; \ |
| 365 |
done |
| 366 |
mkdir -p $(DESTDIR)$(datadir) |
| 367 |
cp -r droppable $(DESTDIR)$(datadir) |
| 368 |
cp tools/util.py $(DESTDIR)$(datadir) |
| 369 |
cp tools/debarch.py $(DESTDIR)$(datadir) |
| 370 |
|
| 371 |
.PHONY: install |
| 372 |
install: install-bin install-man install-wiki |
| 373 |
|
| 374 |
.PHONY: clean |
| 375 |
clean: |
| 376 |
ocamlbuild -clean |
| 377 |
rm -f datatypes_j.ml datatypes_j.mli datatypes.ml datatypes.mli datatypes_t.ml datatypes_t.mli |
| 378 |
rm -f tools/*.pyc |
| 379 |
rm -f *.native *.byte *.p.native *.d.byte |
| 380 |
rm -f doc/man/*.1 |
| 381 |
$(MAKE) -C doc/wiki clean |
| 382 |
|
| 383 |
.PHONY: distclean |
| 384 |
distclean: clean |
| 385 |
rm -rf tools/__pycache__ tmp out |
| 386 |
|
| 387 |
.PHONY: doseclean |
| 388 |
doseclean: |
| 389 |
(cd dose && ocamlbuild -clean) |
| 390 |
|
| 391 |
.PHONY: tarball |
| 392 |
tarball: |
| 393 |
$(eval tmpdir := $(shell mktemp --directory)) |
| 394 |
git archive --worktree-attributes --prefix=botch-$(VERSION)/ -o $(tmpdir)/botch-$(VERSION).tar HEAD |
| 395 |
git -C doc/wiki archive --worktree-attributes --prefix=botch-$(VERSION)/doc/wiki/ -o $(tmpdir)/botch-doc.tar HEAD |
| 396 |
git -C tests archive --worktree-attributes --prefix=botch-$(VERSION)/tests/ -o $(tmpdir)/botch-tests.tar HEAD |
| 397 |
# tar --concatenate seems to only take two files as input so we can |
| 398 |
# neither replace the temporary files with a pipe nor combine both of |
| 399 |
# the below commands into one... :( |
| 400 |
tar --concatenate -f $(tmpdir)/botch-$(VERSION).tar $(tmpdir)/botch-doc.tar |
| 401 |
tar --concatenate -f $(tmpdir)/botch-$(VERSION).tar $(tmpdir)/botch-tests.tar |
| 402 |
# testing shows that in this case, -9e compresses better than -9 |
| 403 |
xz --verbose -c9e $(tmpdir)/botch-$(VERSION).tar > ../botch-$(VERSION).tar.xz |
| 404 |
rm -rf $(tmpdir) |
| 405 |
|
| 406 |
.PHONY: upload |
| 407 |
upload: tarball |
| 408 |
gpg -u 8FBD83E1 --armor --detach-sig ../botch-$(VERSION).tar.xz |
| 409 |
scp ../botch-$(VERSION).tar.xz.asc ../botch-$(VERSION).tar.xz mmfn:/var/www/botch/ |
| 410 |
ssh mmfn tree -s --noreport -P "botch-*.tar.xz*" -o /var/www/botch/index.html -v -L 1 -H "." -T "botch-releases" /var/www/botch/ |
| 411 |
|
| 412 |
# Behave like POSIX. In particular, if this target is mentioned then recipes |
| 413 |
# will be invoked as if the shell had been passed the -e flag: the first |
| 414 |
# failing command in a recipe will cause the recipe to fail immediately. |
| 415 |
.POSIX: |