about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAaron Andersen <aaron@fosslib.net>2021-03-15 21:59:08 -0400
committerAaron Andersen <aaron@fosslib.net>2021-03-15 22:43:47 -0400
commit2d9ac443208ae5733fb9cb5b0eaa27e4a4c7c0fa (patch)
treee67d292934666edd75d644cf1ec52736534937e0
parente0b04570fecbc3fc2ed303843417e94f6349492a (diff)
kodi.packages: add update script for addons from kodi repository
-rw-r--r--pkgs/applications/video/kodi-packages/addon-update-script/default.nix23
-rw-r--r--pkgs/applications/video/kodi-packages/certifi/default.nix6
-rw-r--r--pkgs/applications/video/kodi-packages/chardet/default.nix6
-rw-r--r--pkgs/applications/video/kodi-packages/idna/default.nix6
-rw-r--r--pkgs/applications/video/kodi-packages/inputstreamhelper/default.nix6
-rw-r--r--pkgs/applications/video/kodi-packages/myconnpy/default.nix6
-rw-r--r--pkgs/applications/video/kodi-packages/requests/default.nix6
-rw-r--r--pkgs/applications/video/kodi-packages/signals/default.nix6
-rw-r--r--pkgs/applications/video/kodi-packages/urllib3/default.nix6
-rw-r--r--pkgs/top-level/kodi-packages.nix4
10 files changed, 67 insertions, 8 deletions
diff --git a/pkgs/applications/video/kodi-packages/addon-update-script/default.nix b/pkgs/applications/video/kodi-packages/addon-update-script/default.nix
new file mode 100644
index 0000000000000..17c1d45783fa0
--- /dev/null
+++ b/pkgs/applications/video/kodi-packages/addon-update-script/default.nix
@@ -0,0 +1,23 @@
+{ writeShellScript
+, nix
+, curl
+, gzip
+, xmlstarlet
+, common-updater-scripts
+}:
+
+{ attrPath }:
+
+let
+  url = "http://mirrors.kodi.tv/addons/matrix/addons.xml.gz";
+  updateScript = writeShellScript "update.sh" ''
+    set -ex
+
+    attrPath=$1
+    namespace=$(${nix}/bin/nix-instantiate $systemArg --eval -E "with import ./. {}; $attrPath.namespace" | tr -d '"')
+    version=$(${curl}/bin/curl -s -L ${url} | ${gzip}/bin/gunzip -c | ${xmlstarlet}/bin/xml select -T -t -m "//addons/addon[@id='$namespace']" -v @version)
+
+    ${common-updater-scripts}/bin/update-source-version "$attrPath" "$version"
+  '';
+in
+  [ updateScript attrPath ]
diff --git a/pkgs/applications/video/kodi-packages/certifi/default.nix b/pkgs/applications/video/kodi-packages/certifi/default.nix
index b27e612d86dee..bfce47b7b2ce2 100644
--- a/pkgs/applications/video/kodi-packages/certifi/default.nix
+++ b/pkgs/applications/video/kodi-packages/certifi/default.nix
@@ -1,4 +1,4 @@
-{ lib, buildKodiAddon, fetchzip }:
+{ lib, buildKodiAddon, fetchzip, addonUpdateScript }:
 buildKodiAddon rec {
   pname = "certifi";
   namespace = "script.module.certifi";
@@ -9,6 +9,10 @@ buildKodiAddon rec {
     sha256 = "0vsd68izv1ix0hb1gm74qq3zff0sxmhfhjyh7y9005zzp2gpi62v";
   };
 
+  passthru.updateScript = addonUpdateScript {
+    attrPath = "kodi.packages.certifi";
+  };
+
   meta = with lib; {
     homepage = "https://certifi.io";
     description = "Python package for providing Mozilla's CA Bundle";
diff --git a/pkgs/applications/video/kodi-packages/chardet/default.nix b/pkgs/applications/video/kodi-packages/chardet/default.nix
index 02ea0f54d5268..1e37f6b46e2b0 100644
--- a/pkgs/applications/video/kodi-packages/chardet/default.nix
+++ b/pkgs/applications/video/kodi-packages/chardet/default.nix
@@ -1,4 +1,4 @@
-{ lib, buildKodiAddon, fetchzip }:
+{ lib, buildKodiAddon, fetchzip, addonUpdateScript }:
 buildKodiAddon rec {
   pname = "chardet";
   namespace = "script.module.chardet";
@@ -9,6 +9,10 @@ buildKodiAddon rec {
     sha256 = "05928dj4fsj2zg8ajdial3sdf8izddq64sr0al3zy1gqw91jp80f";
   };
 
+  passthru.updateScript = addonUpdateScript {
+    attrPath = "kodi.packages.chardet";
+  };
+
   meta = with lib; {
     homepage = "https://github.com/Freso/script.module.chardet";
     description = "Universal encoding detector";
diff --git a/pkgs/applications/video/kodi-packages/idna/default.nix b/pkgs/applications/video/kodi-packages/idna/default.nix
index 96d317830fdc7..abe5635e8281d 100644
--- a/pkgs/applications/video/kodi-packages/idna/default.nix
+++ b/pkgs/applications/video/kodi-packages/idna/default.nix
@@ -1,4 +1,4 @@
-{ lib, buildKodiAddon, fetchzip }:
+{ lib, buildKodiAddon, fetchzip, addonUpdateScript }:
 buildKodiAddon rec {
   pname = "idna";
   namespace = "script.module.idna";
@@ -9,6 +9,10 @@ buildKodiAddon rec {
     sha256 = "02s75fhfmbs3a38wvxba51aj3lv5bidshjdkl6yjfji6waxpr9xh";
   };
 
+  passthru.updateScript = addonUpdateScript {
+    attrPath = "kodi.packages.idna";
+  };
+
   meta = with lib; {
     homepage = "https://github.com/Freso/script.module.idna";
     description = "Internationalized Domain Names for Python";
diff --git a/pkgs/applications/video/kodi-packages/inputstreamhelper/default.nix b/pkgs/applications/video/kodi-packages/inputstreamhelper/default.nix
index 3ccfdd1eb0dc5..2bbcc6d9d2c3f 100644
--- a/pkgs/applications/video/kodi-packages/inputstreamhelper/default.nix
+++ b/pkgs/applications/video/kodi-packages/inputstreamhelper/default.nix
@@ -1,4 +1,4 @@
-{ lib, buildKodiAddon, fetchzip }:
+{ lib, buildKodiAddon, fetchzip, addonUpdateScript }:
 buildKodiAddon rec {
   pname = "inputstreamhelper";
   namespace = "script.module.inputstreamhelper";
@@ -9,6 +9,10 @@ buildKodiAddon rec {
     sha256 = "18lkksljfa57w69yklbldf7dgyykrm84pd10mdjdqdm88fdiiijk";
   };
 
+  passthru.updateScript = addonUpdateScript {
+    attrPath = "kodi.packages.inputstreamhelper";
+  };
+
   meta = with lib; {
     homepage = "https://github.com/emilsvennesson/script.module.inputstreamhelper";
     description = "A simple Kodi module that makes life easier for add-on developers relying on InputStream based add-ons and DRM playback";
diff --git a/pkgs/applications/video/kodi-packages/myconnpy/default.nix b/pkgs/applications/video/kodi-packages/myconnpy/default.nix
index 386246122090c..a1b2557652421 100644
--- a/pkgs/applications/video/kodi-packages/myconnpy/default.nix
+++ b/pkgs/applications/video/kodi-packages/myconnpy/default.nix
@@ -1,4 +1,4 @@
-{ lib, buildKodiAddon, fetchzip }:
+{ lib, buildKodiAddon, fetchzip, addonUpdateScript }:
 buildKodiAddon rec {
   pname = "myconnpy";
   namespace = "script.module.myconnpy";
@@ -9,6 +9,10 @@ buildKodiAddon rec {
     sha256 = "1cx3qdzw9lkkmbyvyrmc2i193is20fihn2sfl7kmv43f708vam0k";
   };
 
+  passthru.updateScript = addonUpdateScript {
+    attrPath = "kodi.packages.myconnpy";
+  };
+
   meta = with lib; {
     homepage = "http://dev.mysql.com/doc/connector-python/en/index.html";
     description = "MySQL Connector/Python";
diff --git a/pkgs/applications/video/kodi-packages/requests/default.nix b/pkgs/applications/video/kodi-packages/requests/default.nix
index 73fa20f47fb71..05288b74b6c1b 100644
--- a/pkgs/applications/video/kodi-packages/requests/default.nix
+++ b/pkgs/applications/video/kodi-packages/requests/default.nix
@@ -1,4 +1,4 @@
-{ lib, buildKodiAddon, fetchzip, certifi, chardet, idna, urllib3 }:
+{ lib, buildKodiAddon, fetchzip, addonUpdateScript, certifi, chardet, idna, urllib3 }:
 buildKodiAddon rec {
   pname = "requests";
   namespace = "script.module.requests";
@@ -16,6 +16,10 @@ buildKodiAddon rec {
     urllib3
   ];
 
+  passthru.updateScript = addonUpdateScript {
+    attrPath = "kodi.packages.requests";
+  };
+
   meta = with lib; {
     homepage = "http://python-requests.org";
     description = "Python HTTP for Humans";
diff --git a/pkgs/applications/video/kodi-packages/signals/default.nix b/pkgs/applications/video/kodi-packages/signals/default.nix
index 5ade48aa81390..9d49e632721fa 100644
--- a/pkgs/applications/video/kodi-packages/signals/default.nix
+++ b/pkgs/applications/video/kodi-packages/signals/default.nix
@@ -1,4 +1,4 @@
-{ lib, buildKodiAddon, fetchzip }:
+{ lib, buildKodiAddon, fetchzip, addonUpdateScript }:
 buildKodiAddon rec {
   pname = "signals";
   namespace = "script.module.addon.signals";
@@ -9,6 +9,10 @@ buildKodiAddon rec {
     sha256 = "1qcjbakch8hvx02wc01zv014nmzgn6ahc4n2bj5mzr114ppd3hjs";
   };
 
+  passthru.updateScript = addonUpdateScript {
+    attrPath = "kodi.packages.signals";
+  };
+
   meta = with lib; {
     homepage = "https://github.com/ruuk/script.module.addon.signals";
     description = "Provides signal/slot mechanism for inter-addon communication";
diff --git a/pkgs/applications/video/kodi-packages/urllib3/default.nix b/pkgs/applications/video/kodi-packages/urllib3/default.nix
index 5d54aa6ea034c..e814698791394 100644
--- a/pkgs/applications/video/kodi-packages/urllib3/default.nix
+++ b/pkgs/applications/video/kodi-packages/urllib3/default.nix
@@ -1,4 +1,4 @@
-{ lib, buildKodiAddon, fetchzip }:
+{ lib, buildKodiAddon, fetchzip, addonUpdateScript }:
 buildKodiAddon rec {
   pname = "urllib3";
   namespace = "script.module.urllib3";
@@ -9,6 +9,10 @@ buildKodiAddon rec {
     sha256 = "080yq8ns0sag6rmdag1hjwi0whcmp35wzqjp3by92m81cpszs75q";
   };
 
+  passthru.updateScript = addonUpdateScript {
+    attrPath = "kodi.packages.urllib3";
+  };
+
   meta = with lib; {
     homepage = "https://urllib3.readthedocs.io/en/latest/";
     description = "HTTP library with thread-safe connection pooling, file post, and more";
diff --git a/pkgs/top-level/kodi-packages.nix b/pkgs/top-level/kodi-packages.nix
index 0ff32f3821732..f9b20dd2bc7e0 100644
--- a/pkgs/top-level/kodi-packages.nix
+++ b/pkgs/top-level/kodi-packages.nix
@@ -30,6 +30,10 @@ let self = rec {
     in
       unique (modules ++ concatLists (catAttrs "requiredKodiAddons" modules));
 
+  # package update scripts
+
+  addonUpdateScript = callPackage ../applications/video/kodi-packages/addon-update-script { };
+
   # package builders
 
   buildKodiAddon = callPackage ../applications/video/kodi/build-kodi-addon.nix { };