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.

158 lines
4.2KB

  1. #!/bin/bash
  2. PACKAGE="tufte-latex"
  3. CLASS_FILES="tufte-handout.cls tufte-book.cls"
  4. STYLE_FILES="tufte-common.def"
  5. SOURCE_FILES="sample-handout.pdf sample-handout.tex sample-handout.bib sample-book.pdf sample-book.tex"
  6. # Exit on first error:
  7. set -e
  8. # Verify prerequisites:
  9. if [ $# -ne 1 ]; then
  10. echo "Usage: $0 VERSION"
  11. exit 1
  12. fi
  13. DATE=`date +%Y/%m/%d` # (with slashes)
  14. VERSION=$1
  15. echo -n "Testing version number format..."
  16. if ! echo $VERSION | grep -E "^[0-9]+\.[0-9]+\.[0-9]+$"; then
  17. echo "VERSION should be of the form 1.2.5 (major.minor.revision)"
  18. exit 1
  19. fi
  20. echo "ok."
  21. for CLASS in $CLASS_FILES; do
  22. echo -n "Checking version number of $CLASS..."
  23. if ! grep -q $VERSION $CLASS; then
  24. echo "Error: version skew. '$VERSION' does not match that in $CLASS"
  25. grep -H ProvidesClass $CLASS
  26. exit 1
  27. fi
  28. echo "ok."
  29. echo -n "Checking date of $CLASS..."
  30. if ! grep -q $DATE $CLASS; then
  31. echo "Error: date skew. '$DATE' does not match that in $CLASS"
  32. grep -H ProvidesClass $CLASS
  33. exit 1
  34. fi
  35. echo "ok."
  36. done
  37. for STYLE in $STYLE_FILES; do
  38. echo -n "Checking version number of $STYLE..."
  39. if ! grep -q $VERSION $STYLE; then
  40. echo "Error: version skew. '$VERSION' does not match that in $STYLE"
  41. grep -H ProvidesPackage $STYLE
  42. exit 1
  43. fi
  44. echo "ok."
  45. echo -n "Checking date of $STYLE..."
  46. if ! grep -q $DATE $STYLE; then
  47. echo "Error: date skew. '$DATE' does not match that in $STYLE"
  48. grep -H ProvidesPackage $STYLE
  49. exit 1
  50. fi
  51. echo "ok."
  52. done
  53. echo -n "Checking for history notes..."
  54. HISTORY_DATE=`date +%Y-%m-%d` # (with dashes)
  55. if ! grep -q $VERSION History.txt; then
  56. echo "Error: no release notes for '$VERSION' found in History.txt"
  57. grep -H $VERSION History.txt
  58. exit 1
  59. fi
  60. if ! grep -q $HISTORY_DATE History.txt; then
  61. echo "Error: '$HISTORY_DATE' not found in History.txt"
  62. grep -H $HISTORY_DATE History.txt
  63. exit 1
  64. fi
  65. echo "ok."
  66. # Refresh sample documents
  67. echo -n "Building sample-handout..."
  68. pdflatex sample-handout > refresh-sample.log
  69. bibtex sample-handout >> refresh-sample.log
  70. pdflatex sample-handout >> refresh-sample.log
  71. pdflatex sample-handout >> refresh-sample.log
  72. rm -f sample-handout.{aux,log,out,blg,bbl} refresh-sample.log
  73. echo "done."
  74. echo -n "Building sample-book..."
  75. pdflatex sample-book > refresh-sample.log
  76. bibtex sample-book >> refresh-sample.log
  77. texindy --language english sample-book.idx >> refresh-sample.log
  78. pdflatex sample-book >> refresh-sample.log
  79. pdflatex sample-book >> refresh-sample.log
  80. rm -f sample-bok.{aux,log,out,blg,bbl,idx,ind,toc} refresh-sample.log
  81. echo "done."
  82. # To ease googlecode upload, make a distinct version of sample-handout:
  83. cp sample-handout.pdf sample-handout-$VERSION.pdf
  84. cp sample-book.pdf sample-book-$VERSION.pdf
  85. # Make bundle for Google Code release
  86. echo -n "Creating zip bundle for Google Code release..."
  87. mkdir -p pkg/$PACKAGE-$VERSION
  88. tar cf - `cat Manifest.txt` | ( cd pkg/$PACKAGE-$VERSION && tar xf - )
  89. ( cd pkg && zip -rq $PACKAGE-$VERSION.zip $PACKAGE-$VERSION )
  90. echo "done."
  91. # Make bundle for CTAN release
  92. TDS_DIR=pkg/$PACKAGE/tds/
  93. TDS_TEX_DIR=$TDS_DIR/tex/latex/$PACKAGE/
  94. TDS_DOC_DIR=$TDS_DIR/doc/latex/$PACKAGE/
  95. TDS_SRC_DIR=$TDS_DIR/source/latex/$PACKAGE/
  96. echo -n "Creating zip bundle for CTAN release..."
  97. mkdir -p $TDS_DIR $TDS_TEX_DIR $TDS_DOC_DIR $TDS_SRC_DIR
  98. cp $CLASS_FILES $STYLE_FILES $TDS_TEX_DIR/
  99. cp History.txt README.txt sample-handout.{pdf,tex,bib} sample-book.{pdf,tex} $TDS_DOC_DIR/
  100. mkdir $TDS_DOC_DIR/graphics
  101. cp graphics/* $TDS_DOC_DIR/graphics/
  102. cp $CLASS_FILES $STYLE_FILES $SOURCE_FILES $TDS_SRC_DIR/
  103. ( cd $TDS_DIR && zip -rq ../../$PACKAGE-$VERSION/$PACKAGE.tds.zip * )
  104. rm -fr pkg/$PACKAGE
  105. mv pkg/$PACKAGE-$VERSION pkg/$PACKAGE
  106. ( cd pkg && zip -rq $PACKAGE.zip $PACKAGE )
  107. echo "done."
  108. # Remove our temporary files
  109. rm -fr pkg/$PACKAGE
  110. # Provide some cut-n-paste material for manual steps:
  111. cat << MESSAGE
  112. `openssl dgst -sha1 pkg/$PACKAGE-$VERSION.zip`
  113. Don't forget to create an SVN tag (after committing changes),
  114. svn cp -m'To tag release $VERSION.' \\
  115. https://$PACKAGE.googlecode.com/svn/trunk \\
  116. https://$PACKAGE.googlecode.com/svn/tags/rel_$VERSION
  117. And upload the zip file,
  118. http://code.google.com/p/$PACKAGE/downloads/list
  119. http://ctan.org/upload
  120. MESSAGE