summaryrefslogtreecommitdiff
path: root/www
diff options
context:
space:
mode:
authorschmonz <schmonz@pkgsrc.org>2013-01-28 04:30:14 +0000
committerschmonz <schmonz@pkgsrc.org>2013-01-28 04:30:14 +0000
commitf8818eb466ca79bce90aba79b0ebfe4ffd06739d (patch)
tree19d8cd28f4a404f0f6839968ed2c40da264ce9f2 /www
parent3b7655d3b75e59eb89670bea1abe98b53dbbfc43 (diff)
downloadpkgsrc-f8818eb466ca79bce90aba79b0ebfe4ffd06739d.tar.gz
Apply the latest bugfixes to the CVS backend from my git repo:
* `6753235d`: Return bounded output from `rcs_diff()` when asked, as the API states. * `e45175d5`: Always explicitly set CVS keyword substitution behavior. Fixes behavior when a text file is added under a name formerly used for a binary file. * `b30cacdf`: If the previous working directory no longer exists after a CVS operation, don't try to `chdir()` back to it afterward. Bump PKGREVISION.
Diffstat (limited to 'www')
-rw-r--r--www/ikiwiki/Makefile4
-rw-r--r--www/ikiwiki/distinfo3
-rw-r--r--www/ikiwiki/patches/patch-IkiWiki_Plugin_cvs.pm112
3 files changed, 116 insertions, 3 deletions
diff --git a/www/ikiwiki/Makefile b/www/ikiwiki/Makefile
index f3a8c0a918c..ef6e7165062 100644
--- a/www/ikiwiki/Makefile
+++ b/www/ikiwiki/Makefile
@@ -1,9 +1,9 @@
-# $NetBSD: Makefile,v 1.102 2013/01/15 23:10:57 schmonz Exp $
+# $NetBSD: Makefile,v 1.103 2013/01/28 04:30:14 schmonz Exp $
#
DISTNAME= ikiwiki_3.20121212
PKGNAME= ${DISTNAME:S/_/-/}
-PKGREVISION= 1
+PKGREVISION= 2
CATEGORIES= www textproc
MASTER_SITES= ${MASTER_SITE_DEBIAN:=pool/main/i/ikiwiki/}
diff --git a/www/ikiwiki/distinfo b/www/ikiwiki/distinfo
index 91c28fa517d..a744835371c 100644
--- a/www/ikiwiki/distinfo
+++ b/www/ikiwiki/distinfo
@@ -1,6 +1,7 @@
-$NetBSD: distinfo,v 1.84 2013/01/15 23:10:57 schmonz Exp $
+$NetBSD: distinfo,v 1.85 2013/01/28 04:30:14 schmonz Exp $
SHA1 (ikiwiki_3.20121212.tar.gz) = 1c9815502e90a25c5bd7b5cdf198034e6833c3ff
RMD160 (ikiwiki_3.20121212.tar.gz) = a5439279166dc0d6ed1f4f5f7a71a680b08465cc
Size (ikiwiki_3.20121212.tar.gz) = 2917372 bytes
+SHA1 (patch-IkiWiki_Plugin_cvs.pm) = affca7fbdbd08c7b56faaf1583ad36ddba6a89f2
SHA1 (patch-IkiWiki_Plugin_git.pm) = e854ea61afd3968a9dd06f1c70ab2cea993d6a1f
diff --git a/www/ikiwiki/patches/patch-IkiWiki_Plugin_cvs.pm b/www/ikiwiki/patches/patch-IkiWiki_Plugin_cvs.pm
new file mode 100644
index 00000000000..b674c459056
--- /dev/null
+++ b/www/ikiwiki/patches/patch-IkiWiki_Plugin_cvs.pm
@@ -0,0 +1,112 @@
+$NetBSD: patch-IkiWiki_Plugin_cvs.pm,v 1.1 2013/01/28 04:30:15 schmonz Exp $
+
+Bugfixes in `schmonz/cvs` I'd like to see merged:
+
+* `6753235d`: Return bounded output from `rcs_diff()` when asked, as
+ the API states.
+* `e45175d5`: Always explicitly set CVS keyword substitution behavior.
+ Fixes behavior when a text file is added under a name formerly
+ used for a binary file.
+* `b30cacdf`: If the previous working directory no longer exists after
+ a CVS operation, don't try to `chdir()` back to it afterward.
+
+--- IkiWiki/Plugin/cvs.pm.orig 2012-08-25 15:12:13.000000000 +0000
++++ IkiWiki/Plugin/cvs.pm
+@@ -216,14 +216,12 @@ sub rcs_add ($) {
+
+ while ($file = pop @files_to_add) {
+ if (@files_to_add == 0) {
+- # file
+ cvs_runcvs('add', cvs_keyword_subst_args($file)) ||
+- warn("cvs add $file failed\n");
++ warn("cvs add file $file failed\n");
+ }
+ else {
+- # directory
+ cvs_runcvs('add', $file) ||
+- warn("cvs add $file failed\n");
++ warn("cvs add dir $file failed\n");
+ }
+ }
+ }
+@@ -396,11 +394,15 @@ sub rcs_diff ($;$) {
+ my @cvsps = `env TZ=UTC cvsps -q --cvs-direct -z 30 -g -s $rev`;
+ my $blank_lines_seen = 0;
+
++ # skip log, get to the diff
+ while (my $line = shift @cvsps) {
+ $blank_lines_seen++ if ($line =~ /^$/);
+ last if $blank_lines_seen == 2;
+ }
+
++ @cvsps = @cvsps[0..$maxlines-1]
++ if defined $maxlines && @cvsps > $maxlines;
++
+ if (wantarray) {
+ return @cvsps;
+ }
+@@ -491,24 +493,53 @@ sub cvs_keyword_subst_args ($) {
+ my $filemime = File::MimeInfo::default($file);
+ # if (-T $file) {
+
+- if (defined($filemime) && $filemime eq 'text/plain') {
+- return ($file);
+- }
+- else {
+- return ('-kb', $file);
+- }
++ defined($filemime) && $filemime eq 'text/plain'
++ ? return ('-kkv', $file)
++ : return ('-kb', $file);
+ }
+
+ sub cvs_runcvs(@) {
+ my @cmd = @_;
+ unshift @cmd, 'cvs', '-Q';
+
+- local $CWD = $config{srcdir};
++ # CVS can't operate outside a srcdir, so we're always setting $CWD.
++ # "local $CWD" restores the previous value when we go out of scope.
++ # Usually that's correct. But if we're removing the last file from
++ # a directory, the post-commit hook will exec in a working directory
++ # that's about to not exist (CVS will prune it).
++ #
++ # chdir() manually here, so we can selectively not chdir() back.
++
++ my $oldcwd = $CWD;
++ chdir($config{srcdir});
++
++ eval q{
++ use IPC::Open3;
++ use Symbol qw(gensym);
++ use IO::File;
++ };
++ error($@) if $@;
++
++ my $cvsout = '';
++ my $cvserr = '';
++ local *CATCHERR = IO::File->new_tmpfile;
++ my $pid = open3(gensym(), \*CATCHOUT, ">&CATCHERR", @cmd);
++ while (my $l = <CATCHOUT>) {
++ $cvsout .= $l
++ unless 1;
++ }
++ waitpid($pid, 0);
++ my $ret = $? >> 8;
++ seek CATCHERR, 0, 0;
++ while (my $l = <CATCHERR>) {
++ $cvserr .= $l
++ unless $l =~ /^cvs commit: changing keyword expansion /;
++ }
++
++ print STDOUT $cvsout;
++ print STDERR $cvserr;
+
+- open(my $savedout, ">&STDOUT");
+- open(STDOUT, ">", "/dev/null");
+- my $ret = system(@cmd);
+- open(STDOUT, ">&", $savedout);
++ chdir($oldcwd) if -d $oldcwd;
+
+ return ($ret == 0) ? 1 : 0;
+ }