summaryrefslogtreecommitdiff
path: root/t/txinfo-no-extra-dist.sh
blob: 3844d7d86f181a752240c66bfc67149d971d6de5 (plain)
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
#! /bin/sh
# Copyright (C) 1996-2017 Free Software Foundation, Inc.
#
# 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 2, 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 <https://www.gnu.org/licenses/>.

# Test to ensure that a ".info~" or ".info.bak" file doesn't end up
# in the distribution or the installation.  Bug report from Greg McGary.
# Also make sure that "split" info files (today no longer supported,
# see automake bug#13351) are not distributed nor installed.  See
# automake bug#12320.

. test-init.sh

cat >> configure.ac << 'END'
AC_OUTPUT
END

cat > Makefile.am << 'END'
info_TEXINFOS = textutils.texi subdir/main.texi

test-dist: distdir
	test -f $(distdir)/textutils.info
	test -f $(distdir)/subdir/main.info
	@echo DISTFILES = $(DISTFILES)
	@case '$(DISTFILES)' in \
           *'~'*|*'.bak'*|*'.info-'*|*.i[0-9]*) exit 1;; \
           *) exit 0;; \
         esac
	@st=0; \
	 find $(distdir) | grep '~' && st=1; \
	 find $(distdir) | grep '\.bak' && st=1; \
	 find $(distdir) | grep '\.info-' && st=1; \
	 find $(distdir) | grep '\.i[0-9]' && st=1; \
	 exit $$st

test-inst: install
	test -f '$(infodir)/textutils.info'
	test -f '$(infodir)/main.info'
	@st=0; \
	 find '$(prefix)' | grep '~' && st=1; \
	 find '$(prefix)' | grep '\.bak' && st=1; \
	 find '$(prefix)' | grep '\.info-' && st=1; \
	 find '$(prefix)' | grep '\.i[0-9]' && st=1; \
	 exit $$st

PHONY: test-dist test-inst
END

: > texinfo.tex
mkdir subdir
echo '@setfilename textutils.info' > textutils.texi
echo '@setfilename main.info' > subdir/main.texi

$ACLOCAL
$AUTOCONF
$AUTOMAKE

./configure --prefix="$(pwd)/_inst"
info_suffixes='info info-0 info-1 info-2 i00 i01 i23 info.bak info~'
for suf in $info_suffixes; do
  for base in textutils subdir/main; do
    : > $base.$suf
  done
done
ls -l . subdir # For debugging.
$MAKE test-dist
$MAKE test-inst
$MAKE maintainer-clean

for suf in $info_suffixes; do
  for base in textutils subdir/main; do
    if test "$suf" = info; then
      test ! -e $base.$suf
    else
      test -f $base.$suf
    fi
  done
done

: