Commit Graph

1620 Commits

Author SHA1 Message Date
Marcus Schäfer
3220e357d3
Add schema upgrade opportunity for old schemas
kiwi files using a schema version < 7.4 are no longer supported
by kiwi >= v10.x.x. Thus this commit provides the required
XSL stylesheets to upgrade older schemas to v74 such that they
can be consumed by the latest kiwi version. The needed xsltproc
instruction is placed on the main page of the documentation.
2024-04-04 16:52:25 +02:00
Marcus Schäfer
1da2886fd1
Delete kiwi compat mode
The compat mode allowed a kiwi v7 legacy argument translation
and is obsolete since a long time
2024-04-03 13:42:07 +02:00
Marcus Schäfer
8f39d7f6d0
Make excludes in bootstrap effective for dnf
Followup fix to really use the ignore information in the dnf
package manager implementation. This Fixes #2499
2024-04-03 12:27:02 +02:00
Marcus Schäfer
74152d96f2
Fix setup of discoverable partitions
Make sure GUI is unique and typecode is set according to the
standard. This Fixes #2517
2024-03-28 12:00:13 +01:00
Marcus Schäfer
1385187ccf
Allow ignore stanza in bootstrap
So far the <ignore> stanza was only effective when placed
as part of the type="image" packages section. This commit
allows to place it also to the type="bootstrap" packages.
This Fixes #2499
2024-03-22 10:33:04 +01:00
Marcus Schäfer
88ccd4d1e9
Allow bundle format to be set on the commandline
The bundle format is usually specified as part of the image
description in the bundle_format attribute. This commit also
allows to specify/overwrite the bundle format in the kiwi
result bundle command via the new --bundle-format option.
This Fixes #2509
2024-03-19 15:50:23 +01:00
Marcus Schäfer
3ac0ff72b8
Followup fix for use of /boot/zipl
The mounting of /boot/zipl is also only required if the
bootloader is set to grub2_s390x_emu
2024-03-13 09:33:30 +01:00
Marcus Schäfer
ae497f2504
Lookup distro provided BLS entries for zipl
Check if there is already an entry file name produced by the
distribution logic/policy. If we can find an already present
entry name, prefer this name over the kiwi naming policy
2024-03-12 15:37:16 +01:00
Marcus Schäfer
583f3385df
Add support for BLS zipl
Add support for <bootloader name="zipl" .../> to support BLS
based zipl configuration. This Fixes #2481
2024-03-10 11:28:21 +01:00
Marcus Schäfer
a7b984115d
Fixed delta_root build
The support for delta_root allows to build a delta container
image from a given base container. Due to the refactoring of
the kiwi code base using context managers no explicit deletion
of instances happens anymore. This uncovered a weakness of
the delta root code at the level of the overlay mount. At
the time of the umount there are still active temporary
mount handlers which keeps the mountpoint busy. In order to
fix this properly also the PackageManager factory is now
a context manager and the Repository factory received a
cleanup method which is called when the PackageManager goes
out of scope. This refactoring also fixes the busy state
when building deltas
2024-03-07 15:50:58 +01:00
Marcus Schäfer
4fc0d2147d
Move DiskFormat to context manager
Change the DiskFormat Factory to be a context manager.
All code using DiskFormat was updated to the following
with statement:

    with DiskFormat(...).new as disk_format:
        disk_format.some_member()

This is related to Issue #2412
2024-02-29 16:42:49 +01:00
Dan Čermák
11eebcb13d
Merge pull request #2484 from OSInside/system_prepare_to_context
Move SystemPrepare to context manager
2024-02-29 16:00:33 +01:00
Marcus Schäfer
b072cfdc7c
Set default output console to gfxterm for grub
If no console setting is done in the image description for grub
the default output console is set to: gfxterm and the default
input console is set to: console. This Fixes bsc#1219074
2024-02-28 10:42:17 +01:00
Marcus Schäfer
8739088340
Catch error condition more specific
Only a KiwiCommandError is an exception we want to
catch and handle, everything else is a bug and should
not be masked
2024-02-28 10:31:38 +01:00
Marcus Schäfer
f158e22ae3
Move SystemPrepare to context manager
Change the SystemPrepare class to context manager.
All code using SystemPrepare was updated to the following
with statement:

    with SystemPrepare(...) as system_prepare:
        system_prepare.some_member()

This completes the refactoring from finalizers to
context managers and Fixes #2412
2024-02-27 15:43:06 +01:00
Marcus Schäfer
7981095304
Fallback to built-in partition UUID table
If systemd-id128 is not found or failed use the kiwi built-in
table as defined by the UAPI group to assign the partition UUID
2024-02-26 14:59:56 +01:00
Marcus Schäfer
2540d56602
Add support for discoverable partitions
Set PARTUUID according to systemd-id128 if applicable
This Fixes #1385
2024-02-26 09:42:01 +01:00
Marcus Schäfer
4bcfa7f804
Move Repository to context manager
Change the Repository Factory to be a context manager.
All code using Repository was updated to the following
with statement:

    with Repository(...).new as repo:
        repo.some_member()

