-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMakefile
90 lines (71 loc) · 3.04 KB
/
Makefile
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
#
# Makefile for sysadmin tasks associated with johan's ripe-atlas-dns-tools
# The RIPE Atlas packages required at least version 3.6 of python
PYTHON3 = python3
# The directory to install the scripts in
INSTALL_DIR = ${HOME}/ripe-atlas-dns-tool
# If you want a python venv, this is where it will be created:
PYTHON_VENV_DIR = ${INSTALL_DIR}/py-venv
# Sometimes this might need to be just "pip"
PIP = pip3
TEST_DATA_DIR = ./Test-Data
help:
mdcat README.md || cat README.md
# A wrapper script to run the real ra-dns-check.py within a python venv
ra-dns-check.sh: ra-dns-check.sh.template
sed "s?__INSTALL_DIR__?$(INSTALL_DIR)? ; s?__PYTHON_VENV_DIR__?$(PYTHON_VENV_DIR)?" $? > ra-dns-check.sh
# Dependencies that the script needs, including the RIPE Atlas pkgs.
install-pydeps:
$(PIP) install -r requirements.txt || echo "If you saw an error about Rust and SSL, you might need to do: $(PIP) install --upgrade pip"
install: ra-dns-check.py
mkdir -p $(INSTALL_DIR)
install -m 555 ra-dns-check.py $(INSTALL_DIR)
@echo " "
@echo "ra-dns-check.py was installed in: $(INSTALL_DIR)/"
@echo " "
@echo "To install the python dependencies choose ONE of:"
@echo " A) make venv -- then run ra-dns-check.sh which uses the python venv)"
@echo " B) make install-pydeps -- no python venv, so you use ra-dns-check.py directly"
# Create a python venv
venv: requirements.txt ra-dns-check.sh
mkdir -p $(INSTALL_DIR)
install -m 555 ra-dns-check.sh $(INSTALL_DIR)
./python-venv-create.sh $(PYTHON3) $(PYTHON_VENV_DIR)
# Cleanup stuff make generates locally
clean:
rm ra-dns-check.sh
# re-generate the default config file
config-file:
./ra-dns-check.py --config_file ./default_config_file \
$(TEST_DATA_DIR)/RIPE-Atlas-measurement-29083406.json \
$(TEST_DATA_DIR)/RIPE-Atlas-measurement-29096558.json >/dev/null 2>&1
# Run sample with INFO level output
debug-info:
# ./ra-dns-check.py --log_level INFO --datetime1 20210101 --datetime2 20210301 12016241
./ra-dns-check.py --log_level INFO \
$(TEST_DATA_DIR)/RIPE-Atlas-measurement-29083406.json \
$(TEST_DATA_DIR)/RIPE-Atlas-measurement-29096558.json
# Run sample with DEBUG level output
debug-debug:
./ra-dns-check.py --log_level DEBUG \
$(TEST_DATA_DIR)/RIPE-Atlas-measurement-29083406.json \
$(TEST_DATA_DIR)/RIPE-Atlas-measurement-29096558.json
# Sample run with default config file
sample:
./ra-dns-check.py --config_file ./default_config_file \
$(TEST_DATA_DIR)/RIPE-Atlas-measurement-29083406.json \
$(TEST_DATA_DIR)/RIPE-Atlas-measurement-29096558.json
# Sample run without default config file. (Will use config file in $HOME, if it exists.)
sample-myconfig:
./ra-dns-check.py \
$(TEST_DATA_DIR)/RIPE-Atlas-measurement-29083406.json \
$(TEST_DATA_DIR)/RIPE-Atlas-measurement-29096558.json
# run the output tests
tests:
./output_tests.sh -t $(TEST_DATA_DIR)
# Regenerate the data used to run the output tests by pulling down new data from RIPE
tests-benchmark:
./output_tests.sh -t $(TEST_DATA_DIR) -B
# Remove everything the python venv directory that was createrd with "make venv"
wipe-venv:
rm -fr $(INSTALL_DIR)/py-venv