From 8a6f4a7e50c247c061fd74b535d0f292aca6bda7 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 7 Sep 2010 12:08:59 -0400 Subject: [PATCH 1/1] needsbuild hook interface changed; the hooks should now return the modified array of things that need built. (Backwards compatability code keeps plugins using the old interface working.) --- IkiWiki/Plugin/aggregate.pm | 2 ++ IkiWiki/Plugin/calendar.pm | 1 + IkiWiki/Plugin/edittemplate.pm | 2 ++ IkiWiki/Plugin/listdirectives.pm | 2 ++ IkiWiki/Plugin/meta.pm | 1 + IkiWiki/Plugin/pinger.pm | 1 + IkiWiki/Plugin/po.pm | 2 ++ IkiWiki/Plugin/skeleton.pm.example | 4 ++++ IkiWiki/Plugin/theme.pm | 1 + IkiWiki/Plugin/version.pm | 1 + IkiWiki/Render.pm | 5 ++++- debian/changelog | 8 ++++++++ doc/plugins/write.mdwn | 4 ++-- 13 files changed, 31 insertions(+), 3 deletions(-) diff --git a/IkiWiki/Plugin/aggregate.pm b/IkiWiki/Plugin/aggregate.pm index 7789c4c2a..fe53d868d 100644 --- a/IkiWiki/Plugin/aggregate.pm +++ b/IkiWiki/Plugin/aggregate.pm @@ -210,6 +210,8 @@ sub needsbuild (@) { markunseen($feed->{sourcepage}); } } + + return $needsbuild; } sub preprocess (@) { diff --git a/IkiWiki/Plugin/calendar.pm b/IkiWiki/Plugin/calendar.pm index bb995d499..c7d2b7c01 100644 --- a/IkiWiki/Plugin/calendar.pm +++ b/IkiWiki/Plugin/calendar.pm @@ -491,6 +491,7 @@ sub needsbuild (@) { } } } + return $needsbuild; } 1 diff --git a/IkiWiki/Plugin/edittemplate.pm b/IkiWiki/Plugin/edittemplate.pm index 226f83bb4..4f07866e4 100644 --- a/IkiWiki/Plugin/edittemplate.pm +++ b/IkiWiki/Plugin/edittemplate.pm @@ -41,6 +41,8 @@ sub needsbuild (@) { } } } + + return $needsbuild; } sub preprocess (@) { diff --git a/IkiWiki/Plugin/listdirectives.pm b/IkiWiki/Plugin/listdirectives.pm index 8a67f7160..835e25388 100644 --- a/IkiWiki/Plugin/listdirectives.pm +++ b/IkiWiki/Plugin/listdirectives.pm @@ -64,6 +64,8 @@ sub needsbuild (@) { } } } + + return $needsbuild; } sub preprocess (@) { diff --git a/IkiWiki/Plugin/meta.pm b/IkiWiki/Plugin/meta.pm index d18585d3d..5941e3f3f 100644 --- a/IkiWiki/Plugin/meta.pm +++ b/IkiWiki/Plugin/meta.pm @@ -37,6 +37,7 @@ sub needsbuild (@) { } } } + return $needsbuild; } sub scrub ($$) { diff --git a/IkiWiki/Plugin/pinger.pm b/IkiWiki/Plugin/pinger.pm index c20ecb5d4..cc9f52d2b 100644 --- a/IkiWiki/Plugin/pinger.pm +++ b/IkiWiki/Plugin/pinger.pm @@ -45,6 +45,7 @@ sub needsbuild (@) { } } } + return $needsbuild; } sub preprocess (@) { diff --git a/IkiWiki/Plugin/po.pm b/IkiWiki/Plugin/po.pm index f3530faf3..7b62092e1 100644 --- a/IkiWiki/Plugin/po.pm +++ b/IkiWiki/Plugin/po.pm @@ -221,6 +221,8 @@ sub needsbuild () { foreach my $master (keys %translations) { map add_depends($_, $master), values %{otherlanguages_pages($master)}; } + + return $needsbuild; } sub scan (@) { diff --git a/IkiWiki/Plugin/skeleton.pm.example b/IkiWiki/Plugin/skeleton.pm.example index 341d67867..7974d5e53 100644 --- a/IkiWiki/Plugin/skeleton.pm.example +++ b/IkiWiki/Plugin/skeleton.pm.example @@ -73,7 +73,11 @@ sub refresh () { } sub needsbuild ($) { + my $needsbuild=shift; + debug("skeleton plugin needsbuild"); + + return $needsbuild; } sub preprocess (@) { diff --git a/IkiWiki/Plugin/theme.pm b/IkiWiki/Plugin/theme.pm index 03b0816ed..ee94547e9 100644 --- a/IkiWiki/Plugin/theme.pm +++ b/IkiWiki/Plugin/theme.pm @@ -60,6 +60,7 @@ sub needsbuild ($) { $wikistate{theme}{currenttheme}=$config{theme}; } + return $needsbuild; } 1 diff --git a/IkiWiki/Plugin/version.pm b/IkiWiki/Plugin/version.pm index c13643478..fc265526c 100644 --- a/IkiWiki/Plugin/version.pm +++ b/IkiWiki/Plugin/version.pm @@ -37,6 +37,7 @@ sub needsbuild (@) { } } } + return $needsbuild; } sub preprocess (@) { diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm index 9921915b4..0dbe9611a 100644 --- a/IkiWiki/Render.pm +++ b/IkiWiki/Render.pm @@ -759,7 +759,10 @@ sub refresh () { my ($new, $internal_new)=find_new_files($files); my ($del, $internal_del)=find_del_files($pages); my ($changed, $internal_changed)=find_changed($files); - run_hooks(needsbuild => sub { shift->($changed) }); + run_hooks(needsbuild => sub { + my $ret=shift->($changed); + $changed=$ret if ref $ret eq 'ARRAY'; + }); my $oldlink_targets=calculate_old_links($changed, $del); foreach my $file (@$changed) { diff --git a/debian/changelog b/debian/changelog index 81bd99a71..430bd302c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +ikiwiki (3.20100832) UNRELEASED; urgency=low + + * needsbuild hook interface changed; the hooks should now return + the modified array of things that need built. (Backwards compatability + code keeps plugins using the old interface working.) + + -- Joey Hess Tue, 07 Sep 2010 12:08:05 -0400 + ikiwiki (3.20100831) unstable; urgency=low * filecheck: Fall back to using the file command if the freedesktop diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn index 10b4df835..31bb64e68 100644 --- a/doc/plugins/write.mdwn +++ b/doc/plugins/write.mdwn @@ -179,8 +179,8 @@ function is passed no values. This allows a plugin to manipulate the list of files that need to be built when the wiki is refreshed. The function is passed a reference to an -array of files that will be rebuilt, and can modify the array, either -adding or removing files from it. +array of files that will be rebuilt. It should return an array reference +that is a modified version of its input. It can add or remove files from it. ### scan -- 2.45.0