From 1b4c3fb551754cc70abd7a18871a79d79ac3cb5b Mon Sep 17 00:00:00 2001 From: Amitai Schlair Date: Wed, 9 Sep 2009 22:36:23 -0400 Subject: note refactored wrapper tweakulation --- doc/plugins/contrib/cvs/discussion.mdwn | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/doc/plugins/contrib/cvs/discussion.mdwn b/doc/plugins/contrib/cvs/discussion.mdwn index 1f0ce0102..155a2289d 100644 --- a/doc/plugins/contrib/cvs/discussion.mdwn +++ b/doc/plugins/contrib/cvs/discussion.mdwn @@ -125,3 +125,19 @@ to pass to the command. > Thanks for reading carefully. I've tested your suggestions and > applied them on my branch. --[[schmonz]] + +---- + +I've abstracted out CVS's involvement in the wrapper, adding a new +"wrapperargcheck" hook to examine `argc/argv` and return success or +failure (failure causes the wrapper to terminate) and implementing +this hook in the plugin. In the non-CVS case, the check immediately +returns success, so the added overhead is just a function call. + +Given how rarely anything should need to reach in and modify the +wrapper -- I'd go so far as to say we shouldn't make it too easy +-- I don't think it's worth the effort to try and design a more +general-purpose way to do so. If and when some other problem thinks +it wants to be solved by a new wrapper hook, it's easy enough to add +one. Until then, I'd say it's more important to keep the wrapper as +short and clear as possible. --[[schmonz]] -- cgit v1.2.3 From b7415543c1ee1ee6ee0404cf781e89043de26fb7 Mon Sep 17 00:00:00 2001 From: Amitai Schlair Date: Wed, 9 Sep 2009 22:42:47 -0400 Subject: describe current state of wrapper modification --- doc/plugins/contrib/cvs.mdwn | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/plugins/contrib/cvs.mdwn b/doc/plugins/contrib/cvs.mdwn index fcf5b936f..3d72255fe 100644 --- a/doc/plugins/contrib/cvs.mdwn +++ b/doc/plugins/contrib/cvs.mdwn @@ -22,9 +22,9 @@ Consider creating `$HOME/.cvsrc` if you don't have one already; the plugin doesn * `cvs.pm` started life as a copy of [[3.14159|news/version_3.14159]]'s `svn.pm`. * `IkiWiki.pm:wiki_file_prune_regexps` avoids copying CVS metadata into `$DESTDIR`. -* `IkiWiki/Wrapper.pm` avoids calling ikiwiki from post-commit if it's a -directory being `cvs add`ed (this check is only compiled into the wrapper -iff the configured VCS is "cvs"). +* `IkiWiki/Wrapper.pm` provides a new "wrapperargcheck" hook, which +the plugin implements to avoid calling ikiwiki from post-commit +(and locking against itself) if it's a directory being `cvs add`ed. * [[ikiwiki-makerepo]]: * creates a repository, * imports `$SRCDIR` into top-level module `ikiwiki` (vendor tag IKIWIKI, release tag PRE_CVS), -- cgit v1.2.3 From 689106ad3a24850543c7855b8531a1bf8dcfdb63 Mon Sep 17 00:00:00 2001 From: Amitai Schlair Date: Wed, 9 Sep 2009 23:17:15 -0400 Subject: automated tests added (and they highlight that the plugin should probably restore the caller's working directory) --- doc/plugins/contrib/cvs.mdwn | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/plugins/contrib/cvs.mdwn b/doc/plugins/contrib/cvs.mdwn index 3d72255fe..947fa7268 100644 --- a/doc/plugins/contrib/cvs.mdwn +++ b/doc/plugins/contrib/cvs.mdwn @@ -32,6 +32,5 @@ the plugin implements to avoid calling ikiwiki from post-commit * CVS multi-directory commits happen separately; the post-commit hook sees only the first directory's changes in time for [[recentchanges|plugins/recentchanges]]. The next run of `ikiwiki --setup` will correctly re-render such a recentchanges entry. It should be possible to solve this problem with NetBSD's `commit_prep` and `log_accum` scripts (see below). ### To do -* Add automated tests. (Blindly adding svn-like tests to `t/file_pruned.t` doesn't do the trick.) * Instead of resource-intensively scraping changesets with `cvsps`, have `ikiwiki-makerepo` set up NetBSD-like `log_accum` and `commit_prep` scripts that coalesce and keep records of commits. `cvsps` can be used as a fallback for repositories without such records. * Perhaps prevent web edits from attempting to create `.../CVS/foo.mdwn` (and `.../cvs/foo.mdwn` on case-insensitive filesystems); thanks to the CVS metadata directory, the attempt will fail anyway (and much more confusingly) if we don't. -- cgit v1.2.3 From d2b57ae20fa1800d142adad5b3e43dddb97e9466 Mon Sep 17 00:00:00 2001 From: Amitai Schlair Date: Thu, 10 Sep 2009 00:59:05 -0400 Subject: File::chdir is needed now --- doc/plugins/contrib/cvs.mdwn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/plugins/contrib/cvs.mdwn b/doc/plugins/contrib/cvs.mdwn index 947fa7268..d45992300 100644 --- a/doc/plugins/contrib/cvs.mdwn +++ b/doc/plugins/contrib/cvs.mdwn @@ -5,8 +5,8 @@ This plugin allows ikiwiki to use [[!wikipedia desc="CVS" Concurrent Versions System]] as an [[rcs]]. ### Usage -7. Install [cvsps](http://www.cobite.com/cvsps/), [[!cpan -File::ReadBackwards]], and +7. Install [[!cpan File::chdir]], [[!cpan File::ReadBackwards]], +[cvsps](http://www.cobite.com/cvsps/), and [cvsweb](http://www.freebsd.org/projects/cvsweb.html) or the like. 7. Adjust CVS-related parameters in your setup file. -- cgit v1.2.3 From b3cceb0f615089b3a144389f4593c9941a0ed777 Mon Sep 17 00:00:00 2001 From: suxx1k Date: Thu, 10 Sep 2009 09:50:34 -0400 Subject: --- doc/roadmap.mdwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/roadmap.mdwn b/doc/roadmap.mdwn index 2f79f7978..8688b856c 100644 --- a/doc/roadmap.mdwn +++ b/doc/roadmap.mdwn @@ -8,7 +8,7 @@ This is the roadmap for ikiwiki development. Released 29 April 2006. The 1.x series is no longer supported. - +d ---- # 2.0 -- cgit v1.2.3 From 22f02603246f67117471f020a882dfa822849d18 Mon Sep 17 00:00:00 2001 From: suxx1k Date: Thu, 10 Sep 2009 09:51:28 -0400 Subject: --- doc/roadmap.mdwn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/roadmap.mdwn b/doc/roadmap.mdwn index 8688b856c..a701a2685 100644 --- a/doc/roadmap.mdwn +++ b/doc/roadmap.mdwn @@ -7,8 +7,8 @@ This is the roadmap for ikiwiki development. Released 29 April 2006. -The 1.x series is no longer supported. -d +The 1.X series is no longer supported. + ---- # 2.0 -- cgit v1.2.3 From 98ed7cb1d7f99790821b99b3779d6685114fa662 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 10 Sep 2009 13:32:13 -0400 Subject: Fix parsing web commits from ipv6 addresses. I weakended the regexp, so this matches ipv6 addresses too. It does not ensure that the address is valid, but that should not matter here. Note that addresses ending in "::" are not matched, so eg, the unspecified address will not match -- but should never appear here anyway. --- IkiWiki.pm | 2 +- debian/changelog | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/IkiWiki.pm b/IkiWiki.pm index 2f11069c6..187d40a3a 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -364,7 +364,7 @@ sub getsetup () { }, web_commit_regexp => { type => "internal", - default => qr/^web commit (by (.*?(?=: |$))|from (\d+\.\d+\.\d+\.\d+)):?(.*)/, + default => qr/^web commit (by (.*?(?=: |$))|from ([0-9a-fA-F:.]+[0-9a-fA-F])):?(.*)/, description => "regexp to parse web commits from logs", safe => 0, rebuild => 0, diff --git a/debian/changelog b/debian/changelog index de165e4ff..2e1781713 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,6 +6,7 @@ ikiwiki (3.14159265) UNRELEASED; urgency=low allows banning by IP address. * underlay: Also allow configuring additional directories to search for template files in. + * Fix parsing web commits from ipv6 addresses. -- Joey Hess Wed, 02 Sep 2009 15:01:27 -0400 -- cgit v1.2.3 From 3ebd4e0b45a8a6bd4c12604a3bb683dcb3a60eb8 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 10 Sep 2009 14:04:46 -0400 Subject: Add genwrapper hook, that can be used to add code into the C wrapper. --- IkiWiki/Plugin/skeleton.pm.example | 5 +++++ IkiWiki/Wrapper.pm | 8 ++++---- debian/changelog | 1 + doc/plugins/write.mdwn | 7 +++++++ 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/IkiWiki/Plugin/skeleton.pm.example b/IkiWiki/Plugin/skeleton.pm.example index 573510191..ddf2996d6 100644 --- a/IkiWiki/Plugin/skeleton.pm.example +++ b/IkiWiki/Plugin/skeleton.pm.example @@ -39,6 +39,7 @@ sub import { hook(type => "renamepage", id => "skeleton", call => \&renamepage); hook(type => "rename", id => "skeleton", call => \&rename); hook(type => "savestate", id => "skeleton", call => \&savestate); + hook(type => "genwrapper", id => "skeleton", call => \&genwrapper); } sub getopt () { @@ -239,4 +240,8 @@ sub savestate () { debug("skeleton plugin running in savestate"); } +sub genwrapper () { + debug("skeleton plugin running in genwrapper"); +} + 1 diff --git a/IkiWiki/Wrapper.pm b/IkiWiki/Wrapper.pm index 6555fe625..cf85738d6 100644 --- a/IkiWiki/Wrapper.pm +++ b/IkiWiki/Wrapper.pm @@ -38,11 +38,12 @@ sub gen_wrapper () { EOF } - my $test_receive=""; if ($config{test_receive}) { require IkiWiki::Receive; - $test_receive=IkiWiki::Receive::gen_wrapper(); } + + my @wrapper_hooks; + run_hooks(genwrapper => sub { push @wrapper_hooks, shift->() }); my $check_commit_hook=""; my $pre_exec=""; @@ -120,7 +121,7 @@ int main (int argc, char **argv) { char *s; $check_commit_hook -$test_receive +@wrapper_hooks $envsave newenviron[i++]="HOME=$ENV{HOME}"; newenviron[i++]="WRAPPED_OPTIONS=$configstring"; @@ -144,7 +145,6 @@ $pre_exec exit(1); } EOF - close OUT; my $cc=exists $ENV{CC} ? possibly_foolish_untaint($ENV{CC}) : 'cc'; if (system($cc, "$wrapper.c", "-o", "$wrapper.new") != 0) { diff --git a/debian/changelog b/debian/changelog index 2e1781713..488aef866 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,6 +7,7 @@ ikiwiki (3.14159265) UNRELEASED; urgency=low * underlay: Also allow configuring additional directories to search for template files in. * Fix parsing web commits from ipv6 addresses. + * Add genwrapper hook, that can be used to add code into the C wrapper. -- Joey Hess Wed, 02 Sep 2009 15:01:27 -0400 diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn index 3976f9adf..668f8d8b6 100644 --- a/doc/plugins/write.mdwn +++ b/doc/plugins/write.mdwn @@ -496,6 +496,13 @@ describes the plugin as a whole. For example: and undef if a rebuild could be needed in some circumstances, but is not strictly required. +### genwrapper + + hook(type => "genwrapper", id => "foo", call => \&genwrapper); + +This hook is used to inject C code (which it returns) into the `main` +function of the ikiwiki wrapper when it is being generated. + ## Plugin interface To import the ikiwiki plugin interface: -- cgit v1.2.3 From 525d4cd037b1da19f4d54cf113212cbe452be417 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 10 Sep 2009 14:06:30 -0400 Subject: new hook --- doc/plugins/contrib/cvs/discussion.mdwn | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/plugins/contrib/cvs/discussion.mdwn b/doc/plugins/contrib/cvs/discussion.mdwn index 155a2289d..ace455d06 100644 --- a/doc/plugins/contrib/cvs/discussion.mdwn +++ b/doc/plugins/contrib/cvs/discussion.mdwn @@ -141,3 +141,7 @@ general-purpose way to do so. If and when some other problem thinks it wants to be solved by a new wrapper hook, it's easy enough to add one. Until then, I'd say it's more important to keep the wrapper as short and clear as possible. --[[schmonz]] + +> I've committed a slightly different hook, which should be general enough +> that `IkiWiki::Receive` can also use it, so please adapt your code to +> that. --[[Joey]] -- cgit v1.2.3