You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

128 line
3.7KB

  1. #! /bin/bash
  2. set -o errexit # exit on first error
  3. set -o nounset # report undefined variables
  4. set +o xtrace # debugging
  5. PACKAGE="tufte-latex"
  6. CLASS_FILES="tufte-handout.cls tufte-book.cls"
  7. DEF_FILES="tufte-common.def"
  8. BST_FILES="tufte-common.def"
  9. SOURCE_FILES="sample-handout.pdf sample-handout.tex sample-handout.bib sample-book.pdf sample-book.tex"
  10. if test $# -ne 1 ; then echo "Usage: $0 3.5.2 (version number)" ; exit 1 ; fi
  11. VERSION=$1
  12. DATE=$(date +"%Y/%m/%d")
  13. if ! echo $VERSION | egrep -q "^[0-9]+\.[0-9]+\.[0-9]+$" ; then
  14. echo "Error: version argument should be of the form 1.2.5 (major.minor.revision)."
  15. exit 1
  16. fi
  17. # TODO: instead of all this checking, just sed values into the appropriate files
  18. for class_file in $CLASS_FILES ; do
  19. if ! grep -q $VERSION $class_file -o ! grep -q $DATE $class_file ; then
  20. echo "Error: '$VERSION' and '$DATE' do not match that in $class_file:"
  21. grep -H ProvidesClass $class_file
  22. exit 1
  23. fi
  24. done
  25. for aux_file in $DEF_FILES ; do
  26. if ! grep -q $VERSION $aux_file -o ! grep -q $DATE $aux_file ; then
  27. echo "Error: '$VERSION' and '$DATE' do not match that in $aux_file"
  28. grep -H ProvidesFile $aux_file
  29. exit 1
  30. fi
  31. done
  32. VERSION_DATE="$VERSION - $DATE"
  33. if ! grep -q "$VERSION_DATE" History.txt ; then
  34. echo "Error: no release notes for '$VERSION_DATE' found in History.txt"
  35. exit 1
  36. fi
  37. # Refresh sample documents
  38. echo "Building sample-handout ..."
  39. pdflatex sample-handout > refresh-sample.log
  40. bibtex sample-handout >> refresh-sample.log
  41. pdflatex sample-handout >> refresh-sample.log
  42. pdflatex sample-handout >> refresh-sample.log
  43. rm -f sample-handout.{aux,blg,bbl,log,out} refresh-sample.log
  44. echo "Success"
  45. echo "Building sample-book ..."
  46. pdflatex sample-book > refresh-book.log
  47. bibtex sample-book >> refresh-book.log
  48. texindy --language english sample-book.idx >> refresh-book.log
  49. pdflatex sample-book >> refresh-book.log
  50. pdflatex sample-book >> refresh-book.log
  51. rm -f sample-book.{aux,blg,bbl,idx,ind,lof,log,lot,out,toc} refresh-book.log
  52. echo "Success"
  53. # To ease Google Code upload, make a distinct version of samples:
  54. cp sample-handout.pdf sample-handout-$VERSION.pdf
  55. cp sample-book.pdf sample-book-$VERSION.pdf
  56. # Make bundle for Google Code release
  57. echo "Creating zip bundle for Google Code release ..."
  58. mkdir -p pkg/$PACKAGE-$VERSION
  59. tar -cf - $(cat Manifest.txt) | tar -C pkg/$PACKAGE-$VERSION -xf -
  60. ( cd pkg && zip -rq $PACKAGE-$VERSION.zip $PACKAGE-$VERSION )
  61. echo "Complete"
  62. # Make bundle for CTAN release
  63. TDS_DIR=pkg/$PACKAGE/tds/
  64. TDS_TEX_DIR=$TDS_DIR/tex/latex/$PACKAGE/
  65. TDS_DOC_DIR=$TDS_DIR/doc/latex/$PACKAGE/
  66. TDS_SRC_DIR=$TDS_DIR/source/latex/$PACKAGE/
  67. echo "Creating zip bundle for CTAN release ..."
  68. mkdir -p $TDS_DIR $TDS_TEX_DIR $TDS_DOC_DIR $TDS_SRC_DIR
  69. cp $CLASS_FILES $DEF_FILES $BST_FILES $TDS_TEX_DIR/
  70. cp History.txt README.txt sample-handout.{pdf,tex,bib} sample-book.{pdf,tex} $TDS_DOC_DIR/
  71. mkdir $TDS_DOC_DIR/graphics
  72. cp graphics/* $TDS_DOC_DIR/graphics/
  73. cp $CLASS_FILES $DEF_FILES $BST_FILES $SOURCE_FILES $TDS_SRC_DIR/
  74. ( cd $TDS_DIR && zip -rq ../../$PACKAGE-$VERSION/$PACKAGE.tds.zip * )
  75. rm -fr pkg/$PACKAGE
  76. mv pkg/$PACKAGE-$VERSION pkg/$PACKAGE
  77. ( cd pkg && zip -rq $PACKAGE.zip $PACKAGE )
  78. echo "Complete"
  79. # TODO: test release (unpack and build sample-*.tex files)
  80. # Remove our temporary files
  81. rm -rf pkg/$PACKAGE
  82. # Provide some cut-n-paste material for manual steps:
  83. cat << MESSAGE
  84. `openssl dgst -sha1 pkg/$PACKAGE-$VERSION.zip`
  85. Don't forget to create an SVN tag (after committing changes),
  86. svn cp -m'To tag release $VERSION.' \\
  87. https://$PACKAGE.googlecode.com/svn/trunk \\
  88. https://$PACKAGE.googlecode.com/svn/tags/rel_$VERSION
  89. And upload the zip file:
  90. http://code.google.com/p/$PACKAGE/downloads/list
  91. http://ctan.org/upload
  92. MESSAGE