diff options
| author | wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2005-06-22 23:20:55 +0000 |
|---|---|---|
| committer | wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2005-06-22 23:20:55 +0000 |
| commit | ffbf41fb39b7b4e271d16c4c82392159860f8022 (patch) | |
| tree | b17e4ebddf681b53899025ba3241eaa04ddc7576 | |
| parent | b3cf872e6852aac05e9c8e270e6269232c65b990 (diff) | |
| download | docutils-ffbf41fb39b7b4e271d16c4c82392159860f8022.tar.gz | |
update sitemap only if something has changed
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@3561 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
| -rwxr-xr-x | sandbox/davidg/infrastructure/docutils-update | 81 |
1 files changed, 43 insertions, 38 deletions
diff --git a/sandbox/davidg/infrastructure/docutils-update b/sandbox/davidg/infrastructure/docutils-update index 32cdb4034..f1797e770 100755 --- a/sandbox/davidg/infrastructure/docutils-update +++ b/sandbox/davidg/infrastructure/docutils-update @@ -105,7 +105,7 @@ svn up --quiet # gather the materials cd $snapshotdir svn -q revert $project/$project/__init__.py -svn up --quiet +haschanges="`svn up | grep -v '^At revision '`" # update __version_details__ string version_details="snapshot `date --utc --iso`, r`svn info | grep ^Revision: | sed 's/^Revision: //'`" @@ -168,9 +168,11 @@ for htmlfile in `find .. -name '*.html'` ; do if [ "${base:0:4}" == "pep-" ] ; then test $feedback && echo "$txtfile (PEP)" || true python $lib/tools/rstpep2html.py --config=$dir/docutils.conf $txtfile $htmlfile + haschanges=1 else test $feedback && echo $txtfile || true python $lib/tools/rst2html.py --config=$dir/docutils.conf $txtfile $htmlfile + haschanges=1 fi fi fi @@ -180,43 +182,46 @@ done cd $htdocsdest -( - echo '<?xml version="1.0" encoding="UTF-8"?>' - echo '<urlset xmlns="http://www.google.com/schemas/sitemap/0.84">' - find . -name '.[^.]*' -prune -o -type d -printf '%p/\n' -o -type f -print | \ - while read i; do - # i is the file name. - if test "$i" == ./; then - # Homepage. - i=index.html - url="$baseurl/" - elif test "$i" == ./sitemap -o "${i: -1}" == / -a -f "${i}index.html"; then - # This is a directory and it has an index.html, so we - # don't need to include it. - continue - else - url="$baseurl${i:1}" - url="${url// /%20}" - fi - lastmod="`date --iso-8601=seconds -u -r "$i"`" - # Google wants a colon in front of the last two digits. - lastmod="${lastmod::22}:00" - if test "${i: -5}" == .html; then - # HTML files (including the home page) have highest priority. - priority=1.0 - elif test "${i: -4}" == .txt; then - # Text files have medium priority. - priority=0.5 - else - # Everything else (source files etc.) has low priority. - priority=0.2 - fi - echo "<url><loc>$url</loc><lastmod>$lastmod</lastmod><priority>$priority</priority></url>" - done - echo '</urlset>' -) > sitemap -# sitemap is compressed on the remote site for smaller patch sizes. - +# Update the sitemap only if something has changed because it takes +# very much CPU time. +if test -n "$haschanges"; then + ( + echo '<?xml version="1.0" encoding="UTF-8"?>' + echo '<urlset xmlns="http://www.google.com/schemas/sitemap/0.84">' + find . -name '.[^.]*' -prune -o -type d -printf '%p/\n' -o -type f -print | \ + while read i; do + # i is the file name. + if test "$i" == ./; then + # Homepage. + i=index.html + url="$baseurl/" + elif test "$i" == ./sitemap -o "${i: -1}" == / -a -f "${i}index.html"; then + # This is a directory and it has an index.html, so we + # don't need to include it. + continue + else + url="$baseurl${i:1}" + url="${url// /%20}" + fi + lastmod="`date --iso-8601=seconds -u -r "$i"`" + # Google wants a colon in front of the last two digits. + lastmod="${lastmod::22}:00" + if test "${i: -5}" == .html; then + # HTML files (including the home page) have highest priority. + priority=1.0 + elif test "${i: -4}" == .txt; then + # Text files have medium priority. + priority=0.5 + else + # Everything else (source files etc.) has low priority. + priority=0.2 + fi + echo "<url><loc>$url</loc><lastmod>$lastmod</lastmod><priority>$priority</priority></url>" + done + echo '</urlset>' + ) > sitemap + # sitemap is compressed on the remote site for smaller patch sizes. +fi # -------------------- Push changes to remote server. -------------------- |