This is related to Issue #2412
2024-02-22 16:17:28 +01:00
Marcus Schäfer
a39a19b35f
Move VolumeManager to context manager
Change the VolumeManager Factory to be a context manager.
All code using VolumeManager was updated to the following
with statement:

    with VolumeManager(...).new as volume_manager:
        volume_manager.some_member()

This is related to Issue #2412
2024-02-21 09:40:47 +01:00
Marcus Schäfer
5e40229b1c
Merge pull request #2457 from OSInside/drop_command_process_destructor
Drop destructor from CommandProcess
2024-02-20 09:14:07 +01:00
Neal Gompa (ニール・ゴンパ)
8f62f4417f
Merge pull request #2472 from OSInside/system_mount_as_context_manager
Move ImageSystem to context manager
2024-02-19 11:32:52 -05:00
Marcus Schäfer
ba27291de9
Drop destructor from CommandProcess
There is code that sends a SIGTERM to the process in case
there is no error code information. I believe in this case
sending SIGTERM will not kill the process (defunct) and I
also don't see in what good condition we would be entering
this state.
2024-02-19 16:37:33 +01:00
Dan Čermák
48817a6441
Refactor Command class
Command.run() currently has a bit of a confusing behavior: if raise_on_error is
False and the executable is not found, then a weird CommandT is returned (return
code is -1 and stdout+stderr is None). This makes it possible to hanlde command
not found errors separately, but it makes that needlessly verbose. So instead,
let's just return None in *this* special case.

That in turn uncovered, that in most cases when we set `raise_on_error=True`, we
actually want an error if the command is not present but no error if the command
fails to execute (e.g. because it returns -1 if you run `$cmd --version`). Hence we
introduce the flag `raise_on_command_not_found`, which causes an exception to
be raised if the command is not found. This makes it independent of the
`raise_on_error` flag.

Additionally, we add a small optimization: if command starts with /, then we
assume it's a full path and we omit the call to which (and just check whether it
exists).

Co-authored-by: Marcus Schäfer <marcus.schaefer@gmail.com>
2024-02-19 16:33:24 +01:00
Marcus Schäfer
9a8f59946e
Move ImageSystem to context manager
Change the ImageSystem class to context manager.
All code using ImageSystem was updated to the following
with statement:

    with ImageSystem(...) as image_system:
        image_system.some_member()

This is related to Issue #2412
2024-02-19 16:17:00 +01:00
Alexandre Detiste
fb69627ad3
Use unittest.mock from core python everywhere
mock was an independent module that has been merged into the Python standard library.
2024-02-18 22:15:30 +01:00
Fabian Vogt
8064538ebf
Allow specifying the filesystem for live image, also direct squashfs
Allow specifying the filesystem for live image, also direct squashfs

By setting <type image="iso" filesystem="FSTYPE" .../> it's now possible
to specify the filesystem used for live images. By using "squashfs", the
rootfs container is skipped entirely.
2024-02-14 12:51:58 +01:00
Marcus Schäfer
cd052c0558
Move OCI to context manager
Change the OCI Factory to be a context manager.
All code using OCI was updated to the following
with statement:

    with OCI(...).new as oci:
        oci.some_member()

This is related to Issue #2412
2024-02-13 22:35:52 +01:00
Marcus Schäfer
2645225e11
Fix setup of UUID for btrfs
When setting up the UUID for a btrfs filesystem via btrfstune
it could happen that the call becomes interactive asking
a question and give a recommendation. All this is unwanted
and can be forced via the -f switch. This Fixes #2456
2024-02-13 09:27:31 +01:00
Marcus Schäfer
8c6ac25804
Fixed use of custom bootloader
In case no bootloader implementation by kiwi should be
used, users can specify the bootloader="custom" attribute.
Instead of skipping the bootloader stage in the builders
it is better to consistently create an instance of bootloader
but raise if a method of the bootloader interface is called
for which the custom bootloader has no implementation. This
commit adds the consistency bits.
2024-02-12 13:04:29 +01:00
Marcus Schäfer
d8e0d65549
Merge pull request #2452 from OSInside/no_del_on_bootloader_install_grub
Remove destructor from BootLoaderInstallGrub2
2024-02-09 10:30:52 +01:00
Marcus Schäfer
8aa517eb77
Remove destructor from BootLoaderInstallGrub2
With MountManager as context manager the BootLoaderInstallGrub2
class doesn't need a destructor anymore. This is related
to Issue #2412
2024-02-06 10:28:18 +01:00
Marcus Schäfer
ca334c1962
Remove obsolete destructor from BootImageDracut
With MountManager as context manager the BootImageDracut
class doesn't need a destructor anymore. This is
related to Issue #2412
2024-02-05 15:00:09 +01:00
Marcus Schäfer
9addfcd666
Move Raid Luks and Integrity to context manager
Change the RaidDevice, LuksDevice and IntegrityDevice classes
to context manager:

