This change moves user_message from Sys::VirtV2V::UserMessage into
Sys::VirtV2V::Util and removes the former. This involves touching everywhere
that imports UserMessage, which is quite a lot of places.
The change also removes UserMessage's set_identifier method, and instead
hard-codes the message identifier. This involves a significant amount of churn
as all the translations must be updated.
---
MANIFEST | 1 -
lib/Sys/VirtV2V/Config.pm | 2 +-
lib/Sys/VirtV2V/Connection.pm | 2 +-
lib/Sys/VirtV2V/Connection/LibVirt.pm | 2 +-
lib/Sys/VirtV2V/Connection/LibVirtXML.pm | 2 +-
lib/Sys/VirtV2V/Converter.pm | 2 +-
lib/Sys/VirtV2V/Converter/Linux.pm | 3 +-
lib/Sys/VirtV2V/Converter/Windows.pm | 2 +-
lib/Sys/VirtV2V/GuestOS.pm | 2 +-
lib/Sys/VirtV2V/GuestOS/RedHat.pm | 4 +-
lib/Sys/VirtV2V/GuestfsHandle.pm | 2 +-
lib/Sys/VirtV2V/Target/LibVirt.pm | 4 +-
lib/Sys/VirtV2V/Target/RHEV.pm | 6 +-
lib/Sys/VirtV2V/Transfer/ESX.pm | 4 +-
lib/Sys/VirtV2V/Transfer/LocalCopy.pm | 2 +-
lib/Sys/VirtV2V/Transfer/SSH.pm | 2 +-
lib/Sys/VirtV2V/UserMessage.pm | 104 ------------------------------
po/POTFILES.in | 5 +-
po/es.po | 4 +-
po/it.po | 2 +-
po/or.po | 2 +-
po/pl.po | 4 +-
po/ru.po | 4 +-
po/te.po | 2 +-
po/uk.po | 4 +-
po/virt-v2v.pot | 2 +-
po/zh_CN.po | 2 +-
v2v/virt-v2v.pl | 5 +-
28 files changed, 36 insertions(+), 146 deletions(-)
delete mode 100644 lib/Sys/VirtV2V/UserMessage.pm
diff --git a/MANIFEST b/MANIFEST
index 0673eb7..619ad75 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -19,7 +19,6 @@ lib/Sys/VirtV2V/Target/RHEV.pm
lib/Sys/VirtV2V/Transfer/ESX.pm
lib/Sys/VirtV2V/Transfer/LocalCopy.pm
lib/Sys/VirtV2V/Transfer/SSH.pm
-lib/Sys/VirtV2V/UserMessage.pm
lib/Sys/VirtV2V/Util.pm
MANIFEST.SKIP
MANIFEST This list of files
diff --git a/lib/Sys/VirtV2V/Config.pm b/lib/Sys/VirtV2V/Config.pm
index 2e26a77..f703152 100644
--- a/lib/Sys/VirtV2V/Config.pm
+++ b/lib/Sys/VirtV2V/Config.pm
@@ -26,7 +26,7 @@ use XML::DOM;
use XML::DOM::XPath;
use Sys::VirtV2V::ExecHelper;
-use Sys::VirtV2V::UserMessage qw(user_message);
+use Sys::VirtV2V::Util qw(user_message);
use Locale::TextDomain 'virt-v2v';
diff --git a/lib/Sys/VirtV2V/Connection.pm b/lib/Sys/VirtV2V/Connection.pm
index 4dc659d..8029230 100644
--- a/lib/Sys/VirtV2V/Connection.pm
+++ b/lib/Sys/VirtV2V/Connection.pm
@@ -25,7 +25,7 @@ use Sys::Virt;
use Sys::VirtV2V::Transfer::ESX;
use Sys::VirtV2V::Transfer::LocalCopy;
use Sys::VirtV2V::Transfer::SSH;
-use Sys::VirtV2V::UserMessage qw(user_message);
+use Sys::VirtV2V::Util qw(user_message);
use Locale::TextDomain 'virt-v2v';
diff --git a/lib/Sys/VirtV2V/Connection/LibVirt.pm
b/lib/Sys/VirtV2V/Connection/LibVirt.pm
index e5675e1..b83a10d 100644
--- a/lib/Sys/VirtV2V/Connection/LibVirt.pm
+++ b/lib/Sys/VirtV2V/Connection/LibVirt.pm
@@ -29,7 +29,7 @@ use XML::DOM;
use Sys::Virt;
use Sys::VirtV2V;
-use Sys::VirtV2V::UserMessage qw(user_message);
+use Sys::VirtV2V::Util qw(user_message);
use Locale::TextDomain 'virt-v2v';
diff --git a/lib/Sys/VirtV2V/Connection/LibVirtXML.pm
b/lib/Sys/VirtV2V/Connection/LibVirtXML.pm
index ac3e82b..7dc122f 100644
--- a/lib/Sys/VirtV2V/Connection/LibVirtXML.pm
+++ b/lib/Sys/VirtV2V/Connection/LibVirtXML.pm
@@ -24,7 +24,7 @@ use XML::DOM;
use XML::DOM::XPath;
use Sys::VirtV2V::Connection;
-use Sys::VirtV2V::UserMessage qw(user_message);
+use Sys::VirtV2V::Util qw(user_message);
use Locale::TextDomain 'virt-v2v';
diff --git a/lib/Sys/VirtV2V/Converter.pm b/lib/Sys/VirtV2V/Converter.pm
index db90b17..42f0e70 100644
--- a/lib/Sys/VirtV2V/Converter.pm
+++ b/lib/Sys/VirtV2V/Converter.pm
@@ -28,7 +28,7 @@ use Module::Pluggable sub_name => 'modules',
use Locale::TextDomain 'virt-v2v';
-use Sys::VirtV2V::UserMessage qw(user_message);
+use Sys::VirtV2V::Util qw(user_message);
=pod
diff --git a/lib/Sys/VirtV2V/Converter/Linux.pm b/lib/Sys/VirtV2V/Converter/Linux.pm
index 82e7ba4..1734a58 100644
--- a/lib/Sys/VirtV2V/Converter/Linux.pm
+++ b/lib/Sys/VirtV2V/Converter/Linux.pm
@@ -26,8 +26,7 @@ use Locale::TextDomain 'virt-v2v';
use XML::DOM;
use XML::DOM::XPath;
-use Sys::VirtV2V::UserMessage qw(user_message);
-use Sys::VirtV2V::Util qw(augeas_error);
+use Sys::VirtV2V::Util qw(augeas_error user_message);
use Carp;
diff --git a/lib/Sys/VirtV2V/Converter/Windows.pm b/lib/Sys/VirtV2V/Converter/Windows.pm
index 7f4604d..90822dd 100644
--- a/lib/Sys/VirtV2V/Converter/Windows.pm
+++ b/lib/Sys/VirtV2V/Converter/Windows.pm
@@ -32,7 +32,7 @@ use Win::Hivex;
use Win::Hivex::Regedit qw(reg_import);
use Locale::TextDomain 'virt-v2v';
-use Sys::VirtV2V::UserMessage qw(user_message);
+use Sys::VirtV2V::Util qw(user_message);
use Carp;
diff --git a/lib/Sys/VirtV2V/GuestOS.pm b/lib/Sys/VirtV2V/GuestOS.pm
index 57311ec..e07671b 100644
--- a/lib/Sys/VirtV2V/GuestOS.pm
+++ b/lib/Sys/VirtV2V/GuestOS.pm
@@ -25,7 +25,7 @@ use File::Spec;
use File::Temp;
use Sys::VirtV2V::ExecHelper;
-use Sys::VirtV2V::UserMessage qw(user_message);
+use Sys::VirtV2V::Util qw(user_message);
use Module::Pluggable sub_name => 'modules',
search_path => 'Sys::VirtV2V::GuestOS',
diff --git a/lib/Sys/VirtV2V/GuestOS/RedHat.pm b/lib/Sys/VirtV2V/GuestOS/RedHat.pm
index 54ae483..3d8c1c7 100644
--- a/lib/Sys/VirtV2V/GuestOS/RedHat.pm
+++ b/lib/Sys/VirtV2V/GuestOS/RedHat.pm
@@ -24,9 +24,7 @@ use File::Spec;
use Sys::Guestfs::Lib qw(inspect_linux_kernel);
use Sys::VirtV2V::GuestOS;
-use Sys::VirtV2V::UserMessage qw(user_message);
-
-use Sys::VirtV2V::Util qw(augeas_error);
+use Sys::VirtV2V::Util qw(augeas_error user_message);
use Locale::TextDomain 'virt-v2v';
diff --git a/lib/Sys/VirtV2V/GuestfsHandle.pm b/lib/Sys/VirtV2V/GuestfsHandle.pm
index 8720744..953d774 100644
--- a/lib/Sys/VirtV2V/GuestfsHandle.pm
+++ b/lib/Sys/VirtV2V/GuestfsHandle.pm
@@ -23,7 +23,7 @@ use warnings;
use Carp;
use Sys::Guestfs::Lib qw(open_guest);
-use Sys::VirtV2V::UserMessage qw(user_message);
+use Sys::VirtV2V::Util qw(user_message);
use Locale::TextDomain 'virt-v2v';
diff --git a/lib/Sys/VirtV2V/Target/LibVirt.pm b/lib/Sys/VirtV2V/Target/LibVirt.pm
index ca69b96..574590c 100644
--- a/lib/Sys/VirtV2V/Target/LibVirt.pm
+++ b/lib/Sys/VirtV2V/Target/LibVirt.pm
@@ -22,7 +22,7 @@ package Sys::VirtV2V::Target::LibVirt::Vol;
use POSIX;
-use Sys::VirtV2V::UserMessage qw(user_message);
+use Sys::VirtV2V::Util qw(user_message);
use Locale::TextDomain 'virt-v2v';
@@ -145,7 +145,7 @@ sub close
package Sys::VirtV2V::Target::LibVirt;
-use Sys::VirtV2V::UserMessage qw(user_message);
+use Sys::VirtV2V::Util qw(user_message);
use Locale::TextDomain 'virt-v2v';
diff --git a/lib/Sys/VirtV2V/Target/RHEV.pm b/lib/Sys/VirtV2V/Target/RHEV.pm
index 00d5e7d..330b52e 100644
--- a/lib/Sys/VirtV2V/Target/RHEV.pm
+++ b/lib/Sys/VirtV2V/Target/RHEV.pm
@@ -41,7 +41,7 @@ use Carp;
use File::Temp qw(tempfile);
use POSIX qw(:sys_wait_h setuid setgid);
-use Sys::VirtV2V::UserMessage qw(user_message);
+use Sys::VirtV2V::Util qw(user_message);
use Locale::TextDomain 'virt-v2v';
@@ -164,7 +164,7 @@ use File::Path;
use File::Temp qw(tempdir);
use POSIX;
-use Sys::VirtV2V::UserMessage qw(user_message);
+use Sys::VirtV2V::Util qw(user_message);
use Locale::TextDomain 'virt-v2v';
@@ -411,7 +411,7 @@ use File::Temp qw(tempdir);
use Time::gmtime;
use Sys::VirtV2V::ExecHelper;
-use Sys::VirtV2V::UserMessage qw(user_message);
+use Sys::VirtV2V::Util qw(user_message);
use Locale::TextDomain 'virt-v2v';
diff --git a/lib/Sys/VirtV2V/Transfer/ESX.pm b/lib/Sys/VirtV2V/Transfer/ESX.pm
index f9ddbe1..798285b 100644
--- a/lib/Sys/VirtV2V/Transfer/ESX.pm
+++ b/lib/Sys/VirtV2V/Transfer/ESX.pm
@@ -24,7 +24,7 @@ use Sys::Virt::Error;
use Sys::VirtV2V;
-use Sys::VirtV2V::UserMessage qw(user_message);
+use Sys::VirtV2V::Util qw(user_message);
use Locale::TextDomain 'virt-v2v';
@@ -284,7 +284,7 @@ package Sys::VirtV2V::Transfer::ESX;
use Sys::Virt;
-use Sys::VirtV2V::UserMessage qw(user_message);
+use Sys::VirtV2V::Util qw(user_message);
use Locale::TextDomain 'virt-v2v';
diff --git a/lib/Sys/VirtV2V/Transfer/LocalCopy.pm
b/lib/Sys/VirtV2V/Transfer/LocalCopy.pm
index 75ca039..cdff97e 100644
--- a/lib/Sys/VirtV2V/Transfer/LocalCopy.pm
+++ b/lib/Sys/VirtV2V/Transfer/LocalCopy.pm
@@ -21,7 +21,7 @@ use POSIX;
use File::Spec;
use File::stat;
-use Sys::VirtV2V::UserMessage qw(user_message);
+use Sys::VirtV2V::Util qw(user_message);
use Locale::TextDomain 'virt-v2v';
diff --git a/lib/Sys/VirtV2V/Transfer/SSH.pm b/lib/Sys/VirtV2V/Transfer/SSH.pm
index c78edc6..66ec294 100644
--- a/lib/Sys/VirtV2V/Transfer/SSH.pm
+++ b/lib/Sys/VirtV2V/Transfer/SSH.pm
@@ -21,7 +21,7 @@ use POSIX;
use File::Spec;
use File::stat;
-use Sys::VirtV2V::UserMessage qw(user_message);
+use Sys::VirtV2V::Util qw(user_message);
use Locale::TextDomain 'virt-v2v';
diff --git a/lib/Sys/VirtV2V/UserMessage.pm b/lib/Sys/VirtV2V/UserMessage.pm
deleted file mode 100644
index 432f63e..0000000
--- a/lib/Sys/VirtV2V/UserMessage.pm
+++ /dev/null
@@ -1,104 +0,0 @@
-# Sys::VirtV2V::UserMessage
-# Copyright (C) 2009 Red Hat Inc.
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-package Sys::VirtV2V::UserMessage;
-
-use strict;
-use warnings;
-
-use Locale::TextDomain 'virt-v2v';
-
-require Exporter;
-
-use vars qw(@EXPORT_OK @ISA);
-
-@ISA = qw(Exporter);
-@EXPORT_OK = qw(user_message);
-
-=pod
-
-=head1 NAME
-
-Sys::VirtV2V::UserMessage - Create consistent user messages
-
-=head1 SYNOPSIS
-
- use Sys::VirtV2V::UserMessage qw(user_message);
-
- Sys::VirtV2V::UserMessage->set_identifier(__'virt-v2v');
-
- warn user_message(__x("Couldn't open {file}: {error}",
- file => $file, error => $error));
-
-=head1 DESCRIPTION
-
-Sys::VirtV2V::UserMessage provides an interface for displaying consistently
-formatted messages to a user. The string passed to user_message() should not
-contain a trailing newline. In English, the output will have the identifier
-prefixed if one was specified, and a newline appended.
-
-=head1 METHODS
-
-=over
-
-=item Sys::VirtV2V::UserMessage->set_identifier(identifier)
-
-Set an identifier which will identify messages from this source from other
-sources. In English, this identifier will be prefixed to all messages with a
-colon and trailing space.
-
-=cut
-
-our $identifier;
-
-sub set_identifier
-{
- my $class = shift;
- my ($new_identifier) = @_;
-
- $identifier = $new_identifier;
-}
-
-=item user_message(message)
-
-Return a formatted user message.
-
-I<message> should not contain a prefix or a trailing newline.
-
-=cut
-
-sub user_message
-{
- my ($msg) = (@_);
-
- return __x("{identifier}: {message}\n",
- identifier => $identifier, message => $msg);
-}
-
-=back
-
-=head1 COPYRIGHT
-
-Copyright (C) 2009 Red Hat Inc.
-
-=head1 LICENSE
-
-Please see the file COPYING.LIB for the full license.
-
-=cut
-
-1;
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 052f747..6dddbfe 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -3,9 +3,10 @@
../lib/Sys/VirtV2V/Connection/LibVirtXML.pm
../lib/Sys/VirtV2V/Connection.pm
../lib/Sys/VirtV2V/Converter/Linux.pm
-../lib/Sys/VirtV2V/Converter/Windows.pm
../lib/Sys/VirtV2V/Converter.pm
+../lib/Sys/VirtV2V/Converter/Windows.pm
../lib/Sys/VirtV2V/ExecHelper.pm
+../lib/Sys/VirtV2V/GuestfsHandle.pm
../lib/Sys/VirtV2V/GuestOS.pm
../lib/Sys/VirtV2V/GuestOS/RedHat.pm
../lib/Sys/VirtV2V.pm
@@ -14,5 +15,5 @@
../lib/Sys/VirtV2V/Transfer/ESX.pm
../lib/Sys/VirtV2V/Transfer/LocalCopy.pm
../lib/Sys/VirtV2V/Transfer/SSH.pm
-../lib/Sys/VirtV2V/UserMessage.pm
+../lib/Sys/VirtV2V/Util.pm
../v2v/virt-v2v.pl
diff --git a/po/es.po b/po/es.po
index f459ea2..c014aca 100644
--- a/po/es.po
+++ b/po/es.po
@@ -597,8 +597,8 @@ msgstr "Error no esperado obteniendo {path}: {output}"
#: ../lib/Sys/VirtV2V/UserMessage.pm:88
#, perl-brace-format
-msgid "{identifier}: {message}\n"
-msgstr "{identifier}: {message}\n"
+msgid "virt-v2v: {message}\n"
+msgstr "virt-v2v: {message}\n"
#: ../v2v/virt-v2v.pl:240
msgid "Use -ic or -oc to specify an input or an output connection"
diff --git a/po/it.po b/po/it.po
index a2f4c15..b98e49f 100644
--- a/po/it.po
+++ b/po/it.po
@@ -541,7 +541,7 @@ msgstr ""
#: ../lib/Sys/VirtV2V/UserMessage.pm:88
#, perl-brace-format
-msgid "{identifier}: {message}\n"
+msgid "virt-v2v: {message}\n"
msgstr ""
#: ../v2v/virt-v2v.pl:240
diff --git a/po/or.po b/po/or.po
index 48de7ae..a0cc509 100644
--- a/po/or.po
+++ b/po/or.po
@@ -539,7 +539,7 @@ msgstr ""
#: ../lib/Sys/VirtV2V/UserMessage.pm:88
#, perl-brace-format
-msgid "{identifier}: {message}\n"
+msgid "virt-v2v: {message}\n"
msgstr ""
#: ../v2v/virt-v2v.pl:240
diff --git a/po/pl.po b/po/pl.po
index a0b6439..da85df8 100644
--- a/po/pl.po
+++ b/po/pl.po
@@ -585,8 +585,8 @@ msgstr "Nieoczekiwany błąd podczas otrzymywania {path}:
{output}"
#: ../lib/Sys/VirtV2V/UserMessage.pm:88
#, perl-brace-format
-msgid "{identifier}: {message}\n"
-msgstr "{identifier}: {message}\n"
+msgid "virt-v2v: {message}\n"
+msgstr "virt-v2v: {message}\n"
#: ../v2v/virt-v2v.pl:240
msgid "Use -ic or -oc to specify an input or an output connection"
diff --git a/po/ru.po b/po/ru.po
index d17ab8d..9bc1055 100644
--- a/po/ru.po
+++ b/po/ru.po
@@ -552,8 +552,8 @@ msgstr ""
#: ../lib/Sys/VirtV2V/UserMessage.pm:88
#, perl-brace-format
-msgid "{identifier}: {message}\n"
-msgstr "{identifier}: {message}\n"
+msgid "virt-v2v: {message}\n"
+msgstr "virt-v2v: {message}\n"
#: ../v2v/virt-v2v.pl:240
msgid "Use -ic or -oc to specify an input or an output connection"
diff --git a/po/te.po b/po/te.po
index acd622c..ec8c707 100644
--- a/po/te.po
+++ b/po/te.po
@@ -537,7 +537,7 @@ msgstr ""
#: ../lib/Sys/VirtV2V/UserMessage.pm:88
#, perl-brace-format
-msgid "{identifier}: {message}\n"
+msgid "virt-v2v: {message}\n"
msgstr ""
#: ../v2v/virt-v2v.pl:240
diff --git a/po/uk.po b/po/uk.po
index ad7f0ec..749510c 100644
--- a/po/uk.po
+++ b/po/uk.po
@@ -547,8 +547,8 @@ msgstr ""
#: ../lib/Sys/VirtV2V/UserMessage.pm:88
#, perl-brace-format
-msgid "{identifier}: {message}\n"
-msgstr "{identifier}: {message}\n"
+msgid "virt-v2v: {message}\n"
+msgstr "virt-v2v: {message}\n"
#: ../v2v/virt-v2v.pl:240
msgid "Use -ic or -oc to specify an input or an output connection"
diff --git a/po/virt-v2v.pot b/po/virt-v2v.pot
index 31672ec..5095a56 100644
--- a/po/virt-v2v.pot
+++ b/po/virt-v2v.pot
@@ -526,7 +526,7 @@ msgstr ""
#: ../lib/Sys/VirtV2V/UserMessage.pm:88
#, perl-brace-format
-msgid "{identifier}: {message}\n"
+msgid "virt-v2v: {message}\n"
msgstr ""
#: ../v2v/virt-v2v.pl:240
diff --git a/po/zh_CN.po b/po/zh_CN.po
index 0f69b06..1259a44 100644
--- a/po/zh_CN.po
+++ b/po/zh_CN.po
@@ -535,7 +535,7 @@ msgstr ""
#: ../lib/Sys/VirtV2V/UserMessage.pm:88
#, perl-brace-format
-msgid "{identifier}: {message}\n"
+msgid "virt-v2v: {message}\n"
msgstr ""
#: ../v2v/virt-v2v.pl:240
diff --git a/v2v/virt-v2v.pl b/v2v/virt-v2v.pl
index 988308c..38b69b5 100755
--- a/v2v/virt-v2v.pl
+++ b/v2v/virt-v2v.pl
@@ -39,7 +39,7 @@ use Sys::VirtV2V::Target::RHEV;
use Sys::VirtV2V::ExecHelper;
use Sys::VirtV2V::GuestfsHandle;
use Sys::VirtV2V::GuestOS;
-use Sys::VirtV2V::UserMessage qw(user_message);
+use Sys::VirtV2V::Util qw(user_message);
=encoding utf8
@@ -224,9 +224,6 @@ $SIG{'QUIT'} = \&signal_exit;
# from or writing to a pipe.
$SIG{'PIPE'} = 'IGNORE';
-# Initialise the message output prefix
-Sys::VirtV2V::UserMessage->set_identifier('virt-v2v');
-
GetOptions ("help|?" => sub {
pod2usage(0);
},
--
1.7.2