disthook.sh 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. #! /bin/sh
  2. # Copyright (C) 2012-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. # Check that 'dist-hook' works. See automake bug#10878.
  17. . test-init.sh
  18. echo AC_OUTPUT >> configure.ac
  19. cat > Makefile.am <<'END'
  20. EXTRA_DIST = write execute removed doc
  21. removed:
  22. echo I will be deleted > $@
  23. DISTCLEANFILES = removed
  24. dist-hook:
  25. chmod u+w $(distdir)/write $(distdir)/doc
  26. chmod u+x $(distdir)/execute
  27. rm -f $(distdir)/removed
  28. rm -f $(distdir)/doc/HACKING
  29. rm -f $(distdir)/doc/RELEASE-DATE
  30. date > $(distdir)/doc/RELEASE-DATE
  31. echo all is ok > $(distdir)/write
  32. check-local:
  33. ls -l $(srcdir) $(srcdir)/doc
  34. test "`cat $(srcdir)/write`" = "all is ok"
  35. test -f $(srcdir)/doc/README
  36. test -f $(srcdir)/doc/RELEASE-DATE
  37. test ! -f $(srcdir)/removed
  38. test ! -r $(srcdir)/removed
  39. test ! -f $(srcdir)/doc/HACKING
  40. test ! -r $(srcdir)/doc/HACKING
  41. $(srcdir)/execute
  42. $(srcdir)/execute | grep 'I run successfully'
  43. ## Sanity check.
  44. echo ok > $(srcdir)/../distcheck-run
  45. END
  46. $ACLOCAL
  47. $AUTOMAKE
  48. $AUTOCONF
  49. ./configure
  50. mkdir doc
  51. : > doc/README
  52. : > doc/HACKING
  53. echo will be clobbered > write
  54. cat > execute <<'END'
  55. #!/bin/sh
  56. echo I run successfully
  57. END
  58. chmod a-w write
  59. chmod a-x execute
  60. $MAKE distdir
  61. ls -l $distdir $distdir/doc
  62. cd $distdir
  63. test "$(cat write)" = "all is ok"
  64. test ! -e removed
  65. test -f doc/README
  66. test -f doc/RELEASE-DATE
  67. test ! -e doc/HACING
  68. ./execute
  69. ./execute | grep 'I run successfully'
  70. cd ..
  71. $MAKE distcheck
  72. test -f distcheck-run
  73. :