Align package directory structure with upstream.

Use PYTHONPATH to unify  bin/youtube-dl.
This commit is contained in:
df 2020-11-12 21:14:35 +00:00
parent dd7ea39b4f
commit fc04036d02
9 changed files with 46 additions and 10 deletions

View File

@ -14,14 +14,12 @@ clean-opkg:
clean: clean-opk clean-opkg
opkg-lib: ../youtube_dl
-$(RM) -r opkg/lib/$(DISTPKG)
install -d opkg/lib/$(DISTPKG)/youtube-dl
cp -rpP $< opkg/lib/$(DISTPKG)/youtube-dl
mv opkg/lib/$(DISTPKG)/youtube-dl/youtube_dl/__main__.py opkg/lib/$(DISTPKG)/youtube-dl
install -d opkg/lib/$(DISTPKG)
cp -rpP $< opkg/lib/$(DISTPKG)
opkg-bin: $(wildcard bin/*)
opkg-bin: $(wildcard ../bin/*) $(wildcard bin/*)
install -d opkg/bin
install -p $? opkg/bin

View File

@ -1,2 +1,2 @@
#!/bin/sh
python /mod/lib/python2.7/dist-packages/youtube-dl "$@"
python /mod/lib/python2.7/dist-packages/youtube_dl "$@"

View File

@ -1,7 +1,7 @@
Package: youtube-dl
Priority: optional
Section: misc
Version: 2020.11.01.1-1
Version: 2020.11.12
Architecture: mipsel
Maintainer: prpr
Depends: ffmpeg(>=4.1),wget(>=1.20),python,libiconv

View File

@ -1,5 +1,7 @@
#!/bin/sh
distpkgs=/mod/lib/python2.7/dist-packages
cfgfile='/mod/etc/youtube-dl.conf'
oldcfgfile="${cfgfile}.old"
@ -45,7 +47,35 @@ if [ -s "$settings" ]; then
fi
rm "$settings"
sed -i 's/fps<=?30/fps<=?60/' "$cfgfile"
find "/mod/lib/python2.7/dist-packages/youtube-dl" -name '*.pyc' -exec echo rm \"{}\" \; | $SHELL
# make python recognise the distribution pkg directory
patch_python() {
profile=/mod/etc/profile/python
if ! grep -qF "$distpkgs" "$profile"; then
printf 'export PYTHONPATH="%s"\n' "$distpkgs" >> "$profile"
printf "\nLog out and in again to set PYTHONPATH\n\n"
fi
}
patch_python
find "${distpkgs}/youtube_dl" -name '*.pyc' -exec rm -f "{}" \;
# remove pre-20201112 installation
for tag in /tmp/.ytdl_*; do
[ -e "$tag" ] || continue
echo "$tag" |
( while IFS=_ read _ ver _; do
if [ "$ver" -lt 20201112 -a -e "${distpkgs}/youtube-dl" ]; then
rm -f "$tag"
find "${distpkgs}/youtube-dl" -name '*.pyc' -exec rm -f "{}" \;
rmdir "${distpkgs}/youtube-dl" || true
exit
fi
done )
done
# background compile
youtube-dl --version >/dev/null &
exit 0

View File

@ -1,7 +1,7 @@
#!/bin/sh
cfgfile='/mod/etc/youtube-dl.conf'
oldcfgfile="${cfgfile}.old"
pkgdir="/mod/lib/python2.7/dist-packages/youtube-dl"
pkgdir="/mod/lib/python2.7/dist-packages/youtube_dl"
[ -f "$cfgfile" ] && rm "$cfgfile"
[ -f "$oldcfgfile" ] && rm "$oldcfgfile"
[ -d "$pkgdir" ] && rm -r "$pkgdir"

8
Hummy/opkg/CONTROL/preinst Executable file
View File

@ -0,0 +1,8 @@
#!/bin/sh
CTL=/mod/var/opkg/info/youtube-dl.control
[ -r "$CTL" ] &&
grep -E '^Version:' "$CTL" |
( while IFS=".${IFS}" read _ yy mm dd _; do
echo >"/tmp/.ytdl_${yy}${mm}${dd}"
break
done )

Binary file not shown.

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/bin/env python
import youtube_dl