Commit Graph

40 Commits

Author SHA1 Message Date
Marcus Schäfer
bdb7123fa1
Refactor use of logging facility
Use getLogger method instead of a global log object
Also use caplog fixture to capture log messages in
unit tests. This Fixes #1244
2019-10-23 17:54:27 +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
e6a997d858
Do not supress output for dracut call
This commit adds a stderr_to_stdout option to Command.run method to
redirect stderr to stdout.

Additionally this commit also includes to the debug log the dracut
call output, including both, stderr and stdout.

Fixes #1114
2019-07-02 18:07:07 +02:00
Dan Čermák
939d9fe2df
Log thrown exceptions in Compress.get_format() 2019-04-26 12:29:19 +02:00
Dan Čermák
d64ef1918b
Fix documentation of Compress.get_format() 2019-04-26 12:29:00 +02:00
Dan Čermák
5b523400d8
Cleanup warnings in utils/size.py
- use a raw string for the regexp search string
- improve the readability of the returned value
2019-04-23 17:08:06 +02:00
David Cassany
4c3945c4d1
Update bootstrap macro management
This commit extends the bootstrap macro management to also consider
the case where image was already bootstrap. Note this is a common case
for building derived container images and also the situation when
`--allow-existing-root` flag is in use.
2019-04-16 14:40:57 +02:00
Marcus Schäfer
840a872507
Fixup has_rpm method from RpmDataBase class
The method checked for the presence of /usr/bin/rpm. But
that binary is also provided by another toolkit named
busybox. Thus to check if the rpm we are aiming for is
present the check has been modified to look for /usr/bin/rpmdb
which is exclusively provided by rpm only. This Fixes #1037
2019-04-01 14:52:33 +02:00
Alberto Planas
0c095a98b1 Replace @staticmethod with @classmethod when needed
@classmethod are used in Python to represent methods that can
query and update the class (cls parameter). Is expected to be
used for metaprograming, or advanced techniques that require the
access to the class itself, before we have an instance.

@staticmethod are used to associate a function to a class. It will
not be have access to the instance (self) not the class (cls). In
other programming languages are known as class methods.

This patch replace all the @classmethod with @staticmethod when
there is not need to access to the cls parameter, because the
intention is to be used as normal functions.
2019-03-26 16:27:43 +01:00
Marcus Schäfer
d70df02aa3
Care for update alternatives on rpmdb move
In set_database_to_image_path we also have to care for the
move of the alternatives path to the new rpmdb location
2019-03-06 12:09:15 +01:00
Marcus Schäfer
d92606e46f
Fixup zypper/suse link to rpm database
The compat code generating the /var/lib/rpm link was only
effective if a signing key was specified, however it should
be effective in any case
2019-03-06 11:45:02 +01:00
Marcus Schäfer
541cf9c3d1
Fixed import of signing keys
In reference to bsc#1112357 it was required to add the compat
symlink /var/lib/rpm such that zypper can read the signing
keys. Unfortunately zypper does not use the configured rpmdb
from the rpm macro setup.
2019-02-27 14:24:55 +01:00
Marcus Schäfer
fad1c0f1ef
Added support for %_install_langs rpm macro
During the image build the custom rpm macro %_install_langs
is configured with the <locale> setup from the KIWI XML
description. This allows to filter language specific packages
on the rpm level and Fixes #771
2019-02-07 16:05:25 +01:00
Marcus Schäfer
dd1052ac99
Handle location of the rpm DB on the macro level
The location of the rpm database is no longer a standard
path one can trust. Some distributions put it to /var/lib
others to /usr/lib. This introduces the problem of dealing
with different locations between the bootstrapping (host rpm)
phase and the image installation (image rpm) phase.

This commit implements a solution based on an intermediate
rpm database configuration. KIWI creates the macros.kiwi file
inside of the image root which is read by any call of rpm
in the inner and outer system. During bootstrap phase the
rpm dbpath from the host system is used and later in the
install phase the dbpath from the rpm package as it was
installed by the target image distribution is used. In case
of a dbpath difference the database is automatically moved
to the new location by setting the _dbpath_rebuild macro
to the correct location. At the end the custom KIWI macro
is deleted.

As this process allows custom macro defintions during the
KIWI run it also serves as the base for a solution to
Issue #771 which will be done in a follow up request to
this commit.

Also the workaround for bsc#1112357 which uses a static
dbpath to store an optionally given signing key will be
addressed with this commit. The macro setup happens before
the import_trusted_keys method which makes any specification
for a strict dbpath obsolete.

Last the implementation deletes the obsolete
dump_reload_package_database code. rpm is able to automatically
do the conversion of different db versions such that the code
in kiwi is obsolete. In addition that code only worked for
rather old db versions. The public API has not changed though,
but the method is marked obsolete and does nothing anymore.

