Wednesday, September 30, 2009

SBR600 - Koji Build Successful

After reading the comment, my teacher left me on my last blog. I realized something, in all the build logs for every architecture, I was getting errors for the perl directories I hard coded in the spec file. Because of the different architectures of each system, they would require their own perl architecture.

i.e.
%{_libdir}/perl5/5.10.0/x86_64-linux-thread-multi/*
%{_libdir}/perl5/5.10.0/x86_64-linux-thread-multi/auto/Irssi/*

So, I removed those lines, and changed it back to

%{_libdir}/*

So I rebuilt my spec file, tested my src rpm with rpmlint and the next step was going on to koji and testing it out.

Using the same command as last time, I started mock building my src rpm file on the different architecture

koji build --scratch dist-f10 irssi-0.8.14-1.fc10.src.rpm

It this time successfully passed all the mock builds on the other architecture.
Here are my results: Success

While talking to my teacher, he asked me if I have installed my RPM. And I have not, so I installed my package with the following command "rpm -i irssi-0.8.14-1.fc10.x86_64.rpm" and success no errors.

After the installation I tried using it, and bam I was running irssi



Now to verify if it was really my own package, I used "rpm -qi irssi" as advised by my teacher.

After looking at the information and checking my spec file, it was in fact my package I installed.



After all the troubleshooting, with my professor I finally have my finished package.

Kudos to my teacher for his help with all of this. Thanks Chris

SBR600 - First Koji Build and it failed.

After not feeling sleepy for some reason, I decided to play with Koji to see if I can get it working. Again using the Fedora Wiki as a resource, I managed to upload my src rpm to koji.
The command I used was

koji build --scratch dist-f11 irssi-0.8.14-1.fc10.src.rpm

--koji = program
--scratch = Build Option
--dist-f11 = Target, machine you want to build on**
--irssi-0.8.14-1.fc10.src.rpm = Your Source RPM

** To get the list of machines your can build on you would use the command
koji list-targets

The build type I used was called a Scratch build. Here is the definition of a scratch build

"Scratch builds

Sometime it is useful to be able to build a package against the buildroot but without actually including it in the release. This is called a scratch build. "

Information grabbed from Fedora Wiki


Sadly for me, my first attempt failed, and it is all logged on the Koji Build System Site

Here is the results for my build :
Build Results

Looking at the output my script failed during the mock build on all architectures.

I'll catch up with my Teacher Chris on Thursday during class or even on IRC regarding this results.

SBR600 - More RPM Packaging Headaches

After thinking that I got a perfect RPM binary file, tonight I decided to just check it out again before I try it on Koji. But to my surprise, it failed horribly. I find myself with 9 errors all related to these:
non-standard-executable-perm and zero-length,

and 122 warnings related to these:
hidden-file-or-dir, perl-temp-file, /usr/share/doc/ can't be used.

So I jumped onto the seneca channel on our irc freenode server and looked for my teacher Chris.

We spend a total of 3 hours to solve this issue.

The way we solved the issues and warnings are as follows:

for the zero-length error, I did a search on like with the search pattern rpmlint zero-length error
and found a fedora wiki showing me how to solve it.

All I needed to do is under the %install section I just needed to add
for file in $(find %{buildroot} -size 0) ; do
rm -f "$file"
done

which will find all files in my Build Root directory with the size 0 and delete them.

For the non-standard-executable-perm error, Professor Chris and I tried many strategies to overcome this obstacle
1. We changed the directory default attributes to %defattr(0755,root,root,0755), but that caused for errors than less, because now its telling us there are scripts missing the shebang line (#!/bin/bash) for those who are wondering. Of course we set it back to normal

2. In the %files section we changed to order of the directory listing and added another %defattr(-,root,root,-) line, but this time it went before %{_libdir} directory. And same permission settings %defattr(0755,root,root,0755), and again it failed, with the same issues.

3. Professor Chris noted we needed to add a %devel section, since we are using irssi development.
so I added the following sections with section headers

%description devel
Contains headers for irssi development

%files devel
%defattr(-,root,root,-)
%{_includedir}/%{name}/

This solved most of our issues regarding /usr/include we were getting.

4. Finally we both came up with a solution to fix the program and our solution was

Professor Chris :
00:43 <@ctyler> find %{buildroot}/%{_libdir} -name '*.so' -exec chmod 0755 {}
\;

and mine
00:38 <> i found using this command removed those
non-standard-executable errors : chmod -R u+w
$RPM_BUILD_ROOT%{_libdir}/perl5/5.10.0/x86_64-linux-thread-multi/auto/Irssi/

both worked well, and solved this 3 hour long thorn.

Lastly for our warnings, from advice from my professor, he suggested that I use a command that would wipe those files out, and the commands I used to do so was

find %{buildroot}/%{_libdir} -name '.packlist' -exec rm -f {} \;
find %{buildroot}/%{_libdir} -name '*.pod' -exec rm -f {} \;

That got rid of all those files and in the end, rpmlint finally gave me a checkered flag, and I am totally exhausted.


Below is the except, from my conversation with professor chris at the time we began and ended.

Time We Began
22:05 <@ctyler> bochao: pong
22:05 <> hi sir
22:06 <@ctyler> hi Boris
22:06 <@ctyler> how's it going?
....
Time we finished
00:50 <@ctyler> well now that you're down to 0 errors, I'm going to crash :-)
00:50 <@ctyler> goodnight Boris
00:50 <> thanks sir

Oh by the way, before I end it.
Installing Koji was a snap, I found a tutorial on Fedora Wiki that totally guided me from start to finish. Now I just need to figure out how to use it.

Here are my final working rpms.
Source
Binary

Thursday, September 24, 2009

SBR600 - Creating RPM Headaches

For this weeks lab, we are told to create a rpm for a package of our choice.
For me I chose to package Irssi a text based irc client.

My reference source through out this process was off the Fedora Wiki site and also from my prefessor Chris

To start, we would actually need to create a directory where all our packing setup would be kept. The command to do so is "rpmdev-setuptree" and a rpmbuild directory will be made on your home directory

As well we would also need to get the tarball file of the package we want to create an rpm for and then place it in the rpmbuild/SOURCES directory

Next we would need to create a spec file, which is a file that contains a set of instructions to create an rpm. To create an empty spec file the command we would use is "rpmdev-newspec 'package name' " in my case it would be "rpmdev-newspec irssi" and that would give us an empty spec template for my irssi package.

You would later have to move that to your rpmbuild/SPECS directory once you have finished setting up your spec file .

In your spec file you need to completed all the necessary containers i.e.

  1. preamble - basic metadata**
  2. %prep - commands to prepare the package for building**
  3. %build - commands to build the package**
  4. %install - commands to install the built files**
  5. %check - commands to check/test the built files (optional, often not included)**
  6. %clean - commands to clean up the disk space**
  7. %files - list of files to be included in the pacakge**
  8. %changelog - record of the package's change-history**
** Info taken from SBR600 Notes

After you complete your spec file and placed it in the proper directory ,your directory structure should look like this




After moving your spec file in the right directory, you would need to test it out to see if there are any errors in the file when you were creating it.

The command for that is "rpmlint 'spec file' / ' src rpm' / 'rpm' "
If there were any errors it will report it at the bottom for me it was successful


When you have successfully checked your spec file, build your spec file with the following command

rpmbuild -ba 'spec file'

If your build is perfect you can move on to the next step if not correct your spec file and rebuild till it successfully finishes. For me it failed the first two times because I forgot to place some important directory locations in the spec file which caused it to fail. I fixed the issue by placing the proper parameter under the %files container

After the rebuild, your tree structure should resemble this or close to this


To check if your RPMS are working correctly you would use the mock command
the syntax would be mock -
"mock -r 'system architecture*' --rebuild 'src rpm'
*i.e. fedora-11-x86_64

Source rpm would be found in the rpmbuild/SRPM. To find what architecture you are running is to check your /etc/mock with this command ls /etc/mock. For me, since I am using the Scotland machine my fedora-10-x86_64

For me the process failed.


So I asked Chris and he explained to me to check the build result log, and apparently I was missing some lines in my spec file regarding build requirements line. I had to add glib2-devel and pckconfig.
Instead of rebuilding the spec file, I used mock on the srcrpm and I spent about 1/2 hour till I remembered I needed to rebuild my spec file.
After rebuilding my spec file and re-issuing the mock command, it told me I had it had successfully checked my rpm and it was error free.



After tearing out my hair for half an hour, try to mock build a source RPM i forgot to rebuild from spec, I finally remembered, and finally success, perfect no error rpm. What a headache it was trying to figure out whats wrong, changing the spec file all the time, without rebuilding the source. Oh well, it was a lesson I will not forget.

Here is my finished RPM

Boy this was a long blog...my bad = P

Tuesday, September 22, 2009

SBR600 - Another Week Another Blog

For this week, we will be learning how to create RPM packages, to be a head of the game. I decided to visit the fedora wiki and find out what pages I would need to be prepared for this next class. Simply enough going to the Fedora Wiki, I was able to get all the tools I need and it only took 10 mins to download and install. The site provided step by step details to get me set up.

With the knowledge we learned about the SPEC file, how RPM works hopefully this week I can get the next labs done quick. On a side note last week, we had a guest speaker which we communicated via teleconference and he works on the Release Team at Fedora and his name is Jesse Keating. From him, we learned about the Fedora Release Phases which tends to work out to be 6 months. There are about 8 stages and they are:
1. Open Phase = Total of 4 months
-Features are added


2. Feature Freeze = Finishes 1 week before Alpha Freeze
- No new big features can be added
- Decisions on which features will be added to the final release


3. Alpha Freeze = 1 Month
-no more changes accepted
-sent to QA for testing


4. Alpha Release
-tree open -only
- bug fixes should be pushed


5. Beta Freeze + Release
-All the codes are complete
-Every feature should work
- Is released for public testing
-only bugfix + minor enhancements to the release are accepted at this stage

6. Release Candidate
- Little Bugs left still left
- Starts when block bugs from the beta stage are cleared

7. Final Release
- Final Product is release to end users

8. Hard Freeze
- Process where new feature changes will go to the next release


And currently the Fedora team is on Stage 5.

In the past three weeks, this course seems to get more and more interesting, will blog more later about my experiences. Later

Thursday, September 10, 2009

SBR600 - Building Source Packages

Wow, finally after fiddling around with the source files for irssi, nled packages, I finally got it up and running on my laptop.
During the installations I hit a couple of snags.
With irssi, as I tried to configure the package I received some errors regarding missing developers libraries for glib and ncurses.

So I installed the two libraries with the following commands
yum install glib-devel
and
yum install ncurses-devel

and finally got irssi up and running and connected to the freenode irc server.



I tried to install nled on my matrix account, but it seems I have no permission to do so, so instead I installed it on my laptop and its up and running with no problems.







Until next time, Boris out.

Wednesday, September 9, 2009

SBR600 - My First Blog Post

Hello Fellow Senecans,

Can't believe summer is over, and we are again sitting in class waiting for 13 weeks to fly by hopefully.

Moving on, this is my first blog post, and I have tried to stay away from using the blog web tool.

This blog post is I guess my first assignment for Chris Tyler's SBR600 Course.


My IRC Conversation

* bochao new member to the Seneca Channel
* ctyler (n=chris@142.204.133.62) has joined #seneca
* ChanServ sets mode: +o ctyler
* ninethreenine is now known as ninethreenine|Aw
* ninethreenine|Aw (n=chatzill@CPE001a707d5c78-CM0013711c97ec.cpe.net.cable.rogers.com) Quit ("ChatZilla 0.9.85 [Firefox 3.0.13/2009073022]")
bochao: welcome
* t0mmyw starting to notice that chatzilla is the preferred client around here
t0mmyw : thanks, I prefer to use mIRC
* jdeni (n=Jddeni@CPE0011d8a96278-CM001947935120.cpe.net.cable.rogers.com) has joined #seneca
actually on linux i sometimes use irssi
screen+irssi is where the real love is.
Hi, bochao.
Hi mhoye
* bochao heads off to learning centre to tutor

My User Pages for Fedora and Seneca Wiki

Seneca Wiki

Fedora Wiki


More blog posts to come ....