[PATCH] gnu: ytfzf: Update to 2.3.

  • Done
  • quality assurance status badge
Details
2 participants
  • Ludovic Courtès
  • Michael Rohleder
Owner
unassigned
Submitted by
Michael Rohleder
Severity
normal
M
M
Michael Rohleder wrote on 30 Apr 2022 04:49
(address . guix-patches@gnu.org)(name . Michael Rohleder)(address . mike@rohleder.de)
20220430024908.22145-1-mike@rohleder.de
* gnu/packages/patches/ytfzf-programs.patch,
* gnu/packages/patches/ytfzf-updates.patch: Delete patches.
* gnu/local.mk (dist_patch_DATA): Unregister them.
* gnu/packages/image-viewers.scm (ytfzf): Update to 2.3.
[source]: Delete patches.
[arguments]: Remove phase 'patch-script. Add phase 'install-addons,
'wrap-program.
---
gnu/local.mk | 2 -
gnu/packages/image-viewers.scm | 147 +----
gnu/packages/patches/ytfzf-programs.patch | 643 ----------------------
gnu/packages/patches/ytfzf-updates.patch | 44 --
4 files changed, 26 insertions(+), 810 deletions(-)
delete mode 100644 gnu/packages/patches/ytfzf-programs.patch
delete mode 100644 gnu/packages/patches/ytfzf-updates.patch