In addition to the deletion of obsolete code a new API
method post_process_install_requests_bootstrap has been
introduced to handle actions required after bootstrap
and before installing of packages from inside the new image
2019-02-06 11:55:42 +01:00
Marcus Schäfer
b39f5dad97
Fix use of SysConfig objects
objects of that class did not provide a get method but
overload the bracket [] operator. Using the get() method
failed. This Fixes #910
2019-01-07 10:48:09 +01:00
Thomas Schraitle
3156bd14d8
Use cls in @classmethods instead of self
For consistency reasons.
2018-12-20 08:47:43 +01:00
David Cassany
fda157296e
Add Codec utils for bytes literals decoding
In case of a literal decoding failure it tries to decode
the result in utf-8. This is handy in python2 environments where
python and the host might be using different charset configurations.
In python3 this issue seams to be solved.

Fixes #829 and bsc#1110871
2018-10-08 15:48:51 +02:00
David Cassany
7935276807
Make use of kiwi/utils/sysconfig
This commit makes use the sysconfig kiwi utility in order to
read and eventually update the /etc/sysconfig/snapper file.
2018-09-13 17:54:58 +02:00
Marcus Schäfer
afcbe93826
Fixed some code smells
* Use of unused variables, and dangerous defaults
* Update of design patterns on pylint and landscape
2018-07-11 10:31:04 +02:00
Marcus Schäfer
426221ce34
Return file name after archive or compression call
Extend the ArchiveTar and Compress classes such that
their archiving and compression methods returns the
result file name after the operation
2018-05-15 10:36:57 +02:00
David Cassany
1fca29cee8 Cleanup of the iso_tools API docs 2018-04-18 10:03:26 +02:00
David Cassany
9eab3eebf9 Cleanup of the utils API docs 2018-04-17 18:05:09 +02:00
Marcus Schäfer
135fdcf4da
Extend has_option_in_help to also check error data 2018-03-02 10:04:13 +01:00
David Cassany
afbf2687c8 Extend CommandCapabilities to also check version 2018-01-16 16:53:59 +01:00
David Cassany Viladomat
02dc8e32e1
Update locale settings (#579)
* Use systemd-firstboot in order config basic settings

This commit updates locale and keyboard settings in order to make
use of the systemd tools, as this will be the only valid method starting
from SLE15.

Fixes #577

* Added CommandCapabilities utils class
2018-01-16 14:10:31 +01:00
Marcus Schäfer
e91ace3f16
Apply target permissions only if target dir exists 2017-12-06 16:25:12 +01:00
Marcus Schäfer
d1fb751b60
Fixed use of stat result in os.chmod
oct method returns a string representation which was mistakenly
used in a subsequent os.chmod call. This Fixes #564
2017-12-06 15:59:14 +01:00
Marcus Schäfer
f17b6e41f0
Make sure toplevel target dir keeps permissions
When syncing data via rsync we make sure the toplevel target
directory the data gets synced to does not change it's origin
permissions. This Fixes #557
2017-12-04 17:17:35 +01:00
David Cassany
de2b32cbed Add max size post build command
This commit includes a post build constraint validation into the
Result class. With this commit any file included to the result
tuple is verified not to exceed the maximum size configured into
the runtime configuration file config.yml.

Fixes #468
2017-11-17 12:48:52 +01:00
Marcus Schäfer
2179798948 Added custom xz option handling for Compress
Allow to pass custom options for xz method. Issue #373
2017-06-19 11:11:37 +02:00
Marcus Schäfer
08275454e9 Fixed checksum file creation
If the checksum should be created from a compressed file
it is expected that the checksum of the uncompressed file
is added to the checksum file. This is because in a pxe
deployment the uncompressed version of the file is put
on disk and compared with the reference information in
the checksum file
2017-03-21 17:41:31 +01:00
Marcus Schäfer
95504b1414
Added checksum matcher method to Checksum class 2017-03-14 10:22:06 +01:00
Marcus Schäfer
1a5257a0e8 Prevent use of project relative import statements
For details on the motivation of this change please visit:
https://wiki.python.org/moin/FutureProofPython
2017-03-07 11:23:37 +01:00
Marcus Schäfer
2e6816bd0b
Added kiwi image info command
Allow to list information about the image description.
In a first implementation one can show the image name
as well as run a dependency resolution for the packages
listed in the XML description
2017-02-06 17:38:53 +01:00
Marcus Schäfer
374be7c042 Completion for grub bootloader configuration
The configuration files /etc/sysconfig/bootloader and
/etc/default/grub needs to be created/updated with the
relevant values regarding the bootloader setup done by
kiwi. This Fixes #226
2017-01-23 17:24:04 +01:00
Marcus Schäfer
3ddc4326c8
Added BlockID class
Class to provide support for retrieving block device metadata
2016-09-22 15:18:42 +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
Marcus Schäfer
c429c18289
Added xattr checker for DataSync class
The method target_supports_extended_attributes() checks if the
sync target directory supports extended filesystem attributes.
The method is called on sync_data() and will remove the -X / -A
options if provided. A warning message is issued to the caller
if the rsync option list has changed because of the underlaying
filesystem limitations
2016-05-02 11:16:10 +02:00
Marcus Schäfer
b7cf1aa302
Update utils inline API documentation
References #49
2016-04-15 11:58:44 +02:00
Marcus Schäfer
e246e72a52
Refactor data subpackage
Move from data to utils, data is generally considered
as text data and not code
2016-03-17 10:42:08 +01:00