#1968 builder: add bootstrap-chroot support for mock
Closed 3 years ago by tkopecek. Opened 4 years ago by aparsons.

file modified
+7 -1
@@ -534,7 +534,13 @@ 

          return koji.pathinfo.taskrelpath(self.task_id)

  

      def init(self):

-         rv = self.mock(['--init'])

+         args = ['--init']

+ 

+         if 'mock.bootstrap_chroot' in self.config['extra']:

+             if self.config['extra']['mock.bootstrap_chroot']:

+                 args.append('--bootstrap-chroot')

+ 

+         rv = self.mock(args)

  

          if rv:

              self.expire()

@@ -455,6 +455,9 @@ 

  * `mock.new_chroot` - 0/1 value. If it is set, `--new-chroot` or

    `--old-chroot` option is appended to any mock call. If it is not set,

    mock's default behavior is used.

+ * `mock.bootstrap_chroot` - 0/1 value. If it is set, `--bootstrap-chroot`

+   is appended to the mock init call.  This tells mock to build in two stages,

+   using chroot rpm for creating the build chroot

  

  Using Koji to control tasks

  ^^^^^^^^^^^^^^^^^^^^^^^^^^^

We probably also want knobs to enable and configure bootstrap images, too: https://github.com/rpm-software-management/mock/wiki/Feature-container-for-bootstrap

For what it's worth, I'm not sure you can bootstrap EL8 from EL7 without the bootstrap images. There's too many features missing in EL7's RPM for that to work.

For what it's worth, I'm not sure you can bootstrap EL8 from EL7 without the bootstrap images. There's too many features missing in EL7's RPM for that to work.

Works fine on my EL7 builders with dnf from the CentOS Extras repository installed on the builders.

$ rpm -q mock dnf koji-builder
mock-1.4.21-1.el7.noarch
dnf-4.0.9.2-1.el7_6.noarch
koji-builder-1.19.1-1.el7.noarch
INFO buildroot.py:374:  Mock Version: 1.4.21
DEBUG util.py:215:  ensuring that dir exists: /var/lib/mock/el8-build-5880-13361/root/dev/pts
DEBUG util.py:218:  creating dir: /var/lib/mock/el8-build-5880-13361/root/dev/pts
DEBUG util.py:215:  ensuring that dir exists: /var/lib/mock/el8-build-5880-13361/root/dev/shm
DEBUG util.py:218:  creating dir: /var/lib/mock/el8-build-5880-13361/root/dev/shm
DEBUG buildroot.py:517:  kernel version == 3.10.0-1062.9.1.el7.x86_64
DEBUG util.py:228:  touching file: /var/lib/mock/el8-build-5880-13361/root/etc/fstab
DEBUG util.py:228:  touching file: /var/lib/mock/el8-build-5880-13361/root/etc/yum/yum.conf
DEBUG util.py:228:  touching file: /var/lib/mock/el8-build-5880-13361/root/etc/dnf/dnf.conf
DEBUG util.py:228:  touching file: /var/lib/mock/el8-build-5880-13361/root/var/log/yum.log
DEBUG util.py:215:  ensuring that dir exists: /var/lib/mock/el8-build-5880-13361/root/proc
2020-01-24 00:39:51,861 [INFO] {22364} koji.build.buildroot:518 Running mock as kojibuilder
INFO: mock.py version 1.4.21 starting (python version = 3.6.8)...
Start(bootstrap): init plugins
INFO: selinux enabled
Finish(bootstrap): init plugins
Start: init plugins
INFO: selinux enabled
Finish: init plugins
INFO: Signal handler active
Start: run
Start: clean chroot
Finish: clean chroot
Start(bootstrap): chroot init
INFO: calling preinit hooks
INFO: enabled HW Info plugin
Mock Version: 1.4.21
INFO: Mock Version: 1.4.21
Start(bootstrap): dnf install
Finish(bootstrap): dnf install
Finish(bootstrap): chroot init
Start: chroot init
INFO: calling preinit hooks
INFO: enabled HW Info plugin
Mock Version: 1.4.21
INFO: Mock Version: 1.4.21
Start: dnf install
Finish: dnf install
Finish: chroot init
INFO: Installed packages:
Finish: run
2020-01-24 00:41:12,186 [INFO] {23207} koji.build.buildroot:518 Running mock as kojibuilder
INFO: mock.py version 1.4.21 starting (python version = 3.6.8)...
Start: init plugins
INFO: selinux enabled
Finish: init plugins
INFO: Signal handler active
Start: run
INFO: Start(/tmp/koji/tasks/6768/66768/local/work/tasks/6766/66766/tini-0.18.0-2.el8.src.rpm)  Config(el8-build-5880-13361)
Start: chroot init
INFO: calling preinit hooks
INFO: enabled HW Info plugin
Mock Version: 1.4.21
INFO: Mock Version: 1.4.21
Finish: chroot init
Start: build phase for tini-0.18.0-2.el8.src.rpm
Start: build setup for tini-0.18.0-2.el8.src.rpm
Finish: build setup for tini-0.18.0-2.el8.src.rpm
Start: Outputting list of installed packages
Finish: Outputting list of installed packages
Start: rpmbuild tini-0.18.0-2.el8.src.rpm
Finish: rpmbuild tini-0.18.0-2.el8.src.rpm
Finish: build phase for tini-0.18.0-2.el8.src.rpm
INFO: Done(/tmp/koji/tasks/6768/66768/local/work/tasks/6766/66766/tini-0.18.0-2.el8.src.rpm) Config(koji/el8-build-5880-13361) 0 minutes 6 seconds
INFO: Results and/or logs in: /var/lib/mock/el8-build-5880-13361/result
Finish: run

pretty please pagure-ci rebuild

4 years ago

Hi, setting values in config is better place than adding CLI options (koji mock-config will work better) I've extended it a bit (your commit included) and added support for podman's images. #2166

Pull-Request has been closed by tkopecek

3 years ago