Loading pkgs/by-name/za/zap-chip/dont-download-copyfiles-to-copy-files.patch 0 → 100644 +42 −0 Original line number Diff line number Diff line diff --git a/src-script/pack-apack-win-linux.js b/src-script/pack-apack-win-linux.js index 0120f9f9..41fcf99c 100644 --- a/src-script/pack-apack-win-linux.js +++ b/src-script/pack-apack-win-linux.js @@ -6,12 +6,12 @@ exports.default = async function (context) { context.electronPlatformName === 'win32' || context.electronPlatformName === 'linux' ) { - return scriptUtil.executeCmd({}, 'npx', [ - 'copyfiles', - '-V', - '-f', - path.resolve(context.outDir, '../apack.json'), - context.appOutDir + return scriptUtil.executeCmd({}, 'install', [ + '-m466', + '-v', + '-Dt', + context.appOutDir, + path.resolve(context.outDir, '../apack.json') ]) } } diff --git a/src-script/script-util.js b/src-script/script-util.js index 1897c2b8..9faa5f20 100644 --- a/src-script/script-util.js +++ b/src-script/script-util.js @@ -181,11 +181,9 @@ async function rebuildBackendIfNeeded() { return scriptUtil .executeCmd({}, 'npx', ['tsc', '--build', './tsconfig.json']) .then(() => - scriptUtil.executeCmd({}, 'npx', [ - 'copyfiles', - './src-electron/**/*.sql', - './src-electron/icons/*', - './dist/' + scriptUtil.executeCmd({}, 'bash', [ + '-xec', + 'for i in ./src-electron/**/*.sql ./src-electron/icons/*; do install -m 644 -Dt dist/$(dirname $i) $i; done' ]) ) } pkgs/by-name/za/zap-chip/dont-get-version-from-git.patch 0 → 100644 +28 −0 Original line number Diff line number Diff line diff --git a/src-script/script-util.js b/src-script/script-util.js index 1897c2b8..aaf9a08b 100644 --- a/src-script/script-util.js +++ b/src-script/script-util.js @@ -196,23 +194,6 @@ async function rebuildBackendIfNeeded() { * ads the timestamp and saves it into .version.json */ async function stampVersion() { - try { - let out = await getStdout('{"hash": null,"date": null}', 'git', [ - 'log', - '-1', - '--format={"hash": "%H","timestamp": %ct}' - ]) - let version = JSON.parse(out) - let d = new Date(version.timestamp * 1000) // git gives seconds, Date needs milliseconds - let result = await setPackageJsonVersion(d, 'real') - version.date = d - version.zapVersion = result.version - let versionFile = path.join(__dirname, '../.version.json') - console.log(`🔍 Git commit: ${version.hash} from ${version.date}`) - await fsp.writeFile(versionFile, JSON.stringify(version)) - } catch (err) { - console.log(`Error retrieving version: ${err}`) - } } /** pkgs/by-name/za/zap-chip/package.nix 0 → 100644 +74 −0 Original line number Diff line number Diff line { lib, buildNpmPackage, electron_31, fetchFromGitHub, writers, }: let electron = electron_31; in buildNpmPackage rec { pname = "zap-chip"; version = "2024.09.27"; src = fetchFromGitHub { owner = "project-chip"; repo = "zap"; rev = "v${version}"; hash = "sha256-Dc5rU4jJ6aJpk8mwL+XNSmtisYxF86VzXd/Aacd4p0o="; }; npmDepsHash = "sha256-ZFksGwKlXkz6XTs2QdalGB0hR16HfB69XQOFWI9X/KY="; env.ELECTRON_SKIP_BINARY_DOWNLOAD = "1"; env.CYPRESS_INSTALL_BINARY = "0"; patches = [ # the build system creates a file `.version.json` from a git command # as we don't build from a git repo, we create the file manually in postPatch # and this patch disables the logic running git ./dont-get-version-from-git.patch # some files are installed via `npx copyfiles` which tries to download # code from the internet. This fails in the sandbox. This patch replaces the # logic by running "normal" commands instead of `npx copyfiles` ./dont-download-copyfiles-to-copy-files.patch ]; postPatch = let versionJson = { hash = version; timestamp = 1; date = version; zapVersion = version; }; in '' cp ${writers.writeJSON "zapversion.json" versionJson} .version.json cat .version.json ''; postBuild = '' npm exec electron-builder -- \ --dir \ -c.electronDist=${electron.dist} \ -c.electronVersion=${electron.version} ''; postInstall = '' # this file is also used at runtime install -m644 .version.json $out/lib/node_modules/zap/ # home-assistant chip-* python packages need the executable under the name zap-cli ln -s $out/bin/zap $out/bin/zap-cli ''; meta = { description = "Generic generation engine and user interface for applications and libraries based on Zigbee Cluster Library (ZCL)"; changelog = "https://github.com/project-chip/zap/releases/tag/v${version}"; license = lib.licenses.asl20; maintainers = with lib.maintainers; [ symphorien ]; mainProgram = "zap-cli"; }; } pkgs/development/python-modules/home-assistant-chip-clusters/default.nix +8 −10 Original line number Diff line number Diff line { lib, buildPythonPackage, fetchPypi, home-assistant-chip-wheels, aenum, dacite, }: buildPythonPackage rec { pname = "home-assistant-chip-clusters"; version = "2024.9.0"; inherit (home-assistant-chip-wheels) version; format = "wheel"; src = fetchPypi { inherit format version; pname = "home_assistant_chip_clusters"; dist = "py3"; python = "py3"; hash = "sha256-h1umP5bgw1HByiZ0mAd6yWvGHPcvr//G5UhM/qIIkQE="; }; src = home-assistant-chip-wheels; # format=wheel needs src to be a wheel not a folder of wheels preUnpack = '' src=($src/home_assistant_chip_clusters*.whl) ''; propagatedBuildInputs = [ aenum Loading @@ -38,6 +37,5 @@ buildPythonPackage rec { changelog = "https://github.com/home-assistant-libs/chip-wheels/releases/tag/${version}"; license = licenses.asl20; maintainers = teams.home-assistant.members; sourceProvenance = with sourceTypes; [ binaryNativeCode ]; }; } pkgs/development/python-modules/home-assistant-chip-core/default.nix +10 −50 Original line number Diff line number Diff line { lib, stdenv, buildPythonPackage, fetchPypi, pythonOlder, # build autoPatchelfHook, # runtime glib, libnl, # propagates aenum, home-assistant-chip-wheels, coloredlogs, construct, cryptography, dacite, deprecation, ecdsa, rich, pyyaml, ipdb, deprecation, mobly, pygobject3, pyyaml, rich, }: buildPythonPackage rec { pname = "home-assistant-chip-core"; version = "2024.9.0"; inherit (home-assistant-chip-wheels) version; format = "wheel"; disabled = pythonOlder "3.7"; src = let system = { "aarch64-linux" = { name = "aarch64"; hash = "sha256-oVqPaScNCjf1xY2iWJTXTh2YqimZk5kVsiQN586j9mc="; }; "x86_64-linux" = { name = "x86_64"; hash = "sha256-hWH2UCYIuDMFS/W4FELW57iQft0jfGPt8aFT1k59sWA="; }; } .${stdenv.system} or (throw "Unsupported system: ${stdenv.system}"); in fetchPypi { pname = "home_assistant_chip_core"; inherit version format; dist = "cp37"; python = "cp37"; abi = "abi3"; platform = "manylinux_2_31_${system.name}"; hash = system.hash; }; nativeBuildInputs = [ autoPatchelfHook ]; src = home-assistant-chip-wheels; buildInputs = [ glib libnl ]; # format=wheel needs src to be a wheel not a folder of wheels preUnpack = '' src=($src/home_assistant_chip_core*.whl) ''; propagatedBuildInputs = [ aenum Loading Loading @@ -104,10 +69,5 @@ buildPythonPackage rec { changelog = "https://github.com/home-assistant-libs/chip-wheels/releases/tag/${version}"; license = licenses.asl20; maintainers = teams.home-assistant.members; platforms = [ "aarch64-linux" "x86_64-linux" ]; sourceProvenance = with sourceTypes; [ binaryNativeCode ]; }; } Loading
pkgs/by-name/za/zap-chip/dont-download-copyfiles-to-copy-files.patch 0 → 100644 +42 −0 Original line number Diff line number Diff line diff --git a/src-script/pack-apack-win-linux.js b/src-script/pack-apack-win-linux.js index 0120f9f9..41fcf99c 100644 --- a/src-script/pack-apack-win-linux.js +++ b/src-script/pack-apack-win-linux.js @@ -6,12 +6,12 @@ exports.default = async function (context) { context.electronPlatformName === 'win32' || context.electronPlatformName === 'linux' ) { - return scriptUtil.executeCmd({}, 'npx', [ - 'copyfiles', - '-V', - '-f', - path.resolve(context.outDir, '../apack.json'), - context.appOutDir + return scriptUtil.executeCmd({}, 'install', [ + '-m466', + '-v', + '-Dt', + context.appOutDir, + path.resolve(context.outDir, '../apack.json') ]) } } diff --git a/src-script/script-util.js b/src-script/script-util.js index 1897c2b8..9faa5f20 100644 --- a/src-script/script-util.js +++ b/src-script/script-util.js @@ -181,11 +181,9 @@ async function rebuildBackendIfNeeded() { return scriptUtil .executeCmd({}, 'npx', ['tsc', '--build', './tsconfig.json']) .then(() => - scriptUtil.executeCmd({}, 'npx', [ - 'copyfiles', - './src-electron/**/*.sql', - './src-electron/icons/*', - './dist/' + scriptUtil.executeCmd({}, 'bash', [ + '-xec', + 'for i in ./src-electron/**/*.sql ./src-electron/icons/*; do install -m 644 -Dt dist/$(dirname $i) $i; done' ]) ) }
pkgs/by-name/za/zap-chip/dont-get-version-from-git.patch 0 → 100644 +28 −0 Original line number Diff line number Diff line diff --git a/src-script/script-util.js b/src-script/script-util.js index 1897c2b8..aaf9a08b 100644 --- a/src-script/script-util.js +++ b/src-script/script-util.js @@ -196,23 +194,6 @@ async function rebuildBackendIfNeeded() { * ads the timestamp and saves it into .version.json */ async function stampVersion() { - try { - let out = await getStdout('{"hash": null,"date": null}', 'git', [ - 'log', - '-1', - '--format={"hash": "%H","timestamp": %ct}' - ]) - let version = JSON.parse(out) - let d = new Date(version.timestamp * 1000) // git gives seconds, Date needs milliseconds - let result = await setPackageJsonVersion(d, 'real') - version.date = d - version.zapVersion = result.version - let versionFile = path.join(__dirname, '../.version.json') - console.log(`🔍 Git commit: ${version.hash} from ${version.date}`) - await fsp.writeFile(versionFile, JSON.stringify(version)) - } catch (err) { - console.log(`Error retrieving version: ${err}`) - } } /**
pkgs/by-name/za/zap-chip/package.nix 0 → 100644 +74 −0 Original line number Diff line number Diff line { lib, buildNpmPackage, electron_31, fetchFromGitHub, writers, }: let electron = electron_31; in buildNpmPackage rec { pname = "zap-chip"; version = "2024.09.27"; src = fetchFromGitHub { owner = "project-chip"; repo = "zap"; rev = "v${version}"; hash = "sha256-Dc5rU4jJ6aJpk8mwL+XNSmtisYxF86VzXd/Aacd4p0o="; }; npmDepsHash = "sha256-ZFksGwKlXkz6XTs2QdalGB0hR16HfB69XQOFWI9X/KY="; env.ELECTRON_SKIP_BINARY_DOWNLOAD = "1"; env.CYPRESS_INSTALL_BINARY = "0"; patches = [ # the build system creates a file `.version.json` from a git command # as we don't build from a git repo, we create the file manually in postPatch # and this patch disables the logic running git ./dont-get-version-from-git.patch # some files are installed via `npx copyfiles` which tries to download # code from the internet. This fails in the sandbox. This patch replaces the # logic by running "normal" commands instead of `npx copyfiles` ./dont-download-copyfiles-to-copy-files.patch ]; postPatch = let versionJson = { hash = version; timestamp = 1; date = version; zapVersion = version; }; in '' cp ${writers.writeJSON "zapversion.json" versionJson} .version.json cat .version.json ''; postBuild = '' npm exec electron-builder -- \ --dir \ -c.electronDist=${electron.dist} \ -c.electronVersion=${electron.version} ''; postInstall = '' # this file is also used at runtime install -m644 .version.json $out/lib/node_modules/zap/ # home-assistant chip-* python packages need the executable under the name zap-cli ln -s $out/bin/zap $out/bin/zap-cli ''; meta = { description = "Generic generation engine and user interface for applications and libraries based on Zigbee Cluster Library (ZCL)"; changelog = "https://github.com/project-chip/zap/releases/tag/v${version}"; license = lib.licenses.asl20; maintainers = with lib.maintainers; [ symphorien ]; mainProgram = "zap-cli"; }; }
pkgs/development/python-modules/home-assistant-chip-clusters/default.nix +8 −10 Original line number Diff line number Diff line { lib, buildPythonPackage, fetchPypi, home-assistant-chip-wheels, aenum, dacite, }: buildPythonPackage rec { pname = "home-assistant-chip-clusters"; version = "2024.9.0"; inherit (home-assistant-chip-wheels) version; format = "wheel"; src = fetchPypi { inherit format version; pname = "home_assistant_chip_clusters"; dist = "py3"; python = "py3"; hash = "sha256-h1umP5bgw1HByiZ0mAd6yWvGHPcvr//G5UhM/qIIkQE="; }; src = home-assistant-chip-wheels; # format=wheel needs src to be a wheel not a folder of wheels preUnpack = '' src=($src/home_assistant_chip_clusters*.whl) ''; propagatedBuildInputs = [ aenum Loading @@ -38,6 +37,5 @@ buildPythonPackage rec { changelog = "https://github.com/home-assistant-libs/chip-wheels/releases/tag/${version}"; license = licenses.asl20; maintainers = teams.home-assistant.members; sourceProvenance = with sourceTypes; [ binaryNativeCode ]; }; }
pkgs/development/python-modules/home-assistant-chip-core/default.nix +10 −50 Original line number Diff line number Diff line { lib, stdenv, buildPythonPackage, fetchPypi, pythonOlder, # build autoPatchelfHook, # runtime glib, libnl, # propagates aenum, home-assistant-chip-wheels, coloredlogs, construct, cryptography, dacite, deprecation, ecdsa, rich, pyyaml, ipdb, deprecation, mobly, pygobject3, pyyaml, rich, }: buildPythonPackage rec { pname = "home-assistant-chip-core"; version = "2024.9.0"; inherit (home-assistant-chip-wheels) version; format = "wheel"; disabled = pythonOlder "3.7"; src = let system = { "aarch64-linux" = { name = "aarch64"; hash = "sha256-oVqPaScNCjf1xY2iWJTXTh2YqimZk5kVsiQN586j9mc="; }; "x86_64-linux" = { name = "x86_64"; hash = "sha256-hWH2UCYIuDMFS/W4FELW57iQft0jfGPt8aFT1k59sWA="; }; } .${stdenv.system} or (throw "Unsupported system: ${stdenv.system}"); in fetchPypi { pname = "home_assistant_chip_core"; inherit version format; dist = "cp37"; python = "cp37"; abi = "abi3"; platform = "manylinux_2_31_${system.name}"; hash = system.hash; }; nativeBuildInputs = [ autoPatchelfHook ]; src = home-assistant-chip-wheels; buildInputs = [ glib libnl ]; # format=wheel needs src to be a wheel not a folder of wheels preUnpack = '' src=($src/home_assistant_chip_core*.whl) ''; propagatedBuildInputs = [ aenum Loading Loading @@ -104,10 +69,5 @@ buildPythonPackage rec { changelog = "https://github.com/home-assistant-libs/chip-wheels/releases/tag/${version}"; license = licenses.asl20; maintainers = teams.home-assistant.members; platforms = [ "aarch64-linux" "x86_64-linux" ]; sourceProvenance = with sourceTypes; [ binaryNativeCode ]; }; }