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.
This commit is contained in:
Martin Weinelt 2023-12-07 02:39:32 +01:00
parent 0645ff3b62
commit a9c8c99442
No known key found for this signature in database
GPG Key ID: 87C1E9888F856759
2 changed files with 12 additions and 13 deletions

View File

@ -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

View File

@ -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}")