Skip to content

Commit be99123

Browse files
committed
update build system
1 parent 0daac4b commit be99123

File tree

13 files changed

+44
-333
lines changed

13 files changed

+44
-333
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ __pycache__
55
.cache
66
.directory
77
.idea
8+
hooks

Makefile

Lines changed: 41 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,42 @@
11
#
2-
export TOX_SCENARIO ?= default
3-
export TOX_ANSIBLE ?= ansible_8.5
4-
5-
.PHONY: converge destroy verify test lint gh-clean
6-
7-
default: converge
8-
9-
converge:
10-
@hooks/converge
11-
12-
destroy:
13-
@hooks/destroy
14-
15-
verify:
16-
@hooks/verify
17-
18-
test:
19-
@hooks/test
20-
21-
lint:
22-
@hooks/lint
23-
24-
gh-clean:
25-
@hooks/gh-clean
2+
export TOX_SCENARIO ?= default
3+
export TOX_ANSIBLE ?= ansible_9.5
4+
export TOX_SILENCE ?= true
5+
# --------------------------------------------------------
6+
7+
LANG := C.UTF-8
8+
TEMP_REPO_URL := http://git.boone-schulz.de/ansible/ansible-hooks.git
9+
TEMP_REPO_PATH := roles/hooks
10+
TARGET_DIR := hooks
11+
CACHE_DIR := $(HOME)/.cache/ansible/ansible-hooks
12+
13+
# --------------------------------------------------------
14+
15+
# Alle Targets, die schlicht ein Skript in hooks/ aufrufen
16+
HOOKS := doc prepare converge destroy verify test lint gh-clean
17+
TARGET_DIR := hooks
18+
19+
.SILENT: hooks-ready
20+
.PHONY: $(HOOKS)
21+
.ONESHELL:
22+
.DEFAULT_GOAL := converge
23+
24+
$(HOOKS): | hooks-ready
25+
@hooks/$@
26+
27+
hooks-ready:
28+
@if [ ! -d "$(TARGET_DIR)" ] || [ -z "$$(ls -A '$(TARGET_DIR)' 2>/dev/null)" ]; then
29+
$(MAKE) --no-print-directory fetch-hooks >/dev/null;
30+
fi
31+
32+
fetch-hooks:
33+
@if [ -d "$(CACHE_DIR)/.git" ]; then
34+
git -C "$(CACHE_DIR)" fetch --depth=1 --prune origin
35+
def=$$(git -C "$(CACHE_DIR)" remote show origin | awk '/HEAD branch/ {print "origin/"$$NF}')
36+
git -C "$(CACHE_DIR)" reset --hard "$$def"
37+
else
38+
mkdir -p "$(dir $(CACHE_DIR))"
39+
GIT_TERMINAL_PROMPT=0 git clone --depth 1 "$(TEMP_REPO_URL)" "$(CACHE_DIR)"
40+
fi
41+
@mkdir -p "$(TARGET_DIR)"
42+
@rsync -a --delete "$(CACHE_DIR)/$(TEMP_REPO_PATH)/" "$(TARGET_DIR)/"

hooks/converge

Lines changed: 0 additions & 3 deletions
This file was deleted.

hooks/destroy

Lines changed: 0 additions & 3 deletions
This file was deleted.

hooks/gh-clean

Lines changed: 0 additions & 12 deletions
This file was deleted.

hooks/gh-clean.py

Lines changed: 0 additions & 156 deletions
This file was deleted.

hooks/lint

Lines changed: 0 additions & 3 deletions
This file was deleted.

hooks/molecule.rc

Lines changed: 0 additions & 74 deletions
This file was deleted.

hooks/test

Lines changed: 0 additions & 3 deletions
This file was deleted.

hooks/tox.sh

Lines changed: 0 additions & 52 deletions
This file was deleted.

0 commit comments

Comments
 (0)