Upgrade youtube-dl to version 2021.04.21
[sunny256-utils.git] / Makefile
blobb45350445bc239b7dfbc633de4427b18927e6f76
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-to-gitlab
40 push-to-gitlab:
41 git branch | grep 'tmp-gitlab' && exit 1 || true
42 git fetch gitlab
43 for rev in $$(git sht --reverse gitlab/master..master); do \
44 echo; \
45 GIT_PAGER=cat \
46 git log -1 --format="$(T_GREEN)%h$(T_RESET) %s" $$rev \
47 && echo git branch tmp-gitlab $$rev \
48 && git branch tmp-gitlab $$rev \
49 && echo git branch synced/tmp-gitlab $$rev \
50 && git branch synced/tmp-gitlab $$rev \
51 && echo git push gitlab \
52 tmp-gitlab:master synced/tmp-gitlab:synced/master \
53 && git push gitlab \
54 tmp-gitlab:master synced/tmp-gitlab:synced/master \
55 && echo git branch -D tmp-gitlab synced/tmp-gitlab \
56 && git branch -D tmp-gitlab synced/tmp-gitlab \
57 && if git sht gitlab/master..master | grep -q ^; then \
58 printf '%s sleep 60...' $$(date +%H:%M:%S); \
59 sleep 60; \
60 echo ok; \
61 fi \
62 || exit 1; \
63 done
64 git pa -s
65 git push gitlab
67 .PHONY: remotes
68 remotes:
69 git remote add \
70 sunbase sunny@git.sunbase.org:/home/sunny/Git/utils.git; true
71 git remote add \
72 bellmann sunny@bellmann:/home/sunny/repos/Git/utils.git; true
73 git remote add bitbucket git@bitbucket.org:sunny256/utils.git; true
74 git remote add gitlab git@gitlab.com:sunny256/utils.git; true
75 git remote add \
76 repoorcz ssh://sunny256@repo.or.cz/srv/git/sunny256-utils.git; true
78 .PHONY: test
79 test:
80 test ! -e synced.sql.lock
81 # FIXME: synced.sql is modified in Gitlab CI, disable it for now
82 if test "$(GITLAB_CI)" != "true"; then \
83 test -z "$$(filesynced --valid-sha 2>&1)"; \
85 test "$$(git log | grep -- -by: | sort -u | wc -l)" = "2"
86 cd tests && $(MAKE) test
87 cd Lib && $(MAKE) test
88 cd src && $(MAKE) test
89 cd Git && $(MAKE) test
91 .PHONY: test-clean
92 test-clean:
93 $(MAKE) fullclean
94 git status --porcelain --ignored | grep ^ && exit 1 || true
96 .PHONY: testport
97 testport:
98 cd tests && $(MAKE) testport
99 cd Lib && $(MAKE) testport
100 cd src && $(MAKE) testport
101 cd Git && $(MAKE) testport
103 .PHONY: unmerged
104 unmerged:
105 git log --graph --date-order --format=fuller -p --decorate=short \
106 $$(git br -a --contains firstrev --no-merged | git nocom) \
107 ^master
109 .PHONY: update-synced
110 update-synced:
111 test ! -e .update-synced_token.tmp
112 test ! -e synced.sql.lock
113 filesynced --lock >.update-synced_token.tmp
114 git ls-files | while read f; do \
115 if test -f "$$f" -a ! -h "$$f" ; then \
116 echo "INSERT INTO synced (file) VALUES ('$$f');"; \
117 fi; \
118 done | sqlite3 synced.sqlite 2>/dev/null || true
119 echo "SELECT file FROM synced ORDER BY file;" | \
120 sqlite3 synced.sqlite | while read f; do \
121 if test ! -f "$$f"; then \
122 echo "DELETE FROM synced WHERE file = '$$f';"; \
123 echo "DELETE FROM todo WHERE file = '$$f';"; \
124 fi; \
125 done | sqlite3 synced.sqlite
126 filesynced --unlock $$(cat .update-synced_token.tmp)
127 rm -f .update-synced_token.tmp
129 .PHONY: valgrind
130 valgrind:
131 cd Git && $(MAKE) valgrind