Merge pull request #7101 from heitbaum/chrome

[le11] chrome: update to 109.0.5414.74 and addon (1)
This commit is contained in:
CvH 2023-01-12 20:21:53 +01:00 committed by GitHub
commit 40da10b7a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 109 additions and 53 deletions

View File

@ -3,8 +3,8 @@
# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) # Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv)
PKG_NAME="at-spi2-core" PKG_NAME="at-spi2-core"
PKG_VERSION="2.46.0" PKG_VERSION="2.47.1"
PKG_SHA256="aa0c86c79f7a8d67bae49a5b7a5ab08430c608cffe6e33bf47a72f41ab03c3d0" PKG_SHA256="c6ba7c160434edebf09d2936933569c936f6ec972301766f2bdac5a4d418153c"
PKG_LICENSE="OSS" PKG_LICENSE="OSS"
PKG_SITE="https://www.gnome.org/" PKG_SITE="https://www.gnome.org/"
PKG_URL="https://download.gnome.org/sources/at-spi2-core/${PKG_VERSION:0:4}/at-spi2-core-${PKG_VERSION}.tar.xz" PKG_URL="https://download.gnome.org/sources/at-spi2-core/${PKG_VERSION:0:4}/at-spi2-core-${PKG_VERSION}.tar.xz"
@ -12,7 +12,7 @@ PKG_DEPENDS_TARGET="toolchain atk dbus glib libXtst"
PKG_LONGDESC="Protocol definitions and daemon for D-Bus at-spi." PKG_LONGDESC="Protocol definitions and daemon for D-Bus at-spi."
PKG_MESON_OPTS_TARGET="-Ddocs=false \ PKG_MESON_OPTS_TARGET="-Ddocs=false \
-Dintrospection=no \ -Dintrospection=disabled \
-Ddbus_daemon=/usr/bin/dbus-daemon" -Ddbus_daemon=/usr/bin/dbus-daemon"
pre_configure_target() { pre_configure_target() {

View File

@ -0,0 +1,11 @@
# SPDX-License-Identifier: GPL-2.0-only
# Copyright (C) 2022-present Team LibreELEC (https://libreelec.tv)
PKG_NAME="unix_ar"
PKG_VERSION="0.2.1"
PKG_SHA256="4e1c6e8fe5255b7babe93b9af51532ba09c6946eee413c5db00cab3878d7ed2f"
PKG_LICENSE="BSD 3-Clause"
PKG_SITE="https://github.com/getninjas/unix_ar"
PKG_URL="https://github.com/getninjas/unix_ar/archive/refs/tags/${PKG_VERSION}.tar.gz"
PKG_TOOLCHAIN="manual"
PKG_LONGDESC="Python: This packages allows the reading and writing of AR archive files."

View File

@ -4,8 +4,8 @@
PKG_NAME="chrome" PKG_NAME="chrome"
PKG_VERSION="1.0" PKG_VERSION="1.0"
# curl -s http://dl.google.com/linux/chrome/deb/dists/stable/main/binary-amd64/Packages | grep -B 1 Version # curl -s http://dl.google.com/linux/chrome/deb/dists/stable/main/binary-amd64/Packages | grep -B 1 Version
PKG_VERSION_NUMBER="103.0.5060.134" PKG_VERSION_NUMBER="109.0.5414.74"
PKG_REV="0" PKG_REV="1"
PKG_ARCH="x86_64" PKG_ARCH="x86_64"
PKG_LICENSE="Custom" PKG_LICENSE="Custom"
PKG_SITE="http://www.google.com/chrome" PKG_SITE="http://www.google.com/chrome"
@ -13,7 +13,7 @@ PKG_DEPENDS_TARGET="toolchain at-spi2-atk atk cairo chrome-libXcomposite \
chrome-libXdamage chrome-libXfixes chrome-libXi chrome-libXrender \ chrome-libXdamage chrome-libXfixes chrome-libXi chrome-libXrender \
chrome-libXtst chrome-libxcb chrome-libxkbcommon chrome-libxshmfence cups \ chrome-libXtst chrome-libxcb chrome-libxkbcommon chrome-libxshmfence cups \
gdk-pixbuf gtk3 harfbuzz-icu libXcursor libxss nss pango \ gdk-pixbuf gtk3 harfbuzz-icu libXcursor libxss nss pango \
scrnsaverproto unclutter" scrnsaverproto unclutter unix_ar"
PKG_SECTION="browser" PKG_SECTION="browser"
PKG_SHORTDESC="Google Chrome Browser" PKG_SHORTDESC="Google Chrome Browser"
PKG_LONGDESC="Google Chrome Browser" PKG_LONGDESC="Google Chrome Browser"
@ -29,7 +29,7 @@ make_target() {
} }
addon() { addon() {
mkdir -p ${ADDON_BUILD}/${PKG_ADDON_ID}/{bin,config,lib} mkdir -p ${ADDON_BUILD}/${PKG_ADDON_ID}/{bin,config,lib,resources}
# config # config
cp -P ${PKG_DIR}/config/* ${ADDON_BUILD}/${PKG_ADDON_ID}/config cp -P ${PKG_DIR}/config/* ${ADDON_BUILD}/${PKG_ADDON_ID}/config
@ -59,6 +59,9 @@ addon() {
$(get_install_dir chrome-libXtst)/usr/lib/libXtst.so.6 \ $(get_install_dir chrome-libXtst)/usr/lib/libXtst.so.6 \
$(get_install_dir pango)/usr/lib/{libpangocairo-1.0.so.0,libpango-1.0.so.0,libpangoft2-1.0.so.0} \ $(get_install_dir pango)/usr/lib/{libpangocairo-1.0.so.0,libpango-1.0.so.0,libpangoft2-1.0.so.0} \
${ADDON_BUILD}/${PKG_ADDON_ID}/lib ${ADDON_BUILD}/${PKG_ADDON_ID}/lib
# unix_ar
cp -P $(get_build_dir unix_ar)/unix_ar.py ${ADDON_BUILD}/${PKG_ADDON_ID}/resources
} }
post_install_addon() { post_install_addon() {

View File

@ -12,7 +12,7 @@ DATA_FILE="/tmp/curl.data"
CHROME_FILE="google-chrome-stable_@CHROME_VERSION@-1_amd64.deb" CHROME_FILE="google-chrome-stable_@CHROME_VERSION@-1_amd64.deb"
# check for enough free disk space # check for enough free disk space
if [ $(df . | awk 'END {print $4}') -lt 400000 ]; then if [ $(df -P . | awk 'END {print $4}') -lt 400000 ]; then
kodi-send --action="Notification(Not enough disk space, at least 400MB are required,30000,${ICON})" >/dev/null kodi-send --action="Notification(Not enough disk space, at least 400MB are required,30000,${ICON})" >/dev/null
exit 0; exit 0;
fi fi
@ -52,16 +52,19 @@ rm -f ${CONTROL_FILE} ${DATA_FILE}
rm -f ${CONTROL_FILE} ${DATA_FILE} rm -f ${CONTROL_FILE} ${DATA_FILE}
## extract chrome ## extract chrome
# extrat chrome.deb # extrat chrome.deb data to temp
kodi-send --action="Notification(Extracting Chrome,starting,1000,${ICON})" >/dev/null kodi-send --action="Notification(Extracting Chrome,starting,1000,${ICON})" >/dev/null
ar -x ${CHROME_FILE} deb_extract_data ${CHROME_FILE} $ADDON_DIR/tmp_download
# extract data.tar.xz to chrome-bin directory mv opt/google/chrome $ADDON_DIR/chrome-bin
mkdir $ADDON_DIR/chrome-bin
tar xf data.tar.xz --strip-components=4 -C $ADDON_DIR/chrome-bin ./opt/google/chrome
# cleanup # cleanup
cd $ADDON_DIR cd $ADDON_DIR
rm -rf $ADDON_DIR/tmp_download rm -rf $ADDON_DIR/tmp_download
if [ -d chrome-bin ]; then
touch $ADDON_DIR/extract.ok touch $ADDON_DIR/extract.ok
kodi-send --action="Notification(Extracting Chrome,finished,1000,${ICON})" >/dev/null kodi-send --action="Notification(Extracting Chrome,finished,1000,${ICON})" >/dev/null
else
kodi-send --action="Notification(Extracting Chrome,FAILED!,10000,${ICON})" >/dev/null
fi

View File

@ -0,0 +1,18 @@
#!/usr/bin/python3
# SPDX-License-Identifier: GPL-2.0-only
# Copyright (C) 2022-present Team LibreELEC (https://libreelec.tv)
import sys
sys.path.append('/storage/.kodi/addons/browser.chrome/resources')
import unix_ar
import tarfile
if len(sys.argv) != 3:
print("Parameter error", file=sys.stderr)
sys.exit(1)
ar = unix_ar.open(sys.argv[1])
tarball = ar.open('data.tar.xz/')
tar = tarfile.open(fileobj=tarball)
tar.extractall(path=sys.argv[2])

View File

@ -2,17 +2,20 @@
# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) # Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv)
# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) # Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv)
import json
import linecache
import os import os
import shlex
import subprocess
import sys import sys
import time import time
import xbmcaddon
import subprocess
import json
import xbmc import xbmc
import xbmcaddon
__addon__ = xbmcaddon.Addon(); __addon__ = xbmcaddon.Addon();
__path__ = os.path.join(__addon__.getAddonInfo('path'), 'bin') + '/' __path__ = os.path.join(__addon__.getAddonInfo('path'), 'bin')
pauseXBMC = __addon__.getSetting("PAUSE_XBMC") pauseXBMC = __addon__.getSetting("PAUSE_XBMC")
@ -27,41 +30,53 @@ def resumeXbmc():
xbmc.audioResume() xbmc.audioResume()
xbmc.enableNavSounds(True) xbmc.enableNavSounds(True)
def _print_exception():
exc_type, exc_obj, tb = sys.exc_info()
frame = tb.tb_frame
lineno = tb.tb_lineno
filename = frame.f_code.co_filename
linecache.checkcache(filename)
line = linecache.getline(filename, lineno, frame.f_globals)
xbmc.log(f'## Chrome Addon Error: in ({filename}, line {lineno}\n"{line.strip()}"):\n{repr(exc_obj)}', xbmc.LOGERROR)
def startchrome(args): def startchrome(args):
try: try:
new_env = os.environ.copy() chrome_env = {
new_env['VAAPI_MODE'] = __addon__.getSetting('VAAPI_MODE') 'VAAPI_MODE': __addon__.getSetting('VAAPI_MODE'),
new_env['WINDOW_MODE'] = __addon__.getSetting('WINDOW_MODE') 'WINDOW_MODE': __addon__.getSetting('WINDOW_MODE'),
new_env['RASTER_MODE'] = __addon__.getSetting('RASTER_MODE') 'RASTER_MODE': __addon__.getSetting('RASTER_MODE'),
new_env['DARK_MODE'] = __addon__.getSetting('DARK_MODE') 'DARK_MODE': __addon__.getSetting('DARK_MODE')
}
# sound settings as environment variable
if __addon__.getSetting('USE_CUST_AUDIODEVICE') == 'true': if __addon__.getSetting('USE_CUST_AUDIODEVICE') == 'true':
audio_device = __addon__.getSetting('CUST_AUDIODEVICE_STR') audio_device = __addon__.getSetting('CUST_AUDIODEVICE_STR')
else: else:
audio_device = getAudioDevice() audio_device = getAudioDevice()
chrome_env['AUDIO_DEVICE_TYPE'] = getAudioDeviceType(audio_device)
new_env['AUDIO_DEVICE_TYPE'] = getAudioDeviceType(audio_device) if chrome_env['AUDIO_DEVICE_TYPE'] == 'ALSA':
if new_env['AUDIO_DEVICE_TYPE'] == "ALSA":
new_env['ALSA_DEVICE'] = ''
alsa_device = getAlsaAudioDevice(audio_device) alsa_device = getAlsaAudioDevice(audio_device)
if not alsa_device == None and not alsa_device == '': chrome_env['ALSA_DEVICE'] = alsa_device if alsa_device else ''
new_env['ALSA_DEVICE'] = alsa_device
# chrome user-agent string
if __addon__.getSetting('USE_CUST_USERAGENT') == 'true': if __addon__.getSetting('USE_CUST_USERAGENT') == 'true':
new_env['USER_AGENT'] = __addon__.getSetting('CUST_USERAGENT_STR') chrome_env['USER_AGENT'] = __addon__.getSetting('CUST_USERAGENT_STR')
chrome_params = args + ' ' + \ # launch chrome
__addon__.getSetting('HOMEPAGE') new_env = os.environ.copy()
subprocess.call(__path__ + 'chrome-start ' + chrome_params, shell=True, env=new_env) new_env.update(chrome_env)
except Exception as e: chrome_execute = ([os.path.join(__path__, 'chrome-start')]
xbmc.log('## Chrome Error:' + repr(e), xbmc.LOGERROR) + args
+ [__addon__.getSetting('HOMEPAGE')])
subprocess.call(chrome_execute, env=new_env)
except Exception:
_print_exception()
xbmc.log(f'## Chrome Addon Error: chrome env: {chrome_env}, audio device: {audio_device}', xbmc.LOGERROR)
def isRuning(pname): def isRunning(pname):
tmp = os.popen("ps -Af").read() '''Returns True/False if pname is running'''
pcount = tmp.count(pname) running_commands = subprocess.run(shlex.split('ps -Ao comm'), text=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
if pcount > 0: return pname in running_commands.stdout
return True
return False
def getAudioDevice(): def getAudioDevice():
return json.loads(xbmc.executeJSONRPC(json.dumps({ return json.loads(xbmc.executeJSONRPC(json.dumps({
@ -74,20 +89,26 @@ def getAudioDevice():
})))['result']['value'] })))['result']['value']
def getAudioDeviceType(dev): def getAudioDeviceType(dev):
if dev:
if dev.startswith("ALSA:"): if dev.startswith("ALSA:"):
return "ALSA" return "ALSA"
if dev.startswith("PULSE:"): elif dev.startswith("PULSE:"):
return "PULSE" return "PULSE"
return None else:
# backwards compatibility of device string
return "ALSA"
return "ALSA"
def getAlsaAudioDevice(dev): def getAlsaAudioDevice(dev):
if not dev.startswith('ALSA:'):
return dev
dev = dev.split("ALSA:")[1] dev = dev.split("ALSA:")[1]
if dev == "@": if dev == "@":
return None return None
if dev.startswith("@:"): if dev.startswith("@:"):
dev = dev.split("@:")[1] dev = dev.split("@:")[1]
if dev.startswith("CARD="): if dev.startswith("CARD="):
dev = "plughw:" + dev dev = f'plughw:{dev}'
return dev return dev
if (not __addon__.getSetting("firstrun")): if (not __addon__.getSetting("firstrun")):
@ -95,19 +116,19 @@ if (not __addon__.getSetting("firstrun")):
__addon__.openSettings() __addon__.openSettings()
try: try:
args = ' '.join(sys.argv[1:]) args = sys.argv[1:]
except: except Exception:
args = "" args = ''
if args == 'widevine': if args == 'widevine':
install_widevine() install_widevine()
elif args == 'flash': elif args == 'flash':
install_flash() install_flash()
else: else:
if not isRuning('chrome'): if not isRunning('chrome'):
pauseXbmc() pauseXbmc()
startchrome(args) startchrome(args)
while isRuning('chrome'): while isRunning('chrome'):
time.sleep(1) time.sleep(1)
resumeXbmc() resumeXbmc()