subpkg4.sh 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #! /bin/sh
  2. # Copyright (C) 2006-2017 Free Software Foundation, Inc.
  3. #
  4. # This program is free software; you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation; either version 2, or (at your option)
  7. # any later version.
  8. #
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU General Public License
  15. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. # Test to ensure 'distdir' fixes the mode of files and directories
  17. # copied into '$(distdir)', even with sub-packages.
  18. . test-init.sh
  19. cat >Makefile.am <<'END'
  20. SUBDIRS = subpkg
  21. test-distdir-is-readable:
  22. bad_dirs=`find $(distdir) -type d ! -perm -755 -print`; \
  23. if test -n "$$bad_dirs"; then \
  24. echo "directories not permissive: $$bad_dirs" >&2; \
  25. exit 1; \
  26. fi
  27. bad_files=`find $(distdir) ! -type d ! -perm -444 -print`; \
  28. if test -n "$$bad_files"; then \
  29. echo "file not permissive: $$bad_files" >&2; \
  30. exit 1; \
  31. fi
  32. END
  33. cat >>configure.ac <<'END'
  34. AC_CONFIG_SUBDIRS([subpkg])
  35. AC_OUTPUT
  36. END
  37. mkdir subpkg subpkg/dir
  38. echo foobar >subpkg/foobar
  39. echo baz > subpkg/dir/baz
  40. chmod go-rwx subpkg/foobar subpkg/dir/baz subpkg/dir
  41. cat >subpkg/Makefile.am <<'END'
  42. EXTRA_DIST = foobar dir
  43. END
  44. cat >subpkg/configure.ac <<'END'
  45. AC_INIT([subpkg], [1.0])
  46. AM_INIT_AUTOMAKE
  47. AC_CONFIG_FILES([Makefile])
  48. AC_OUTPUT
  49. END
  50. $ACLOCAL
  51. $AUTOMAKE
  52. $AUTOCONF
  53. cd subpkg
  54. $ACLOCAL
  55. $AUTOMAKE
  56. $AUTOCONF
  57. cd ..
  58. ./configure
  59. $MAKE distdir
  60. $MAKE test-distdir-is-readable