git-check.am 4.43 KB
Newer Older
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# git-check.am
#
# Copyright (C) 2019 Vivien Kraus <vivien@planete-kraus.eu>
# 
#  This program is free software: you can redistribute it and/or
#  modify it under the terms of the GNU General Public License as
#  published by the Free Software Foundation, either version 3 of the
#  License, or (at your option) any later version.
# 
#  This program is distributed in the hope that it will be useful, but
#  WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
#  General Public License for more details.
# 
#  You should have received a copy of the GNU General Public License
#  along with this program.  If not, see
#  <http://www.gnu.org/licenses/>.

.PHONY: git-check

git_clone_verbose = $(git_clone_verbose_@AM_V@)
git_clone_verbose_ = $(git_clone_verbose_@AM_DEFAULT_V@)
git_clone_verbose_0 = @echo "  GIT CLONE";

git-check:
	@$(MKDIR_P) .gitcheck ; chmod -R u+w .gitcheck
	@rm -rf .gitcheck
	$(MKDIR_P) .gitcheck
	$(git_clone_verbose) $(GIT) clone $(srcdir) .gitcheck/clean/
	$(git_clone_verbose) $(GIT) clone $(srcdir) .gitcheck/source/
	$(MKDIR_P) .gitcheck/build
	(cd .gitcheck/source && ./autogen.sh)
	(cd .gitcheck/build && ../../.gitcheck/source/configure VALAFLAGS="--target-glib=2.50")
	$(MAKE) $(AM_MAKEFLAGS) -C .gitcheck/build safe
	$(MAKE) $(AM_MAKEFLAGS) -C .gitcheck/build check distcheck
	$(MAKE) $(AM_MAKEFLAGS) -C .gitcheck/build indent
	$(MAKE) $(AM_MAKEFLAGS) distdir
	(cd .gitcheck/clean \
	  && for source in $$(find . -type f) ; \
	do \
	  case $$source in \
	    *.md) \
	      >&2 echo "Ignoring Markdown file $$source (because org markdown exporter is not reproducible)";; \
	    */.git/*);; \
	    *.po) \
	      if test $$($(DIFF) $$source ../../.gitcheck/source/$$source | wc -l) -eq '4' ; \
	      then \
	        >&2 echo "$$source: OK" ; \
	      else \
	        $(DIFF) $$source ../../.gitcheck/source/$$source ; \
	        >&2 echo "Error: $$source is checked in, but overwritten by a substantial bit.  Maybe you should update the po files." ; \
	        exit 1; \
	      fi;; \
	    *) \
	      if $(DIFF) $$source ../../.gitcheck/source/$$source ; \
	      then \
	        >&2 echo "$$source: OK" ; \
	      else \
	        >&2 echo "Error: $$source is checked in, but overwritten.  Maybe it should not be checked in in the first place." ; \
	        exit 1; \
	      fi;; \
	  esac ; \
	done)
	@(cd .gitcheck/source ; \
	  if test "$$($(GIT) status --porcelain | grep '^??' | wc -l)" -eq "0"; \
	  then \
	    >&2 echo "Gitignore: OK"; \
	  else \
	    >&2 $(GIT) status ; \
	    >&2 echo "Please update the .gitignore." ; \
	    exit 1 ; \
	  fi)
	(cd .gitcheck/clean \
	  && for source in $$(find . -type f) ; \
	do \
	  case $$source in \
	    *.po | *.pot);; \
	    */.git/*);; \
	    *) \
	      if $(DIFF) $$source ../../$(top_distdir)/$$source ; \
	      then \
	        >&2 echo "$$source is distributed" ; \
	      else \
	        >&2 echo "Error: $$source is checked in, but not distributed.  Maybe it should not be checked in in the first place." ; \
	        exit 1 ; \
	      fi;; \
	   esac ; \
	done)
	$(MAKE) $(AM_MAKEFLAGS) -C .gitcheck/build maintainer-clean
	(cd .gitcheck/source \
	  && for source in $$(find . -type f) ; \
	do \
	  case $$source in \
	    ./po/en@quot.header | ./po/en@boldquot.header | ./po/Rules-quot | ./po/remove-potcdate.sin | ./po/boldquot.sed | ./po/quot.sed | ./po/insert-header.sin | ./po/Makefile.in.in | ./po/Makevars.template | ./po/tarot.pot) \
	      >&2 echo "Ignoring Gettext leftover $$source";; \
	    ./.tarball-version) \
	      >&2 echo "Ignoring the tarball version stamp $$source";; \
	    ./lib/* | ./snippet/* | ./git-version-gen | ./gitlog-to-changelog) \
	      >&2 echo "Ignoring Gnulib's $$source";; \
	    ./m4/*) \
	      >&2 echo "Ignoring autoconf's macro $$source";; \
	    ./compile | ./depcomp | ./config.rpath | ./config.sub | ./texinfo.tex | ./ar-lib | ./INSTALL | ./missing | ./test-driver | ./ltmain.sh | ./aclocal.m4 | ./ChangeLog | ./config.h.in | ./config.guess | ./Makefile.in | ./configure | ./install-sh | ./ABOUT-NLS) \
	      >&2 echo "Ignorign automake's $$source";; \
	    */.git/*);; \
	    *~);; \
	    *.po);; \
	    *) \
	      if $(DIFF) $$source ../../.gitcheck/clean/$$source ; \
	      then \
	        >&2 echo "$$source: OK" ; \
	      else \
	        >&2 echo "Error: $$source is a generated file, but not cleaned by make maintainer-clean." ; \
	        exit 1 ; \
	      fi;; \
	  esac ; \
	done)
	@rm -rf .gitcheck