Thursday, September 26, 2013

Mock Lab

The mock lab was flawless for both of the packages (which and less)
Here is the output of which

INFO: mock.py version 1.1.33 starting...
Start: init plugins
INFO: selinux enabled
Finish: init plugins
Start: run
INFO: Start(less-458-4.fc19.src.rpm)  Config(fedora-19-x86_64)
Start: lock buildroot
Start: clean chroot
Finish: clean chroot
Finish: lock buildroot
Start: chroot init
Start: lock buildroot
Mock Version: 1.1.33
INFO: Mock Version: 1.1.33
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 less-458-4.fc19.src.rpm
Start: device setup
Finish: device setup
Start: build setup for less-458-4.fc19.src.rpm
Finish: build setup for less-458-4.fc19.src.rpm
Start: rpmbuild -bb less-458-4.fc19.src.rpm
Start: Outputting list of installed packages
Finish: Outputting list of installed packages
Finish: rpmbuild -bb less-458-4.fc19.src.rpm
Finish: build phase for less-458-4.fc19.src.rpm
INFO: Done(less-458-4.fc19.src.rpm) Config(fedora-19-x86_64) 5 minutes 8 seconds
INFO: Results and/or logs in: /var/lib/mock/fedora-19-x86_64/result
Finish: run
[ron@f19 SRPMS]$ cd ~/Downloads/
[ron@f19 Downloads]$ mock -r fedora-19-x86_64 which-2.20-1.fc19.src.rpm
INFO: mock.py version 1.1.33 starting...
Start: init plugins
INFO: selinux enabled
Finish: init plugins
Start: run
INFO: Start(which-2.20-1.fc19.src.rpm)  Config(fedora-19-x86_64)
Start: lock buildroot
Start: clean chroot
INFO: chroot (/var/lib/mock/fedora-19-x86_64) unlocked and deleted
Finish: clean chroot
Finish: lock buildroot
Start: chroot init
Start: lock buildroot
Mock Version: 1.1.33
INFO: Mock Version: 1.1.33
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 which-2.20-1.fc19.src.rpm
Start: device setup
Finish: device setup
Start: build setup for which-2.20-1.fc19.src.rpm
Finish: build setup for which-2.20-1.fc19.src.rpm
Start: rpmbuild -bb which-2.20-1.fc19.src.rpm
Start: Outputting list of installed packages
Finish: Outputting list of installed packages
Finish: rpmbuild -bb which-2.20-1.fc19.src.rpm
Finish: build phase for which-2.20-1.fc19.src.rpm
INFO: Done(which-2.20-1.fc19.src.rpm) Config(fedora-19-x86_64) 0 minutes 33 seconds
INFO: Results and/or logs in: /var/lib/mock/fedora-19-x86_64/result
Finish: run

I was really glad I switched gimp for which … It would have been a terrible pain to build an RPM package of gimp and then run mock with all the dependencies that gimp requires and the dependencies of dependencies.
Mock did not take too long to finish, perhaps a little bit more than building the RPM package. I was expecting mock to finish successfully for both packages since I spent a lot of time looking working on the spec file of each one.

--------------------------------------

Koji Lab

For the koji lab first I yum install fedora-packager then

I cd to /usr/bin and run ./fedora-packager-setup.

It prompts me for my FAS account and then It asks for an export password.
Afterwards I add the certificate to chrome and enter the export password. I test that I can sign in with koji. Everything seems good to go.


Testing less with Koji

I begin with the following command:

time s390-koji build f19 --scratch less-458-4.fc19.src.rpm

this is what I get back:

Created task: 1217365
Task info: http://s390.koji.fedoraproject.org/koji/taskinfo?taskID=1217365
Watching tasks (this may be safely interrupted)...
1217365 build (f19, less-458-4.fc19.src.rpm): free
1217365 build (f19, less-458-4.fc19.src.rpm): free -> open (fedora2.s390.bos.redhat.com)
 1217366 buildArch (less-458-4.fc19.src.rpm, s390): free
 1217367 buildArch (less-458-4.fc19.src.rpm, s390x): open (fedora3.s390.bos.redhat.com)
 1217366 buildArch (less-458-4.fc19.src.rpm, s390): free -> open (fedora1.s390.bos.redhat.com)
 1217366 buildArch (less-458-4.fc19.src.rpm, s390): open (fedora1.s390.bos.redhat.com) -> closed
 0 free  2 open  1 done  0 failed
 1217367 buildArch (less-458-4.fc19.src.rpm, s390x): open (fedora3.s390.bos.redhat.com) -> closed
 0 free  1 open  2 done  0 failed
1217365 build (f19, less-458-4.fc19.src.rpm): open (fedora2.s390.bos.redhat.com) -> closed
 0 free  0 open  3 done  0 failed

1217365 build (f19, less-458-4.fc19.src.rpm) completed successfully

real    5m14.094s
user    0m2.188s
sys    0m0.287s

I ran the same source file a second time for f18

real    3m45.686s
user    0m1.957s
sys    0m0.256s

Then for ppc-koji in f18

real    3m49.745s
user    0m1.713s
sys    0m0.234s

ppc-koji in f19

 0 free  2 open  1 done  0 failed
gaierror: [Errno -2] Name or service not known

real    3m28.543s
user    0m1.694s
sys    0m0.219s

I got an error or warning for PPC in f19 but since it said 0 failed I ignored it, Nor I have any idea why the powerpc could not recognize what was clearly recognized in all of the other platforms.


time koji build f18 --scratch  less-458-4.fc19.src.rpm

The first time I ran koji I forgot to time, so this is the second time I ran koji for the same file

real    2m55.563s
user    0m1.427s
sys    0m0.207s

Now for f19

real    3m5.445s
user    0m1.327s
sys    0m0.227s



Testing which with Koji

koji for f19

real    2m48.838s
user    0m1.152s
sys    0m0.197s


koji for f18

real    2m10.631s
user    0m1.358s
sys    0m0.208s

s390-koji for f18

real    2m58.190s
user    0m1.323s
sys    0m0.146s

ppc-koji for f19

real    2m57.790s
user    0m1.738s
sys    0m0.231s

ppc-koji for f18

real    1m30.340s
user    0m0.935s
sys    0m0.127s


In general Koji took longer to build than mock and rpmbuild for the same packets. Of course we have to take into account that there might not be a free machine always which will increase the time. In my case there was always a free machine but the Seneca network caused the time to increase due to either lag or upload speed etc. Ignoring the network the process is almost as fast as from my computer.

Koji in general is very versatile tool to test if your package will build in several architectures. Given that most likely we have at home a 32 or 64 bit machine. Process is fairly simple and the build time is fast for the packages done.

Thursday, September 19, 2013

RPM Build Lab

RPM Writing Lab

To begin I do the required package installations

yum groupinstall “Fedora Packager”
yum install rpmlint  yum-utils rpmdevtools

Then If you are always running around as root like I do make sure to add your regular account to visudo and exit of root since it is recommended to run as a different user other than root.

Then I set up the folders inside the rpmbuild folder with:

rpmdev-setuptree

This will setup folders in /home/username/rpmbuild/
The folders are BUILD, BUILDROOT, RPMS, SOURCES, SPECS, SRPMS

If this folders were here before make sure to run this command:

rpmdev-wipetree

This will clean all the files in the folders.

now I download the tarball of which from GNU project and putting in ~/rpmbuild/SOURCES

I cd to ~/rpmbuild/SPECS and run the command.

rpmdev-newspec which

to create a new spec file for which.
The file is like a template and you fill up the missing data.

I did with the information that I had taken from the class, then I ran:

rpmbuild -ba which.spec

To which came up giving error. Knowing that I had not idea what I was doing and that the I failed to do the same with another package I decided to look at the original spec file.

I download the source file with yum then I rpm install the file:

yumdownloader --source which
rpm -i which-*.src.rpm

Which ended up populating the folders inside ~/rpmbuild/ from here I took the which.spec file to modify mine. I ended up taking only a few things and ignore many. To read through the spec file easier I decided to install vim and since I did that I also went ahead and installed gvim. It made things colorful and easy to identify inside the spec file.

With this new modification I managed to successfully build the package, then to test it I ran

rpmlint RPMS/ SRPMS/ SPECS/

This gave a whole set of problems around 14 errors and 3 warnings.
And I thought I was good to go !!!

I managed to get the errors down to 6 but I didn’t know what else to do so I made other changes from the original spec file to my spec file. which needed to also install 2 other local sources and a patch from version 2.19 before installing 2.20. So I copied the files to the SOURCES dir and modified the spec file correspondingly. After doing this I did another build and ran rpmlint which came with zero errors. Yay

The next package to build for RPM is less

I’ve noticed that many packages do not have clean spec files as was shown with wget, instead they are filled with other files and many patches. For that reason I have left this package mainly untouched.
There is a difference between BuildRequires and Requires
Requires is what the Built RPM requires
BuildRequires is what RPM needs in order to build

I have tried several packages before switching back to less but they all would give me error if I missed or modified a single line in the spec file.
But well with less I got no errors not even with rpmlint.

Files for which
https://drive.google.com/folderview?id=0B2G5T2vxJmLrbEtRbVNWQW5IVFk&usp=sharing

Files for less
https://drive.google.com/folderview?id=0B2G5T2vxJmLra1dKa2VpOWp4amM&usp=sharing

Monday, September 16, 2013

Compiling from source: the almost neverending story



Compiling less from source

First step Download the package
Second step: Extract the package from the tar ball
Third step: move to the folder and do a configure ./configure
Here is where the problem started. When I did ./configure it will start running but it would immediately tell me this error. 

“checking for working terminal libraries cannot find terminal libraries configure failed”

I look around the web and they say I need the ncurses package. So I do a yum install for ncurses to which it says that it is installed and up to date. I go ahead and try again as root just to be sure. The thing error showed up. After a few minutes of tinkering I decided to do a“yum install *curses*” since the configure output was referencing curses files like lxcurses and lncursesw.
The yum command prompts me to install 48 packages 10 related to curses and the rest for dependencies. I skim through the packages and I find ncurses-devel and I remember Chris doing something similar for wget so I yum install ncurses-devel and try configure again. Eureka configure finished without errors.

Next step I run and time make.

Note: Before I posted the specs of my desktop but I am currently compiling from my 5 year old laptop without ssd or anything fancy.  It is a Core 2 Duo P8100, 3 GB of DDR 2 Ram and a 250 GB HDD Spinning at 5400 RPM. I am dual booting Windows 7 and Fedora 19.

Less time:

real    0m5.928s
user    0m4.945s
sys    0m0.670s

After that from the source folder I run the command
./less README

And Less works perfectly


Now trying with GIMP This should be more challenging (So I said before starting)

I run ./configure and I get the following error

configure: error: Your intltool is too old.  You need intltool 0.40.1 or later.

I proceed to yum install intltool and configure keeps going and it stops at this error

checking for BABL... no
configure: error: Package requirements (babl >= 0.1.10) were not met:

No package 'babl' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.


I yum install babl and try again but it will still give the same error.
I sit back and wonder why if the package is installed it does not recognize it. Then I decide to try with babl-devel and it continues. I think *-devel is the magic combination haha.

I continued doing this with a few more packages until I hit gtk+
after yum installing it for gtk+ and gtk+-devel it was still complaining I checked the config.log and apparently the version from yum was pretty old and it needed 2.24 or newer. So I go to the GIMP website and Download gtk+ 3.8 and when I hit configure for GTK+ I run into other dependencies Issues.

This is the neverending story !!!.

First one on the list is pango which is already install so I hit pango-devel with yum. I keep solving the dependencies  until I hit gdk-pixbuf that yum would not resolve. So once again I go to compile this package from source. after resolving a few more dependencies I can install gdk-pixbuf and continue working on GTK+ which continues asking for dependencies. After I finished finding all the dependencies for GTK+ I went ahead and did a make  on GIMP which took several minutes. 

time to compile GIMP

real    11m48.668s
user    9m14.039s
sys    1m44.884s

After I open Gimp it tells me that it could not find some files thus I cannot use the program. I am guessing the cause is that I did not do the make install. Which is where it is looking for this files.

In total just for GIMP I probably spent around 4 hours and around 200-300 MB in dependencies and dependencies of dependencies. As Chris Tyler stated compiling can take long with bigger programs and that is the reality, 11 minutes to compile. Although it took a while, this taught to use understand and use yum better.