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 lines
3.7KB

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