[libaudio-mpd-perl] 01/02: Add patch from Simon McVittie enabling UNIX socket support for MPD_HOST environment variable

Damyan Ivanov dmn at moszumanska.debian.org
Sat Jun 20 16:38:35 UTC 2015


This is an automated email from the git hooks/post-receive script.

dmn pushed a commit to branch master
in repository libaudio-mpd-perl.

commit 1204ebe8263e22a009e3793566646eaf4509e93f
Author: Damyan Ivanov <dmn at debian.org>
Date:   Sat Jun 20 16:32:07 2015 +0000

    Add patch from Simon McVittie enabling UNIX socket support for MPD_HOST environment variable
    
    Closes: #768982
---
 debian/patches/series                        |  1 +
 debian/patches/unix-socket-in-MPD_HOST.patch | 48 ++++++++++++++++++++++++++++
 2 files changed, 49 insertions(+)

diff --git a/debian/patches/series b/debian/patches/series
index 9e70dcb..3761f4e 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
 mpd-0.19.patch
+unix-socket-in-MPD_HOST.patch
diff --git a/debian/patches/unix-socket-in-MPD_HOST.patch b/debian/patches/unix-socket-in-MPD_HOST.patch
new file mode 100644
index 0000000..37248ce
--- /dev/null
+++ b/debian/patches/unix-socket-in-MPD_HOST.patch
@@ -0,0 +1,48 @@
+From: Simon McVittie <smcv at debian.org>
+Date: Thu, 23 Oct 2014 21:32:19 +0100
+Subject: Recognise MPD_HOST="/..." as a Unix socket
+
+---
+ lib/Audio/MPD.pm | 22 ++++++++++++++++------
+ 1 file changed, 16 insertions(+), 6 deletions(-)
+
+diff --git a/lib/Audio/MPD.pm b/lib/Audio/MPD.pm
+index 530ef29..ffab9fc 100644
+--- a/lib/Audio/MPD.pm
++++ b/lib/Audio/MPD.pm
+@@ -38,7 +38,7 @@ has collection => ( ro, lazy_build, isa=>'Audio::MPD::Collection' );
+ has playlist   => ( ro, lazy_build, isa=>'Audio::MPD::Playlist'   );
+ has version    => ( rw );
+ 
+-has _socket    => ( rw, isa=>'IO::Socket::IP' );
++has _socket    => ( rw, isa=>'IO::Socket' );
+ 
+ 
+ #--
+@@ -93,11 +93,21 @@ sub _connect_to_mpd_server {
+     my ($self) = @_;
+ 
+     # try to connect to mpd.
+-    my $socket = IO::Socket::IP->new(
+-        PeerAddr => $self->host,
+-        PeerPort => $self->port,
+-    )
+-    or die "Could not create socket: $!\n";
++    my $socket;
++
++    if ($self->host =~ m{^/}) {
++        eval q{use IO::Socket::UNIX qw(); 1}
++            or die "Could not load IO::Socket::UNIX: $@\n";
++        $socket = IO::Socket::UNIX->new($self->host)
++            or die "Could not create socket: $!\n";
++    }
++    else {
++        $socket = IO::Socket::IP->new(
++            PeerAddr => $self->host,
++            PeerPort => $self->port,
++        )
++        or die "Could not create socket: $!\n";
++    }
+ 
+     # parse version information.
+     my $line = $socket->getline;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libaudio-mpd-perl.git



More information about the Pkg-perl-cvs-commits mailing list