yd: Use yt-dlp instead of youtube-dl
[sunny256-utils.git] / Makefile
blob201e3184cf96c6c13a58f2c84e5b05640334fd7d
1 # sunny256/utils.git/Makefile
2 # File ID: 455af534-fd45-11dd-a4b7-000475e441b9
3 # Author: Øyvind A. Holm <sunny@sunbase.org>
5 T_GREEN=$$(tput setaf 2)
6 T_RESET=$$(tput sgr0)
8 .PHONY: all
9 all:
10 cd Lib && $(MAKE)
11 cd src && $(MAKE)
12 cd Git && $(MAKE)
14 .PHONY: clean
15 clean:
16 rm -f synced.sqlite.*.bck *.pyc
17 cd tests && $(MAKE) clean
18 cd Lib && $(MAKE) clean
19 cd src && $(MAKE) clean
20 cd Git && $(MAKE) clean
21 find . -name .testadd.tmp -type d -print0 | xargs -0r rm -rf
23 .PHONY: fullclean
24 fullclean:
25 $(MAKE) clean
26 cd src && $(MAKE) fullclean
27 cd Git && $(MAKE) fullclean
29 .PHONY: lgd
30 lgd:
31 git lg --date-order $$(git branch -a | cut -c3- | \
32 grep -Ee 'remotes/(Spread|bitbucket|repoorcz|sunbase)/' | \
33 grep -v 'HEAD -> ') $$(git branch | cut -c3-)
35 .PHONY: obsolete
36 obsolete:
37 git delrembr $$(cat Div/obsolete-refs.txt); true
39 .PHONY: push
40 push:
41 $(MAKE) push-to-gitlab
42 git pa
44 .PHONY: push-to-gitlab
45 push-to-gitlab:
46 git branch | grep 'tmp-gitlab' && exit 1 || true
47 git fetch gitlab
48 for rev in $$(git sht --reverse gitlab/master..master); do \
49 echo; \
50 GIT_PAGER=cat \
51 git log -1 --format="$(T_GREEN)%h$(T_RESET) %s" $$rev \
52 && echo git branch tmp-gitlab $$rev \
53 && git branch tmp-gitlab $$rev \
54 && echo git branch synced/tmp-gitlab $$rev \
55 && git branch synced/tmp-gitlab $$rev \
56 && echo git push gitlab \
57 tmp-gitlab:master synced/tmp-gitlab:synced/master \
58 && git push gitlab \
59 tmp-gitlab:master synced/tmp-gitlab:synced/master \
60 && echo git branch -D tmp-gitlab synced/tmp-gitlab \
61 && git branch -D tmp-gitlab synced/tmp-gitlab \
62 && if git sht gitlab/master..master | grep -q ^; then \
63 printf '%s sleep 60...' $$(date +%H:%M:%S); \
64 sleep 60; \
65 echo ok; \
66 fi \
67 || exit 1; \
68 done
69 git pa -s
70 git push gitlab
72 .PHONY: remotes
73 remotes:
74 git remote add \
75 sunbase sunny@git.sunbase.org:/home/sunny/Git/utils.git; true
76 git remote add \
77 bellmann sunny@bellmann:/home/sunny/repos/Git/utils.git; true
78 git remote add bitbucket git@bitbucket.org:sunny256/utils.git; true
79 git remote add gitlab git@gitlab.com:sunny256/utils.git; true
80 git remote add \
81 repoorcz ssh://sunny256@repo.or.cz/srv/git/sunny256-utils.git; true
83 .PHONY: test
84 test:
85 test ! -e synced.sql.lock
86 # FIXME: synced.sql is modified in Gitlab CI, disable it for now
87 if test "$(GITLAB_CI)" != "true"; then \
88 test -z "$$(filesynced --valid-sha 2>&1)"; \
90 test "$$(git log | grep -- -by: | sort -u | wc -l)" = "2"
91 cd tests && $(MAKE) test
92 cd Lib && $(MAKE) test
93 cd src && $(MAKE) test
94 cd Git && $(MAKE) test
96 .PHONY: test-clean
97 test-clean:
98 $(MAKE) fullclean
99 git status --porcelain --ignored | grep ^ && exit 1 || true
101 .PHONY: testport
102 testport:
103 cd tests && $(MAKE) testport
104 cd Lib && $(MAKE) testport
105 cd src && $(MAKE) testport
106 cd Git && $(MAKE) testport
108 .PHONY: unmerged
109 unmerged:
110 git log --graph --date-order --format=fuller -p --decorate=short \
111 $$(git br -a --contains firstrev --no-merged | git nocom) \
112 ^master
114 .PHONY: update-synced
115 update-synced:
116 test ! -e .update-synced_token.tmp
117 test ! -e synced.sql.lock
118 filesynced --lock >.update-synced_token.tmp
119 git ls-files | while read f; do \
120 if test -f "$$f" -a ! -h "$$f" ; then \
121 echo "INSERT INTO synced (file) VALUES ('$$f');"; \
122 fi; \
123 done | sqlite3 synced.sqlite 2>/dev/null || true
124 echo "SELECT file FROM synced ORDER BY file;" | \
125 sqlite3 synced.sqlite | while read f; do \
126 if test ! -f "$$f"; then \
127 echo "DELETE FROM synced WHERE file = '$$f';"; \
128 echo "DELETE FROM todo WHERE file = '$$f';"; \
129 fi; \
130 done | sqlite3 synced.sqlite
131 filesynced --unlock $$(cat .update-synced_token.tmp)
132 rm -f .update-synced_token.tmp
134 .PHONY: valgrind
135 valgrind:
136 cd Git && $(MAKE) valgrind