[elbe-devel] [PATCH 5/6] elbepack: init: allow setting PYTHONWARNINGS
Thomas Weißschuh
thomas.weissschuh at linutronix.de
Tue Jul 2 09:53:35 CEST 2024
This will be used during development to make sure no warnings are
emitted.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
elbepack/commands/init.py | 6 +++++-
elbepack/commands/initvm.py | 6 +++++-
elbepack/init/init-elbe.sh.mako | 4 ++++
elbepack/initvmaction.py | 3 +++
4 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/elbepack/commands/init.py b/elbepack/commands/init.py
index 6db8ed8ae53d..de5bc4154e38 100644
--- a/elbepack/commands/init.py
+++ b/elbepack/commands/init.py
@@ -9,7 +9,7 @@ import pathlib
import shutil
import subprocess
import sys
-from optparse import OptionParser
+from optparse import OptionParser, SUPPRESS_HELP
import elbepack.init
from elbepack.commands import add_deprecated_optparse_option
@@ -69,6 +69,10 @@ def run_command(argv):
default=True,
help='Skip building Source CDROM')
+ oparser.add_option('--fail-on-warning', action='store_true',
+ dest='fail_on_warning', default=False,
+ help=SUPPRESS_HELP)
+
(opt, args) = oparser.parse_args(argv)
if not args:
diff --git a/elbepack/commands/initvm.py b/elbepack/commands/initvm.py
index 4952a3497d69..a42b2f78a93d 100644
--- a/elbepack/commands/initvm.py
+++ b/elbepack/commands/initvm.py
@@ -4,7 +4,7 @@
import os
import sys
-from optparse import OptionParser
+from optparse import OptionParser, SUPPRESS_HELP
from elbepack.commands import add_deprecated_optparse_option
from elbepack.initvmaction import InitVMAction, InitVMError
@@ -62,6 +62,10 @@ def run_command(argv):
dest='qemu_mode', default=False,
help='Use QEMU direct instead of libvirtd.')
+ oparser.add_option('--fail-on-warning', action='store_true',
+ dest='fail_on_warning', default=False,
+ help=SUPPRESS_HELP)
+
PreprocessWrapper.add_options(oparser)
(opt, args) = oparser.parse_args(argv)
diff --git a/elbepack/init/init-elbe.sh.mako b/elbepack/init/init-elbe.sh.mako
index fe0c3a4070b8..ebac3e0706d9 100644
--- a/elbepack/init/init-elbe.sh.mako
+++ b/elbepack/init/init-elbe.sh.mako
@@ -51,6 +51,10 @@ in-target update-initramfs -u
echo 'PermitRootLogin yes' >> /buildenv/etc/ssh/sshd_config
% endif
+% if opt.fail_on_warning:
+ echo 'PYTHONWARNINGS="error"' >> /buildenv/etc/default/python3-elbe-daemon
+% endif
+
# since elbe fetch_initvm_pkgs generates repo keys,
# we need entropy in the target
diff --git a/elbepack/initvmaction.py b/elbepack/initvmaction.py
index bf520c4250d4..362149c0fabb 100644
--- a/elbepack/initvmaction.py
+++ b/elbepack/initvmaction.py
@@ -750,6 +750,9 @@ class CreateAction(InitVMAction):
if not opt.build_sources:
init_opts.append('--skip-build-source')
+ if opt.fail_on_warning:
+ init_opts.append('--fail-on-warning')
+
if cdrom:
cdrom_opts = ['--cdrom', cdrom]
else:
--
2.45.2
More information about the elbe-devel
mailing list