Skip to main content

The mighty RPM Build lab

In my first experience of building an RPM. I did not have any idea what I was up against. The process looked easy, however, when we actually began to configure the spec file, then it showed its real face. I am also writing this blog very late and I hope Chris would consider this, I had to take some time out for this to do my research and actually know what is going on.

To begin, I issued the commands to install Fedora Packager and  yum utils.
After that was done, I followed the steps outlined in the lab up until it told us to work on the SPEC file which I had no idea how to configure. I embarked on a journey of research and got to know a bit about SPEC how it functions, what are the common macros and what are the common issues in making a SPEC file.

The Packages that I had to build were "less" and "grep".

Building RPM for less:

In order to get information on less I issued the command

               rpm -qi less

and that gave me some information that I can use in my SPEC file
Name        : less
Version     : 444
Release     : 9.fc18
Architecture: i686
Install Date: Thu 26 Sep 2013 09:30:16 PM EDT
Group       : Applications/Text
Size        : 204397
License     : GPLv3+
Signature   : RSA/SHA256, Fri 26 Oct 2012 02:41:44 AM EDT, Key ID ff01125cde7f38bd
Source RPM  : less-444-9.fc18.src.rpm
Build Date  : Thu 25 Oct 2012 11:53:55 AM EDT
Build Host  : buildvm-02.phx2.fedoraproject.org
Relocations : (not relocatable)
Packager    : Fedora Project
Vendor      : Fedora Project
URL         : http://www.greenwoodsoftware.com/less/
Summary     : A text file browser similar to more, but better
Description :
The less utility is a text file browser that resembles more, but has
more capabilities.  Less allows you to move backwards in the file as
well as forwards.  Since less doesn't have to read the entire input file
before it starts, less starts up more quickly than text editors (for
example, vi).

You should install less because it is a basic utility for viewing text
files, and you'll use it frequently.
I took a few things, like name, Description etc from this, however, for the version and release I had to get it from the source code I downloaded, otherwise it I would have built the RPM with a wrong version.

I filled the SPEC file with as much info as I can and then I started I issued the command to build the RPM
                               rpmbuild -ba less.spec

Little did I know what was ahead of me. When it was building the RPM the first warning i got was

configure: WARNING: unrecognized options: --disable-dependency-tracking

I did some research on this warning and found that if the config script of the source file had this option then this warning would not have showed up. To check if I had this option on the config script I issued this command in my source folder.

grep -qe --disable-dependency-tracking configure

The command did not return any result that meant that there was indeed no such option present, therefore, I ignored this warning. If i find anything that I can do in the SPEC file to ignore this warning then I would, but I think this requires some change in the config script and not the spec file.

I moved on, and the build command completed with a few errors.

   error: Installed (but unpackaged) file(s) found:
   /usr/bin/less
   /usr/bin/lessecho
   /usr/bin/lesskey
   /usr/share/man/man1/less.1.gz
   /usr/share/man/man1/lessecho.1.gz
   /usr/share/man/man1/lesskey.1.gz

the rpmbuild command failed to extract these files, therefore, I had to adjust my spec file so it would extract these files as well. I used %{_bindir} and %{_mandir} macros to fix these errors.

I added these lines to the spec File
%{_bindir}/less*
%{_mandir}/man1/less* 

Explanation:

%{_bindir}= /usr/bin
%{_mandir}/man1

Hence, by using these macros and specifying "less*" I was able to extract the files that were giving me error and the build completed successfully.

Here is a link to my Spec file less.spec
Here is a link to my RPM file  less-451-1.fc18.i686.rpm
Here is a link to my SRPM file less-451-1.fc18.src.rpm

Less took me about 1 hours and 30 minutes to build.

Building RPM for GREP:

This is where the fun began, I followed the steps that I did for less but I had much more errors then I had for less and I had to modify my SPEC FILE a lot more than I did for less.

I got information on GREP package by running the command
                    rpm -qi grep

I filled in the spec file with that and then I ran the rpmbuild command to see what awaits me.

First thing I noticed while it was building the package is that it gave me a warning:

configure: WARNING: libpcre development library was not found or not usable.

This was easy, I just had to install the pcre-devel, I did it by using the yum command.

