diff options
author | Joey Hess <joeyh@joeyh.name> | 2014-12-28 14:32:39 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2014-12-28 14:32:39 -0400 |
commit | 1d6dec40ebde1afa81aec05a68dc5649782c4b1f (patch) | |
tree | f099156413d1733db218cc687d9639db93ca637f | |
parent | 9f62caaff7676ee87d7ab348064a8f8a93f488ac (diff) | |
parent | a87f43d71eccc6c71bd0dadcc1fe06ec809cfdcf (diff) | |
download | ikiwiki-1d6dec40ebde1afa81aec05a68dc5649782c4b1f.tar ikiwiki-1d6dec40ebde1afa81aec05a68dc5649782c4b1f.tar.gz |
Merge branch 'master' of ssh://git.ikiwiki.info
-rw-r--r-- | IkiWiki/Plugin/calendar.pm | 2 | ||||
-rw-r--r-- | IkiWiki/Plugin/comments.pm | 14 | ||||
-rw-r--r-- | debian/changelog | 2 | ||||
-rw-r--r-- | doc/sandbox.mdwn | 5 | ||||
-rw-r--r-- | doc/todo/Add_DESTDIR_to_the___39__pm__95__filter__39___and_use_MAKE_in___39__po__47__Makefile__39__.mdwn | 76 | ||||
-rwxr-xr-x | ikiwiki-comment.in | 137 | ||||
-rw-r--r-- | po/Makefile | 2 |
7 files changed, 197 insertions, 41 deletions
diff --git a/IkiWiki/Plugin/calendar.pm b/IkiWiki/Plugin/calendar.pm index 23246757b..c03b89667 100644 --- a/IkiWiki/Plugin/calendar.pm +++ b/IkiWiki/Plugin/calendar.pm @@ -115,7 +115,7 @@ sub build_affected { $affected{calendarlink($ayear)} = sprintf(gettext("building calendar for %s, its previous or next year has changed"), $ayear) if ($valid); ($ayear, $valid) = previousyear($year, $config{archivebase}); $affected{calendarlink($ayear)} = sprintf(gettext("building calendar for %s, its previous or next year has changed"), $ayear) if ($valid); - foreach my $month (keys $changed{$year}) { + foreach my $month (keys %{$changed{$year}}) { ($ayear, $amonth, $valid) = nextmonth($year, $month, $config{archivebase}); $affected{calendarlink($ayear, sprintf("%02d", $amonth))} = sprintf(gettext("building calendar for %s/%s, its previous or next month has changed"), $amonth, $ayear) if ($valid); ($ayear, $amonth, $valid) = previousmonth($year, $month, $config{archivebase}); diff --git a/IkiWiki/Plugin/comments.pm b/IkiWiki/Plugin/comments.pm index d7666c852..1a50d1865 100644 --- a/IkiWiki/Plugin/comments.pm +++ b/IkiWiki/Plugin/comments.pm @@ -206,10 +206,12 @@ sub preprocess { $commentopenid = $commentuser; } else { - $commentauthorurl = IkiWiki::cgiurl( - do => 'goto', - page => IkiWiki::userpage($commentuser) - ); + if (length $config{cgiurl}) { + $commentauthorurl = IkiWiki::cgiurl( + do => 'goto', + page => IkiWiki::userpage($commentuser) + ); + } $commentauthor = $commentuser; } @@ -507,7 +509,7 @@ sub editcomment ($$) { $subject = "comment ".(num_comments($page, $config{srcdir}) + 1); } $content .= " subject=\"$subject\"\n"; - $content .= " " . commentdate() . "\n"; + $content .= " date=\"" . commentdate() . "\"\n"; my $editcontent = $form->field('editcontent'); $editcontent="" if ! defined $editcontent; @@ -636,7 +638,7 @@ sub editcomment ($$) { } sub commentdate () { - "date=\"" . strftime_utf8('%Y-%m-%dT%H:%M:%SZ', gmtime) . "\""; + strftime_utf8('%Y-%m-%dT%H:%M:%SZ', gmtime); } sub getavatar ($) { diff --git a/debian/changelog b/debian/changelog index 824a0061c..2a3f729c5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -28,6 +28,8 @@ ikiwiki (3.20141017) UNRELEASED; urgency=medium [ Amitai Schlair ] * core: log a debug message before waiting for the lock. Thanks, Mark Jason Dominus + * build: in po/Makefile, use the same $(MAKE) as the rest of the build. + Thanks, ttw -- Joey Hess <joeyh@debian.org> Mon, 20 Oct 2014 12:04:49 -0400 diff --git a/doc/sandbox.mdwn b/doc/sandbox.mdwn index 9aeb10deb..bfc1bf46a 100644 --- a/doc/sandbox.mdwn +++ b/doc/sandbox.mdwn @@ -19,6 +19,11 @@ pre formated text? > >> Without a space works too. >>> to three levels + + +Azerty +** Qsdf ** + > > Back to the first level. > diff --git a/doc/todo/Add_DESTDIR_to_the___39__pm__95__filter__39___and_use_MAKE_in___39__po__47__Makefile__39__.mdwn b/doc/todo/Add_DESTDIR_to_the___39__pm__95__filter__39___and_use_MAKE_in___39__po__47__Makefile__39__.mdwn new file mode 100644 index 000000000..0a80647c7 --- /dev/null +++ b/doc/todo/Add_DESTDIR_to_the___39__pm__95__filter__39___and_use_MAKE_in___39__po__47__Makefile__39__.mdwn @@ -0,0 +1,76 @@ +The `PM_FILTER` doesn't include the `DESTDIR` variable. This means that, if you use it with your build, it's incoherent to the rest of the build; i.e. the `INSTALLDIR_AUTOREPLACE` doesn't include it. Honestly I can't recall what the final effect of that was but the following [[patch]] fixed it. + +[[!format diff """ +diff --git a/Makefile.PL b/Makefile.PL +index 5b0eb74..94adb0f 100755 +--- a/Makefile.PL ++++ b/Makefile.PL +@@ -194,7 +194,7 @@ coverage: + WriteMakefile( + NAME => 'IkiWiki', + PREFIX => "/usr/local", +- PM_FILTER => './pm_filter $(PREFIX) $(VER) $(PROBABLE_INST_LIB)', ++ PM_FILTER => './pm_filter $(DESTDIR)$(PREFIX) $(VER) $(PROBABLE_INST_LIB)', + MAN1PODS => {}, + PREREQ_PM => { + 'XML::Simple' => "0", +"""]] + +> This change certainly looks plausible, but I maintain a package +> of ikiwiki in a build system that sets `DESTDIR`, and I've not +> noticed any problems there. Would you be willing to do one more +> build in your environment without this change, so that we can +> understand the problem it's trying to fix? --[[schmonz]] + +Also, the `po/Makefile` presumes the use of `make`, explicitly. If you use another build tool it fails (ironically I was actually using `gmake` in non-gnu environment so it wasn't aliased to `make`). Switch from the explicit call to the generic recall variable `$(MAKE)`. + +[[!format diff """ +diff --git a/po/Makefile b/po/Makefile +index 5ec4a15..4d1d33e 100644 +--- a/po/Makefile ++++ b/po/Makefile +@@ -84,7 +84,7 @@ underlays: ../ikiwiki.out underlays_copy_stamp + ../ikiwiki.out -libdir .. -setup underlay.setup -refresh + + ../ikiwiki.out: ../Makefile +- make -C .. ikiwiki.out ++ $(MAKE) -C .. ikiwiki.out + + ../Makefile: ../Makefile.PL + cd .. && ./Makefile.PL +"""]] + +> This change looks more obviously correct, and I understand exactly +> I haven't encountered the problem you have (my build system ensures +> that `make` gets me `gmake` for ikiwiki). Cherry-picked, with amended +> commit message. --[[schmonz]] + +Note following comments by [[Joey]] via github + +> These are not mergeable in their current state. +> +> *Pull 'DESTDIR' update to 'Makefile.PL' from mixed-master.* +> +> This doesn't explain +> +> * what the problem was +> * how the change fixed it +> * why the change is correct + +>> No, I suppose not; I won't explain. Hopefully the above clarifies. -- [[ttw]] + +> *Re-merge from 'joeyh' to new, clean head.* +> +> I have no idea what the above commit is doing, but it somehow makes changes to 432 files?! + +>> Yeah, sort of. I'm not very good with computers ... specifically, with `git` and stuff. The diff between my `master` and your `master` is only two files so hopefully it *is* actually doing what's intended (that is, those changes are from your repository into my own -- I "rebased" my own in an attempt to simplify things). Anyway. -- [[ttw]] + +> *Pull the 'po/Makefile' change from the mixed-master.* +> +> This one is adding a $(MAKE) where there was a make. Which is fine, but the commit message is again, horrible. What is the mixed-master? Describe the change you are making, not your internal process for making it. + +>> Note to others, `graft` from `hg` doesn't pull original commit messages the way you wish it did (or I did something wrong ... more likely). -- [[ttw]] + +> Also, please don't use github pull requests for ikiwiki. Post todo items on ikiwiki.info with a link to your git repository and branches to be merged. + +>> NP. [[http://github.com/ttw/ikiwiki]]; `master` branch. -- [[ttw]] diff --git a/ikiwiki-comment.in b/ikiwiki-comment.in index b0cea4a4a..0891766ab 100755 --- a/ikiwiki-comment.in +++ b/ikiwiki-comment.in @@ -4,49 +4,120 @@ use strict; use lib '.'; # For use in nonstandard directory, munged by Makefile. use IkiWiki; use IkiWiki::Plugin::comments; +use Getopt::Long; -sub usage () { - die gettext("usage: ikiwiki-comment pagefile"), "\n"; +sub usage { + die gettext("usage: ikiwiki-comment pagefile [options]") . "\n"; } -my $pagefile=shift || usage (); +sub main { + my $pagefile=shift || usage(); + my $interactive = -t STDIN; + my $content; + my ($format, $username, $subject, $date, $url, $email, $ip); + GetOptions( + 'format:s' => \$format, + 'username:s' => \$username, + 'subject:s' => \$subject, + 'date:s' => \$date, + 'url:s' => \$url, + 'email:s' => \$email, + 'ip:s' => \$ip, + ) || usage(); -my $dir=IkiWiki::dirname($pagefile); -$dir="." unless length $dir; -my $page=IkiWiki::basename($pagefile); -if (! -d $pagefile) { - $page=~s/\.[^.]+$//; -} + my $dir=get_dir($pagefile); + my $page=get_page($pagefile); + + IkiWiki::Plugin::comments::checkconfig(); + + if ($interactive) { + $format ||= 'mdwn'; + $username ||= get_username(); + $subject ||= get_subject($page, $dir); + $date ||= IkiWiki::Plugin::comments::commentdate(); + $url ||= undef; + $email ||= undef; + $ip ||= undef; + } else { + $format ||= undef; + die "must supply username" unless defined $username; + $subject ||= get_subject($page, $dir); + die "must supply date" unless defined $date; + $url ||= undef; + $email ||= undef; + $ip ||= undef; + chomp($content = join('', <STDIN>)); + } -IkiWiki::Plugin::comments::checkconfig(); -my $comment_num=1 + IkiWiki::Plugin::comments::num_comments($page, $dir); + my $comment=get_comment($format, $username, $subject, $date, $url, $email, $ip, $content); -my $username = getpwuid($<); -if (! defined $username) { $username="" } + # For interactive use, this will yield a hash of the comment before + # it's edited, but that's ok; the date provides sufficient entropy + # to avoid collisions, and the hash of a comment does not need to + # match its actual content. + # Doing it this way avoids needing to move the file to a final + # location after it's edited. + my $location=IkiWiki::Plugin::comments::unique_comment_location($page, $comment, $dir)."._comment"; -my $comment="[[!comment format=mdwn\n"; -$comment.=" username=\"$username\"\n"; -$comment.=" subject=\"\"\"comment $comment_num\"\"\"\n"; -$comment.=" " . IkiWiki::Plugin::comments::commentdate() . "\n"; -$comment.=" content=\"\"\"\n\n\"\"\"]]\n"; + IkiWiki::writefile($location, $dir, $comment); + exec_editor("$dir/$location") if $interactive; +} + +sub get_dir { + my ($file) = @_; + my $dir=IkiWiki::dirname($file); + $dir="." unless length $dir; + return $dir; +} -# This will yield a hash of the comment before it's edited, -# but that's ok; the date provides sufficient entropy to avoid collisions, -# and the hash of a comment does not need to match its actual content. -# Doing it this way avoids needing to move the file to a final -# location after it's edited. -my $location=IkiWiki::Plugin::comments::unique_comment_location($page, $comment, $dir)."._comment"; +sub get_page { + my ($file) = @_; + my $page=IkiWiki::basename($file); + $page=~s/\.[^.]+$// unless -d $file; + return $page; +} -IkiWiki::writefile($location, $dir, $comment); +sub get_username { + my $username = getpwuid($<); + $username="" unless defined $username; + return $username; +} -my @editor="vi"; -if (-x "/usr/bin/editor") { - @editor="/usr/bin/editor"; +sub get_subject { + my ($page, $dir) = @_; + my $comment_num=1+IkiWiki::Plugin::comments::num_comments($page, $dir); + return "comment $comment_num"; } -if (exists $ENV{EDITOR}) { - @editor=split(' ', $ENV{EDITOR}); + +sub get_comment { + my ($format, $username, $subject, $date, $url, $email, $ip, $content) = @_; + $format = defined $format ? $format = " format=$format" : q{}; + $content = '' unless defined $content; + my $comment="[[!comment$format\n"; + $comment.=" username=\"$username\"\n"; + $comment.=" subject=\"\"\"$subject\"\"\"\n"; + $comment.=" date=\"$date\"\n"; + $comment.=" url=\"$url\"\n" if defined $url; + $comment.=" email=\"$email\"\n" if defined $email; + $comment.=" ip=\"$ip\"\n" if defined $ip; + $comment.=" content=\"\"\"\n$content\n\"\"\"]]\n"; + return $comment; } -if (exists $ENV{VISUAL}) { -@editor=split(' ', $ENV{VISUAL}); + +sub exec_editor { + my ($file) = @_; + + my @editor="vi"; + if (-x "/usr/bin/editor") { + @editor="/usr/bin/editor"; + } + if (exists $ENV{EDITOR}) { + @editor=split(' ', $ENV{EDITOR}); + } + if (exists $ENV{VISUAL}) { + @editor=split(' ', $ENV{VISUAL}); + } + exec(@editor, $file); } -exec(@editor, "$dir/$location"); + +main(@ARGV); diff --git a/po/Makefile b/po/Makefile index 5ec4a157c..4d1d33e83 100644 --- a/po/Makefile +++ b/po/Makefile @@ -84,7 +84,7 @@ underlays: ../ikiwiki.out underlays_copy_stamp ../ikiwiki.out -libdir .. -setup underlay.setup -refresh ../ikiwiki.out: ../Makefile - make -C .. ikiwiki.out + $(MAKE) -C .. ikiwiki.out ../Makefile: ../Makefile.PL cd .. && ./Makefile.PL |