Commit Graph

43 Commits

Author SHA1 Message Date
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
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
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
Marcus Schäfer
a77288fac2
Fix unit tests to run in parallel
Setting sys.argv and global variables impacts tests such that
they cannot run in parallel. The little footprint of excluding
the --config global args test from the coverage is beneficial
to allow parallel test runs
2022-12-14 16:58:43 +01:00
Marcus Schäfer
80fffdecc2
Support repo URI's with credentials on cmdline
Specifying a repository as part of the image description
allows for credentials via the username and password attributes.
Howver, repositories can also be specified on the commandline
via the --set-repo / --add-repo options. The options on the
commandline did not allow to specify credentials so far.
This commit adds the commandline options --set-repo-credentials
and --add-repo-credentials to support them
2022-12-14 16:58:43 +01:00
Marcus Schäfer
b8bcabf30c
Added --loglevel option
specify logging level as number. Details about the
available log levels can be found at:
https://docs.python.org/3/library/logging.html#logging-levels
Setting a log level causes all message >= level to be
displayed.
2022-11-08 15:06:50 +01:00
Marcus Schäfer
ce203dbe14
Added support for --logsocket
Like with --logfile this commit adds support for using
an existing Unix Domain Socket for logging. It's required
that there is a listener on the given socket otherwise
kiwi exits with an appropriate error message from the
socket layer. A simple listener could look like the
following:

```python
sock_file = '/tmp/log_socket'
buffer = 1024
if os.path.exists(sock_file):
    os.unlink(sock_file)
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
sock.bind(sock_file)
sock.listen(1)
while True:
    connection, client_address = sock.accept()
    try:
        while True:
            data = connection.recv(buffer)
            if not data:
                break
            print(data.decode())
    finally:
        connection.close()
```

With the listener in place kiwi can be called as follows:

    kiwi-ng --logsocket /tmp/log_socket ...
2022-10-29 20:36:08 +02:00
Marcus Schäfer
9c9250ebc4
Support nose and xunit style tests
The modifications in this commit allows the unit tests
to run on both, pytest 6.x (nose test layout) and the new
pytest 7.x (xunit test layout). This Fixes #2072 in a
much nicer way. Thanks much to @smarlowucf
2022-02-26 20:26:18 +01:00
Marcus Schäfer
dd763835cf
Added debug option --debug-run-scripts-in-screen
Instead of running scripts in screen if the --debug switch is
set, we allow to explicitly switch on this behavior via
a new option. This Fixes #2010
2022-01-11 09:38:22 +01:00
Marcus Schäfer
ed523284f2
Add global --kiwi-file option
When building with kiwi a search on the kiwi main config
file is made inside of the given --description directory.
The search looks up for the file config.xml or *.kiwi.
So far there was no opportunity to specify another name.
This commit adds an option in the global area named:

    --kiwi-file name

