Code Monkey home page Code Monkey logo

mock's Introduction

Mock

A 'simple' chroot build environment manager for building RPMs.

Mock is used by the Fedora Build system to populate a chroot environment, which is then used in building a source-RPM (SRPM). It can be used for long-term management of a chroot environment, but generally a chroot is populated (using DNF), an SRPM is built in the chroot to generate binary RPMs, and the chroot is then discarded.

User documentation

This is an area for developers. You may be looking for user documentation.

Sources

Mock source tarballs: https://github.com/rpm-software-management/mock/releases

Mock Branches

Mock currently has one active branch plus main.

  • main - This is used for releasing and developing the latest Mock version. If you want to send patches, you probably want this branch.
  • mock-2 - This branch is used for Mock v2.x, for EL-7, bug-fixes-only mode.
  • mock-1.4 - End of life, there will be no changes.
  • mock-1.3 - This branch was used for EL-6, EOL.
  • mock-1.0 - This branch was used for EL-5, EOL.

Communication

Do you have a patch, an idea, or just a question? You can write to buildsys mailing list or try Fedora Build System Matrix channel. We prefer email though.

If you hate mailing lists for some reason (we still prefer it) - you can use Discussions.

Getting and compiling mock

git clone https://github.com/rpm-software-management/mock.git
cd mock
cd mock-core-configs
tito build --rpm
cd ../mock
tito build --rpm

The latest release for all supported platforms can be found in this Fedora Copr project.

Packaging status

mock versions mock-core-configs versions

Nightly

Pre-release packages built from the latest git commit in the main branch are in Fedora Copr project:

dnf copr enable @mock/mock
dnf install mock

Mock pre-release build status: build status

Sponsor

This project is sponsored by Red Hat. Buy Red Hat subscription to sponsor this project.

License

GPL-2.0-or-later

mock's People

Contributors

adamel avatar ausil avatar carlwgeorge avatar clrkwllms avatar conan-kudo avatar frodox avatar frostyx avatar hrnciar avatar hroncok avatar ignatenkobrain avatar jkeating avatar mikebonnet avatar mnecas avatar msimacek avatar myllynen avatar owtaylor avatar pghmcfc avatar plageat avatar praiskup avatar rsuste avatar schlupov avatar scop avatar sergiomb2 avatar sfowl avatar sharkcz avatar skvidal avatar superchalupa avatar tmzullinger avatar xsuchy avatar yikun avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mock's Issues

