debian/0000755000000000000000000000000011525627075007200 5ustar debian/copyright0000644000000000000000000000155411525627034011133 0ustar This is the debian package for the WWW::Mediawiki::Client module and the MVS command-line program. The Debian package was created by Benjamin Mako Hill from sources obtained from CPAN at: http://search.cpan.org/CPAN/authors/id/M/MA/MARKJ/WWW-Mediawiki-Client-0.31.tar.gz Upstream Author: Mark Jaroski . Copyright: Copyright © 2004, Mark Jaroski All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. On Debian GNU/Linux systems, Perl's license is described in detail in the following location: * /usr/share/doc/perl/copyright Like Perl, this package is distributed under both the Artistic license and GPL. On Debian GNU/Linux systems, these licenses can be found in: * /usr/share/common-licenses/Artistic * /usr/share/common-licenses/GPL debian/changelog0000644000000000000000000000200311525627075011045 0ustar libwww-mediawiki-client-perl (0.31-2) unstable; urgency=low * Update to new source package format. * Adapted patch to libmediawiki-perl (#578691) (to fix security patch to MediaWiki in a way that should still work with old versions as well. (Closes: #578692) * Fix documentation of command-line in regards to placement of options. (Closes: #507582) * Added watch file. * Fixed a series of minor formatting issues in the pod documentation. -- Benjamin Mako Hill Sat, 12 Feb 2011 15:57:25 -0500 libwww-mediawiki-client-perl (0.31-1.1) unstable; urgency=low * Non-maintainer upload. * debian/rules: Don't fail when perl is smart enough not to create empty dirs. (Closes: #467770) -- Marc 'HE' Brockschmidt Sat, 05 Apr 2008 17:36:51 +0200 libwww-mediawiki-client-perl (0.31-1) unstable; urgency=low * Initial release. * Small fix for unversioned pre-req for libvcs-lite-perl. -- Benjamin Mako Hill Sun, 3 Sep 2006 17:42:10 -0400 debian/README.Debian0000644000000000000000000000164011525627034011235 0ustar To get very simple help for MVS, either use `man mvs` or `mvs --help`. The following set of intstructions is the quickest way to get you up and running with editing the English Wikipedia. If you want to edit another MediaWiki, change the hostnames in the appropriate places. Step 1: make a directory to store pages from this Mediawiki instance mkdir en-wp cd en-wp Step 2: log in to the host with your username/password mvs login -d wikipedia.org -l en -u 'Benjamin Mako Hill' -p password Step 3: download a page that you want to edit by adding ".wiki" to the end mvs update Granrojo.wiki Step 4: edit the file to make changes vim Granrojo.wiki Step 5: preview your changes mvs preview Granrojo.wiki Step 6: commit your changes into the wiki mvs commit --minor yes -m 'made spelling fix' Granrojo.wiki --------------------------- Benjamin Mako Hill Sun, 3 Sep 2006 19:58:29 -0400 debian/control0000644000000000000000000000246511525627034010605 0ustar Source: libwww-mediawiki-client-perl Section: perl Priority: optional Build-Depends: debhelper (>= 5.0.0) Build-Depends-Indep: perl (>= 5.8), libexception-class-perl, libtest-differences-perl, libvcs-lite-perl (>= 0.08), libwww-perl, libxml-libxml-perl Maintainer: Benjamin Mako Hill Standards-Version: 3.9.1 Package: libwww-mediawiki-client-perl Architecture: all Provides: mvs Depends: ${perl:Depends}, ${misc:Depends}, libvcs-lite-perl (>= 0.8), libwww-perl, libexception-class-perl, libxml-libxml-perl Description: simple CVS-like interface for editing MediaWiki websites This package includes the MVS client and the WWW::Mediawiki::Client perl library implementing the functionality in MVS. WWW::Mediawiki::Client provides a very simple CVS-like interface for viewing, staying in sync with, and editing pages in websites that run Mediawiki software. In particular, the software is extremely useful for editing pages in Wikipedia or other Wikimedia websites. . MVS is a command line client whose purpose is to simplify offline editing of Wiki content. It allows you to get any number of pages from a given Mediawiki site, edit the pages with any editor, get and merge any concurrent updates of the pages, and then safely commit the users own changes back to the version of the page on the server. debian/patches/0000755000000000000000000000000011525627034010622 5ustar debian/patches/0001-specifiy-version-of-VCS-Lite.patch0000644000000000000000000000121511525627034017444 0ustar From d86fcd48aa7ccc89a1f1a7ea55597f09d9dce55d Mon Sep 17 00:00:00 2001 From: Benjamin Mako Hill Date: Sat, 12 Feb 2011 15:59:58 -0500 Subject: specifiy version of VCS::Lite --- Makefile.PL | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Makefile.PL b/Makefile.PL index a524473..c3e986b 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -7,7 +7,7 @@ WriteMakefile( PREREQ_PM => { 'Test::Differences'=> 0, - 'VCS::Lite' => 0, + 'VCS::Lite' => 0.08, 'Getopt::Std'=> 0, 'Pod::Usage' => 0, 'File::Spec' => 0, -- 1.7.2.3 debian/patches/0003-fix-error-reporting-IRT-UNIVERAL-isa.patch0000644000000000000000000000504311525627034020602 0ustar From 466d70bd1187419cd8daa4503653da58cb1b54d0 Mon Sep 17 00:00:00 2001 From: Benjamin Mako Hill Date: Sat, 12 Feb 2011 16:13:46 -0500 Subject: fix error reporting IRT UNIVERAL::isa --- bin/mvs | 38 ++++++++++++++++++++++++-------------- 1 files changed, 24 insertions(+), 14 deletions(-) diff --git a/bin/mvs b/bin/mvs index 2bd8505..5d54edd 100755 --- a/bin/mvs +++ b/bin/mvs @@ -86,23 +86,33 @@ sub main { if $opt_verbose >= 1; print $message unless $opt_verbose <= -1; eval { $wmc->$method(@files) }; - if (UNIVERSAL::isa($@, 'WWW::Mediawiki::Client::Exception')) { + + my $tmp_error = $@; + + if (UNIVERSAL::isa($tmp_error, 'WWW::Mediawiki::Client::Exception')) { open (LOG, ">>$LOGFILE"); - print LOG "\n-----------------\n$@"; - warn "\n-----------------\n$@" if $opt_verbose >= 1; - if ($@->isa('WWW::Mediawiki::Client::LoginException')) { - print LOG Data::Dumper->Dump([$@->res], ['res'] ) . "\n"; - print LOG Data::Dumper->Dump([$@->cookie_jar], ['cookie_jar']) . "\n"; + print LOG "\n-----------------\n$tmp_error"; + warn "\n-----------------\n$tmp_error" if $opt_verbose >= 1; + + if (UNIVERSAL::isa($tmp_error, 'WWW::Mediawiki::Client::LoginException')) { + print LOG Data::Dumper->Dump([$tmp_error->res], ['res'] ) . "\n"; + print LOG Data::Dumper->Dump([$tmp_error->cookie_jar], + ['cookie_jar']) . "\n"; close LOG; - die $@->error . " See $LOGFILE for details.\n" ; - } elsif ($@->isa('WWW::Mediawiki::Client::CommitException')) { - print LOG Data::Dumper->Dump([$@->res], ['res']) . "\n"; - } elsif ($@->isa('WWW::Mediawiki::Client::ServerPageException')) { - print LOG Data::Dumper->Dump([$@->res], ['res']) . "\n"; + die $tmp_error->error . "See $LOGFILE for details.\n" ; + } elsif (UNIVERSAL::isa($tmp_error, + 'WWW::Mediawiki::Client::CommitException')) { + print LOG Data::Dumper->Dump([$tmp_error->res], ['res']) . "\n"; + + } elsif (UNIVERSAL::isa($tmp_error, + 'WWW::Mediawiki::Client::ServerPageException')) { + print LOG Data::Dumper->Dump([$tmp_error->res], ['res']) . "\n"; } - warn $@->error . " See $LOGFILE for details.\n" ; - } elsif ($@) { - die $@; + + warn $tmp_error->error, "\n", "See $LOGFILE for details.\n"; + + } elsif ($tmp_error) { + die $tmp_error->error; } return 1 unless $wmc->status; my %status = %{$wmc->status}; -- 1.7.2.3 debian/patches/0006-fix-bugs-related-to-unicode-handling.patch0000644000000000000000000000374511525627034021227 0ustar From 5c6a3b828859eea7eb3fda24f38c38b87b54e9c1 Mon Sep 17 00:00:00 2001 From: Benjamin Mako Hill Date: Sat, 12 Feb 2011 19:34:54 -0500 Subject: fix bugs related to unicode handling --- lib/WWW/Mediawiki/Client.pm | 23 ++++++++++------------- 1 files changed, 10 insertions(+), 13 deletions(-) diff --git a/lib/WWW/Mediawiki/Client.pm b/lib/WWW/Mediawiki/Client.pm index cfdc0a9..32a7d53 100644 --- a/lib/WWW/Mediawiki/Client.pm +++ b/lib/WWW/Mediawiki/Client.pm @@ -20,15 +20,6 @@ use Encode; use Encode::Guess; use utf8; -BEGIN { - # If we tell LWP it's dealing with UTF-8 then URI::Escape will munge the text - # So either we put up with warnings or do this: - for (0x100 .. 0xd7ff, 0xf000 .. 0xfdcf) { - $URI::Escape::escapes{chr($_)} = - &URI::Escape::uri_escape_utf8(chr($_)); - } -} - use base 'Exporter'; our %EXPORT_TAGS = ( options => [qw(OPT_YES OPT_NO OPT_DEFAULT OPT_KEEP)], @@ -1714,18 +1705,24 @@ sub _upload_file { my $act_name = ($commit ? EDIT_SUBMIT_NAME : EDIT_PREVIEW_NAME ); my $act_value = ($commit ? EDIT_SUBMIT_VALUE : EDIT_PREVIEW_VALUE); my $url = $self->filename_to_url($filename, SUBMIT); - my $octets = Encode::encode($self->encoding, $text); + my $content_type = 'application/x-www-form-urlencoded;charset=' . + $self->encoding; + my $res = $self->{ua}->post($url, - [ + 'Content-type' => $content_type, + Content => + [ $act_name => $act_value, - &TEXTAREA_NAME => $octets, + &TEXTAREA_NAME => $text, &COMMENT_NAME => $self->{commit_message}, &EDIT_TIME_NAME => $self->{edit}->{date}, &EDIT_TOKEN_NAME => $self->{edit}->{token}, @params, - ], + ] ); + my $doc = $res->decoded_content; + my $headline = $self->_get_page_headline($doc); my $expect = ($commit ? $pagename : "Editing $pagename"); unless (lc($headline) eq lc($expect)) { -- 1.7.2.3 debian/patches/0004-patched-to-work-with-the-newest-version-of-MW.patch0000644000000000000000000000654611525627034022707 0ustar From 6769a57a2eb3f1ca8de4e1f22d26e9cd78570beb Mon Sep 17 00:00:00 2001 From: Benjamin Mako Hill Date: Sat, 12 Feb 2011 16:49:41 -0500 Subject: patched to work with the newest version of MW --- lib/WWW/Mediawiki/Client.pm | 29 ++++++++++++++++++++++------- 1 files changed, 22 insertions(+), 7 deletions(-) diff --git a/lib/WWW/Mediawiki/Client.pm b/lib/WWW/Mediawiki/Client.pm index 18645bb..cfdc0a9 100644 --- a/lib/WWW/Mediawiki/Client.pm +++ b/lib/WWW/Mediawiki/Client.pm @@ -278,6 +278,7 @@ use constant PASSWORD_NAME => 'wpPassword'; use constant REMEMBER_NAME => 'wpRemember'; use constant LOGIN_SUBMIT_NAME => 'wpLoginattempt'; use constant LOGIN_SUBMIT_VALUE => 'Log In'; +use constant LOGIN_TOKEN => 'wpLoginToken'; =head2 Files @@ -814,6 +815,7 @@ sub do_login { my $lang = $self->language_code; $host =~ s/__LANG__/$lang/; $path =~ s/__LANG__/$lang/; + my $protocol = $self->protocol; my $url = "$protocol://$host/$path" . "?" . ACTION . "=" . LOGIN @@ -822,14 +824,27 @@ sub do_login { $self->{ua}->cookie_jar->save or WWW::Mediawiki::Client::CookieJarException->throw( "Could not save cookie jar."); - my $res = $self->{ua}->request(POST $url, - [ + + # get login token + my $res = $self->{ua}->request(GET $url); + unless ($res->is_success) { + WWW::Mediawiki::Client::LoginException->throw( + error => "Could not connect to MediaWiki to get login token.\n", + res => $res); + } + + my $token; + $token = $1 if $res->content() =~ /input type=['"]hidden['"] name=['"]wpLoginToken['"] value=['"]([a-fA-F0-9]+)['"]/i; + + $res = $self->{ua}->request(POST $url, + [ ( &USERNAME_NAME => $self->username, &PASSWORD_NAME => $self->password, &REMEMBER_NAME => 1, - &LOGIN_SUBMIT_NAME => &LOGIN_SUBMIT_VALUE, - ] + &LOGIN_SUBMIT_NAME => &LOGIN_SUBMIT_VALUE + ), defined $token ? (&LOGIN_TOKEN => $token) : () ] ); + # success == Mediawiki gave us a Password cookie if ($self->{ua}->cookie_jar->as_string =~ /UserID=/) { $self->encoding($self->_get_server_encoding); @@ -1496,7 +1511,7 @@ sub _get_edit_date { my $p = HTML::TokeParser->new(\$doc); my $date; while (my $tag = $p->get_tag('input')) { - next unless $tag->[1]->{type} eq 'hidden'; + next unless exists $tag->[1]->{type} and $tag->[1]->{type} eq 'hidden'; next unless $tag->[1]->{name} eq EDIT_TIME_NAME; $date = $tag->[1]->{value}; } @@ -1508,7 +1523,7 @@ sub _get_edit_token { my $p = HTML::TokeParser->new(\$doc); my $token; while (my $tag = $p->get_tag('input')) { - next unless $tag->[1]->{type} eq 'hidden'; + next unless exists $tag->[1]->{type} and $tag->[1]->{type} eq 'hidden'; next unless $tag->[1]->{name} eq 'wpEditToken'; $token = $tag->[1]->{value}; } @@ -1533,7 +1548,7 @@ sub _get_edit_checkbox { my $p = HTML::TokeParser->new(\$doc); my $status; while (my $tag = $p->get_tag('input')) { - next unless $tag->[1]->{type} eq 'checkbox'; + next unless exists $tag->[1]->{type} and $tag->[1]->{type} eq 'checkbox'; next unless $tag->[1]->{name} eq $name; $status = ($tag->[1]->{checked} ? 1 : 0); } -- 1.7.2.3 debian/patches/0005-fix-documentation-manpage.patch0000644000000000000000000000246011525627034017272 0ustar From cb3ac71d7a48b2f14b9bede07fd67040c4be9fe0 Mon Sep 17 00:00:00 2001 From: Benjamin Mako Hill Date: Sat, 12 Feb 2011 16:58:36 -0500 Subject: fix documentation/manpage - the -v and -q information was incorrect in that it explained it could be used before the subcommands (which it cannot) --- bin/mvs | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bin/mvs b/bin/mvs index 5d54edd..403bf33 100755 --- a/bin/mvs +++ b/bin/mvs @@ -239,14 +239,14 @@ mvs - A command line Mediawiki client mkdir wikistuff cd wikistuff - mvs [-q|-v] login [-T] [-d ] [-l language_code ] [-u ] [-p ] [-w ] + mvs login [-q|-v] [-T] [-d ] [-l language_code ] [-u ] [-p ] [-w ] - mvs [-q|-v] update [ ..] - mvs [-q|-v] up [ ..] + mvs update [-q|-v] [ ..] + mvs up [[-q|-v] ..] - mvs [-q|-v] commit [-M] [-W] -m "commit message" - mvs [-q|-v] com [-M] [-W] -m "commit message" - mvs [-q|-v] preview [-M] [-W] [-m "commit message"] + mvs commit [-q|-v] [-M] [-W] -m "commit message" + mvs com [-q|-v] [-M] [-W] -m "commit message" + mvs preview [-q|-v] [-M] [-W] [-m "commit message"] =head1 DESCRIPTION -- 1.7.2.3 debian/patches/series0000644000000000000000000000047211525627034012042 0ustar 0001-specifiy-version-of-VCS-Lite.patch 0002-remove-problematic-unicode-character.patch 0003-fix-error-reporting-IRT-UNIVERAL-isa.patch 0004-patched-to-work-with-the-newest-version-of-MW.patch 0005-fix-documentation-manpage.patch 0006-fix-bugs-related-to-unicode-handling.patch 0007-pod2man-formatting-fixes.patch debian/patches/0002-remove-problematic-unicode-character.patch0000644000000000000000000000120311525627034021370 0ustar From 8baf7567bdc065043c470a236c8682a2f96ee6cd Mon Sep 17 00:00:00 2001 From: Benjamin Mako Hill Date: Sat, 12 Feb 2011 16:00:31 -0500 Subject: remove problematic unicode character --- bin/mvs | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/bin/mvs b/bin/mvs index f707f01..2bd8505 100755 --- a/bin/mvs +++ b/bin/mvs @@ -651,7 +651,7 @@ and 'watch' settings, and bug reports. =head1 COPYRIGHT -© Copyright 2004-2005, Mark Jaroski +(C) Copyright 2004-2005, Mark Jaroski This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. -- 1.7.2.3 debian/patches/0007-pod2man-formatting-fixes.patch0000644000000000000000000000510011525627034017047 0ustar From 9d4132f7e445f9bf077677536e2393a62c125761 Mon Sep 17 00:00:00 2001 From: Benjamin Mako Hill Date: Sat, 12 Feb 2011 20:04:04 -0500 Subject: pod2man formatting fixes --- bin/mvs | 6 ++++++ lib/WWW/Mediawiki/Client.pm | 6 +++++- lib/WWW/Mediawiki/Client/Exceptions.pm | 6 +++++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/bin/mvs b/bin/mvs index 403bf33..6017696 100755 --- a/bin/mvs +++ b/bin/mvs @@ -524,6 +524,8 @@ pages you've deleted. rm Paris.wiki mvs clean +=back + =head2 File names Any additional arguments are taken as I filenames to be processed. @@ -644,6 +646,8 @@ L =head1 AUTHORS +=over + =item Mark Jaroski =item Bernhard Kaindl @@ -659,6 +663,8 @@ Bug reports and feedback. Preview support, export support for multi-page update, more 'minor' and 'watch' settings, and bug reports. +=back + =head1 COPYRIGHT (C) Copyright 2004-2005, Mark Jaroski diff --git a/lib/WWW/Mediawiki/Client.pm b/lib/WWW/Mediawiki/Client.pm index 32a7d53..9e9bff4 100644 --- a/lib/WWW/Mediawiki/Client.pm +++ b/lib/WWW/Mediawiki/Client.pm @@ -28,7 +28,7 @@ our @EXPORT_OK = map { @{$EXPORT_TAGS{$_}} } keys %EXPORT_TAGS; =head1 NAME -WWW::Mediawiki::Client +WWW::Mediawiki::Client - module providing a VCS like to MediaWiki =cut @@ -699,6 +699,8 @@ This field will be empty until do_update has been called, after which it will be set to a hash of C => C pairs. Each C will be one of the following (see CONSTANTS for discriptions): +=over + =item WWW::Mediawiki::Client::STATUS_UNKNOWN; =item WWW::Mediawiki::Client::STATUS_UNCHANGED; @@ -711,6 +713,8 @@ will be one of the following (see CONSTANTS for discriptions): =item WWW::Mediawiki::Client::STATUS_CONFLICT; +=back + =cut sub status { diff --git a/lib/WWW/Mediawiki/Client/Exceptions.pm b/lib/WWW/Mediawiki/Client/Exceptions.pm index 6311d5b..c5a52e7 100644 --- a/lib/WWW/Mediawiki/Client/Exceptions.pm +++ b/lib/WWW/Mediawiki/Client/Exceptions.pm @@ -117,7 +117,7 @@ __END__ =head1 NAME -WWW::Mediawiki::Client::Exception +WWW::Mediawiki::Client::Exception - exception handling for WWW::Mediawiki::Client =head1 SYNOPSIS @@ -235,6 +235,8 @@ Exception::Class =head1 AUTHORS +=over + =item Mark Jaroski Author @@ -243,6 +245,8 @@ Author Inspired the improvement in error handling and reporting. +=back + =head1 LICENSE Copyright (c) 2004 Mark Jaroski. -- 1.7.2.3 debian/source/0000755000000000000000000000000011525627034010473 5ustar debian/source/format0000644000000000000000000000001411525627034011701 0ustar 3.0 (quilt) debian/compat0000644000000000000000000000000211525627034010371 0ustar 5 debian/watch0000644000000000000000000000013211525627034010220 0ustar version=3 http://www.cpan.org/modules/by-module/WWW/WWW-Mediawiki-Client-([0-9].*)\.tar.gzdebian/rules0000755000000000000000000000365611525627034010265 0ustar #!/usr/bin/make -f # This debian/rules file is provided as a template for normal perl # packages. It was created by Marc Brockschmidt for # the Debian Perl Group (http://pkg-perl.alioth.debian.org/) but may # be used freely wherever it is useful. # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 # If set to a true value then MakeMaker's prompt function will # always return the default without waiting for user input. export PERL_MM_USE_DEFAULT=1 PACKAGE=$(shell dh_listpackages) ifndef PERL PERL = /usr/bin/perl endif TMP =$(CURDIR)/debian/$(PACKAGE) build: build-stamp build-stamp: dh_testdir # Add commands to compile the package here $(PERL) Makefile.PL INSTALLDIRS=vendor $(MAKE) OPTIMIZE="-Wall -O2 -g" touch build-stamp clean: dh_testdir dh_testroot # Add commands to clean up after the build process here [ ! -f Makefile ] || $(MAKE) realclean dh_clean build-stamp install-stamp install: build install-stamp install-stamp: dh_testdir dh_testroot dh_clean -k $(MAKE) test $(MAKE) install DESTDIR=$(TMP) PREFIX=/usr # As this is a architecture independent package, we are not # supposed to install stuff to /usr/lib. MakeMaker creates # the dirs, we delete them from the deb: [ ! -d $(TMP)/usr/lib/perl5 ] || rmdir --ignore-fail-on-non-empty --parents --verbose $(TMP)/usr/lib/perl5 touch install-stamp binary-arch: # We have nothing to do by default. binary-indep: build install dh_testdir dh_testroot # dh_installcron # dh_installmenu # dh_installexamples dh_installdocs README TODO debian/README.Debian dh_installchangelogs ChangeLog dh_perl dh_link dh_strip dh_compress dh_fixperms dh_installdeb dh_gencontrol dh_md5sums dh_builddeb source diff: @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false binary: binary-indep binary-arch .PHONY: build clean binary-indep binary-arch binary