Errors:
Installed (but unpackaged) file(s) found:
   /usr/bin/egrep
   /usr/bin/fgrep
   /usr/share/info/dir
   /usr/share/info/grep.info.gz
   /usr/share/locale/af/LC_MESSAGES/grep.mo
   /usr/share/locale/be/LC_MESSAGES/grep.mo
   /usr/share/locale/bg/LC_MESSAGES/grep.mo
   /usr/share/locale/ca/LC_MESSAGES/grep.mo
   /usr/share/locale/cs/LC_MESSAGES/grep.mo
   /usr/share/locale/da/LC_MESSAGES/grep.mo
   /usr/share/locale/de/LC_MESSAGES/grep.mo
   /usr/share/locale/el/LC_MESSAGES/grep.mo
   /usr/share/locale/eo/LC_MESSAGES/grep.mo
   /usr/share/locale/es/LC_MESSAGES/grep.mo
   /usr/share/locale/et/LC_MESSAGES/grep.mo
   /usr/share/locale/eu/LC_MESSAGES/grep.mo
   /usr/share/locale/fi/LC_MESSAGES/grep.mo
   /usr/share/locale/fr/LC_MESSAGES/grep.mo
   /usr/share/locale/ga/LC_MESSAGES/grep.mo
   /usr/share/locale/gl/LC_MESSAGES/grep.mo
   /usr/share/locale/he/LC_MESSAGES/grep.mo
   /usr/share/locale/hr/LC_MESSAGES/grep.mo
   /usr/share/locale/hu/LC_MESSAGES/grep.mo
   /usr/share/locale/id/LC_MESSAGES/grep.mo
   /usr/share/locale/it/LC_MESSAGES/grep.mo
   /usr/share/locale/ja/LC_MESSAGES/grep.mo
   /usr/share/locale/ko/LC_MESSAGES/grep.mo
   /usr/share/locale/ky/LC_MESSAGES/grep.mo
   /usr/share/locale/lt/LC_MESSAGES/grep.mo
   /usr/share/locale/nb/LC_MESSAGES/grep.mo
   /usr/share/locale/nl/LC_MESSAGES/grep.mo
   /usr/share/locale/pl/LC_MESSAGES/grep.mo
   /usr/share/locale/pt/LC_MESSAGES/grep.mo
   /usr/share/locale/pt_BR/LC_MESSAGES/grep.mo
   /usr/share/locale/ro/LC_MESSAGES/grep.mo
   /usr/share/locale/ru/LC_MESSAGES/grep.mo
   /usr/share/locale/sk/LC_MESSAGES/grep.mo
   /usr/share/locale/sl/LC_MESSAGES/grep.mo
   /usr/share/locale/sr/LC_MESSAGES/grep.mo
   /usr/share/locale/sv/LC_MESSAGES/grep.mo
   /usr/share/locale/th/LC_MESSAGES/grep.mo
   /usr/share/locale/tr/LC_MESSAGES/grep.mo
   /usr/share/locale/uk/LC_MESSAGES/grep.mo
   /usr/share/locale/vi/LC_MESSAGES/grep.mo
   /usr/share/locale/zh_CN/LC_MESSAGES/grep.mo
   /usr/share/locale/zh_TW/LC_MESSAGES/grep.mo
   /usr/share/man/man1/egrep.1.gz
   /usr/share/man/man1/fgrep.1.gz


FIXES:

   ERROR                                      Solution
/usr/bin/egrep                                     %{_bindir}/egrep
/usr/bin/fgrep                                     %{_bindir}/fgrep
/usr/share/info/grep.info.gz              %{_infodir}/%{name}*
/usr/share/info/dir                             %{_infodir}/dir
/usr/share/man/man1/egrep.1.gz      %{_mandir}/man1/fgrep*
/usr/share/man/man1/fgrep.1.gz       %{_mandir}/man1/egrep*

All the ".mo" files are language files, after doing my research I found a short way of addressing all the language files without compromising the security and accessing the files that do not need to be accessed.

%find_lang %{name}

%post
/sbin/install-info %{_infodir}/%{name}.info %{_infodir}/dir || :
%preun
if [ $1 = 0 ] ; then
/sbin/install-info --delete %{_infodir}/%{name}.info %{_infodir}/dir || :
fi

%files -f %{name}.lang


After all of this my rpmbuild command executed without any errors or warnings.
The time command said:

real    2m33.418s
user    0m29.549s
sys    1m25.282s

Little did it know that it took me about 5 hours to build both of these RPMs.

Here is a link to my Spec file grep.spec
Here is a link to my RPM file grep-2.9-1.fc18.i686.rpm
Here is a link to my SRPM file grep-2.9-1.fc18.src.rpm


Rpmlint:
The rpmlint did not complain about a lot of things, for both spec file I gave a wrong URL, therefore, it just pointed out that it cannot access the provided URL. It also issued warnings when tab and space are used together in a line, I just edited the file to remove all the spaces and only have tab as a separator. It did not give me any error or warning after that. The output I got was:

0 packages and 1 specfiles checked; 0 errors, 0 warnings.

I got the same output for less as well as grep when i ran the rpmlint command.
Hope you enjoyed my blog, I certainly did enjoy figuring out all of this stuff.

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,