Thursday 14 November 2013

Mock Lab SBR600

Mock creates chroots and builds packages in them. Its only task is to reliably populate a chroot and attempt to build a package in that chroot.

So I began by installing mock
  • yum install mock
Then added my user-name to the group mock
  • usermod -aG mock hitman
Then just ran the mock command to build grep under chroot.
  • mock -r fedora-18-i386 grep-2.9-1.fc18.src.rpm 
 Surprisingly, It build without any issues in the first shot! Maybe because I put a lot of work in my SPEC files and made sure build requires and macros are properly given.

INFO: mock.py version 1.1.32 starting...
Start: init plugins
INFO: selinux enabled
Finish: init plugins
Start: run
INFO: Start(grep-2.9-1.fc18.src.rpm)  Config(fedora-18-i386)
Start: lock buildroot
Start: clean chroot
Finish: clean chroot
Finish: lock buildroot
Start: chroot init
Start: lock buildroot
Mock Version: 1.1.32
INFO: Mock Version: 1.1.32
INFO: calling preinit hooks
INFO: enabled root cache
INFO: enabled yum cache
Start: cleaning yum metadata
Finish: cleaning yum metadata
INFO: enabled ccache
Start: device setup
Finish: device setup
Start: yum update
Start: Outputting list of available packages
Finish: Outputting list of available packages
Finish: yum update
Start: creating cache
Finish: creating cache
Finish: lock buildroot
Finish: chroot init
INFO: Installed packages:
Start: build phase for grep-2.9-1.fc18.src.rpm
Start: device setup
Finish: device setup
Start: build setup for grep-2.9-1.fc18.src.rpm
Finish: build setup for grep-2.9-1.fc18.src.rpm
Start: rpmbuild -bb grep-2.9-1.fc18.src.rpm
Start: Outputting list of installed packages
Finish: Outputting list of installed packages
Finish: rpmbuild -bb grep-2.9-1.fc18.src.rpm
Finish: build phase for grep-2.9-1.fc18.src.rpm
INFO: Done(grep-2.9-1.fc18.src.rpm) Config(fedora-18-i386) 4 minutes 3 seconds
INFO: Results and/or logs in: /var/lib/mock/fedora-18-i386/result
Finish: run



Took me about 4 minutes 3 seconds as can be seen from the output above.

Then I ran mock to build the other package less
  • mock -r fedora-18-i386 less-451-1.fc18.src.rpm
INFO: mock.py version 1.1.32 starting...
Start: init plugins
INFO: selinux enabled
Finish: init plugins
Start: run
INFO: Start(less-451-1.fc18.src.rpm)  Config(fedora-18-i386)
Start: lock buildroot
Start: clean chroot
INFO: chroot (/var/lib/mock/fedora-18-i386) unlocked and deleted
Finish: clean chroot
Finish: lock buildroot
Start: chroot init
Start: lock buildroot
Mock Version: 1.1.32
INFO: Mock Version: 1.1.32
INFO: calling preinit hooks
INFO: enabled root cache
Start: unpacking root cache
Finish: unpacking root cache
INFO: enabled yum cache
Start: cleaning yum metadata
Finish: cleaning yum metadata
INFO: enabled ccache
Start: device setup
Finish: device setup
Start: yum update
Start: Outputting list of available packages
Finish: Outputting list of available packages
Finish: yum update
Finish: lock buildroot
Finish: chroot init
INFO: Installed packages:
Start: build phase for less-451-1.fc18.src.rpm
Start: device setup
Finish: device setup
Start: build setup for less-451-1.fc18.src.rpm
Finish: build setup for less-451-1.fc18.src.rpm
Start: rpmbuild -bb less-451-1.fc18.src.rpm
Start: Outputting list of installed packages
Finish: Outputting list of installed packages
ERROR: Exception(less-451-1.fc18.src.rpm) Config(fedora-18-i386) 0 minutes 25 seconds
INFO: Results and/or logs in: /var/lib/mock/fedora-18-i386/result
ERROR: Command failed. See logs for output.
 # ['bash', '--login', '-c', 'rpmbuild -bb --target i686 --nodeps builddir/build/SPECS/less.spec']


About time something had to go wrong. Let me check the result and modify my specs.

Did some research and found this article, they were talking about re-installing ncurses? so I figured, maybe it needs ncurses-devel. I added "BuildRequires: ncurses-devel" and ran mock again. It build without any issues.


 [hitman@localhost SRPMS]$ mock -r fedora-18-i386 less-451-1.fc18.src.rpm
INFO: mock.py version 1.1.32 starting...
Start: init plugins
INFO: selinux enabled
Finish: init plugins
Start: run
INFO: Start(less-451-1.fc18.src.rpm)  Config(fedora-18-i386)
Start: lock buildroot
Start: clean chroot
INFO: chroot (/var/lib/mock/fedora-18-i386) unlocked and deleted
Finish: clean chroot
Finish: lock buildroot
Start: chroot init
Start: lock buildroot
Mock Version: 1.1.32
INFO: Mock Version: 1.1.32
INFO: calling preinit hooks
INFO: enabled root cache
Start: unpacking root cache
Finish: unpacking root cache
INFO: enabled yum cache
Start: cleaning yum metadata
Finish: cleaning yum metadata
INFO: enabled ccache
Start: device setup
Finish: device setup
Start: yum update
Start: Outputting list of available packages
Finish: Outputting list of available packages
Finish: yum update
Finish: lock buildroot
Finish: chroot init
INFO: Installed packages:
Start: build phase for less-451-1.fc18.src.rpm
Start: device setup
Finish: device setup
Start: build setup for less-451-1.fc18.src.rpm
Finish: build setup for less-451-1.fc18.src.rpm
Start: rpmbuild -bb less-451-1.fc18.src.rpm
Start: Outputting list of installed packages
Finish: Outputting list of installed packages
Finish: rpmbuild -bb less-451-1.fc18.src.rpm
Finish: build phase for less-451-1.fc18.src.rpm
INFO: Done(less-451-1.fc18.src.rpm) Config(fedora-18-i386) 0 minutes 30 seconds
INFO: Results and/or logs in: /var/lib/mock/fedora-18-i386/result
Finish: run

Just took about 30 seconds. That is pretty neat!
Here is a link to my changed spec file.
less.spec

I think Mock tool is amazing, one thing I liked about it is, you can build packages on different architectures using mock which is nice.

The whole lab took be about 45 minutes to complete.


No comments:

Post a Comment

How to add "Discord" in Steam's Big Picture Mode

 With the release of Steam deck a lot of people are turning into Steam Deck Big Picture Mode(BPM) to enjoy an exclusive gaming experience, t...