Commit Graph

45 Commits

Author SHA1 Message Date
Marcus Schäfer
3c07603f71
Fixed wrong log level on --logfile
When using --logfile, the log generated there matches the
stdout log (which without --debug, does not include any debug info).
This is in contrast to the automatically generated one in the
output directory, which always does and also not following the
way how it is documented. This Fixes #2503
2024-08-16 12:45:55 +02:00
Marcus Schäfer
175bce420a
Drop use of obsolete pkg_resources
As documented in https://setuptools.pypa.io/en/latest/pkg_resources.html
the use of pkg_resources is obsolete and will cause issues.
So happened on Debian unstable. This Fixes #2548
2024-05-10 15:14:41 +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
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
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
22647a9efb
Added --target-arch for image info
Allow cross arch dependency solving
2022-05-23 16:53:04 +02: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
7e0927e8d5
Allow logfile option to log on stdout
The option setting '--logfile stdout' is now a special form
and logs the messages usually written to a file to stdout
instead. This is handy if all messages of the build are
requested but the --debug switch is not because it does more
than that, e.g calling scripts through debug'able screen
sessions
2021-10-05 17:25:25 +02:00
Marcus Schäfer
3050eba5c7
Allow to set --logfile for result namespace
Setting a logfile for e.g 'kiwi-ng result bundle ...'
is useful and should be possible
2021-09-09 13:17:47 +02: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
Jesus Bermudez Velazquez
5318c357f5
Refactor default shared cache location
Defaults shared cache location does not depend on CLI parameters
Add set method for custom cache location in Defaults
CLI default value for shared cache dir depends on Defaults if not set
Update default if CLI shared cache dir set

Fixes #1671
2021-01-14 14:57:26 +00: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
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
bde788f593
Fixed docopt strings to use correct binary name
The kiwi binary from the entry_point configuration is
kiwi-ng. The docopt strings should use this name for
consistency. The alternative binary name kiwi is just
a symlink created on the rpm packaging level and is
not guaranteed to exist depending on how kiwi was
installed
2020-02-25 10:36:29 +01:00
Dan Čermák
b015b91679
Stop inheriting from object
This is no longer required in Python3
2019-08-22 15:43:27 +02:00
Marcus Schäfer
1566750242
Drop support for python2
Python2 is announced to be unmaintained from Jan 2020.
KIWI supports Python 2.7 and it should not support any python version that
is not maintained upstream. This Fixes #1036
2019-07-10 11:58:57 +02:00
Marcus Schäfer
75b1e2d6c7
Fixed docstring :rtype: values
In Python the string type name is str not string
2018-04-18 10:33:15 +02:00
Marcus Schäfer
41970d3dd4
Cleanup api doc strings
This cleans up and fixes the api documentation for the
public interface of the projects toplevel source code
files and Fixes #697
2018-04-16 16:10:04 +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
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
d85060d73c
Explicitly bool check for the service name option
From docopt we expect a True/False value for the selected
service name positional parameter. Thus the code should
also make it clear what we expect
2016-10-18 17:20:00 +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
319fb9e6e4
Adapt to common python style
Private methods should start with _f() not __f()
2016-06-15 16:27:45 +02:00
Bo Maryniuk
168b0f92dc Add print function for Python 2 2016-06-07 16:03:46 +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
75458c9e12
Fixed completion generator
In addition cleanup the main docopt definition
2016-05-26 00:33:13 +02:00
Marcus Schäfer
cfa7714f31
Exit code for --version call should be zero 2016-05-12 21:10:15 +02:00
Marcus Schäfer
b2f8f2a40e
Fixup usage messages 2016-04-29 21:16:49 +02:00
Marcus Schäfer
e0f2418984 Add docstrings for Cli class
References Issue #49
2016-04-08 16:10:14 +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
1ab40fa33a
Continue Refactor into subpackage
Move task classes into tasks namespace
2016-03-08 16:21:00 +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
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
39aae1e154 Better error message for call with unknown command
If kiwi is called with an unknown command an error message
showing which commands actually exists should be shown
2015-12-21 12:18:53 +01:00
Thomas Schraitle
f00d4eb727 Use "next generation" string
To distinguish it between old and new KIWI
2015-12-15 14:01:07 +01:00
Thomas Schraitle
686e6d1bba __VERSION__ -> __version__ 2015-12-11 16:42:50 +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