Building Units Package with Mock

The Mock command uses rpmbuild and a changeroot to emulate building on different architetures(or the same) and in a clean environment. This is especially useful to find out what BuildRequires are needed inside your spec file.

Setup mock:

Step 1: Install the mock command
yum install mock

Step 2:
Add user to mock group
usermod -a -G mock username
logoff the user and login again
Begin using mock!

Before using mock:

Step 1:
The first steps to using mock are making sure your SRPM’s are error free, by using the command rpmlint

rpmlint ~/rpmbuild/SRPMS/units-2.00-1.fc17.src.rpm
1 packages and 0 specfiles checked; 0 errors, 0 warnings.

If you find errors, then fix them before continuing.

Step 2:
Running the mock command

mock -r fedora-18-x86_64 ~/rpmbuild/SRPMS/units-2.00-1.fc17.src.rpm

In this case, no errors came up and it finished successfully in 28 seconds(though this depends on your connection, had one that took 7 minutes). Logs are inside the /var/lib/mock/fedora-18-x86_64/result/ folder.

Advertisements

About oatleywillisa

Computer Networking Student
This entry was posted in SBR600. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s