From 033e1e3b331a501674bda89dd7897ea35250b359 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Mon, 25 Dec 2017 00:18:34 -0500 Subject: multimedia/youtube-viewer: Updated for version 3.3.2. Signed-off-by: B. Watson --- multimedia/youtube-viewer/fix_history.diff | 51 ++++++++++++++++++++++ .../youtube-viewer/youtube-viewer.SlackBuild | 13 +++++- multimedia/youtube-viewer/youtube-viewer.info | 6 +-- 3 files changed, 66 insertions(+), 4 deletions(-) create mode 100644 multimedia/youtube-viewer/fix_history.diff (limited to 'multimedia/youtube-viewer') diff --git a/multimedia/youtube-viewer/fix_history.diff b/multimedia/youtube-viewer/fix_history.diff new file mode 100644 index 0000000000..973268a7b6 --- /dev/null +++ b/multimedia/youtube-viewer/fix_history.diff @@ -0,0 +1,51 @@ +diff --git a/bin/youtube-viewer b/bin/youtube-viewer +index 7aff691..28b4ed5 100755 +--- a/bin/youtube-viewer ++++ b/bin/youtube-viewer +@@ -538,25 +538,22 @@ if ($opt{history}) { + or warn "[!] Can't create the history file `$opt{history_file}': $!"; + } + +- if ($term->can('ReadHistory')) { ++ # Add history to Term::ReadLine ++ $term->ReadHistory($opt{history_file}); + +- # Add history to Term::ReadLine +- $term->ReadHistory($opt{history_file}); ++ # All history entries ++ my @entries = $term->history_list; + +- # All history entries +- my @entries = $term->history_list; ++ # Rewrite the history file, when the history_limit has been reached. ++ if ($opt{history_limit} > 0 and @entries > $opt{history_limit}) { + +- # Rewrite the history file, when the history_limit has been reached. +- if ($opt{history_limit} > 0 and @entries > $opt{history_limit}) { +- +- # Try to create a backup, first +- require File::Copy; +- File::Copy::cp($opt{history_file}, "$opt{history_file}.bak"); ++ # Try to create a backup, first ++ require File::Copy; ++ File::Copy::cp($opt{history_file}, "$opt{history_file}.bak"); + +- if (open my $fh, '>', $opt{history_file}) { +- say {$fh} join("\n", @entries[(@entries - $opt{history_limit} + rand($opt{history_limit} >> 1)) .. $#entries]); +- close $fh; +- } ++ if (open my $fh, '>', $opt{history_file}) { ++ say {$fh} join("\n", @entries[(@entries - $opt{history_limit} + rand($opt{history_limit} >> 1)) .. $#entries]); ++ close $fh; + } + } + } +@@ -1670,7 +1667,7 @@ sub get_user_input { + + my ($args, $keywords) = parse_options($input); + +- if ($opt{history} and $term->can('append_history') and @{$keywords}) { ++ if ($opt{history} and @{$keywords}) { + my $str = join(' ', grep { /\w/ and not /^[:;=]/ } @{$keywords}); + if ($str ne '' and $str !~ /^[0-9]{1,2}\z/) { + $term->append_history(1, $opt{history_file}); diff --git a/multimedia/youtube-viewer/youtube-viewer.SlackBuild b/multimedia/youtube-viewer/youtube-viewer.SlackBuild index 75b1d971c4..c7d546901a 100644 --- a/multimedia/youtube-viewer/youtube-viewer.SlackBuild +++ b/multimedia/youtube-viewer/youtube-viewer.SlackBuild @@ -6,6 +6,12 @@ # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details. +# 20171225 bkw: +# - updated for 3.3.2. +# - add upstream patch (commit d857451) to fix a long-standing bug where +# youtube-viewer's command history wasn't being saved across sessions. +# NOTE TO SELF: remove this patch once 3.3.3 is released. + # 20171219 bkw: # - updated for 3.3.1. @@ -54,7 +60,7 @@ # - Added support for gtk-youtube-viewer PRGNAM=youtube-viewer -VERSION=${VERSION:-3.3.1} +VERSION=${VERSION:-3.3.2} BUILD=${BUILD:-1} TAG=${TAG:-_SBo} ARCH=noarch @@ -78,6 +84,11 @@ find -L . \ \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ -exec chmod 644 {} \; +# This is upstream's first commit after the 3.3.2 release. It fixes a +# pretty major bug that's been annoying me for a couple of years, so +# I'm not going to patiently wait for a 3.3.3 release. +patch -p1 < $CWD/fix_history.diff + # perl-gtk2 is a runtime dep, we can build with GTK=yes even if it's not # installed... but don't do that by default. GTK="${GTK:-auto}" diff --git a/multimedia/youtube-viewer/youtube-viewer.info b/multimedia/youtube-viewer/youtube-viewer.info index 4e53544e15..8045f78c15 100644 --- a/multimedia/youtube-viewer/youtube-viewer.info +++ b/multimedia/youtube-viewer/youtube-viewer.info @@ -1,8 +1,8 @@ PRGNAM="youtube-viewer" -VERSION="3.3.1" +VERSION="3.3.2" HOMEPAGE="https://github.com/trizen/youtube-viewer/" -DOWNLOAD="https://github.com/trizen/youtube-viewer/archive/3.3.1/youtube-viewer-3.3.1.tar.gz" -MD5SUM="413713c886091f16fb065a36db74b958" +DOWNLOAD="https://github.com/trizen/youtube-viewer/archive/3.3.2/youtube-viewer-3.3.2.tar.gz" +MD5SUM="ad580bd9a864334c919ca33f03e7f080" DOWNLOAD_x86_64="" MD5SUM_x86_64="" REQUIRES="perl-data-dump perl-LWP-Protocol-https perl-lwp-useragent-cached perl-JSON perl-JSON-XS perl-Module-Build" -- cgit v1.2.3