Toggle diff (445 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index ad7b0a1480..2cb23db58c 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1978,8 +1978,6 @@ dist_patch_DATA = \
%D%/packages/patches/xterm-370-explicit-xcursor.patch \
%D%/packages/patches/xygrib-fix-finding-data.patch \
%D%/packages/patches/yggdrasil-extra-config.patch \
- %D%/packages/patches/ytfzf-programs.patch \
- %D%/packages/patches/ytfzf-updates.patch \
%D%/packages/patches/ytnef-CVE-2021-3403.patch \
%D%/packages/patches/ytnef-CVE-2021-3404.patch \
%D%/packages/patches/zig-use-system-paths.patch
diff --git a/gnu/packages/image-viewers.scm b/gnu/packages/image-viewers.scm
index 7e3154be91..1db169535e 100644
--- a/gnu/packages/image-viewers.scm
+++ b/gnu/packages/image-viewers.scm
@@ -23,6 +23,7 @@
;;; Copyright © 2021 Guillaume Le Vaillant <glv@posteo.net>
;;; Copyright © 2021 Zheng Junjie <873216071@qq.com>
;;; Copyright © 2021 dissent <disseminatedissent@protonmail.com>
+;;; Copyright © 2022 Michael Rohleder <mike@rohleder.de>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -97,7 +98,7 @@ (define-module (gnu packages image-viewers)
(define-public ytfzf
(package
(name "ytfzf")
- (version "1.2.0")
+ (version "2.3")
(home-page "https://github.com/pystardust/ytfzf")
(source
(origin
@@ -108,128 +109,32 @@ (define-public ytfzf
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
- (base32 "00d416qb4109pm77ikhnmds8qng90ni2jan9kdnxz7b6sh5f61nz"))
- (patches
- (search-patches
- ;; Pre-requisite for 'patch-script' phase.
- "ytfzf-programs.patch"
- ;; Disables self-update.
- "ytfzf-updates.patch"))))
+ (base32 "01prcg6gfwy1r49v92pkzxay9iadqqhpaxvn8jmij2jm5l50iynd"))))
(build-system gnu-build-system)
(arguments
- `(#:tests? #f ;no test suite
- #:modules
- ((guix build gnu-build-system)
- (guix build utils)
- (srfi srfi-26))
- #:phases
- (modify-phases %standard-phases
- (add-after 'unpack 'patch-script
- (lambda* (#:key inputs outputs #:allow-other-keys)
- (let* ((out (assoc-ref outputs "out"))
- (bash (assoc-ref inputs "bash"))
- (catimg (assoc-ref inputs "catimg"))
- (chafa (assoc-ref inputs "chafa"))
- (coreutils (assoc-ref inputs "coreutils"))
- (curl (assoc-ref inputs "curl"))
- (dmenu (assoc-ref inputs "dmenu"))
- (fzf (assoc-ref inputs "fzf"))
- (gawk (assoc-ref inputs "gawk"))
- (grep (assoc-ref inputs "grep"))
- (jp2a (assoc-ref inputs "jp2a"))
- (jq (assoc-ref inputs "jq"))
- (libnotify (assoc-ref inputs "libnotify"))
- (mpv (assoc-ref inputs "mpv"))
- (ncurses (assoc-ref inputs "ncurses"))
- (python-ueberzug (assoc-ref inputs "python-ueberzug"))
- (sed (assoc-ref inputs "sed"))
- (util-linux (assoc-ref inputs "util-linux"))
- (youtube-dl (assoc-ref inputs "youtube-dl")))
- ;; Use correct $PREFIX path.
- (substitute* "Makefile"
- (("/usr/bin")
- (string-append out "/bin")))
- ;; Use absolute path for referenced programs.
- (substitute* "ytfzf"
- (("@awk@")
- (string-append gawk "/bin/awk"))
- (("@cat@")
- (string-append coreutils "/bin/cat"))
- (("@catimg@")
- (string-append catimg "/bin/catimg"))
- (("@chafa@")
- (string-append chafa "/bin/chafa"))
- (("@chmod@")
- (string-append coreutils "/bin/chmod"))
- (("@column@")
- (string-append util-linux "/bin/column"))
- (("@cp@")
- (string-append coreutils "/bin/cp"))
- (("@cut@")
- (string-append coreutils "/bin/cut"))
- (("@curl@")
- (string-append curl "/bin/curl"))
- (("@date@")
- (string-append coreutils "/bin/date"))
- (("@dmenu@")
- (string-append dmenu "/bin/dmenu"))
- (("@fzf@")
- (string-append fzf "/bin/fzf"))
- (("@grep@")
- (string-append grep "/bin/grep"))
- (("@head@")
- (string-append coreutils "/bin/head"))
- (("@jp2a@")
- (string-append jp2a "/bin/jp2a"))
- (("@jq@")
- (string-append jq "/bin/jq"))
- (("@mkdir@")
- (string-append coreutils "/bin/mkdir"))
- (("@mkfifo@")
- (string-append coreutils "/bin/mkfifo"))
- (("@mpv@")
- (string-append mpv "/bin/mpv"))
- (("@nohup@")
- (string-append coreutils "/bin/nohup"))
- (("@notify-send@")
- (string-append libnotify "/bin/notify-send"))
- (("@rm@")
- (string-append coreutils "/bin/rm"))
- (("@sed@")
- (string-append sed "/bin/sed"))
- (("@seq@")
- (string-append coreutils "/bin/seq"))
- (("@setsid@")
- (string-append util-linux "/bin/setsid"))
- (("@sh@")
- (string-append bash "/bin/sh"))
- (("@sleep@")
- (string-append coreutils "/bin/sleep"))
- (("@sort@")
- (string-append coreutils "/bin/sort"))
- (("@tput@")
- (string-append ncurses "/bin/tput"))
- (("@tr@")
- (string-append coreutils "/bin/tr"))
- (("@ueberzug@")
- (string-append python-ueberzug "/bin/ueberzug"))
- (("@uname@")
- (string-append coreutils "/bin/uname"))
- (("@uniq@")
- (string-append coreutils "/bin/uniq"))
- (("@wc@")
- (string-append coreutils "/bin/wc"))
- (("@youtube-dl@")
- (string-append youtube-dl "/bin/youtube-dl"))))
- (substitute* "ytfzf"
- ;; Generate temporary files in the user-specific path,
- ;; to avoid issues in multi-user systems.
- (("/tmp/ytfzf")
- "$HOME/.cache/ytfzf")
- ;; Report errors to Guix.
- (("report at: https://github.com/pystardust/ytfzf")
- "report at: https://issues.guix.gnu.org"))))
- (delete 'configure)))) ;no configure script
+ (list
+ #:tests? #f ;no test suite
+ #:make-flags
+ #~(list (string-append "PREFIX=" #$output))
+ #:phases
+ #~(modify-phases %standard-phases
+ (delete 'configure)
+ (add-after 'install 'install-addons
+ (lambda _
+ (invoke "make" "addons"
+ (string-append "PREFIX=" #$output))))
+ (add-after 'install 'wrap-program
+ (lambda* (#:key inputs #:allow-other-keys)
+ (wrap-program (string-append #$output "/bin/ytfzf")
+ `("PATH" ":" prefix
+ ,(map (lambda (input)
+ (string-append (assoc-ref inputs input) "/bin"))
+ '("bash" "catimg" "chafa" "coreutils" "curl"
+ "dmenu" "fzf" "gawk" "grep" "jp2a" "jq"
+ "libnotify" "mpv" "ncurses" "python-ueberzug"
+ "sed" "util-linux" "youtube-dl")))
+ `("YTFZF_SYSTEM_ADDON_DIR" ":" =
+ ,(list (string-append #$output "/share/ytfzf/addons")))))))))
(inputs
(list bash
catimg
diff --git a/gnu/packages/patches/ytfzf-programs.patch b/gnu/packages/patches/ytfzf-programs.patch
deleted file mode 100644
index 005ce2cf99..0000000000
--- a/gnu/packages/patches/ytfzf-programs.patch
+++ /dev/null
@@ -1,643 +0,0 @@
-From 3f1eaf5a1645b28ca18cfa028417dc225b7a557f Mon Sep 17 00:00:00 2001
-From: Raghav Gururajan <rg@raghavgururajan.name>
-Date: Mon, 5 Jul 2021 06:45:49 -0400
-Subject: [PATCH] Modify the strings of referenced programs.
-
-Pattern the strings of referenced programs, so that they can be easily
-substituted with absolute paths using a custom-phase.
-
-Co-authored-by: jgart <jgart@dismail.de>
----
- ytfzf | 198 +++++++++++++++++++++++++++++-----------------------------
- 1 file changed, 99 insertions(+), 99 deletions(-)
-
-diff --git a/ytfzf b/ytfzf
-index f4d2e0d..e8bb60b 100755
---- a/ytfzf
-+++ b/ytfzf
-@@ -49,17 +49,17 @@ cache_dir=${YTFZF_CACHE-${cache_dir-$HOME/.cache/ytfzf}}
- #video type preference (mp4/1080p, mp4/720p, etc..)
- video_pref=${YTFZF_PREF-${video_pref-}}
- #the menu to use instead of fzf when -D is specified
--external_menu=${YTFZF_EXTMENU-${external_menu-dmenu -i -l 30 -p Search:}}
-+external_menu=${YTFZF_EXTMENU-${external_menu-@dmenu@ -i -l 30 -p Search:}}
- #number of columns (characters on a line) the external menu can have
- #necessary for formatting text for external menus
- external_menu_len=${YTFZF_EXTMENU_LEN-${external_menu_len-220}}
- #player settings (players need to support streaming with youtube-dl)
- #player to use for watching the video
--video_player=${YTFZF_PLAYER-${video_player-mpv}}
-+video_player=${YTFZF_PLAYER-${video_player-@mpv@}}
- #if YTFZF_PREF is specified, use this player instead
--video_player_format=${YTFZF_PLAYER_FORMAT-${video_player_format-mpv --ytdl-format=}}
-+video_player_format=${YTFZF_PLAYER_FORMAT-${video_player_format-@mpv@ --ytdl-format=}}
- #player to use for audio only
--audio_player=${YTFZF_AUDIO_PLAYER-${audio_player-mpv --no-video}}
-+audio_player=${YTFZF_AUDIO_PLAYER-${audio_player-@mpv@ --no-video}}
- #the command to use for displaying thumbnails
- thumb_disp_method=${YTFZF_THUMB_DISP_METHOD-${thumb_disp_method-ueberzug}}
- #Storing the argument and location for autogenerated subtitles
-@@ -85,8 +85,8 @@ subscriptions_file=${subscriptions_file-$config_dir/subscriptions}
- #> stores the pid of running ytfzf sessions
- pid_file="$cache_dir/.pid"
- #> make folders that don't exist
--[ -d "$cache_dir" ] || mkdir -p "$cache_dir"
--[ -d "$thumb_dir" ] || mkdir -p "$thumb_dir"
-+[ -d "$cache_dir" ] || @mkdir@ -p "$cache_dir"
-+[ -d "$thumb_dir" ] || @mkdir@ -p "$thumb_dir"
-
- #> config settings
- #list of shortcuts to use in fzf
-@@ -177,12 +177,12 @@ dep_ck () {
- done
- unset Dep
- }
--dep_ck "jq" "youtube-dl" "curl"
-+dep_ck "@jq@" "@youtube-dl@" "@curl@"
-
-
- #only check for mpv if $YTFZF_PLAYER is set to it
- #don't check $YTFZF_PLAYER as it could be multiple commands
--[ "$video_player" = "mpv" ] && dep_ck "mpv"
-+[ "$video_player" = "@mpv@" ] && dep_ck "@mpv@"
-
- ############################
- # Help Texts #
-@@ -326,8 +326,8 @@ print_info () {
- }
-
- print_error () {
-- [ $ext_menu_notifs -eq 1 ] && notify-send "error" "$*" || printf "\033[31m$*\033[0m" >&2
-- [ $ext_menu_notifs -eq 1 ] && notify-send "Check for new versions and report at: https://github.com/pystardust/ytfzf\n" || printf "Check for new versions and report at: https://github.com/pystardust/ytfzf\n" >&2
-+ [ $ext_menu_notifs -eq 1 ] && @notify-send@ "error" "$*" || printf "\033[31m$*\033[0m" >&2
-+ [ $ext_menu_notifs -eq 1 ] && @notify-send@ "Check for new versions and report at: https://github.com/pystardust/ytfzf\n" || printf "Check for new versions and report at: https://github.com/pystardust/ytfzf\n" >&2
- }
-
- ############################
-@@ -398,12 +398,12 @@ format_fzf () {
- format_menu () {
- if [ "$is_ext_menu" -eq 0 ]; then
- #dep_ck fzf here because it is only necessary to use here
-- dep_ck "fzf"
-- menu_command='column -t -s "$tab_space" | fzf -m --bind change:top --tabstop=1 --layout=reverse --delimiter="$tab_space" --nth=1,2 --expect="$shortcuts" $FZF_DEFAULT_OPTS'
-+ dep_ck "@fzf@"
-+ menu_command='@column@ -t -s "$tab_space" | @fzf@ -m --bind change:top --tabstop=1 --layout=reverse --delimiter="$tab_space" --nth=1,2 --expect="$shortcuts" $FZF_DEFAULT_OPTS'
- format_fzf
- else
- # Dmenu doesn't render tabs so removing it
-- menu_command='tr -d "$tab_space" | '"$external_menu"
-+ menu_command='@tr@ -d "$tab_space" | '"$external_menu"
- format_ext_menu
- fi
- }
-@@ -461,13 +461,13 @@ ID="ytfzf-ueberzug"
- WIDTH=$FZF_PREVIEW_COLUMNS
- HEIGHT=$FZF_PREVIEW_LINES
- start_ueberzug () {
-- [ -e $FIFO ] || { mkfifo "$FIFO" || exit 1 ; }
-- ueberzug layer --parser json --silent < "$FIFO" &
-+ [ -e $FIFO ] || { @mkfifo@ "$FIFO" || exit 1 ; }
-+ @ueberzug@ layer --parser json --silent < "$FIFO" &
- exec 3>"$FIFO"
- }
- stop_ueberzug () {
- exec 3>&-
-- rm "$FIFO" > /dev/null 2>&1
-+ @rm@ "$FIFO" > /dev/null 2>&1
- }
-
- preview_img () {
-@@ -476,12 +476,12 @@ preview_img () {
- shorturl=${args##*${tab_space}|}
- shorturl="${shorturl%% *}"
-
-- json_obj=$(printf "%s" "$videos_json" | jq '.[]|select( .videoID == "'"$shorturl"'")')
-+ json_obj=$(printf "%s" "$videos_json" | @jq@ '.[]|select( .videoID == "'"$shorturl"'")')
-
-
- IFS=$tab_space read -r title channel duration views date description <<-EOF
- $(
-- printf "%s" "$json_obj" | jq -r \
-+ printf "%s" "$json_obj" | @jq@ -r \
- '
- [.title,.channel,.duration,.views,.date,.description]|@tsv
- '
-@@ -530,31 +530,31 @@ preview_img () {
- } > "$FIFO" ;;
- catimg)
- printf "\n"
-- catimg -w "$((thumb_width * 2))" "$IMAGE" ;;
-+ @catimg@ -w "$((thumb_width * 2))" "$IMAGE" ;;
- jp2a)
- printf "\n"
-- jp2a --size="${thumb_width}x$((thumb_height / 2))" --colors --color-depth=24 "$IMAGE" ;;
-+ @jp2a@ --size="${thumb_width}x$((thumb_height / 2))" --colors --color-depth=24 "$IMAGE" ;;
- jp2a-8)
- printf "\n"
-- jp2a --size="${thumb_width}x$((thumb_height / 2))" --colors --color-depth=8 "$IMAGE" ;;
-+ @jp2a@ --size="${thumb_width}x$((thumb_height / 2))" --colors --color-depth=8 "$IMAGE" ;;
- jp2a-4)
- printf "\n"
-- jp2a --size="${thumb_width}x$((thumb_height / 2))" --colors --color-depth=4 "$IMAGE" ;;
-+ @jp2a@ --size="${thumb_width}x$((thumb_height / 2))" --colors --color-depth=4 "$IMAGE" ;;
- jp2a-gray|jp2a-grey)
- printf "\n"
-- jp2a --size="${thumb_width}x$((thumb_height / 2))" "$IMAGE" ;;
-+ @jp2a@ --size="${thumb_width}x$((thumb_height / 2))" "$IMAGE" ;;
- chafa)
- printf "\n"
-- chafa --size="${thumb_width}x${thumb_height}" "$IMAGE" ;;
-+ @chafa@ --size="${thumb_width}x${thumb_height}" "$IMAGE" ;;
- chafa-gray|chafa-grey)
- printf "\n"
-- chafa --size="${thumb_width}x${thumb_height}" --colors=2 "$IMAGE" ;;
-+ @chafa@ --size="${thumb_width}x${thumb_height}" --colors=2 "$IMAGE" ;;
- chafa-4)
- printf "\n"
-- chafa --size="${thumb_width}x${thumb_height}" --colors=16 "$IMAGE" ;;
-+ @chafa@ --size="${thumb_width}x${thumb_height}" --colors=16 "$IMAGE" ;;
- chafa-8)
- printf "\n"
-- chafa --size="${thumb_width}x${thumb_height}" --colors=256 "$IMAGE" ;;
-+ @chafa@ --size="${thumb_width}x${thumb_height}" --colors=256 "$IMAGE" ;;
- custom)
- if ! function_exists "handle_display_img"; then
- printf "\033[031mERROR[#07]: \033[0m\033[1mhandle_display_img\033[0m is not defined" >&2
-@@ -585,20 +585,20 @@ download_thumbnails () {
- if [ "$thumbnail_quality" -eq 1 ]; then
- image_download () {
- # higher quality images
-- curl -s "$Url" -G --data-urlencode "sqp=" > "$thumb_dir/$Name.png"
-+ @curl@ -s "$Url" -G --data-urlencode "sqp=" > "$thumb_dir/$Name.png"
- }
- else
- image_download () {
-- curl -s "$Url" > "$thumb_dir/$Name.png"
-+ @curl@ -s "$Url" > "$thumb_dir/$Name.png"
- }
- fi
-
- print_info "Downloading Thumbnails...\n"
- thumb_urls=$(printf "%s" "$*" |\
-- jq -r '.[]|[.thumbs,.videoID]|@tsv' )
-+ @jq@ -r '.[]|[.thumbs,.videoID]|@tsv' )
-
- while IFS=$tab_space read -r Url Name; do
-- sleep 0.001
-+ @sleep@ 0.001
- {
- image_download
- } &
-@@ -628,7 +628,7 @@ get_sp_filter () {
- #another example is sort by filter + upload date filter only changes one character as well
- if [ -n "$filter_id" ]; then
- #gets the character in the filter_id that needs to be replaced if upload_date_filter is also given
-- upload_date_character=$(printf "%s" "$filter_id" | awk '{print substr($1, 8, 1)}')
-+ upload_date_character=$(printf "%s" "$filter_id" | @awk@ '{print substr($1, 8, 1)}')
- fi
-
- #For each of these, if upload_date_character is unset, the filter_id should be the normal filter
-@@ -650,7 +650,7 @@ get_sp_filter () {
- if [ -n "$upload_date_character" ]; then
- #replaces the 8th character in the filter_id with the appropriate character
- #the 8th character specifies the upload_date_filter
-- sp=$(printf "%s" "$filter_id" | sed 's/\(.\{7\}\)./\1'"$upload_date_character"'/')
-+ sp=$(printf "%s" "$filter_id" | @sed@ 's/\(.\{7\}\)./\1'"$upload_date_character"'/')
- #otherwise set it to the filter_id
- else
- sp=$filter_id
-@@ -660,15 +660,15 @@ get_sp_filter () {
-
- get_yt_json () {
- # scrapes the json embedded in the youtube html page
-- printf "%s" "$*" | sed -n '/var *ytInitialData/,$p' | tr -d '\n' |\
-- sed -E ' s_^.*var ytInitialData ?=__ ; s_;</script>.*__ ;'
-+ printf "%s" "$*" | @sed@ -n '/var *ytInitialData/,$p' | @tr@ -d '\n' |\
-+ @sed@ -E ' s_^.*var ytInitialData ?=__ ; s_;</script>.*__ ;'
- }
-
- get_yt_html () {
- link=$1
- query=$2
- printf "%s" "$(
-- curl "$link" -s \
-+ @curl@ "$link" -s \
- -G --data-urlencode "search_query=$query" \
- -G --data-urlencode "sp=$sp" \
- -H 'Authority: www.youtube.com' \
-@@ -684,7 +684,7 @@ get_video_data () {
- # outputs tab and pipe separated fields: title, channel, view count, video length, video upload date, and the video id/url
- # from the videos_json
- printf "%s" "$*" |\
-- jq -r '.[]| "\(.title)'"$tab_space"'|\(.channel)'"$tab_space"'|\(.views)'"$tab_space"'|\(.duration)'"$tab_space"'|\(.date)'"$tab_space"'|\(.videoID)"'
-+ @jq@ -r '.[]| "\(.title)'"$tab_space"'|\(.channel)'"$tab_space"'|\(.views)'"$tab_space"'|\(.duration)'"$tab_space"'|\(.date)'"$tab_space"'|\(.videoID)"'
- }
-
- scrape_channel () {
-@@ -694,7 +694,7 @@ scrape_channel () {
- channel_url=$*
-
- # Converting channel title page url to channel video url
-- if ! printf "%s" "$channel_url" | grep -q '/videos *$'; then
-+ if ! printf "%s" "$channel_url" | @grep@ -q '/videos *$'; then
- channel_url=${channel_url%/featured}/videos
- fi
-
-@@ -706,8 +706,8 @@ scrape_channel () {
- fi
-
- #gets the channel name from title of page
-- channel_name=$(printf "%s" "$yt_html" | grep -o '<title>.*</title>' |
-- sed \
-+ channel_name=$(printf "%s"
This message was truncated. Download the full message here.
L
L
Ludovic Courtès wrote on 6 May 2022 10:22
(name . Michael Rohleder)(address . mike@rohleder.de)(address . 55191-done@debbugs.gnu.org)
875ymj5aup.fsf@gnu.org
Hi,

Michael Rohleder <mike@rohleder.de> skribis:

Toggle quote (8 lines)
> * gnu/packages/patches/ytfzf-programs.patch,
> * gnu/packages/patches/ytfzf-updates.patch: Delete patches.
> * gnu/local.mk (dist_patch_DATA): Unregister them.
> * gnu/packages/image-viewers.scm (ytfzf): Update to 2.3.
> [source]: Delete patches.
> [arguments]: Remove phase 'patch-script. Add phase 'install-addons,
> 'wrap-program.

Applied, thanks!

Toggle quote (2 lines)
> 4 files changed, 26 insertions(+), 810 deletions(-)

Well done. :-)

Ludo’.
Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 55191@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 55191
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch