From 8e5de72c482f9095b2ea9e040e49760ef1aa6f2c Mon Sep 17 00:00:00 2001 From: Jan Palus Date: Sat, 25 Oct 2014 20:14:40 +0200 Subject: [PATCH] - up to 1.2.2 - epoch 1 due to changed versioning scheme - defconf patch no longer requried - ca patch updated - ssl_opts patch for LWP::Protocol::https >= 6 taken from upstream - updated source url - BR: Term::ReadLine::Gnu for config wizard --- mbank-cli-ca.patch | 56 ++++++++++++++++++++++++++++------------ mbank-cli-defconf.patch | 23 ----------------- mbank-cli-ssl_opts.patch | 20 ++++++++++++++ mbank-cli.spec | 10 ++++--- 4 files changed, 65 insertions(+), 44 deletions(-) delete mode 100644 mbank-cli-defconf.patch create mode 100644 mbank-cli-ssl_opts.patch diff --git a/mbank-cli-ca.patch b/mbank-cli-ca.patch index ea1432a..4e6e4c5 100644 --- a/mbank-cli-ca.patch +++ b/mbank-cli-ca.patch @@ -1,19 +1,41 @@ -diff -uNr mbank-cli-20120215/mbank-cli mbank-cli-20120215.new/mbank-cli ---- mbank-cli-20120215/mbank-cli 2012-02-15 22:48:39.000000000 +0100 -+++ mbank-cli-20120215.new/mbank-cli 2012-02-23 14:40:56.453431641 +0100 -@@ -189,12 +189,12 @@ +diff -urN mbank-cli-1.2.2.orig/mbank-cli mbank-cli-1.2.2/mbank-cli +--- mbank-cli-1.2.2.orig/mbank-cli 2014-10-25 12:19:48.139241025 +0200 ++++ mbank-cli-1.2.2/mbank-cli 2014-10-25 12:20:41.925905849 +0200 +@@ -547,36 +547,7 @@ - sub lwp_init() + sub get_default_ca_path { -- my $ca_dir = $ENV{HTTPS_CA_DIR}; -- $ca_dir //= '/etc/ssl/certs/'; -+ my $ca_file = $ENV{HTTPS_CA_FILE}; -+ $ca_file //= '/etc/certs/ca-certificates.crt'; - map { delete $ENV{$_}; } grep(/^HTTPS_/, keys %ENV); - $ENV{'HTTPS_VERSION'} = 3; - $ENV{'HTTPS_DEBUG'} = 0; -- $ENV{'HTTPS_CA_DIR'} = $ca_dir; -+ $ENV{'HTTPS_CA_FILE'} = $ca_file; - umask(umask() | 077); - my $ua = new LWP::UserAgent( - agent => 'Mozilla/5.0', +- my ($name, @hashes) = @_; +- my $filename = "$name.crt"; +- $filename =~ y/ /_/; +- my $path = "/usr/share/ca-certificates/mozilla/$filename"; +- if (-r $path) { +- return $path; +- } +- my $ssl_cert_dir = $ENV{SSL_CERT_DIR}; +- if (not defined($ssl_cert_dir) and $Net::SSLeay::VERSION >= 1.43) { +- # https://www.openssl.org/docs/crypto/SSLeay_version.html +- # SSLEAY_DIR == 5 +- my $openssl_info = Net::SSLeay::SSLeay_version(5); +- my ($openssl_dir) = $openssl_info =~ m/\AOPENSSLDIR: "(.*)"\Z/; +- if (defined($openssl_dir)) { +- $ssl_cert_dir = "$openssl_dir/certs"; +- } +- } +- if (defined($ssl_cert_dir)) { +- for my $hash (@hashes) { +- $path = "$ssl_cert_dir/$hash.0"; +- # TODO: actually check if this is the certificate we want +- # hash collisions are unlikely, but not impossible +- -r $path or next; +- my $rpath = readlink($path) or next; +- $rpath =~ m{\A/} +- or $rpath = "$ssl_cert_dir/$rpath"; +- return $rpath; +- } +- } +- return "$FindBin::Bin/ca.crt"; ++ return '/etc/certs/ca-certificates.crt'; + } + + # =========================== diff --git a/mbank-cli-defconf.patch b/mbank-cli-defconf.patch deleted file mode 100644 index 6cf46c2..0000000 --- a/mbank-cli-defconf.patch +++ /dev/null @@ -1,23 +0,0 @@ -diff -uNr mbank-cli-20120215/mbank-cli mbank-cli-20120215.new/mbank-cli ---- mbank-cli-20120215/mbank-cli 2012-02-15 22:48:39.000000000 +0100 -+++ mbank-cli-20120215.new/mbank-cli 2012-02-23 14:36:01.943098229 +0100 -@@ -70,8 +70,8 @@ - - my $mbank_host = undef; # use set_country() to define - my $mbank = undef; # use set_country() to define --my $cookie_jar_file = './cookie-jar.txt'; --my $config_file = './mbank-cli.conf'; -+my $cookie_jar_file = "$ENV{ HOME }/.mbank-cli_cookie-jar.txt"; -+my $config_file = "$ENV{ HOME }/.mbank-cli.conf"; - my $http_read_size_hint = 1 << 20; # 1 MiB - - sub set_country($) -@@ -302,7 +302,7 @@ - eval { $digest_module = Digest->new('SHA-1'); } if $@; - $digest_module = Digest->new('MD5') if $@; - } -- user_error "Can't open the config file: $!" unless open my $config, '<', $config_file; -+ user_error "Can't open the config file ($config_file): $!" unless open my $config, '<', $config_file; - my $prev_digest = ''; - $main::digest_module->new(); - my $header = ''; diff --git a/mbank-cli-ssl_opts.patch b/mbank-cli-ssl_opts.patch new file mode 100644 index 0000000..24cc478 --- /dev/null +++ b/mbank-cli-ssl_opts.patch @@ -0,0 +1,20 @@ +changeset: 715:41fa04634db2 +tag: tip +user: Jakub Wilk +date: Sat Oct 25 19:59:32 2014 +0200 +summary: Always pass ssl_options to LWP >= 6. + +diff -r 78985f550841 -r 41fa04634db2 mbank-cli +--- a/mbank-cli Sat Oct 25 19:53:40 2014 +0200 ++++ b/mbank-cli Sat Oct 25 19:59:32 2014 +0200 +@@ -463,7 +463,8 @@ + IO::Socket::SSL::set_args_filter_hack('use_defaults'); + # TODO: Work around the bug also for earlier versions of + # IO::Socket::SSL, which don't support set_args_filter_hack(). +- } elsif ($LWP::UserAgent::VERSION >= 6) { ++ } ++ if ($LWP::UserAgent::VERSION >= 6) { + $ua->ssl_opts( + @ssl_options, + ) + diff --git a/mbank-cli.spec b/mbank-cli.spec index 1db66aa..007dfb1 100644 --- a/mbank-cli.spec +++ b/mbank-cli.spec @@ -2,13 +2,14 @@ Summary: A command line interface to mBank Summary(pl.UTF-8): Interfejs CLI do mBanku Name: mbank-cli -Version: 20140112 +Version: 1.2.2 Release: 1 +Epoch: 1 License: GPL v2 Group: Applications/Console -Source0: http://mbank-cli.googlecode.com/files/%{name}-%{version}.tar.gz -# Source0-md5: ed196f70dd78984925ae2f56fb31da3b -Patch0: %{name}-defconf.patch +Source0: https://bitbucket.org/jwilk/mbank-cli/downloads/%{name}-%{version}.tar.gz +# Source0-md5: d7510c3084d4fb148d3723e3a0dd51d9 +Patch0: %{name}-ssl_opts.patch Patch1: %{name}-ca.patch URL: http://code.google.com/p/mbank-cli/ BuildRequires: perl-base >= 5.10 @@ -16,6 +17,7 @@ BuildRequires: rpm-perlprov Requires: ca-certificates Requires: perl(LWP::Protocol::https) Requires: perl(Net::SSL) +Requires: perl(Term::ReadLine::Gnu) BuildArch: noarch BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) -- 2.44.0