summaryrefslogtreecommitdiffstats
path: root/pkgs/servers/home-assistant/patches
diff options
context:
space:
mode:
authorMartin Weinelt <hexa@darmstadt.ccc.de>2021-12-11 20:59:08 +0100
committerMartin Weinelt <hexa@darmstadt.ccc.de>2021-12-12 20:25:50 +0100
commitfd19df269d61b897dc42cbbe9495cfa1bdd6fe09 (patch)
tree8133e33b58e4c19dd461c7a1f3c1797cbe7b07cd /pkgs/servers/home-assistant/patches
parentc9e0271369f228d66f574997e77bfd13910e229e (diff)
home-assistant: 2021.11.4 -> 2021.12.0
Diffstat (limited to 'pkgs/servers/home-assistant/patches')
-rw-r--r--pkgs/servers/home-assistant/patches/ffmpeg-path.patch84
-rw-r--r--pkgs/servers/home-assistant/patches/tests-ignore-OSErrors-in-hass-fixture.patch27
-rw-r--r--pkgs/servers/home-assistant/patches/tests-mock-source-ip.patch13
3 files changed, 124 insertions, 0 deletions
diff --git a/pkgs/servers/home-assistant/patches/ffmpeg-path.patch b/pkgs/servers/home-assistant/patches/ffmpeg-path.patch
new file mode 100644
index 000000000000..a72674ff7a5f
--- /dev/null
+++ b/pkgs/servers/home-assistant/patches/ffmpeg-path.patch
@@ -0,0 +1,84 @@
+diff --git a/homeassistant/components/ffmpeg/__init__.py b/homeassistant/components/ffmpeg/__init__.py
+index 74c826f47d..91f359da2a 100644
+--- a/homeassistant/components/ffmpeg/__init__.py
++++ b/homeassistant/components/ffmpeg/__init__.py
+@@ -40,7 +40,7 @@ CONF_FFMPEG_BIN = "ffmpeg_bin"
+ CONF_EXTRA_ARGUMENTS = "extra_arguments"
+ CONF_OUTPUT = "output"
+
+-DEFAULT_BINARY = "ffmpeg"
++DEFAULT_BINARY = "@ffmpeg@"
+
+ CONFIG_SCHEMA = vol.Schema(
+ {
+diff --git a/tests/components/ffmpeg/test_init.py b/tests/components/ffmpeg/test_init.py
+index e1730ffdab..e9cd7934fd 100644
+--- a/tests/components/ffmpeg/test_init.py
++++ b/tests/components/ffmpeg/test_init.py
+@@ -87,7 +87,7 @@ class TestFFmpegSetup:
+ with assert_setup_component(1):
+ setup_component(self.hass, ffmpeg.DOMAIN, {ffmpeg.DOMAIN: {}})
+
+- assert self.hass.data[ffmpeg.DATA_FFMPEG].binary == "ffmpeg"
++ assert self.hass.data[ffmpeg.DATA_FFMPEG].binary == "@ffmpeg@"
+
+ def test_setup_component_test_service(self):
+ """Set up ffmpeg component test services."""
+diff --git a/tests/components/ffmpeg/test_sensor.py b/tests/components/ffmpeg/test_sensor.py
+index a6c9c1f441..f13091da1a 100644
+--- a/tests/components/ffmpeg/test_sensor.py
++++ b/tests/components/ffmpeg/test_sensor.py
+@@ -27,7 +27,7 @@ class TestFFmpegNoiseSetup:
+ setup_component(self.hass, "binary_sensor", self.config)
+ self.hass.block_till_done()
+
+- assert self.hass.data["ffmpeg"].binary == "ffmpeg"
++ assert self.hass.data["ffmpeg"].binary == "@ffmpeg@"
+ assert self.hass.states.get("binary_sensor.ffmpeg_noise") is not None
+
+ @patch("haffmpeg.sensor.SensorNoise.open_sensor", return_value=mock_coro())
+@@ -37,7 +37,7 @@ class TestFFmpegNoiseSetup:
+ setup_component(self.hass, "binary_sensor", self.config)
+ self.hass.block_till_done()
+
+- assert self.hass.data["ffmpeg"].binary == "ffmpeg"
++ assert self.hass.data["ffmpeg"].binary == "@ffmpeg@"
+ assert self.hass.states.get("binary_sensor.ffmpeg_noise") is not None
+
+ self.hass.start()
+@@ -53,7 +53,7 @@ class TestFFmpegNoiseSetup:
+ setup_component(self.hass, "binary_sensor", self.config)
+ self.hass.block_till_done()
+
+- assert self.hass.data["ffmpeg"].binary == "ffmpeg"
++ assert self.hass.data["ffmpeg"].binary == "@ffmpeg@"
+ assert self.hass.states.get("binary_sensor.ffmpeg_noise") is not None
+
+ self.hass.start()
+@@ -89,7 +89,7 @@ class TestFFmpegMotionSetup:
+ setup_component(self.hass, "binary_sensor", self.config)
+ self.hass.block_till_done()
+
+- assert self.hass.data["ffmpeg"].binary == "ffmpeg"
++ assert self.hass.data["ffmpeg"].binary == "@ffmpeg@"
+ assert self.hass.states.get("binary_sensor.ffmpeg_motion") is not None
+
+ @patch("haffmpeg.sensor.SensorMotion.open_sensor", return_value=mock_coro())
+@@ -99,7 +99,7 @@ class TestFFmpegMotionSetup:
+ setup_component(self.hass, "binary_sensor", self.config)
+ self.hass.block_till_done()
+
+- assert self.hass.data["ffmpeg"].binary == "ffmpeg"
++ assert self.hass.data["ffmpeg"].binary == "@ffmpeg@"
+ assert self.hass.states.get("binary_sensor.ffmpeg_motion") is not None
+
+ self.hass.start()
+@@ -115,7 +115,7 @@ class TestFFmpegMotionSetup:
+ setup_component(self.hass, "binary_sensor", self.config)
+ self.hass.block_till_done()
+
+- assert self.hass.data["ffmpeg"].binary == "ffmpeg"
++ assert self.hass.data["ffmpeg"].binary == "@ffmpeg@"
+ assert self.hass.states.get("binary_sensor.ffmpeg_motion") is not None
+
+ self.hass.start()
diff --git a/pkgs/servers/home-assistant/patches/tests-ignore-OSErrors-in-hass-fixture.patch b/pkgs/servers/home-assistant/patches/tests-ignore-OSErrors-in-hass-fixture.patch
new file mode 100644
index 000000000000..add0ea1d5521
--- /dev/null
+++ b/pkgs/servers/home-assistant/patches/tests-ignore-OSErrors-in-hass-fixture.patch
@@ -0,0 +1,27 @@
+From 3e3f5c37252a33ea1e71c39f2ca0f13940c261ad Mon Sep 17 00:00:00 2001
+From: Martin Weinelt <hexa@darmstadt.ccc.de>
+Date: Sat, 17 Jul 2021 16:11:23 +0200
+Subject: [PATCH] tests: ignore OSErrors in hass fixture
+
+The nix sandbox will cause OSErrors due to limitations imposed on
+network interaction. This change makes it so we forgive these cases.
+---
+ tests/conftest.py | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/tests/conftest.py b/tests/conftest.py
+index 1f5ffc80d0..b284727a0f 100644
+--- a/tests/conftest.py
++++ b/tests/conftest.py
+@@ -168,6 +168,8 @@ def hass(loop, load_registries, hass_storage, request):
+ continue
+ if isinstance(ex, ServiceNotFound):
+ continue
++ if isinstance(ex, OSError):
++ continue
+ raise ex
+
+
+--
+2.32.0
+
diff --git a/pkgs/servers/home-assistant/patches/tests-mock-source-ip.patch b/pkgs/servers/home-assistant/patches/tests-mock-source-ip.patch
new file mode 100644
index 000000000000..4094d08ee7ff
--- /dev/null
+++ b/pkgs/servers/home-assistant/patches/tests-mock-source-ip.patch
@@ -0,0 +1,13 @@
+diff --git a/homeassistant/components/network/__init__.py b/homeassistant/components/network/__init__.py
+index 7cc864727d..69333a5454 100644
+--- a/homeassistant/components/network/__init__.py
++++ b/homeassistant/components/network/__init__.py
+@@ -26,7 +26,7 @@ async def async_get_source_ip(
+ ) -> str:
+ """Get the source ip for a target ip."""
+ adapters = await async_get_adapters(hass)
+- all_ipv4s = []
++ all_ipv4s = ["127.0.0.1"]
+ for adapter in adapters:
+ if adapter["enabled"] and (ipv4s := adapter["ipv4"]):
+ all_ipv4s.extend([ipv4["address"] for ipv4 in ipv4s])