Merge pull request #210902 from Yarny0/tvbrowser

tvbrowser: fix, update, build from source, add small test
This commit is contained in:
Anderson Torres 2023-02-04 16:10:53 -03:00 committed by GitHub
commit 1149f14600
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 137 additions and 56 deletions

View File

@ -858,6 +858,12 @@
<literal>libax25</literal> package.
</para>
</listitem>
<listitem>
<para>
<literal>tvbrowser-bin</literal> was removed, and now
<literal>tvbrowser</literal> is built from source.
</para>
</listitem>
<listitem>
<para>
<literal>nixos-version</literal> now accepts

View File

@ -213,6 +213,8 @@ In addition to numerous new and upgraded packages, this release has the followin
- [Xastir](https://xastir.org/index.php/Main_Page) can now access AX.25 interfaces via the `libax25` package.
- `tvbrowser-bin` was removed, and now `tvbrowser` is built from source.
- `nixos-version` now accepts `--configuration-revision` to display more information about the current generation revision
- The option `services.nomad.extraSettingsPlugins` has been fixed to allow more than one plugin in the path.

View File

@ -1,55 +0,0 @@
{ lib, stdenv, fetchurl, makeWrapper, jre, makeDesktopItem }:
let
desktopItem = makeDesktopItem {
name = "tvbrowser";
exec = "tvbrowser";
icon = "tvbrowser";
comment = "Themeable and easy to use TV Guide";
desktopName = "TV-Browser";
genericName = "Electronic TV Program Guide";
categories = [ "AudioVideo" "TV" "Java" ];
startupNotify = true;
startupWMClass = "tvbrowser-TVBrowser";
};
in stdenv.mkDerivation rec {
pname = "tvbrowser";
version = "4.0.1";
name = "${pname}-bin-${version}";
src = fetchurl {
url = "mirror://sourceforge/${pname}/TV-Browser%20Releases%20%28Java%208%20and%20higher%29/${version}/${pname}_${version}_bin.tar.gz";
sha256 = "0ahsirf6cazs5wykgbwsc6n35w6jprxyphzqmm7d370n37sb07pm";
};
nativeBuildInputs = [ makeWrapper ];
installPhase = ''
mkdir -p $out/share/java/${pname}
cp -R * $out/share/java/${pname}
rm $out/share/java/${pname}/${pname}.{sh,desktop}
mkdir -p $out/share/applications
ln -s ${desktopItem}/share/applications/* $out/share/applications/
for i in 16 32 48 128; do
mkdir -p $out/share/icons/hicolor/''${i}x''${i}/apps
ln -s $out/share/java/${pname}/imgs/${pname}$i.png $out/share/icons/hicolor/''${i}x''${i}/apps/${pname}.png
done
mkdir -p $out/bin
makeWrapper ${jre}/bin/java $out/bin/${pname} \
--add-flags "-jar $out/share/java/${pname}/${pname}.jar" \
--chdir "$out/share/java/${pname}"
'';
meta = with lib; {
description = "Electronic TV Program Guide";
homepage = "https://www.tvbrowser.org/";
sourceProvenance = with sourceTypes; [ binaryBytecode ];
license = licenses.gpl3;
platforms = platforms.linux;
maintainers = with maintainers; [ jfrankenau ];
};
}

View File

@ -0,0 +1,87 @@
{ lib
, fetchurl
, stdenv
, fetchzip
, ant
, jdk
, makeWrapper
, callPackage
}:
let
minimalJavaVersion = "11";
newsPlugin = fetchurl {
url = "https://www.tvbrowser.org/data/uploads/1372016422809_543/NewsPlugin.jar";
hash = "sha256-5XoypuMd2AFBE2SJ6EdECuvq6D81HLLuu9UoA9kcKAM=";
};
in
assert lib.versionAtLeast jdk.version minimalJavaVersion;
stdenv.mkDerivation rec {
pname = "tvbrowser";
version = "4.2.7";
src = fetchzip {
url = "mirror://sourceforge/${pname}/TV-Browser%20Releases%20%28Java%20${minimalJavaVersion}%20and%20higher%29/${version}/${pname}_${version}_src.tar.gz";
hash = "sha256-dmNfI6T0MU7UtMH+C/2hiAeDwZlFCB4JofQViZezoqI=";
};
nativeBuildInputs = [ ant jdk makeWrapper ];
buildPhase = ''
runHook preBuild
ant runtime-linux -Dnewsplugin.url=file://${newsPlugin}
ant tvbrowser-desktop-entry
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out/share/${pname}
cp -R runtime/tvbrowser_linux/* $out/share/${pname}
mkdir -p $out/share/applications
mv -t $out/share/applications $out/share/${pname}/${pname}.desktop
sed -e 's|=imgs/|='$out'/share/${pname}/imgs/|' \
-e 's|=${pname}.sh|='$out'/bin/${pname}|' \
-i $out/share/applications/${pname}.desktop
for i in 16 32 48 128; do
mkdir -p $out/share/icons/hicolor/''${i}x''${i}/apps
ln -s $out/share/${pname}/imgs/${pname}$i.png $out/share/icons/hicolor/''${i}x''${i}/apps/${pname}.png
done
mkdir -p $out/bin
makeWrapper \
$out/share/${pname}/${pname}.sh \
$out/bin/${pname} \
--prefix PATH : ${jdk}/bin \
--prefix XDG_DATA_DIRS : $out/share \
--set PROGRAM_DIR $out/share/${pname}
runHook postInstall
'';
passthru.tests.startwindow = callPackage ./test.nix {};
meta = with lib; {
description = "Electronic TV Program Guide";
downloadPage = "https://www.tvbrowser.org/index.php?id=tv-browser";
homepage = "https://www.tvbrowser.org/";
changelog = "https://www.tvbrowser.org/index.php?id=news";
sourceProvenance = with sourceTypes; [ binaryBytecode fromSource ];
license = licenses.gpl3Plus;
mainProgram = pname;
platforms = platforms.linux;
maintainers = with maintainers; [ jfrankenau yarny ];
longDescription = ''
TV-Browser shows TV program data arranged like in printed
TV programs after downloading it from the internet.
Plugins are used to download program data
and to provide additional functionality.
'';
};
}

View File

@ -0,0 +1,40 @@
{ lib
, xvfb-run
, tvbrowser
, runCommand
, writeShellApplication
, xorg
}:
let
testScript = writeShellApplication {
name = "tvbrowser-test-script";
runtimeInputs = [ xorg.xwininfo tvbrowser ];
text = ''
function find_tvbrowser_windows {
for window_name in java tvbrowser-TVBrowser 'Setup assistant' ; do
grep -q "$window_name" "$1" || return 1
done
}
tvbrowser &
for _ in {0..900} ; do
xwininfo -root -tree \
| sed 's/.*0x[0-9a-f]* \"\([^\"]*\)\".*/\1/; t; d' \
| tee window-names
echo
if find_tvbrowser_windows window-names ; then
break
fi
sleep 1
done
find_tvbrowser_windows window-names
'';
};
in
runCommand
"tvbrowser-test"
{ buildInputs = [ xvfb-run ]; }
''
HOME=$PWD xvfb-run ${lib.getExe testScript}
touch ${placeholder "out"}
''

View File

@ -1547,6 +1547,7 @@ mapAliases ({
truecrypt = throw "'truecrypt' has been renamed to/replaced by 'veracrypt'"; # Converted to throw 2022-02-22
tuijam = throw "tuijam has been removed because Google Play Music was discontinued"; # Added 2021-03-07
turbo-geth = throw "turbo-geth has been renamed to erigon"; # Added 2021-08-08
tvbrowser-bin = throw "tvbrowser-bin was removed because it is now built from sources; use 'tvbrowser' instead"; # Added 2023-02-04
twister = throw "twister has been removed: abandoned by upstream and python2-only"; # Added 2022-04-26
tychus = throw "tychus has been dropped due to the lack of maintenance from upstream since 2018"; # Added 2022-06-03
typora = throw "Newer versions of typora use anti-user encryption and refuse to start. As such it has been removed"; # Added 2021-09-11

View File

@ -38251,7 +38251,7 @@ with pkgs;
trufflehog = callPackage ../tools/security/trufflehog { };
tvbrowser-bin = callPackage ../applications/misc/tvbrowser/bin.nix { };
tvbrowser = callPackage ../applications/misc/tvbrowser { };
tvheadend = callPackage ../servers/tvheadend {
dtv-scan-tables = dtv-scan-tables_tvheadend;