From 6b1c0573eaff7d22f625452cfbfe2967c0647ea2 Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Tue, 8 Jun 2010 10:34:13 +0000 Subject: Update to ikiwiki b10d353490197b576ef7bf2e8bf8016039efbd2d. --- render_locally | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'render_locally') diff --git a/render_locally b/render_locally index f4a249a8..9e257560 100755 --- a/render_locally +++ b/render_locally @@ -20,10 +20,14 @@ case $1 in export DESTDIR && DESTDIR=$ROOT.rendered.official && # Use ``--no-usedirs'' here, so that not too many separate directories have # to be created. + # + # ``--gettime --rebuild'': + # set x \ --set wikistatedir="$ROOT"/.ikiwiki-official \ --url http://www.gnu.org/software/hurd \ --no-usedirs \ + --gettime --rebuild \ "$@" && shift;; --w3m-wrapper) -- cgit v1.2.3 From 6fc97a71b0594afa47781571654e71cb18d4d08a Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Wed, 9 Jun 2010 15:15:12 +0200 Subject: .library/IkiWiki/Plugin/reset_mtimes.pm: New. --- .library/IkiWiki/Plugin/reset_mtimes.pm | 84 +++++++++++++++++++++++++++++++++ render_locally | 21 +++++++-- 2 files changed, 100 insertions(+), 5 deletions(-) create mode 100644 .library/IkiWiki/Plugin/reset_mtimes.pm (limited to 'render_locally') diff --git a/.library/IkiWiki/Plugin/reset_mtimes.pm b/.library/IkiWiki/Plugin/reset_mtimes.pm new file mode 100644 index 00000000..a168652b --- /dev/null +++ b/.library/IkiWiki/Plugin/reset_mtimes.pm @@ -0,0 +1,84 @@ +# Copyright © 2010 Thomas Schwinge + +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2, or (at your option) any later +# version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +package IkiWiki::Plugin::reset_mtimes; + +use warnings; +use strict; +use IkiWiki 3.00; + +# This plugin resets pages' / files' mtimes according to the RCS information +# when using --refresh mode. +# +# Note that the files' mtimes are *always* set, even if the file has +# un-committed changes. +# +# + +sub import +{ + hook (type => "needsbuild", + id => "reset_mtimes", + call => \&needsbuild); +} + +sub needsbuild (@) +{ + # Only proceed if --gettime is in effect, as we're clearly not intersted in + # this functionality otherwise. + return unless $config{gettime}; + + my $files = shift; + foreach my $file (@$files) + { + # [TODO. Perhaps not necessary. Can this hook ever be called for + # removed pages -- that need to be ``rebuilt'' in the sense that + # they're to be removed?] Don't bother for pages that don't exist + # anymore. + next unless -e "$config{srcdir}/$file"; + + my $page = pagename ($file); + debug ("needsbuild: <$file> <$page>"); + + # Only ever update -- otherwise ikiwiki shall do its own thing. + if (defined $IkiWiki::pagemtime{$page}) + { + debug ("pagemtime: " . $IkiWiki::pagemtime{$page}); + + my $mtime = 0; + eval + { + $mtime = IkiWiki::rcs_getmtime ($file); + }; + if ($@) + { + print STDERR $@; + } + elsif ($mtime > 0) + { + $IkiWiki::pagemtime{$page} = $mtime; + + # We have to set the actual file's mtime too, as otherwise + # ikiwiki will update it again and again. + utime($mtime, $mtime, "$config{srcdir}/$file"); + } + + debug ("pagemtime: " . $IkiWiki::pagemtime{$page}); + } + } +} + +1 diff --git a/render_locally b/render_locally index 9e257560..ca7856f5 100755 --- a/render_locally +++ b/render_locally @@ -12,27 +12,32 @@ export ROOT && ROOT=$(readlink -f "$(dirname "$0")") && export LC_MESSAGES && LC_MESSAGES=C && case $1 in + # Use this for rendering the set of pages which are to be installed under + # . --official) - # Use this for rendering the set of pages which are to be installed under - # . shift && + export TZ && TZ=UTC && export DESTDIR && DESTDIR=$ROOT.rendered.official && + # Use ``--no-usedirs'' here, so that not too many separate directories have # to be created. # - # ``--gettime --rebuild'': - # + # Use ``--gettime --plugin update_mtimes'' to reset pages' / files' mtimes + # according to the RCS information when using --refresh mode. set x \ --set wikistatedir="$ROOT"/.ikiwiki-official \ --url http://www.gnu.org/software/hurd \ --no-usedirs \ - --gettime --rebuild \ + --gettime --plugin reset_mtimes \ "$@" && shift;; + --w3m-wrapper) shift && + export NO_MSG && NO_MSG=y && + # Disable the configured VCS, as the CGI wrapper together with using the # anonok plugin inhibits the propagation of authorship information. set x \ @@ -41,21 +46,27 @@ case $1 in --rcs norcs \ "$@" && shift && + exec \ "$0" \ --w3m \ "$@";; + --w3m) shift && + export DESTDIR && DESTDIR=$ROOT.rendered.w3m && + set x \ --set wikistatedir="$ROOT"/.ikiwiki-w3m \ --cgiurl hurd-web.cgi --w3mmode \ "$@" && shift && + exec \ "$0" \ "$@";; + *) # Use ``--no-usedirs'' here, because when browsing local files, the web # browsers don't display `index.html' files by default when a hyperlink -- cgit v1.2.3