From db83efd4d439ecd100c9b2400c00a68597444d89 Mon Sep 17 00:00:00 2001 From: xengineering Date: Fri, 25 Jul 2025 22:38:51 +0200 Subject: tools: Remove deploy.py This prepares switching to deployment with only a single archive file. The deploy script will be re-written as soon as this transition is complete. --- tools/deploy.py | 58 --------------------------------------------------------- 1 file changed, 58 deletions(-) delete mode 100755 tools/deploy.py (limited to 'tools') diff --git a/tools/deploy.py b/tools/deploy.py deleted file mode 100755 index 26048e8..0000000 --- a/tools/deploy.py +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env python3 - - -import argparse -import subprocess -import pathlib - - -SCRIPT = pathlib.Path(__file__) -SOURCE_ROOT = SCRIPT.parent.parent.resolve() -ARTIFACTS_DEFAULT = SOURCE_ROOT / "build" / "artifacts" - - -def main() -> None: - parser = argparse.ArgumentParser( - description="Use OpenSSH and rsync to deploy artifacts", - ) - - parser.add_argument( - "-a", - "--artifacts", - default=ARTIFACTS_DEFAULT, - help="local path to artifacts folder", - ) - parser.add_argument( - "-H", "--host", default="cloud", help="target `Host` name from ~/.ssh/config" - ) - parser.add_argument( - "-p", - "--path", - default="/srv/http/deploy.xengineering.eu/public/git/iot-contact/main/", - help="remote path to destination folder on server", - ) - parser.add_argument( - "-d", - "--dry-run", - action="store_true", - help="do not execute command and instead print it", - ) - - args = parser.parse_args() - - command = [ - "rsync", - "-av", - "--delete", - f"{str(pathlib.Path(args.artifacts).resolve())}/", - f"{args.host}:{args.path}", - ] - - if args.dry_run: - print(command) - else: - subprocess.run(command, shell=False, check=True) - - -if __name__ == "__main__": - main() -- cgit v1.2.3-70-g09d2 From ce9b6c2d205b7d2559a49a36a8d7422ccd12a177 Mon Sep 17 00:00:00 2001 From: xengineering Date: Sat, 26 Jul 2025 18:59:33 +0200 Subject: tools: Re-introduce deploy.py script After the transition to tar archive based deployment it can now be re-introduced with small changes. --- meson.build | 4 ++-- tools/deploy.py.in | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ tools/meson.build | 8 ++++++++ 3 files changed, 67 insertions(+), 2 deletions(-) create mode 100755 tools/deploy.py.in (limited to 'tools') diff --git a/meson.build b/meson.build index a6fd4a0..7549940 100644 --- a/meson.build +++ b/meson.build @@ -7,6 +7,8 @@ tar = find_program('tar', required : true) fs = import('fs') +project_version_string = meson.project_name() + '-v' + meson.project_version() + html = fs.copyfile(meson.current_source_dir() / 'web' / 'index.html') css = fs.copyfile(meson.current_source_dir() / 'simple.css' / 'simple.css') @@ -25,8 +27,6 @@ artifacts = [ kicad_pcb, ] -project_version_string = meson.project_name() + '-v' + meson.project_version() - custom_target( output: project_version_string + '.tar.zst', command: [ diff --git a/tools/deploy.py.in b/tools/deploy.py.in new file mode 100755 index 0000000..8eeecda --- /dev/null +++ b/tools/deploy.py.in @@ -0,0 +1,57 @@ +#!/usr/bin/env python3 + + +import argparse +import subprocess +import pathlib + + +SCRIPT = pathlib.Path(__file__) +BUILD_ROOT = SCRIPT.parent.parent.resolve() +ARTIFACTS_DEFAULT = BUILD_ROOT / "@PROJECT_VERSION_STRING@.tar.zst" + + +def main() -> None: + parser = argparse.ArgumentParser( + description="Use OpenSSH and rsync to deploy artifacts", + ) + + parser.add_argument( + "-a", + "--artifacts", + default=ARTIFACTS_DEFAULT, + help="local path to artifacts archive file", + ) + parser.add_argument( + "-H", "--host", default="cloud", help="target `Host` name from ~/.ssh/config" + ) + parser.add_argument( + "-p", + "--path", + default="/srv/http/deploy.xengineering.eu/public/git/iot-contact/", + help="remote path to destination folder on server", + ) + parser.add_argument( + "-d", + "--dry-run", + action="store_true", + help="do not execute command and instead print it", + ) + + args = parser.parse_args() + + command = [ + "rsync", + "-av", + f"{str(pathlib.Path(args.artifacts).resolve())}", + f"{args.host}:{args.path}", + ] + + if args.dry_run: + print(command) + else: + subprocess.run(command, shell=False, check=True) + + +if __name__ == "__main__": + main() diff --git a/tools/meson.build b/tools/meson.build index f58c54b..2a33d0e 100644 --- a/tools/meson.build +++ b/tools/meson.build @@ -1,3 +1,11 @@ configure_zephyr = meson.current_source_dir() / 'configure_zephyr.py' build_zephyr = meson.current_source_dir() / 'build_zephyr.py' make_factory_image = meson.current_source_dir() / 'make_factory_image.py' + +configure_file( + configuration : { + 'PROJECT_VERSION_STRING': project_version_string, + }, + input : 'deploy.py.in', + output : 'deploy.py', +) -- cgit v1.2.3-70-g09d2