which will make kiwi to lookup this file inside of the
given --description directory and fail if it does not
exist. This Fixes #1973
2021-11-29 12:23:26 +01:00
Marcus Schäfer
fc2446dfea
Moving temp data handling to its own namespace
Moving use of mkdtemp, NamedTemporaryFile and TemporaryDirectory
into its own class called Temporary: By default all temporary
data is created below /var/tmp but can be changed via the
global commandline option --temp-dir. This Fixes #1870
2021-07-22 13:31:44 +02:00
Marcus Schäfer
ce9b1ccc08
Added option to set the image target architecture
The option --target-arch allows to set the architecture
used to build the image. By default this is the host
architecture. Please note, if the specified architecture
name does not match the host architecture and is therefore
requesting a cross architecture image build, it's important
to understand that for this process to work a preparatory
step to support the image architecture and binary format
on the building host is required and is not considered a
responsibility of kiwi. There will be a followup effort
on providing a plugin for kiwi which should be used to
manage the needed binfmt settings for cross arch image
builds
2021-04-14 12:53:28 +02:00
Marcus Schäfer
f05e8b905a
Fixed API vs. CLI inconsistency
when using kiwi as API the program fails with a usage message
from the Cli class. The kiwi.cli module should not be imported
except for kiwi comandline tasks. It has turned out that the
RuntimeConfig class which is used in several places in different
API classes imports Cli and creates an instance of it to check
for a global option. This causes major issues for all programs
which uses the kiwi API but not the command line interface because
the docopt call in Cli() expects a valid docstring which only
exists in kiwi's cli.py. This commit fixes the inconsistency
and allows people to use the kiwi API independent of any
command line interface. Fixes #1755
2021-03-08 10:08:26 +01:00
Marcus Schäfer
b84f142ce4
Allow to specify config file on the command line
The optional kiwi runtime config file (kiwi.yml) could
only be read from ~/.config/kiwi/config.yml or /etc/kiwi.yml
This commits adds the global option --config which allows
to specify a custom runtime configuration as well.
2021-02-06 17:01:24 +01:00
Marcus Schäfer
3e8e6c8608
Followup fix to handle one disk type better
The vmx type is auto converted into an oem type with rootfs
resize disabled such that all disk images can be handled
under one disk type. However people who run kiwi on the
commandline and have selected --type vmx before now end
with an error message saying that there is no vmx type
because it was converted into an oem type. To handle this
more gracefully this commit changes the commandline
option --type vmx into --type oem if provided and prints
a warning message.
2020-09-23 10:21:40 +02:00
Marcus Schäfer
8d2d9c214c
Make oem be a superset of vmx
A vmx image is the same disk as an oem just without the dracut
repart/resize feature. This difference is better handled with
an oemconfig parameter <oem-resize> which allows to switch resize
on or off. The extra image type vmx will be dropped and an XSLT
stylesheet automatically transforms a vmx description to be a
oem image with the resize feature switched off.
This Fixes #1425
2020-09-16 12:56:14 +02:00
Marcus Schäfer
52c5d4a703
Refactor plugin architecture
Set kiwi.tasks to be the plugin entry point and register
existing task plugins in setup.py. Change the code in
cli.py to auto register plugins using the iter_entry_points
method from the pkg_resources class. This allows for easier
writing of external kiwi plugins.
2020-02-26 16:40:04 +01:00
Marcus Schäfer
f8bc05fd42
Refactor use of raises in unit tests
Use raises as context manager instead of a method decorator.
This clearly identifies which code part is expected to raise
an exception. Related to Issue #1128
2019-09-29 19:42:43 +02:00
Marcus Schäfer
be17186503
Add --add-bootstrap-packages option
The prepare and build commands now allows to specify additional
packages to be installed as part of the early bootstrap phase
This Fixes #1151
2019-08-29 11:38:56 +02:00
Dan Čermák
b015b91679
Stop inheriting from object
This is no longer required in Python3
2019-08-22 15:43:27 +02:00
David Cassany
dd21e6c8d7
Add '--add-container-label' flag
This commits adds a command line flag to add a label for container image
types. The flag can be used multiple times.

Fixes #770
2018-07-06 14:11:00 +02:00
Marcus Schäfer
f7a37fda78 Merge pull request #427 from SUSE/call_comfort_for_compat_mode
More comfort in calling with compat arguments
2017-07-17 10:56:49 +02:00
Marcus Schäfer
06d1a07373 More comfort in calling with compat arguments
In addition to the 'kiwi --compat -- ...' style we also support calling
the kiwi compat mode as a service via 'kiwi compat ...' The preferred
way of calling kiwi with legacy options is via the new compat service.
Thus the documentation also changed to no longer mention the --compat
option but it still exists for compatibility reasons. Fixes #407
2017-07-14 16:18:53 +02:00
Marcus Schäfer
6fe8a2a9d6
Allow use of more fine grain ignore repos options
The meaning of the --ignore-repos option has changed back
to ignore all configured repositories. A new option
named --ignore-repos-used-for-build has been added which
allows to ignore all except imageonly repositories. The
command manual pages has been changed to document the
options. This Fixes #410
2017-07-14 11:55:32 +02:00
Marcus Schäfer
f9f4f0b5e0
Delete obsolete --obs-repo-internal switch 2017-07-07 10:05:28 +02:00
David Cassany
26995dbe9c Add --signing-key option
This commit adds --signing-key option which sets a key file to import
into the package manager trusted keys database. This commit adds this
flag support only for zypper.

