git-push-to-gitlab: Don't create or push `synced/master`
[sunny256-utils.git] / Makefile
blobb15627ed5288f627c2ab1ac7fabcd2de824f267c
1 # oyvholm/utils/Makefile
2 # File ID: 455af534-fd45-11dd-a4b7-000475e441b9
3 # Author: Øyvind A. Holm <sunny@sunbase.org>
5 PYFILES =
6 PYFILES += git-expand
7 PYFILES += jsonfmt.py
8 PYFILES += line_exec.py
9 T_GREEN=$$(tput setaf 2)
10 T_RESET=$$(tput sgr0)
12 .PHONY: all
13 all:
14 cd Lib && $(MAKE)
15 cd src && $(MAKE)
16 cd Git && $(MAKE)
18 .PHONY: clean
19 clean:
20 rm -f synced.sqlite.*.bck *.pyc
21 cd tests && $(MAKE) clean
22 cd Lib && $(MAKE) clean
23 cd src && $(MAKE) clean
24 cd Git && $(MAKE) clean
25 find . -name .testadd.tmp -type d -print0 | xargs -0r rm -rf
27 .PHONY: format
28 format:
29 black -l 79 $(PYFILES)
30 cd Lib && $(MAKE) $@
32 .PHONY: fullclean
33 fullclean:
34 $(MAKE) clean
35 cd src && $(MAKE) fullclean
36 cd Git && $(MAKE) fullclean
38 .PHONY: lgd
39 lgd:
40 git lg --date-order $$(git branch -a | cut -c3- | \
41 grep -Ee 'remotes/(Spread|bitbucket|repoorcz|sunbase)/' | \
42 grep -v 'HEAD -> ') $$(git branch | cut -c3-)
44 .PHONY: obsolete
45 obsolete:
46 git delrembr $$(cat Div/obsolete-refs.txt); true
48 .PHONY: push
49 push:
50 git push-to-gitlab
51 git pa
53 .PHONY: remotes
54 remotes:
55 git remote add \
56 sunbase sunny@git.sunbase.org:/home/sunny/Git/utils.git; true
57 git remote add bitbucket git@bitbucket.org:sunny256/utils.git; true
58 git remote add gitlab git@gitlab.com:oyvholm/utils.git; true
59 git remote add \
60 repoorcz ssh://sunny256@repo.or.cz/srv/git/sunny256-utils.git; true
62 .PHONY: test
63 test:
64 test ! -e synced.sql.lock
65 # FIXME: synced.sql is modified in Gitlab CI, disable it for now
66 if test "$(GITLAB_CI)" != "true"; then \
67 test -z "$$(filesynced --valid-sha 2>&1)"; \
69 test "$$(git log | grep -- -by: | sort -u | wc -l)" = "2"
70 cd tests && $(MAKE) test
71 cd Lib && $(MAKE) test
72 cd src && $(MAKE) test
73 cd Git && $(MAKE) test
75 .PHONY: test-clean
76 test-clean:
77 $(MAKE) fullclean
78 git status --porcelain --ignored | grep ^ && exit 1 || true
80 .PHONY: testport
81 testport:
82 cd tests && $(MAKE) testport
83 cd Lib && $(MAKE) testport
84 cd src && $(MAKE) testport
85 cd Git && $(MAKE) testport
87 .PHONY: unmerged
88 unmerged:
89 git log --graph --date-order --format=fuller -p --decorate=short \
90 $$(git br -a --contains firstrev --no-merged | git nocom) \
91 ^master
93 .PHONY: update-synced
94 update-synced:
95 test ! -e .update-synced_token.tmp
96 test ! -e synced.sql.lock
97 filesynced --lock >.update-synced_token.tmp
98 git ls-files | while read f; do \
99 if test -f "$$f" -a ! -h "$$f" ; then \
100 echo "INSERT INTO synced (file) VALUES ('$$f');"; \
101 fi; \
102 done | sqlite3 synced.sqlite 2>/dev/null || true
103 echo "SELECT file FROM synced ORDER BY file;" | \
104 sqlite3 synced.sqlite | while read f; do \
105 if test ! -f "$$f"; then \
106 echo "DELETE FROM synced WHERE file = '$$f';"; \
107 echo "DELETE FROM todo WHERE file = '$$f';"; \
108 fi; \
109 done | sqlite3 synced.sqlite
110 filesynced --unlock $$(cat .update-synced_token.tmp)
111 rm -f .update-synced_token.tmp
113 .PHONY: valgrind
114 valgrind:
115 cd Git && $(MAKE) valgrind