Skip to main content

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.


Comments

Popular posts from this blog

ASUS RT N16 + OpenWRT + nodogsplash = WiFi Hotspot (For beginners)

1.Make sure you are directly connected to the router through a cable ·Take an ethernet cable from your ASUS modem and plug it into your pc/laptop
2.Now access your modem by going into the browser and typing: 192.168.1.1 ·Go to administration tab and click on Firmware upgrade/update NOTE: Please use internet explorer for all of these configurations. There are some issues reported in other browsers. 3.You will have to load a DD-WRT basic image first to load the openWRT image. You cannot directly load openWRT image for some reason I dont know of ·Download the image by clicking on the link: www.dd-wrt.com/routerdb/de/download/Asus/RT-N16/-/dd-wrt.v24-14896_NEWD-2_K2.6_mini_RT-N16.trx/3763
4.Once the image is downloaded just click on browse on the ASUS firmware upgrade page and browse to the DDWRT image and upload it
5.

How to Install GTK-RecordMyDesktop on RHEL 7 (best screen recording software imo)

If you want to record your screen to make tutorials or something else, GTK-recordmydesktop is capable of doing it. Most of the screen-recording programs that I have come across requires you to record your audio separately, however this software is also capable of recording audio without any extra step. It can also work with JACK audio server.

PART 1 - Install EPL repository for RHEL 7:
Open a terminalInstall epel using the following command: yum -y install epel-release.Refresh repo by typing the following commad: yum repolist.PART 2 - Install GTK-RecordMyDesktop: yum install gtk-recordmydesktop That's it, it should work right away. If it doesn't, it is possible that you might be missing some codecs as I installed them from nux and epel repos earlier.

Create isolated network on Virtual Machine Manager - Centos 6.5

Since most of the Linux administration practice is done in a virtual environment, I thought I should create a video about it, as I am aware that some students at my college struggle with it in their labs. Please let me know if I missed anything or did not explain anything clearly.

Thanks,