with RaidDevice(...) as raid:
    raid.some_member()

with LuksDevice(...) as luks:
    luks.some_member()

with IntegrityDevice(...) as integrity:
    integrity.some_member()

In the context of the disk builder an ExitStack is used to
handle the new context manager based classes

This is related to Issue #2412
2024-02-05 09:35:05 +01:00
Marcus Schäfer
3846ba7051
Merge pull request #2443 from OSInside/fix_csv_reading
Fix reading of os-release file
2024-02-01 15:33:37 +01:00
Marcus Schäfer
09e4758609
Move Disk to context manager
Change the Disk class to be a context manager.
All code using Disk was updated to the following
with statement:

    with Disk(...) as disk:
        disk.some_member()

This is related to Issue #2412
2024-01-31 15:04:10 +01:00
Marcus Schäfer
d154317573
Fix reading of os-release file
If the /etc/os-release file contains comments or spaces
python's csv reader will throw an exception. Thus this
data must be ripped out prior reading
2024-01-31 10:30:22 +01:00
Dan Čermák
66747c754c
Fix invalid escape sequence 2024-01-29 14:08:13 +01:00
Dan Čermák
882fb9019a
Add missing assert call to install_test 2024-01-29 14:08:13 +01:00
Dan Čermák
34934b2f8f
Convert BootLoaderConfigBase into an abstract base class 2024-01-29 14:07:41 +01:00
Dan Čermák
f906704ea5
Convert BootLoaderConfig to free function
The class serves really no purpose except for creating another
namespace. This function now allows us to have more stricter type checking.
2024-01-29 13:56:51 +01:00
Marcus Schäfer
54f92d2a9f
Drop support for syslinux/isolinux
SYSLINUX has been abandoned for several years now, and it does not
even work with modern versions of the filesystems supported in kiwi.
This commit drops it and Fixes #2433
2024-01-26 21:25:37 +01:00
Marcus Schäfer
d209a57910
Move BootLoaderConfig to context manager
Change the BootLoaderConfig class to be a context manager.
All code using BootLoaderConfig was updated to the following
with statement:

    with BootLoaderConfig.new(...) as bootloader_config:
        bootloader_config.some_member()

This is related to Issue #2412
2024-01-23 15:11:21 +01:00
Dan Čermák
3140c1e6b6
Add type hints & doc to VolumeManagerBase & VolumeManagerBtrfs
Also add additional tests for test coverage of typing edge cases
2024-01-19 13:10:32 +01:00
Dan Čermák
e808d88319
Don't catch all exceptions in MountManager.umount 2024-01-19 13:10:31 +01:00
Dan Čermák
5c364e95d4
Implement a context manager interface for MountManager 2024-01-18 16:44:56 +01:00
Marcus Schäfer
a1783ffd83
Refactor disk builder for use with context manager
In preparation to further context manager related changes
in VolumeManager, LuksDevice, RaidDevice and more the
disk builder code which uses these classes needs to be
refactored beforehand to allow switching to context
manager based cascading of the storage device classes.
This commit does the refactoring and is related to
Issue #2412
2024-01-18 15:46:08 +01:00
Marcus Schäfer
d9e9a3820b
Follow up fix for drop of hybrid boot snippets
The following is left over code from the drop of the hybrid
boot templates.
2024-01-16 15:50:45 +01:00
Neal Gompa (ニール・ゴンパ)
5ee55aeaf3
Merge pull request #2424 from OSInside/drop-grub2-linuxefi
Drop hybrid boot snippets from the GRUB 2 configuration template
2024-01-16 08:03:30 -05:00
Marcus Schäfer
31e6f2d587
Merge pull request #2428 from OSInside/move_filesystem_to_context_manager
Move FileSystem to context manager
2024-01-16 13:51:48 +01:00
Neal Gompa
a638884192 Drop hybrid boot snippets from the GRUB 2 configuration template
Sometime between GRUB 2.04 and GRUB 2.06, it became no longer
necessary to use "linuxefi"+"initrdefi" for UEFI boot. The
standard "linux"+"initrd" stanzas work for both legacy BIOS boot
and modern UEFI boot.

Some distributions no longer support "linuxefi"+"initrdefi" at all
anymore, so let's just use "linux"+"initrd" for everything now.
2024-01-16 04:37:16 -05:00