]> sipb.mit.edu Git - ikiwiki.git/commitdiff
Merge branch 'master' of ssh://git.ikiwiki.info
authorJoey Hess <joeyh@joeyh.name>
Sun, 28 Dec 2014 18:32:39 +0000 (14:32 -0400)
committerJoey Hess <joeyh@joeyh.name>
Sun, 28 Dec 2014 18:32:39 +0000 (14:32 -0400)
IkiWiki/Plugin/calendar.pm
IkiWiki/Plugin/comments.pm
debian/changelog
doc/sandbox.mdwn
doc/todo/Add_DESTDIR_to_the___39__pm__95__filter__39___and_use_MAKE_in___39__po__47__Makefile__39__.mdwn [new file with mode: 0644]
ikiwiki-comment.in
po/Makefile

index 23246757bacbd6d7dad04fbc031044f090555fcb..c03b89667c39bb67feb94116c92892f1cab0d21c 100644 (file)
@@ -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});
index d7666c8526f831b4f147a1aa880e53d4ee7a1906..1a50d1865071a7a92dc7882b614d7deb150fe03b 100644 (file)
@@ -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 ($) {
index 824a0061c454d178008a4bf2dee3d37264aa4ef7..2a3f729c57b785ebcf3269a45c4d8ee7e297d702 100644 (file)
@@ -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
 
index 9aeb10deb4a1357ffac6a9f369e0000c78526cdf..bfc1bf46a609047e72280ff2b5aba3d75e48678f 100644 (file)
@@ -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 (file)
index 0000000..0a80647
--- /dev/null
@@ -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]]
index b0cea4a4ae03fe17d6ad7a382b097f114f89c557..0891766ab6f154ae1f7977c49a58a7d86f44996b 100755 (executable)
@@ -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);
index 5ec4a157c6ddbb0fdfcdea3d117730b3cb2ea266..4d1d33e83246ad54bb705d9e09f7469d23418fbe 100644 (file)
@@ -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