memory Issue with default path : /var/lib/mock/*

Please suggest the way to change Mock default path /var/lib/mock/ to my particular folder
/source/user/mock
i tried creating cfg file to change Path for where the chroot builts
how to use option to change the path
config_opts[?]

postinstall option and mock return code if failure

Hi,
I expected to have mock returns an error code when the install built packages step fails but it isn't the case apparently. I haven't found any option to make mock fails instead of returning a warning + exit 0. I ends up with the solution to grab logs from root.log but I don't really like that solution.
I'm wondering if this is something you want to change in the future or if the actual behavior will remains. Should I propose a patch ?

Thanks in advance for your response.

Please document how to add a 3rd party repo

I've been trying to create an rpm which build depends on mono-complete, from the repo provided by mono-project.

However adding the repo in the mock configuration doesn't seem to work, and the build just fails because mono-complete can't be resolved.

To add the repository I just copied and pasted the file /etc/yum.repos.d/download.mono.blablabla.repo into the configuration for the chroot.

So, I guess there is a way to make this work, but I can't find any documentation about it.

mock init fails

in trying to test current git head mock -r fedora-rawhide-x86_64 --init failed

my config has some diffs to the rpmnew version but nothing that should break anything

[root@anubis mock]# diff -u fedora-rawhide-x86_64.cfg.rpmnew fedora-rawhide-x86_64.cfg
--- fedora-rawhide-x86_64.cfg.rpmnew 2017-03-02 04:32:52.000000000 -0600
+++ fedora-rawhide-x86_64.cfg 2015-12-18 13:02:36.637889081 -0600
@@ -4,7 +4,7 @@
config_opts['chroot_setup_cmd'] = 'install @buildsys-build'
config_opts['dist'] = 'rawhide' # only useful for --resultdir variable subst
config_opts['extra_chroot_dirs'] = [ '/run/lock', ]
-config_opts['releasever'] = '27'
+config_opts['releasever'] = '24'

config_opts['package_manager'] = 'dnf'

@@ -22,7 +22,6 @@
syslog_device=
install_weak_deps=0
metadata_expire=0
-best=1

repos

@@ -33,11 +32,11 @@

[local]
name=local
-baseurl=https://kojipkgs.fedoraproject.org/repos/rawhide/latest/x86_64/
+baseurl=http://kojipkgs.fedoraproject.org/repos/rawhide/latest/x86_64/
cost=2000
-enabled=0
+enabled=1

-[fedora-debuginfo]
+[debug]
name=Fedora Rawhide - x86_64 - Debug
failovermethod=priority
metalink=https://mirrors.fedoraproject.org/metalink?repo=rawhide-debug&arch=$basearch

the failure is
INFO: Mock Version: 1.4.0
Start: dnf install
Failed to synchronize cache for repo 'fedora', disabling.
Failed to synchronize cache for repo 'local', disabling.
Warning: Group 'buildsys-build' does not exist.
Error: Nothing to do.
ERROR: Command failed:

/usr/bin/systemd-nspawn -q -M 4db7ef2e57d84184baa3182ac14197c1 -D /var/lib/mock/fedora-rawhide-x86_64-bootstrap/root -a --setenv=TERM=vt100 --setenv=SHELL=/bin/bash --setenv=HOME=/builddir --setenv=HOSTNAME=mock --setenv=PATH=/usr/bin:/bin:/usr/sbin:/sbin --setenv=PROMPT_COMMAND=printf "\033]0;\007" --setenv=PS1= \s-\v$ --setenv=LANG=es_US.utf8 --setenv=LC_MESSAGES=C /usr/bin/dnf --installroot /var/lib/mock/fedora-rawhide-x86_64/root/ --releasever 24 --disableplugin=local --setopt=deltarpm=false install @buildsys-build

Failed to synchronize cache for repo 'fedora', disabling.
Failed to synchronize cache for repo 'local', disabling.
Warning: Group 'buildsys-build' does not exist.
Error: Nothing to do.

Running /usr/sbin/mock as non-root fails with exit 0

Is it intentional and correct behavior that if /usr/sbin/mock is run by a non-root user in mock.py line 890 it prints out an ERROR message then leaves the exit code as 0 indicating success? I ran into a bad interaction with other tooling, in this case tito, which swallowed the error output if the sub-process exited 0 indicating success making it harder to find a $PATH problem that caused this to be run in the wrong way.

installing local packages into the buildroot broken since 1.4.1

Installing local packages (i.e., mock --install ./PACKAGE.rpm doesn't work with mock 1.4.1 (even with an absolute path), since dnf doesn't have access to the filesystem containing the file. For example, I get the following error (I chose the package only for demonstration purposes):

INFO: installing package(s): /home/deca/filesystem-3.2-40.fc26.x86_64.rpm
Last metadata expiration check: 0:00:00 ago on Tue May 09 16:39:56 2017 CEST.
Can not load RPM file: /home/deca/filesystem-3.2-40.fc26.x86_64.rpm.
Could not open: /home/deca/filesystem-3.2-40.fc26.x86_64.rpm
ERROR: Command failed: 
 # /usr/bin/systemd-nspawn -q -M b9596376f5d54fadad45b4e64a0e66a3 -D /var/lib/mock/fedora-rawhide-x86_64-bootstrap/root -a --setenv=TERM=vt100 --setenv=SHELL=/bin/bash --setenv=HOME=/builddir --setenv=HOSTNAME=mock --setenv=PATH=/usr/bin:/bin:/usr/sbin:/sbin --setenv=PROMPT_COMMAND=printf "\033]0;<mock-chroot>\007" --setenv=PS1=<mock-chroot> \s-\v\$  --setenv=LANG=en_US.UTF-8 --setenv=LC_MESSAGES=C /usr/bin/dnf --installroot /var/lib/mock/fedora-rawhide-x86_64/root/ --releasever 27 --disableplugin=local --setopt=deltarpm=false install /home/deca/filesystem-3.2-40.fc26.x86_64.rpm

Installing packages from repositories still works as expected (for example, mock install golang), but local packages don't work anymore without reverting to the old behavior. This makes it impossible to build packages with dependencies that aren't yet present in fedora repositores with the new bootstrap environment.

Maybe local files should first be copied into the container's file system, where they can then be found and installed successfully?

Splitting stdout and stderr

Currently, build.log contains both stdout and stderr. A possibility to either split them into separate logs or mark lines coming from stderr would be great.

Some compilers do not prefix their error messages with any fixed pattern. Searching for such messages in build.log is painful.

hw_info plugin fails when locale is not english

Hi,

My current local is

$ locale
LANG=bg_BG.utf8
...

and when I start mock it fails with the following exception

$ mock -r epel-7-x86_64 init
INFO: mock.py version 1.3.4 starting (python version = 2.7.5)...
Start: init plugins
INFO: selinux disabled
Finish: init plugins
Start: run
Start: clean chroot
WARNING: Process ID 3329 still running in chroot. Killing...
Finish: clean chroot
Start: chroot init
INFO: calling preinit hooks
INFO: enabled root cache
INFO: enabled yum cache
Start: cleaning yum metadata
Finish: cleaning yum metadata
INFO: enabled HW Info plugin
WARNING: Process ID 3329 still running in chroot. Killing...
ERROR: 'ascii' codec can't encode characters in position 0-6: ordinal not in range(128)
Traceback (most recent call last):
  File "/usr/libexec/mock/mock", line 886, in <module>
    main()
  File "/usr/lib/python2.7/site-packages/mockbuild/trace_decorator.py", line 89, in trace
    result = func(*args, **kw)
  File "/usr/libexec/mock/mock", line 701, in main
    run_command(options, args, config_opts, commands, buildroot, state)
  File "/usr/lib/python2.7/site-packages/mockbuild/trace_decorator.py", line 89, in trace
    result = func(*args, **kw)
  File "/usr/libexec/mock/mock", line 726, in run_command
    commands.init()
  File "/usr/lib/python2.7/site-packages/mockbuild/trace_decorator.py", line 89, in trace
    result = func(*args, **kw)
  File "/usr/lib/python2.7/site-packages/mockbuild/backend.py", line 125, in init
    self.buildroot.initialize(**kwargs)
  File "/usr/lib/python2.7/site-packages/mockbuild/trace_decorator.py", line 89, in trace
    result = func(*args, **kw)
  File "/usr/lib/python2.7/site-packages/mockbuild/buildroot.py", line 90, in initialize
    self._init(prebuild=prebuild, do_log=do_log)
  File "/usr/lib/python2.7/site-packages/mockbuild/trace_decorator.py", line 89, in trace
    result = func(*args, **kw)
  File "/usr/lib/python2.7/site-packages/mockbuild/buildroot.py", line 123, in _init
    self.plugins.call_hooks('preinit')
  File "/usr/lib/python2.7/site-packages/mockbuild/trace_decorator.py", line 89, in trace
    result = func(*args, **kw)
  File "/usr/lib/python2.7/site-packages/mockbuild/plugin.py", line 69, in call_hooks
    hook(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/mockbuild/trace_decorator.py", line 89, in trace
    result = func(*args, **kw)
  File "/usr/lib/python2.7/site-packages/mockbuild/plugins/hw_info.py", line 50, in _PreInitHook
    out.write(output)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-6: ordinal not in range(128)

and the output of df -H is in Bulgarian because of the locale

df -h
Файлова с-ма                   Размер Заети Свобод Изп% Монтирана на
/dev/mapper/test-root   271G  126G   132G  49% /
tmpfs                            7,8G     0   7,8G   0% /dev/shm

When I start mock in an English or C locales everything works as expected

mockchain: regression of local repo functionality from 1.3.4-1 to 1.4.1-1 on F25

Command used:
 mockchain -r fedora-25-x86_64 -l /tmp/myrepo  compat-libgcrypt-1.5.3-4.fc25.src.rpm brackets-1.9-1.fc25.src.rpm

(Note: changing -r or -l or not using -l has zero effect on the outcome. As well as using/not using: nosync, nspawn)

Expected results with 1.3.4-1:
starting logfile: None
results dir: /tmp/myrepo/results/fedora-25-x86_64
config dir: /tmp/myrepo/configs/fedora-25-x86_64
Start build: compat-libgcrypt-1.5.3-4.fc25.src.rpm
building compat-libgcrypt-1.5.3-4.fc25.src.rpm
End build: compat-libgcrypt-1.5.3-4.fc25.src.rpm
Success building compat-libgcrypt-1.5.3-4.fc25.src.rpm
Start build: brackets-1.9-1.fc25.src.rpm
building brackets-1.9-1.fc25.src.rpm
End build: brackets-1.9-1.fc25.src.rpm
Success building brackets-1.9-1.fc25.src.rpm
Results out to: /tmp/myrepo/results/fedora-25-x86_64
Pkgs built: 2
Packages successfully built in this order:
compat-libgcrypt-1.5.3-4.fc25.src.rpm
brackets-1.9-1.fc25.src.rpm
Actual results with 1.4.1-1:
starting logfile: None
results dir: /tmp/myrepo/results/fedora-25-x86_64
config dir: /tmp/myrepo/configs/fedora-25-x86_64
Start build: compat-libgcrypt-1.5.3-4.fc25.src.rpm
building compat-libgcrypt-1.5.3-4.fc25.src.rpm
End build: compat-libgcrypt-1.5.3-4.fc25.src.rpm
Success building compat-libgcrypt-1.5.3-4.fc25.src.rpm
Start build: brackets-1.9-1.fc25.src.rpm
building brackets-1.9-1.fc25.src.rpm
INFO: mock.py version 1.4.1 starting (python version = 3.5.3)...
Start: init plugins
INFO: selinux disabled
Finish: init plugins
Start: init plugins
INFO: selinux disabled
Finish: init plugins
Start: run
INFO: Start(brackets-1.9-1.fc25.src.rpm)  Config(fedora-25-x86_64)
Start: clean chroot
Finish: clean chroot
Start: chroot init
INFO: calling preinit hooks
INFO: enabled root cache
Start: unpacking root cache
Finish: unpacking root cache
INFO: enabled dnf cache
Start: cleaning dnf metadata
Finish: cleaning dnf metadata
INFO: enabled HW Info plugin
Mock Version: 1.4.1
INFO: Mock Version: 1.4.1
Start: dnf update
Finish: dnf update
Finish: chroot init
Start: chroot init
INFO: calling preinit hooks
INFO: enabled root cache
Start: unpacking root cache
Finish: unpacking root cache
INFO: enabled dnf cache
Start: cleaning dnf metadata
Finish: cleaning dnf metadata
INFO: enabled HW Info plugin
Mock Version: 1.4.1
INFO: Mock Version: 1.4.1
Start: dnf update
Finish: dnf update
Finish: chroot init
Start: build phase for brackets-1.9-1.fc25.src.rpm
Start: build setup for brackets-1.9-1.fc25.src.rpm
ERROR: Exception(brackets-1.9-1.fc25.src.rpm) Config(fedora-25-x86_64) 0 minutes 23 seconds
INFO: Results and/or logs in: /tmp/myrepo/results/fedora-25-x86_64/brackets-1.9-1.fc25
INFO: Cleaning up build root ('cleanup_on_failure=True')
Start: clean chroot
Finish: clean chroot
ERROR: Command failed:
 # /usr/bin/systemd-nspawn -q -M 334f6fd37c7c403eaba83de2c3a74246 -D /var/lib/mock/fedora-25-x86_64-bootstrap-xenith-16011/root -a --setenv=TERM=vt100 --setenv=HOME=/builddir --setenv=SHELL=/bin/bash --setenv=LANG=en_US.UTF-8 --setenv=PATH=/usr/bin:/bin:/usr/sbin:/sbin --setenv=HOSTNAME=mock --setenv=PS1=<mock-chroot> \s-\v\$  --setenv=PROMPT_COMMAND=printf "\033]0;<mock-chroot>\007" --setenv=LC_MESSAGES=C /usr/bin/dnf builddep --installroot /var/lib/mock/fedora-25-x86_64-xenith-16011/root/ --releasever 25 /var/lib/mock/fedora-25-x86_64-xenith-16011/root//builddir/build/SRPMS/brackets-1.9-1.fc25.src.rpm
Failed to synchronize cache for repo 'local_build_repo', disabling.
No matching package to install: 'compat-libgcrypt'
Not all dependencies satisfied
Error: Some packages could not be found.

End build: brackets-1.9-1.fc25.src.rpm
Error building brackets-1.9-1.fc25.src.rpm.
See logs/results in /tmp/myrepo/results/fedora-25-x86_64
Results out to: /tmp/myrepo/results/fedora-25-x86_64
Pkgs built: 1
Some packages successfully built in this order:
compat-libgcrypt-1.5.3-4.fc25.src.rpm

I didn't see any guidelines for logs, so I'm not really sure which ones you want! Please advise, thanks.

Missing getrandom syscall prevents running Fedora python-3.6.0 on a CentOS host

When trying to build a fedora-rawhide python3 package on a CentOS-7 host, the python3 process fails with:

Fatal Python error: failed to get random numbers to initialize Python

Aborted

It seems related to the use of the getrandom syscall not included in the CentOS-7 kernel.

For what it worth, I was able to mitigate the failure by setting the PYTHONHASHSEED environment as well as ld_preloading the _PyOS_URandomNonblock function.

mockbuild GID is 135 hardcoded

I have installed mock package inside a mock as a prerequisite of another package that I need.
When mock init tries to assign GID 135 for mockbuild group, it fails with exit code 4 which means "already exists".
I would prefer that mock will look for an empty GID (starting with 135) instead of using 135 hard coded and fail if it is taken

mock to run newer gcc

host centos 7
mock -r epel-7-x86_64 --init
installs
libgcc-4.8.5-11.el7.x86_64
while on host I installed
gcc --version
gcc (GCC) 5.4.0

How run / to pass into a newer gcc?

[RFE] Support microdnf as a package manager

When working with ultra-minimal environments such as the modularity base runtime, we do not have a complete yum or dnf implementation in the available repositories. Right now, we are working around this by disabling the new bootstrapping mechanism, but it would be vastly preferable if we could work with microdnf in the bootstrap chroot.

Remove internal_setarch option?

At least the documentation of internal_setarch is outdated in etc/mock/site-defaults.cfg: it always defaults to True, and ctypes is a hard dependency anyway.

But before I go fix the doc: is the whole option outdated? py/mock.py sets personality if it's True, but is there a downside in just always doing that?

Document minimum supported Python version

I cannot seem to find the minimum supported Python version specified/documented anywhere. One place where it could be added would be to make "Requires: python" in mock.spec versioned. No strong opinions as long as it's doumented somewhere where it can be found.

(grepping for 2. or sys.version doesn't yield anything useful, except a changelog entry of mine dropping pre 2.5 support, but I doubt the minimum supported version would be 2.5 nowadays).

Icon directive in spec file is underdocumented

Hello,

There is an "Icon" directive in spec file, that can point to an icon. However, when building from mock, pointing to files inside the source directory do not work, and pointing to files with an absolute path and installing them with config_opts['files'] doesn't seem to work either. In both cases the result is file not found.

Some more documentation about how to use this option, and how to use it with mock would be nice. I barely found anything about it.

Thanks

mockchain does not understand 'include' in mock configs

Hello,
it appears that mockchain is having issues parsing 'include' statements in mock config files. RPM Fusion mock config contains the following line:
include('/etc/mock/fedora-rawhide-x86_64.cfg')
using -r fedora-rawhide-x86_64-rpmfusion_free parameter works perfectly fine when using with standalone mock, but with mockchain the following happens:
Traceback (most recent call last):
File "/usr/bin/mockchain", line 416, in <module>
sys.exit(main(sys.argv))
File "/usr/bin/mockchain", line 298, in main
res, msg = add_local_repo(config_opts['config_file'], my_mock_config, local_baseurl, 'local_build_repo')
File "/usr/bin/mockchain", line 142, in add_local_repo
exec(code)
File "/etc/mock/fedora-rawhide-x86_64-rpmfusion_free.cfg", line 1, in <module>
include('/etc/mock/fedora-rawhide-x86_64.cfg')
NameError: name 'include' is not defined
This is with mock-1.3.4-1.fc25.noarch

Best regards,
Julian

mock -bootstrap-chroot doen't work on RHEL7

Steps to reproduce:

$ mock --init --configdir ...

Ends with:

ERROR: Command failed:
/usr/bin/systemd-nspawn -q -M 5832c55c5cee4553aae09e32ce2bab46 -D /var/lib/mock/13371337-bootstrap/root 
--setenv=LANG=en_US.UTF-8 --setenv=TERM=vt100 --setenv=SHELL=/bin/bash --setenv=LC_MESSAGES=C 
--setenv=HOSTNAME=mock --setenv=PROMPT_COMMAND=printf "\033]0;<mock-chroot>\007" --setenv=HOME=/builddir 
--setenv=PATH=/usr/bin:/bin:/usr/sbin:/sbin --setenv=PS1=<mock-chroot> \s-\v\$  /usr/bin/yum 
--installroot /var/lib/mock/13371337/root/ --skip-broken install abrt-addon-ccpp shadow-utils gdb rpm


Directory /var/lib/mock/13371337-bootstrap/root lacks the binary to execute or doesn't look 
like a binary tree. Refusing.

Package versions:

$ rpm -q mock systemd
mock-1.4.1-1.el7.noarch
systemd-219-39.el7.x86_64

Cannot initialize Fedora >=24 on Debian systems using mock

I have made efforst to port over dnf and the required runtime dependencies to Debian. Mock, since dnf is not within Debian repos, will not build Fedora >= 24. Mock on Arch Linux functions just fine, as it has dnf in the AUR. For whatever reason, I get the below error when dnf install kicks off. Any help is very appreciated. You may ask why? Well, why on Arch Linux?, well it's convenient to do packaging on one system, especially on the go over SSH, or if you want to avoid paying for extra VPS instances. If this will not be acted upon for any sound reason, please close.

Traceback (most recent call last):
  File "/usr/bin/dnf", line 58, in <module>
    main.user_main(sys.argv[1:], exit_code=True)
  File "/usr/lib/python2.7/dist-packages/dnf/cli/main.py", line 170, in user_main
    errcode = main(args)
  File "/usr/lib/python2.7/dist-packages/dnf/cli/main.py", line 60, in main
    return _main(base, args)
  File "/usr/lib/python2.7/dist-packages/dnf/cli/main.py", line 119, in _main
    ret = resolving(cli, base)
  File "/usr/lib/python2.7/dist-packages/dnf/cli/main.py", line 138, in resolving
    base.resolve(cli.demands.allow_erasing)
  File "/usr/lib/python2.7/dist-packages/dnf/base.py", line 564, in resolve
    goal.add_protected(self.sack.query().filter(
AttributeError: 'Goal' object has no attribute 'add_protected'

Using dnf: http://paste.debian.net/899866
Using yum: http://paste.debian.net/899860

nosync plugin is failing for epel-7-ppc64le chroot

There is a problem with installing build-root in epel-7-ppc64le when nosync plugin is enabled. The messages I am getting in the root.log read like this:

DEBUG util.py:435:    Installing : glibc-2.17-157.el7_3.1.ppc64le                            13/158 
DEBUG util.py:435:  /usr/sbin/iconvconfig: /lib64/ld64.so.2: version `GLIBC_2.22' not found (required by /tmp/tmp.mock.pkqww6rf/lib64/nosync.so)
DEBUG util.py:435:  /usr/sbin/glibc_post_upgrade: While trying to execute /usr/sbin/iconvconfig.ppc64le child exited with exit code 1
DEBUG util.py:435:  warning: %post(glibc-2.17-157.el7_3.1.ppc64le) scriptlet failed, exit status 1
DEBUG util.py:435:  Non-fatal POSTIN scriptlet failure in rpm package glibc-2.17-157.el7_3.1.ppc64le

or here is an error instead of just warning:

DEBUG util.py:435:  /bin/sh: /lib64/ld64.so.2: version `GLIBC_2.22' not found (required by /tmp/tmp.mock.pkqww6rf/lib64/nosync.so)
DEBUG util.py:435:  error: %prein(pinentry-0.8.1-17.el7.ppc64le) scriptlet failed, exit status 1
DEBUG util.py:435:  Error in PREIN scriptlet in rpm package pinentry-0.8.1-17.el7.ppc64le
DEBUG util.py:435:    Installing : cpp-4.8.5-11.el7.ppc64le                                  60/158 
DEBUG util.py:435:  error: pinentry-0.8.1-17.el7.ppc64le: install failed

nosync plugin works for epel-7-x86_64, just not for epel-7-ppc64le, which is quite interesting. The whole root.log is attached. This was tested on copr f24 builder cloud instance with mock 1.3.3.
root.log.txt

Building rpms from tarballs

rpmbuild man

   BUILDING PACKAGES:
       rpmbuild {-ba|-bb|-bp|-bc|-bi|-bl|-bs} [rpmbuild-options] SPECFILE ...

       rpmbuild {-ta|-tb|-tp|-tc|-ti|-tl|-ts} [rpmbuild-options] TARBALL ...

       rpmbuild {--rebuild|--recompile} SOURCEPKG ...

mock should support building RPMs from TARBALL
basically to download the source tarball

rpmbuild -ts $SRC
yum-builddep $generated_src
rpmbuild -tb $SRC

classic example is building httpd rpm

https://httpd.apache.org/docs/2.4/platform/rpm.html
rpmbuild -ts httpd-2.4.x.tar.bz2
rpmbuild -tb httpd-2.4.x.tar.bz2

Mass disable keepcache

Hello,

Since I have my own cache server, I would like to disable mock storing installed packages to /var/lib/mock . Is this currently possible, and if not can this be added?

I know I could just mass replace s/^keepcache=1/keepcache=0/ /etc/mock/* but I was wondering if there could be some nicer solution.

Unable to conditionalize BuildRequires due to chroot missing macros from "special" (systemd) packages, otherwise always present in that distro

The more one wants to achieve in the packaging regarding the versatility,
the more of the subtle differences between real non-chrooted building
and the mock-based building (i.e. chroot mimicing such real target
system) comes to the light.

For pacemaker project packaging, I'd want to conditionalize BuildRequires
of pkgconfig(dbus-1) but (for simplicity) only if the target
distribution is using systemd as its init system, because otherwise it
makes no sense to build with DBus libraries -- pacemaker uses DBus API
of systemd to manage live cycle of configured units when this is
available.

What seemed natural was to use:

%if %{defined _unitdir}
BuildRequires: pkgconfig(dbus-1)
%endif

which works when building the package in a standard way, but fails
in mock (with new Fedora releases, at least), as apparently _unitdir
is not available at the time BuildRequires are being evaluated.
Systemd (rpm -qf /usr/lib*/pkgconfig/systemd.pc) is, understandably,
not considered a minimal build root requirement.

