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.

125 lines
3.6KB

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