Fixes #342
2017-05-24 13:11:15 +02:00
Marcus Schäfer
c368c2731c
Added --clear-cache option
The system prepare and build commands now provides the
option --clear-cache which deletes all cache data
associated with the repositories to build the image.
This Fixes #341
2017-05-22 17:57:57 +02:00
Marcus Schäfer
cec1512ba1 Additional container commandline options
Added --set-container-derived-from and --set-container-tag
commandline options which allows to overwrite the data set
in the XML configuration
2017-04-26 16:47:15 +02:00
Marcus Schäfer
6cc0b2085d Flake cleanup for unit tests 2017-03-07 13:03:10 +01:00
Marcus Schäfer
aa296716c8
Use docopt's default value feature for cache dir 2016-10-25 21:59:51 +02:00
Marcus Schäfer
5b755e7b92 Added global option --shared-cache-dir
The option allows to specify an alternative shared host_to_image
cache directory. The default location is /var/cache/kiwi.
Fixes #92
2016-10-25 17:51:57 +02:00
Marcus Schäfer
c9c71f4dc5 Added kiwi image resize command
The image resize command allows to resize a disk image
and its optional disk format to a new disk geometry
2016-10-18 10:13:41 +02:00
Marcus Schäfer
08bbe74abc
Added --ignore-repos for build and prepare tasks
The option allows to ignore all repos configured in the
XML description. This allows to specify a complete set
of repositories via the commandline
2016-08-17 16:26:35 +02:00
Marcus Schäfer
0ebe777056 Don't search for kiwicompat in fixed absolute path
Allow alternative locations from search PATH
2016-05-31 15:49:31 +02:00
Marcus Schäfer
d5f1bdd159
Added --add|delete package for prepare command
Allow additional packages to be installed/deleted when
calling system prepare. Fixes #62
2016-04-28 14:21:57 +02:00
Marcus Schäfer
e68d61dc6b
Make color output an option
By default no color output is used
2016-04-01 22:50:00 +02:00
Marcus Schäfer
e6cc5bfa09 Move from nose to pytest
nose is no longer maintained, thus we have to move to another
testing system. This commit updates the tox setup and all tests
to use pytest instead of nose.
2016-03-14 12:23:14 +01:00
Marcus Schäfer
40e6308aa9 Port application from python 2.7 to 3.4
For new applications like this kiwi version and its use cases
it is better to base it on a more recent python version
2016-02-17 22:38:38 +01:00
Marcus Schäfer
a1aab40cae
Added git like command completion
Provide a 'Did you mean' log message for unclear task names
2016-02-09 21:12:03 +01:00
Marcus Schäfer
f2ff481bf2
Added support for kiwi --compat
The --compat call will trigger the call of the kiwicompat
tool written to support legacy kiwi commandlines. An example
could look like the following call:

    sudo kiwi --compat -- --build /my/description --type vmx -d /my/dest

Please be aware the -- is required to tell docopt to treat all
options as parameters
2016-02-04 15:06:56 +01:00
Marcus Schäfer
e95eab38fa
Added support for using internal build service
An option --obs-repo-internal was added
2016-01-25 17:09:19 +01:00
Marcus Schäfer
9c60b1f128
Added kiwi result task
Implementing 'kiwi result list' which marshal loads the
serialized result instance from a previous build and shows
the build results
2016-01-15 11:38:08 +01:00
Marcus Schäfer
09daca60c0
KIWI - appliance builder next generation
a rewrite of the current kiwi from https://github.com/openSUSE/kiwi
2015-12-05 16:17:10 +01:00