Now, I fully understand that one cannot normally expect to conditionalize
BRs based on RPM macros introduced with arbitrary packages, but still,
I consider systemd somewhat special, and would be nice to have this
knowledge about systemd in minimal/start-point build roots to be able
to utilize that yet for reasoning about necessary BuildRequires.
Alternatives are checks based on:

Is there any reasonable solution to the original desire, either existing
or something that we could add? I am mostly interested in the package
build systems not under my control, such as COPR (apparently I could
tweak the system on my own was it under my control).

No logs when using --shell option

When I'm using mock like

mock --resultdir /myresults --shell "some command"

it doesn't store any logs in /myresults dir at all. I expect at least build.log, root.log and state.log. Because, in case of any errors with env (broken repo) it is hard to detect it without manually running this command...
Also, it would be cool to log runned commands in state.log (as with --chroot option), and also save --shell stdout somewhere may be :)

install device nodes for hw randon number generators

When looking for the reason why tests for the libica crypto library fail (s390x specific package), I found it's due missing /dev/prandom device.

Citing from the "Device Drivers, Features, and Commands" book (http://www.ibm.com/developerworks/linux/linux390/documentation_dev.html): The pseudorandom number generator (PRNG) device driver provides user-space applications with pseudorandom numbers generated by the z Systems CP Assist for Cryptographic Function (CPACF).
And the interface to the kernel driver is /dev/prandom

Similarly on eg. x86 there is no /dev/hwrng in the chroots. /dev/hwnrg exists on my x86_64, ppc64, s390x machines, maybe it could be always installed.

Require for docs: use mount_bind from command line

How can I use mock's bind_mount plugin from cmd line?
I see there are lines in man page: --plugin-option PLUGIN:KEY=VALUE, but in case of mount_bind I have no ideas how to use it ;(

And if it is impossible, it would be cool to add wiki/man, or issue..

update /etc/yum.conf, not /etc/yum/yum.conf

I found this bug when using mock-1.3.5-1.el6.noarch from EPEL on Amazon Linux to initialize an epel-6-x86_64 chroot. It failed to initialize until I applied the following code change, because the correct file location is /etc/yum.conf, not /etc/yum/yum.conf:

--- package_manager.py-orig	2017-03-02 10:15:54.000000000 +0000
+++ package_manager.py	2017-06-06 03:38:13.605571068 +0000
@@ -184,7 +184,7 @@
         if os.path.exists('/usr/bin/yum-deprecated'):
             self.resolvedep_command = [
                 'repoquery', '--resolve', '--requires',
-                '--config', self.buildroot.make_chroot_path('etc', 'yum', 'yum.conf')]
+                '--config', self.buildroot.make_chroot_path('etc', 'yum.conf')]
 
     @traceLog()
     def _write_plugin_conf(self, name):
@@ -209,7 +209,7 @@
         # write in yum.conf into chroot
         # always truncate and overwrite (w+)
         self.buildroot.root_log.debug('configure yum')
-        yumconf_path = self.buildroot.make_chroot_path('etc', 'yum', 'yum.conf')
+        yumconf_path = self.buildroot.make_chroot_path('etc', 'yum.conf')
         with open(yumconf_path, 'w+') as yumconf_file:
             yumconf_file.write(config_content)

The bug is also in the devel and master branches. This is my first time using mock, so I don't know why it doesn't work for me but must be working in other contexts.

util.rmtree fails with RecursionError

Steps to reproduce:

  • create directory tree like this: ./subdir/subdir/subdir/subdir/subdir/........... with more than 1000 subdirectories.
  • Call util.rmtree to that with default python recursion limit (set to 1000)

bootstrap-chroot: Almost of all lines are duplicated in build.log, root.log, and state.log

I use mock-1.4.1-1.fc25.noarch. In the log files build.log, root.log, state.log, almost all lines are duplicated.
The below is the part of build.log generated by mock -r fedora-25-x86_64 --rebuild systemd-233-4.7.git5efd9f7.fc25.src.rpm.

$ cat build.log
Mock Version: 1.4.1
Mock Version: 1.4.1
Mock Version: 1.4.1
ENTER ['do'](['/usr/bin/rpmbuild', '-bs', '--target', 'x86_64', '--nodeps', '/builddir/build/SPECS/systemd.spec'], logger=<mockbuild.trace_decorator.getLog object at 0x7feebf04c1d0>user='mockbuild'uid=1014env={'PS1': '<mock-chroot> \\s-\\v\\$ ', 'LANG': 'en_US.utf8', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin', 'SHELL': '/bin/bash', 'HOSTNAME': 'mock', 'PROMPT_COMMAND': 'printf "\\033]0;<mock-chroot>\\007"', 'HOME': '/builddir', 'TERM': 'vt100'}timeout=0nspawn_args=[]printOutput=Falseshell=Falsegid=135chrootPath='/var/lib/mock/fedora-25-x86_64-systemd-43014/root')
ENTER ['do'](['/usr/bin/rpmbuild', '-bs', '--target', 'x86_64', '--nodeps', '/builddir/build/SPECS/systemd.spec'], logger=<mockbuild.trace_decorator.getLog object at 0x7feebf04c1d0>user='mockbuild'uid=1014env={'PS1': '<mock-chroot> \\s-\\v\\$ ', 'LANG': 'en_US.utf8', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin', 'SHELL': '/bin/bash', 'HOSTNAME': 'mock', 'PROMPT_COMMAND': 'printf "\\033]0;<mock-chroot>\\007"', 'HOME': '/builddir', 'TERM': 'vt100'}timeout=0nspawn_args=[]printOutput=Falseshell=Falsegid=135chrootPath='/var/lib/mock/fedora-25-x86_64-systemd-43014/root')
Executing command: ['/usr/bin/systemd-nspawn', '-q', '-M', '9fde58e2febc449e8bff9ad486a2585d', '-D', '/var/lib/mock/fedora-25-x86_64-systemd-43014/root', '-a', '--setenv=PS1=<mock-chroot> \\s-\\v\\$ ', '--setenv=LANG=en_US.utf8', '--setenv=PATH=/usr/bin:/bin:/usr/sbin:/sbin', '--setenv=SHELL=/bin/bash', '--setenv=HOSTNAME=mock', '--setenv=PROMPT_COMMAND=printf "\\033]0;<mock-chroot>\\007"', '--setenv=HOME=/builddir', '--setenv=TERM=vt100', '-u', 'mockbuild', '/usr/bin/rpmbuild', '-bs', '--target', 'x86_64', '--nodeps', '/builddir/build/SPECS/systemd.spec'] with env {'PS1': '<mock-chroot> \\s-\\v\\$ ', 'LANG': 'en_US.utf8', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin', 'SHELL': '/bin/bash', 'HOSTNAME': 'mock', 'PROMPT_COMMAND': 'printf "\\033]0;<mock-chroot>\\007"', 'HOME': '/builddir', 'TERM': 'vt100'} and shell False
Executing command: ['/usr/bin/systemd-nspawn', '-q', '-M', '9fde58e2febc449e8bff9ad486a2585d', '-D', '/var/lib/mock/fedora-25-x86_64-systemd-43014/root', '-a', '--setenv=PS1=<mock-chroot> \\s-\\v\\$ ', '--setenv=LANG=en_US.utf8', '--setenv=PATH=/usr/bin:/bin:/usr/sbin:/sbin', '--setenv=SHELL=/bin/bash', '--setenv=HOSTNAME=mock', '--setenv=PROMPT_COMMAND=printf "\\033]0;<mock-chroot>\\007"', '--setenv=HOME=/builddir', '--setenv=TERM=vt100', '-u', 'mockbuild', '/usr/bin/rpmbuild', '-bs', '--target', 'x86_64', '--nodeps', '/builddir/build/SPECS/systemd.spec'] with env {'PS1': '<mock-chroot> \\s-\\v\\$ ', 'LANG': 'en_US.utf8', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin', 'SHELL': '/bin/bash', 'HOSTNAME': 'mock', 'PROMPT_COMMAND': 'printf "\\033]0;<mock-chroot>\\007"', 'HOME': '/builddir', 'TERM': 'vt100'} and shell False
Building target platforms: x86_64
Building target platforms: x86_64
Building for target x86_64
Building for target x86_64
Wrote: /builddir/build/SRPMS/systemd-233-4.7.git5efd9f7.fc25.src.rpm
Wrote: /builddir/build/SRPMS/systemd-233-4.7.git5efd9f7.fc25.src.rpm
Child return code was: 0
Child return code was: 0
ENTER ['do'](['/usr/bin/rpmbuild', '-bb', '--target', 'x86_64', '--nodeps', '/builddir/build/SPECS/systemd.spec'], logger=<mockbuild.trace_decorator.getLog object at 0x7feebf04c1d0>user='mockbuild'uid=1014env={'PS1': '<mock-chroot> \\s-\\v\\$ ', 'LANG': 'en_US.utf8', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin', 'SHELL': '/bin/bash', 'HOSTNAME': 'mock', 'PROMPT_COMMAND': 'printf "\\033]0;<mock-chroot>\\007"', 'HOME': '/builddir', 'TERM': 'vt100'}timeout=0nspawn_args=['--private-network']printOutput=Falseshell=Falsegid=135chrootPath='/var/lib/mock/fedora-25-x86_64-systemd-43014/root')
ENTER ['do'](['/usr/bin/rpmbuild', '-bb', '--target', 'x86_64', '--nodeps', '/builddir/build/SPECS/systemd.spec'], logger=<mockbuild.trace_decorator.getLog object at 0x7feebf04c1d0>user='mockbuild'uid=1014env={'PS1': '<mock-chroot> \\s-\\v\\$ ', 'LANG': 'en_US.utf8', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin', 'SHELL': '/bin/bash', 'HOSTNAME': 'mock', 'PROMPT_COMMAND': 'printf "\\033]0;<mock-chroot>\\007"', 'HOME': '/builddir', 'TERM': 'vt100'}timeout=0nspawn_args=['--private-network']printOutput=Falseshell=Falsegid=135chrootPath='/var/lib/mock/fedora-25-x86_64-systemd-43014/root')
Executing command: ['/usr/bin/systemd-nspawn', '-q', '-M', 'f4130c3efc274e238174323783c63ab3', '-D', '/var/lib/mock/fedora-25-x86_64-systemd-43014/root', '-a', '--private-network', '--setenv=PS1=<mock-chroot> \\s-\\v\\$ ', '--setenv=LANG=en_US.utf8', '--setenv=PATH=/usr/bin:/bin:/usr/sbin:/sbin', '--setenv=SHELL=/bin/bash', '--setenv=HOSTNAME=mock', '--setenv=PROMPT_COMMAND=printf "\\033]0;<mock-chroot>\\007"', '--setenv=HOME=/builddir', '--setenv=TERM=vt100', '-u', 'mockbuild', '/usr/bin/rpmbuild', '-bb', '--target', 'x86_64', '--nodeps', '/builddir/build/SPECS/systemd.spec'] with env {'PS1': '<mock-chroot> \\s-\\v\\$ ', 'LANG': 'en_US.utf8', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin', 'SHELL': '/bin/bash', 'HOSTNAME': 'mock', 'PROMPT_COMMAND': 'printf "\\033]0;<mock-chroot>\\007"', 'HOME': '/builddir', 'TERM': 'vt100'} and shell False
Executing command: ['/usr/bin/systemd-nspawn', '-q', '-M', 'f4130c3efc274e238174323783c63ab3', '-D', '/var/lib/mock/fedora-25-x86_64-systemd-43014/root', '-a', '--private-network', '--setenv=PS1=<mock-chroot> \\s-\\v\\$ ', '--setenv=LANG=en_US.utf8', '--setenv=PATH=/usr/bin:/bin:/usr/sbin:/sbin', '--setenv=SHELL=/bin/bash', '--setenv=HOSTNAME=mock', '--setenv=PROMPT_COMMAND=printf "\\033]0;<mock-chroot>\\007"', '--setenv=HOME=/builddir', '--setenv=TERM=vt100', '-u', 'mockbuild', '/usr/bin/rpmbuild', '-bb', '--target', 'x86_64', '--nodeps', '/builddir/build/SPECS/systemd.spec'] with env {'PS1': '<mock-chroot> \\s-\\v\\$ ', 'LANG': 'en_US.utf8', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin', 'SHELL': '/bin/bash', 'HOSTNAME': 'mock', 'PROMPT_COMMAND': 'printf "\\033]0;<mock-chroot>\\007"', 'HOME': '/builddir', 'TERM': 'vt100'} and shell False
Building target platforms: x86_64
Building target platforms: x86_64
Building for target x86_64
Building for target x86_64
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.h6Wzt6
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.h6Wzt6
+ umask 022
+ umask 022
+ cd /builddir/build/BUILD
+ cd /builddir/build/BUILD
+ cd /builddir/build/BUILD
+ cd /builddir/build/BUILD
+ rm -rf systemd-5efd9f72ca2684ea1e22af5fa8771cd5b0524477
+ rm -rf systemd-5efd9f72ca2684ea1e22af5fa8771cd5b0524477
+ /usr/bin/gzip -dc /builddir/build/SOURCES/systemd-5efd9f7.tar.gz
+ /usr/bin/gzip -dc /builddir/build/SOURCES/systemd-5efd9f7.tar.gz
+ /usr/bin/tar -xof -
+ /usr/bin/tar -xof -
+ STATUS=0
+ STATUS=0
(snip)

[RFE] add '--buildrpm' option

Similarly to --buildsrpm, it would be nice if we could be able to build RPMs from source directory and spec file:

mock -r <CHROOT> --buildrpm --spec spec --sources src

Motivation:
In koji we build SRPM only once (done by --buildsrpm), and then we rebuild that SRPM in all chroots/architectures (done by mock --rebuild).
In Copr though, we need to build the SRPM for each chroot. The irony is that theoretically we actually don't need SRPM -- it would be completely enough to just (a) clone the dist-git directory, (b) download sources from lookaside cache and (c) submit mock ... --buildrpm --spec * --sources ..

--nocheck doesn't work (again)

Cockpit's %check assumes the presence of a non-loopback network device, which breaks with --new-chroot (I think this is a good thing). I don't want to run %check at all actually, but --nocheck still seems to be running %check.

This is for
https://wiki.centos.org/SpecialInterestGroup/Atomic/Devel

We added cockpit in:
CentOS/sig-atomic-buildscripts#150

Host system is CentOS 7.2.
17:41:24 INFO: mock.py version 1.2.20 starting (python version = 2.7.5)...

May be related to https://bugzilla.redhat.com/show_bug.cgi?id=1327594

ENTER ['do'](['/usr/bin/rpmbuild', '-bb', '--target', 'x86_64', '--nodeps', '--define', "'__spec_check_template exit 0; '", u'/builddir/build/SPECS/cockpit.spec'], chrootPath='/var/lib/mock/centos-and-extras-7-x86_64-mockchain-22666/root'shell=Falseuid=1000env={'LANG': 'en_US.utf8', 'TERM': 'vt100', 'SHELL': '/bin/bash', 'HOSTNAME': 'mock', 'PROMPT_COMMAND': 'printf "\\033]0;<mock-chroot>\\007"', 'HOME': '/builddir', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin', 'PS1': '<mock-chroot> \\s-\\v\\$ '}gid=135user='mockbuild'timeout=0private_network=Truelogger=<mockbuild.trace_decorator.getLog object at 0x16ea710>printOutput=True)
Executing command: ['/usr/bin/systemd-nspawn', '-q', '-M', '0e64f9a91abd4bbab8a5d0f8948f9d23', '-D', '/var/lib/mock/centos-and-extras-7-x86_64-mockchain-22666/root', '--private-network', '--setenv=LANG=en_US.utf8', '--setenv=TERM=vt100', '--setenv=SHELL=/bin/bash', '--setenv=HOSTNAME=mock', '--setenv=PROMPT_COMMAND=printf "\\033]0;<mock-chroot>\\007"', '--setenv=HOME=/builddir', '--setenv=PATH=/usr/bin:/bin:/usr/sbin:/sbin', '--setenv=PS1=<mock-chroot> \\s-\\v\\$ ', '-u', 'mockbuild', '/usr/bin/rpmbuild', '-bb', '--target', 'x86_64', '--nodeps', '--define', "'__spec_check_template exit 0; '", u'/builddir/build/SPECS/cockpit.spec'] with env {'LANG': 'en_US.utf8', 'TERM': 'vt100', 'SHELL': '/bin/bash', 'HOSTNAME': 'mock', 'PROMPT_COMMAND': 'printf "\\033]0;<mock-chroot>\\007"', 'HOME': '/builddir', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin', 'PS1': '<mock-chroot> \\s-\\v\\$ '} and shell False

Yet, we still end up running %check. I'm not sure where things are going wrong here...possibly in RPM?

mock init does not set correct permissions after unpacking root_cache

When having multiple users using mock the ownership of the /builddir tree is not set to the current user after unpacking the root_cache when doing a simple mock init.

(This worked fine in mock 1.1.41 and earlier, so we've been using that up until now when I finally decided we do not want to keep using an ancient version forever.)

memory Issue with default path : /var/lib/mock/* #81

Please suggest the way to change Mock default path /var/lib/mock/ to my particular folder
/source/user/mock
I tried this when i was testing with different options.these three folders inside :
buildroot.lock
result
root

--rootdir=/source/user/mock is only creating root directory still default copy in /var/lib/mock/root
who creates buildroot.lock file ?
I want everything inside /var/lib/mock/* should move to /source/user/mock
help in this case. Could someone guide me a way
any change suggestion for .cfg

rpkg is missing on f26+

Mock scm plugin now depends on rpkg binary (and copr-builder too) to work with dist-git lookaside cache, but that script was removed from Fedora (see https://bugzilla.redhat.com/1400592). IOW: starting from mock.fc26 this feature won't work as host machine won't have rpkg script available.

As I sort of agree that reintroducing rpkg package doesn't make much sense, I propose temporary work-around -> providing rpkg script as part of mock package.

Long term solution: Koji (and Brew) uses fedpkg-minimal vs. rhpkg-simple packages. Those packages are installed only for the purpose of building source RPM (those packages explicitly collide with fedpkg and rhpkg respectively. So, ideally we should have something like rpkg-minimal package which would suite all: Koji, Brew, Copr, Mock... So rpkg-minimal should be:

  • written in shell (or very simple C), to allow installation into minimal buildroot without dependancy pollution)
  • should have some trivial plug-in mechanism, so distributions can package upstream code and add one distribution-specific plugin file for distro-specific issues
  • rpkg-minimal must be non-colliding with fedpkg, rpkg, rhpkg, and so on ... so instead of calling /usr/bin/rpkg one should explicitly ask for /usr/bin/rpkg-minimal.

@xsuchy, @clime, @pbabinca wdyt?

error when using chroot bootstrapping with tmpfs plugin enabled

Hello, if I enable tmpfs plugin config_opts['plugin_conf']['tmpfs_enable'] = True and use config_opts['use_bootstrap_container'] = True, I get the following error when building:

[root@copr-builder-901702498 dnf-plugins-core]# mock -r fedora-rawhide-x86_64 /tmp/build_package_repo/dnf-plugins-core/dnf-plugins-core-1.0.2-1.fc26.src.rpm
INFO: mock.py version 1.4.0 starting (python version = 3.5.1)...
Start: init plugins
INFO: tmpfs initialized
INFO: selinux disabled
INFO: compress_logs: initialized
Finish: init plugins
Start: init plugins
INFO: tmpfs initialized
INFO: selinux disabled
INFO: compress_logs: initialized
Finish: init plugins
Start: run
INFO: Start(/tmp/build_package_repo/dnf-plugins-core/dnf-plugins-core-1.0.2-1.fc26.src.rpm)  Config(fedora-rawhide-x86_64)
Start: clean chroot
Finish: clean chroot
Start: chroot init
INFO: mounting tmpfs at /var/lib/mock/fedora-rawhide-x86_64-bootstrap/root.
INFO: calling preinit hooks
INFO: enabled root cache
INFO: enabled HW Info plugin
Mock Version: 1.4.0
INFO: Mock Version: 1.4.0
ERROR: Exception(/tmp/build_package_repo/dnf-plugins-core/dnf-plugins-core-1.0.2-1.fc26.src.rpm) Config(fedora-rawhide-x86_64) 0 minutes 0 seconds
INFO: Results and/or logs in: /var/lib/mock/fedora-rawhide-x86_64/result
INFO: unmounting tmpfs.
ERROR: Command failed. See logs for output.
 # /bin/mount -n --bind /var/lib/mock/fedora-rawhide-x86_64/root /var/lib/mock/fedora-rawhide-x86_64-bootstrap/root/var/lib/mock/fedora-rawhide-x86_64/root

When I set config_opts['plugin_conf']['tmpfs_enable'] = False, the build passes. The whole problematic /etc/mock/site-defaults.cfg is attached.

site-defaults.cfg.txt

RFE: add support for .spec in --installdeps

Since both yum-builddep and dnf builddep supports installing deps for

Install whatever is needed to build the given .src.rpm, .nosrc.rpm or .spec file.

I do not see any reasons why mock can't support smth like

$ mock -r epel7 --installdeps kernel.spec
INFO: mock.py version 1.3.3 starting (python version = 2.7.5)...
Start: init plugins
INFO: selinux enabled
Finish: init plugins
Start: run
ERROR: Cannot find/open srpm: kernel.spec.  Error: error reading package header
mock  [options] --installdeps {SRPM|RPM}

setup subscription-manager.conf fails on non-registered machine

I'm trying to setup subscription-manager.conf on centos machine, like (not matter which config)

config_opts['subscription-manager.conf'] = """
[main]
enabled=0
"""

and get an error:

ERROR: [Errno 2] No such file or directory: '/etc/rhsm/rhsm.conf'
Traceback (most recent call last):
  File "/usr/libexec/mock/mock", line 885, in <module>
    main()
  File "/usr/lib/python2.7/site-packages/mockbuild/trace_decorator.py", line 89, in trace
    result = func(*args, **kw)
  File "/usr/libexec/mock/mock", line 701, in main
    run_command(options, args, config_opts, commands, buildroot, state)
  File "/usr/lib/python2.7/site-packages/mockbuild/trace_decorator.py", line 89, in trace
    result = func(*args, **kw)
  File "/usr/libexec/mock/mock", line 726, in run_command
    commands.init()
  File "/usr/lib/python2.7/site-packages/mockbuild/trace_decorator.py", line 89, in trace
    result = func(*args, **kw)
  File "/usr/lib/python2.7/site-packages/mockbuild/backend.py", line 124, in init
    self.buildroot.initialize(**kwargs)
  File "/usr/lib/python2.7/site-packages/mockbuild/trace_decorator.py", line 89, in trace
    result = func(*args, **kw)
  File "/usr/lib/python2.7/site-packages/mockbuild/buildroot.py", line 90, in initialize
    self._init(prebuild=prebuild, do_log=do_log)
  File "/usr/lib/python2.7/site-packages/mockbuild/trace_decorator.py", line 89, in trace
    result = func(*args, **kw)
  File "/usr/lib/python2.7/site-packages/mockbuild/buildroot.py", line 139, in _init
    self.pkg_manager.initialize()
  File "/usr/lib/python2.7/site-packages/mockbuild/package_manager.py", line 146, in initialize
    self.initialize_config()
  File "/usr/lib/python2.7/site-packages/mockbuild/trace_decorator.py", line 89, in trace
    result = func(*args, **kw)
  File "/usr/lib/python2.7/site-packages/mockbuild/package_manager.py", line 232, in initialize_config
    self.buildroot.make_chroot_path('etc', 'rhsm'))
  File "/usr/lib64/python2.7/shutil.py", line 119, in copy
    copyfile(src, dst)
  File "/usr/lib64/python2.7/shutil.py", line 82, in copyfile
    with open(src, 'rb') as fsrc:
IOError: [Errno 2] No such file or directory: '/etc/rhsm/rhsm.conf'

Looks like mock copies /etc/rhsm/rhsm.conf from host (which doesn't exist).

Should there be a note/wiki about 'how to use this plugin correctly'..? Looks like nobody use it :)

lvm_root_opts > 16G defaulting to 16G

Hello,

When I change the value of
config_opts['plugin_conf']['lvm_root_opts']['size']
in /etc/mock/site-defaults.cfg, the value I set is accepted and reflected in the size of the mock chroot when I start a mock build. However, if I set the value to be anything greater than 16G, the mock chroot is being created as 16G. I cannot get it to create a mock chroot greater than 16G in size (trying to build the fedora kernel and it fails for running out of space here). Is this a bug or am I doing something wrong?

Thanks!

The do function should always check timeout even when running yum

Now when running yum mock does not check timeout because the timeout parameter's value is zero. In this case if yum encounters a dead lock, and this situation will hit mock In a infinite loop.

do('/usr/bin/yum --installroot /var/lib/mock/RHEL-6-build-repo_latest/root/  groupinstall build', True, None, None, 0, True, 1, None, None, None)

What if we have the timeout parameter has a default non-zero value?

ChrootScan plugin creates directory owned by root

Tested on RHEL7.3

So, is smth like

$ mock --resultdir zt /build/result/src/master/pkg-2.13-124.el7.src.rpm
$ ls -lh zt/
total 1.7M
drwxrwxr-x. 3 root    root      17 Feb 20 19:31 chroot_scan/
-rw-rw-r--. 1 builder builder  22K Feb 20 19:31 build.log
-rw-rw-r--. 1 builder builder 1.1M Feb 20 19:31 root.log
-rw-rw-r--. 1 builder builder  878 Feb 20 19:31 state.log
-rw-rw-r--. 1 builder mock     29K Feb 20 19:31 pkg-2.13-124.el7.noarch.rpm
-rw-rw-r--. 1 builder mock    323K Feb 20 19:31 pkg-2.13-124.el7.src.rpm
-rw-rw-r--. 1 builder mock    299K Feb 20 19:31 pkg-gui-2.13-124.el7.noarch.rpm

$ rm -rf zt/chroot_scan/
/bin/rm: cannot remove ‘zt/chroot_scan/’: Permission denied

And current user can't access/edit result_dir/chroot_scan now. What do you think about that?
How about change perms to user/mock one ?

nosync produce error with the new bootstrap chroot

I have enabled tmpfs and nosync and I'm getting:

Start: dnf update
ERROR: ld.so: object '/tmp/tmp.mock.i2ulf5q3/$LIB/nosync.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.

This should be harmless but should be fixed.

Import of key(s) didn't help, wrong key(s)? when building for fedora-26-ppc64le

I created a fresh Fedora-25 cloud-based ppc64le virtual machine and in there run the following:

$ dnf install mock
$ dnf install wget
$ wget https://copr-be.cloud.fedoraproject.org/results/clime/dist-git/fedora-25-x86_64/00538027-dist-git/dist-git-1.0-1.fc25.src.rpm
$ mock -r fedora-26-ppc64le dist-git-1.0-1.fc25.src.rpm

Building ends in the following error:

Total                                                                                                                                                                                                          5.8 MB/s | 121 MB     00:20     
warning: /var/lib/mock/fedora-26-ppc64le/root/var/cache/dnf/fedora-716ef756fbe46d11/packages/grep-3.0-1.fc26.ppc64le.rpm: Header V3 RSA/SHA256 Signature, key ID 64dab85d: NOKEY
Importing GPG key 0x3B921D09:
 Userid     : "Fedora 26 Secondary (26) <[email protected]>"
 Fingerprint: 19AA 0442 2491 9109 8B3D 8035 4560 FD4D 3B92 1D09
 From       : /usr/share/distribution-gpg-keys/fedora/RPM-GPG-KEY-fedora-26-secondary
Key imported successfully
Import of key(s) didn't help, wrong key(s)?
Error:


Public key for grep-3.0-1.fc26.ppc64le.rpm is not installedFailing package is: grep-3.0-1.fc26.ppc64le
 GPG Keys are configured as: file:///usr/share/distribution-gpg-keys/fedora/RPM-GPG-KEY-fedora-26-secondary

It's reproducible always but the error can be obtained also for a different package than grep as in the snippet. The whole output is attached.

bar.txt

./autogen.sh doesn't seem to work (with my versions of autotools)

Just tried to run ./autogen.sh:

# ./autogen.sh 
configure.ac:15: error: AC_INIT should be called with package and version arguments
/usr/share/aclocal-1.15/init.m4:29: AM_INIT_AUTOMAKE is expanded from...
configure.ac:15: the top level
autom4te-2.69: /usr/bin/m4 failed with exit status: 1
aclocal-1.15: error: echo failed with exit status: 1

Uncommenting AC_INIT doesn't help:

# ./autogen.sh 
configure.ac:15: installing 'build/install-sh'
configure.ac:15: installing 'build/missing'
automake-1.15: error: no 'Makefile.am' found for any configure output
  • autoconf 2.69
  • automake 1.15

When building i686 package on x86_64 host mock should have yum preload some shared libraries

When we building i686 package on an x86_64 host, mock will start a yum process that comes from a 64bit program. Because dynamic loader's feature, it's possible that yum doesn't load some shared libraries.

But after calling chroot, yum perhaps need load these share libraries. But because it's a 64 process, while the new root file system contains a 32bit env, hence the dynamic loader cannot find out these libraries. This failure could cause dead lock and other troubles.

For example, if the host enable nscd daemon, then the libnss_files.so will causes yum failed when it calling chown or lchown.

RFE: Parameterized config files

I'm facing a situation where I'm having an explosion of multiple config files what only differ slightly, and the difference could expressed by passing an argument to mock. Does something like that seem feasible?

It would look something like:

mock -r epel-7-x86_64-nwra-intel --param intel_version=2016.4.258 ....

With the config file having:

config_opts['chroot_setup_cmd'] = 'install @buildsys-build altcc-rpm-macros rpm-opt-hooks nwra-compiler-%{intel_version}'
config_opts['files']['/etc/profile.d/zz-nwra.sh'] = """
export MODULEPATH=/opt/modulefiles/Core:$MODULEPATH
module load intel/%{intel_version}
"""

This could even be applied to current configs that differ only by version number.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.