about summary refs log tree commit diff
path: root/pkgs/servers/home-assistant
diff options
context:
space:
mode:
authorMartin Weinelt <hexa@darmstadt.ccc.de>2023-12-07 02:39:32 +0100
committerMartin Weinelt <hexa@darmstadt.ccc.de>2023-12-09 17:51:12 +0100
commita9c8c99442748f1580909f3642008d8acb43d42d (patch)
tree0900c55cce7077c22237fc256d4dca89e21fd714 /pkgs/servers/home-assistant
parent0645ff3b624febeae63993920bff562a2f6ab73a (diff)
downloadnixlib-a9c8c99442748f1580909f3642008d8acb43d42d.tar
nixlib-a9c8c99442748f1580909f3642008d8acb43d42d.tar.gz
nixlib-a9c8c99442748f1580909f3642008d8acb43d42d.tar.bz2
nixlib-a9c8c99442748f1580909f3642008d8acb43d42d.tar.lz
nixlib-a9c8c99442748f1580909f3642008d8acb43d42d.tar.xz
nixlib-a9c8c99442748f1580909f3642008d8acb43d42d.tar.zst
nixlib-a9c8c99442748f1580909f3642008d8acb43d42d.zip
home-assistant: make git the primary source, sdist secondary
Make the git src the primary one, since it can be replaced with a local
checkout to run bisects.

We now copy the translations from the sdist published on PyPi into the
source tree, instead of previously the tests from the git source tree.
Diffstat (limited to 'pkgs/servers/home-assistant')
-rw-r--r--pkgs/servers/home-assistant/default.nix21
-rwxr-xr-xpkgs/servers/home-assistant/update.py4
2 files changed, 12 insertions, 13 deletions
diff --git a/pkgs/servers/home-assistant/default.nix b/pkgs/servers/home-assistant/default.nix
index 12c1fa737c47..71ef528549f9 100644
--- a/pkgs/servers/home-assistant/default.nix
+++ b/pkgs/servers/home-assistant/default.nix
@@ -324,20 +324,20 @@ in python.pkgs.buildPythonApplication rec {
   # don't try and fail to strip 6600+ python files, it takes minutes!
   dontStrip = true;
 
-  # Primary source is the pypi sdist, because it contains translations
-  src = fetchPypi {
-    inherit pname version;
-    hash = "sha256-TspjqX98adi6cYe/raV1FB5Xy59F4jWJukw1pkuP+Sw=";
-  };
-
-  # Secondary source is git for tests
-  gitSrc = fetchFromGitHub {
+  # Primary source is the git, which has the tests and allows bisecting the core
+  src = fetchFromGitHub {
     owner = "home-assistant";
     repo = "core";
     rev = "refs/tags/${version}";
     hash = "sha256-d7H6U5wRU1mOAU5YFyy7gtttsG9p1g7iDxZcaK+cAOg=";
   };
 
+  # Secondary source is pypi sdist for translations
+  sdist = fetchPypi {
+    inherit pname version;
+    hash = "sha256-TspjqX98adi6cYe/raV1FB5Xy59F4jWJukw1pkuP+Sw=";
+  };
+
   nativeBuildInputs = with python.pkgs; [
     pythonRelaxDepsHook
     setuptools
@@ -365,10 +365,9 @@ in python.pkgs.buildPythonApplication rec {
     "yarl"
   ];
 
-  # copy tests early, so patches apply as they would to the git repo
+  # extract translations from pypi sdist
   prePatch = ''
-    cp --no-preserve=mode --recursive ${gitSrc}/tests ./
-    chmod u+x tests/auth/providers/test_command_line_cmd.sh
+    tar --extract --gzip --file $sdist --strip-components 1 --wildcards "**/translations"
   '';
 
   # leave this in, so users don't have to constantly update their downstream patch handling
diff --git a/pkgs/servers/home-assistant/update.py b/pkgs/servers/home-assistant/update.py
index c914979e28bd..30b371e0686d 100755
--- a/pkgs/servers/home-assistant/update.py
+++ b/pkgs/servers/home-assistant/update.py
@@ -192,11 +192,11 @@ class HomeAssistant:
 
 
     async def update_core(self, old_version: str, new_version: str) -> None:
-        old_sdist_hash = str(await Nix.eval("home-assistant.src.outputHash"))
+        old_sdist_hash = str(await Nix.eval("home-assistant.sdist.outputHash"))
         new_sdist_hash = await Nurl.prefetch("https://pypi.org/project/homeassistant/", new_version)
         print(f"sdist: {old_sdist_hash} -> {new_sdist_hash}")
 
-        old_git_hash = str(await Nix.eval("home-assistant.gitSrc.outputHash"))
+        old_git_hash = str(await Nix.eval("home-assistant.src.outputHash"))
         new_git_hash = await Nurl.prefetch("https://github.com/home-assistant/core/", new_version)
         print(f"git: {old_git_hash} -> {new_git_hash}")