diff --git a/.abf.yml b/.abf.yml index 695236b..45e30b4 100644 --- a/.abf.yml +++ b/.abf.yml @@ -1,2 +1,2 @@ sources: - yt-dlp-2021.12.27.tar.gz: 490092c8aaac50d021e5a9f26186635fcada7c52 + yt-dlp-2022.02.04.tar.gz: 1dc5951cc990768d59f273c963a717d9c0fcbc28 diff --git a/upd.sh b/upd.sh new file mode 100755 index 0000000..d5568cd --- /dev/null +++ b/upd.sh @@ -0,0 +1,45 @@ +#!/usr/bin/env bash +# Script to partly automate updating this package +# Based on upd.sh from abf.io/import/nebula +# sudo dnf install /usr/bin/rpmbuild /usr/bin/spectool /usr/bin/rpmspec /usr/bin/git /usr/bin/curl /usr/bin/abf /usr/bin/jq /usr/bin/sed /usr/bin/tar /usr/bin/xz + +set -x +set -e +set -f +set -u + +spec="$PWD"/yt-dlp.spec +dir0="$PWD" + +old_version="$(rpmspec -q --srpm --qf '%{version}' "$spec")" +latest_version="$(curl --silent "https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest" | jq '.tag_name' | sed -e 's,",,g' -e 's,^v,,')" +[ -n "$latest_version" ] +if [ "$old_version" = "$latest_version" ]; then + echo "No updates" + exit 0 +fi + +sed -E -i'' "$spec" \ + -e "s,^Version:.+,Version:\t${latest_version}," \ + -e "s,^Release:.+,Release:\t1," \ + -- + +source0="$(rpmspec --parse "$spec" | grep -i ^Source0: | awk -F '/' '{print $NF}')" +spectool --get-files --source 0 "$spec" +[ -f "$source0" ] + +patches_ok=0 + +tmp="$(mktemp --tmpdir=/tmp -d)" +trap 'if [ "$patches_ok" = 1 ]; then rm -fr "$tmp"; fi' EXIT +# check appliability of patches +rpmbuild --define "_sourcedir $PWD" --define "_builddir $tmp" -bp "$spec" && patches_ok=1 +abf put + +PAGER='' git diff +# can be copypasted for a commit message +echo "upd: $old_version -> $latest_version" + +if [ "$patches_ok" = 0 ]; then + echo "PATCHES require attention!" +fi diff --git a/yt-dlp.spec b/yt-dlp.spec index 262ccf0..c90957b 100644 --- a/yt-dlp.spec +++ b/yt-dlp.spec @@ -3,13 +3,13 @@ Summary: Small command-line program to download videos and audio from different websites Name: yt-dlp -Version: 2021.12.27 +Version: 2022.02.04 Release: 1 License: Public Domain and GPLv2+ Group: Video Url: https://github.com/yt-dlp/yt-dlp -# source from Github requires at least pandoc which is not packaged -Source0: %{pypi_source} +# pure source from Github requires at least pandoc which is not packaged +Source0: https://github.com/yt-dlp/yt-dlp/releases/download/%{version}/yt-dlp.tar.gz?/yt-dlp-%{version}.tar.gz BuildRequires: ffmpeg BuildRequires: gnupg2 BuildRequires: pkgconfig(python3) @@ -55,7 +55,7 @@ This package contains the Python 3 bindings for %{name} (fork of youtube-dl) #----------------------------------------------------------------------------- %prep -%autosetup -p1 +%autosetup -p1 -n %{name} %build %py3_build