[elbe-devel] [PATCH] elbepack: use devel initvm automatically when running from source tree

Thomas Weißschuh thomas.weissschuh at linutronix.de
Wed Apr 10 12:42:18 CEST 2024


Elbe knows about two indicators for "development mode".
The first one is elbepack.version.is_devel which detects if elbe is
running from the source checkout.
The second one is "elbe initvm --devel" which needs to be specified by
the user to install the current source tree into the initvm.

Using --devel while is_devel == False was explicitly forbidden.
The inverse, using the non-devel initvm from a source checkout is not
guaranteed to work either and a source for confusion to users.

Instead automatically use the devel initvm when running from the source
tree.

---
Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
 README.adoc                     |  4 ----
 bash-completion                 |  2 +-
 docs/elbe-initvm.txt            |  3 ---
 elbepack/commands/init.py       | 20 ++++----------------
 elbepack/commands/initvm.py     |  7 -------
 elbepack/init/init-elbe.sh.mako |  2 +-
 elbepack/initvmaction.py        |  3 ---
 7 files changed, 6 insertions(+), 35 deletions(-)

diff --git a/README.adoc b/README.adoc
index 7019b799e753..03bb8c1b6a57 100644
--- a/README.adoc
+++ b/README.adoc
@@ -46,7 +46,3 @@ Crash Course
         elbe-build-<TIMESTAMP>
 
 3. copy the rfs to a sdcard: `sudo dd if=elbe-build*/sdcard.img of=/dev/mmcblk0`
-
-NOTE: When using a specific ELBE git checkout or during development you may
-want to use the `./elbe initvm create --devel` parameter to make the elbe
-version in the initvm match the one in your git checkout.
diff --git a/bash-completion b/bash-completion
index d010e4ccec8f..10c894ac6b96 100644
--- a/bash-completion
+++ b/bash-completion
@@ -127,7 +127,7 @@ _cmd_args_completion_elbe()
                 file_arg=true
                 disable_space=true
                 cmd_opt=$(_elbe_cmd_with_options '-h --help --skip-validation --directory= --cdrom= --buildtype= \
-                                                  --debug --devel --nesting --skip-build-bin --skip-build-sources')
+                                                  --debug --nesting --skip-build-bin --skip-build-sources')
                 ;;
             initvm)
                 cmd_opt=$(_elbe_subcmd_with_opt 'attach create ensure start stop submit sync')
diff --git a/docs/elbe-initvm.txt b/docs/elbe-initvm.txt
index 712de94a310d..68faf8ea873d 100644
--- a/docs/elbe-initvm.txt
+++ b/docs/elbe-initvm.txt
@@ -39,9 +39,6 @@ OPTIONS
 --cdrom <CDROM>::
 	ISO image of Binary cdrom.
 
---devel::
-	Install elbe Version from the current working into initvm.
-
 --skip-download::
 	After the build has finished, the generated Files are downloaded from
 	the initvm to the host. This step is skipped, when this option is specified.
diff --git a/elbepack/commands/init.py b/elbepack/commands/init.py
index 82fb6f7a8052..19bb888a1443 100644
--- a/elbepack/commands/init.py
+++ b/elbepack/commands/init.py
@@ -52,13 +52,6 @@ def run_command(argv):
         default=False,
         help='start qemu in graphical mode to enable console switch')
 
-    oparser.add_option(
-        '--devel',
-        dest='devel',
-        action='store_true',
-        default=False,
-        help='use devel mode, and install current builddir inside initvm')
-
     oparser.add_option(
         '--nesting',
         dest='nesting',
@@ -93,12 +86,6 @@ def run_command(argv):
         sys.exit(79)
 
     with elbe_logging({'files': None}):
-        if opt.devel:
-            if not is_devel:
-                logging.error('Devel Mode only valid, '
-                              'when running from elbe checkout')
-                sys.exit(80)
-
         if not opt.skip_validation:
             validation = validate_xml(args[0])
             if validation:
@@ -152,12 +139,13 @@ def run_command(argv):
         initvm_http_proxy = http_proxy.replace('http://localhost:',
                                                'http://10.0.2.2:')
         elbe_exe = '/usr/bin/elbe'
-        if opt.devel:
+        if is_devel:
             elbe_exe = '/var/cache/elbe/devel/elbe'
         prj = xml.node('/initvm')
 
         d = {'elbe_exe': elbe_exe,
              'elbe_version': elbe_version,
+             'is_devel': is_devel,
              'defs': defs,
              'opt': opt,
              'xml': xml,
@@ -240,7 +228,7 @@ def run_command(argv):
                 --output {export_keyring}',
             env_add={'GNUPGHOME': out_path})
 
-        if opt.devel:
+        if is_devel:
             opts = [
                 '--exclude-vcs',
                 '--exclude-vcs-ignores',
@@ -261,7 +249,7 @@ def run_command(argv):
 
         elbe_in = Filesystem(out_path)
 
-        if opt.devel:
+        if is_devel:
             to_cpy.append(('elbe-devel.tar.bz2', ''))
 
         # Convert relative rfs path to absolute in the system
diff --git a/elbepack/commands/initvm.py b/elbepack/commands/initvm.py
index 208b1c4aaae3..93fcf2378c4a 100644
--- a/elbepack/commands/initvm.py
+++ b/elbepack/commands/initvm.py
@@ -22,13 +22,6 @@ def run_command(argv):
     oparser.add_option('--cdrom', dest='cdrom', default=None,
                        help='iso image of Binary cdrom')
 
-    oparser.add_option(
-        '--devel',
-        action='store_true',
-        dest='devel',
-        default=False,
-        help='Install elbe Version from the current working into initvm')
-
     oparser.add_option('--skip-download', action='store_true',
                        dest='skip_download', default=False,
                        help='Skip downloading generated Files')
diff --git a/elbepack/init/init-elbe.sh.mako b/elbepack/init/init-elbe.sh.mako
index 07cb87941135..35576f7bc7a1 100644
--- a/elbepack/init/init-elbe.sh.mako
+++ b/elbepack/init/init-elbe.sh.mako
@@ -42,7 +42,7 @@ EOF
 
 in-target update-initramfs -u
 
-% if opt.devel:
+% if is_devel:
    mkdir /buildenv/var/cache/elbe/devel
    tar xj -f elbe-devel.tar.bz2 -C /buildenv/var/cache/elbe/devel
    echo "export PATH=/var/cache/elbe/devel:\$PATH" > /buildenv/etc/profile.d/elbe-devel-path.sh
diff --git a/elbepack/initvmaction.py b/elbepack/initvmaction.py
index 16891bc05ff2..35f78906781a 100644
--- a/elbepack/initvmaction.py
+++ b/elbepack/initvmaction.py
@@ -743,9 +743,6 @@ class CreateAction(InitVMAction):
 
         try:
             init_opts = []
-            if opt.devel:
-                init_opts.append('--devel')
-
             if opt.nesting:
                 init_opts.append('--nesting')
 

---
base-commit: 41747ffae99073c8ae1380c202c2eef740bf570a
change-id: 20240410-auto-devel-62c24d6d3f56

Best regards,
-- 
Thomas Weißschuh <thomas.weissschuh at linutronix.de>



More information about the elbe-devel mailing list