mock_chroot Package reference¶
mock_chroot
Package¶
mock_chroot - Thin Python wrapper around mock(1)
-
class
mock_chroot.
MockChroot
(root=None, config=None)[source]¶ Create a Python wrapper object to magae mock(1) chroot environments
Parameters: - root (str) – The name or path for the mock configuration file to use
- config (str) – The Mock configuration for the chroot as string or some other object that will yield a configuration string when passed to ‘str()’
‘root’ and ‘config’ are mutually exclusive
-
dump_config
()[source]¶ Dump configuration for debugging purposes
Returns: the current mock configuration as a string Return type: str
-
chroot
(*cmd, **more_options)[source]¶ Run a non-interactive command in mock
All positional arguments are passes as the command to run and its argumens This method will behave in a similliar manner to subprocess.check_output yeilding CalledProcessError on command failure
Optional named agruments passed via ‘more_options’ can be as follows: :param str cwd: Working directory inside the chroot to run in
Returns: the command output as string Return type: str
-
rebuild
(src_rpm, no_clean=False, define=None, resultdir=None)[source]¶ Build a package from .src.rpm in Mock
Parameters: - src_rpm (str) – The path to the .src.rpm file to build
- no_clean (bool) – Avoid cleaning the chroot before building
- define (object) – An optional define string for the build process or an Iterable of multiple such define strings.
- resultdir (str) – Override where the build results get placed
Returns: the command output as string
Return type: str
-
buildsrpm
(spec, sources, no_clean=False, define=None, resultdir=None)[source]¶ Build a .src.rpm package from sources and spcefile in Mock
Parameters: - spec (str) – The path to the specfile to build
- sources (str) – The path to the sources directory
- no_clean (bool) – Avoid cleaning the chroot before building
- define (object) – An optional define string for the build process or an Iterable of multiple such define strings.
- resultdir (str) – Override where the build results get placed
Returns: the command output as string
Return type: str