Sunday, September 22, 2013

RPM packaging Process


Preparation

First and foremost, I installed the required packages: Fedora Packager (group of packages) and rpmlint and yum-utils

$ sudo yum -y groupinstall "Fedora Packager"

Next Package

$ sudo yum -y install rpmlint yum-utils


After installing the packages I created the ~/rpmbuild directories and the ~/.rpmmacros file through this command:

$ rpmdev-setuptree

I made sure that these directories and file are created. Here are the screenshots:










RPM-writing Steps:

1) From the previous packages on build-from-source blog, I get the two packages I chose and moved it to ~/rpmbuild/SOURCES directory. The packages should be in tarball.

$ mv Downloads/units-2.02.tar.gz rpmbuild/SOURCES/
$ mv Downloads/radius-1.6.1.tar.gz rpmbuild/SOURCES/

2) Change directory to ~/rpmbuild/SOURCES

$ cd ~/rpmbuild/SOURCES

3) From this directory, I created an empty spec file for the packages

$ rpmdev-newspec units-2.02.tar.gz 
$ rpmdev-newspec radius-1.6.1.tar.gz






4) Using vi, I edited the specfile and fill in the corresponding metadata.
After my first try, I received this errors.

Name:           units-2.02.tar.gz
Version:        2.02
Release:        1%{?dist}
Summary:        Converting units from one to another

License:        GPLv3
URL:            http://www.gnu.org/software/units
Source0:        http://ftp.gnu.org/gnu/units/units-2.02.tar.gz

#BuildRequires: 
#Requires:      



$ rpmbuild -ba units-2.02.tar.gz.spec
error: File /home/jfgiagonia/rpmbuild/SOURCES is smaller than 13 bytes
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.NXTyCn
+ umask 022
+ cd /home/jfgiagonia/rpmbuild/BUILD
+ LANG=C
+ export LANG
+ unset DISPLAY
+ cd /home/jfgiagonia/rpmbuild/BUILD
+ rm -rf units-2.02.tar.gz-2.02
+ /usr/bin/tar -xf /home/jfgiagonia/rpmbuild/SOURCES
/usr/bin/tar: /home/jfgiagonia/rpmbuild/SOURCES: Cannot read: Is a directory
/usr/bin/tar: At beginning of tape, quitting now
/usr/bin/tar: Error is not recoverable: exiting now
error: Bad exit status from /var/tmp/rpm-tmp.NXTyCn (%prep)


RPM build errors:
    File /home/jfgiagonia/rpmbuild/SOURCES is smaller than 13 bytes
    Bad exit status from /var/tmp/rpm-tmp.NXTyCn (%prep)

Solution: removed the forward slashes from both source and URL. solution found on this forum. http://www.redhat.com/archives/fedora-packaging/2009-December/msg00020.html

After the fix, a new error came.

$ rpmbuild -ba units-2.02.tar.gz.spec
error: File /home/jfgiagonia/rpmbuild/SOURCES/units: No such file or directory

Solution: Change Source0 to: http://ftp.gnu.org/gnu/units/units-2.02.tar.gz

New error: Bad exit status from /var/tmp/rpm-tmp.nADFQG (%prep)

Solution: Change the name to just units

New errors:    
Installed (but unpackaged) file(s) found:
   /usr/bin/units
   /usr/bin/units_cur
   /usr/share/info/units.info.gz
   /usr/share/man/man1/units.1.gz
   /usr/share/units/currency.units
   /usr/share/units/definitions.units
   /usr/share/units/locale.map

Solution: Added the files onto the %files section. Found the solution on Jason Carman's blog.

After the last solution, the build was successful. the rpms were successfully placed on /rpmbuild/RPMS/x86_64/ and /rpmbuild/SRPMS/









TESTING THE BUILD:


Using the rpmlint -i command, I received a lot of errors. Some errors were about the changelog, %post and %postun entries (scriptlets), and invalid urls. Most of the solution were found in the blogs of my classmates. After fixing the errors all that is left were the warnings for the specfile and the two rpms. The Radius package was also successfully built and the process and the solutions were the same as the Units package.









Wednesday, September 18, 2013

Build-From-Source Lab


The first step of this lab was to install Development Tools and Development Libraries using yum.

$ yum groupinstall "Develeopment Tools" "Development Libraries"

I chose two packages that I can test at this site. I downloaded Units(converts certain units to other units)  and Radius (remote user authentication and accounting) both in.tar extensions. used tar to unzip.

On to building from the source
Steps:

Download the packages and the extract. Both files were in .tar.gz format so I used tar to extract.

$ tar xvzf units-2.02.tar.gz

Next was to run the configure script to find any compatibility issues on a wide variety of computers. we time it to know how long it takes it to execute

$ time ./configure

real    0m1.328s
user    0m0.619s
sys    0m0.329s


Now in order to build the software, we use the command make. Again we time.

$ time make

real    0m0.224s
user    0m0.103s
sys    0m0.054s

After running the command there was no known errors that has shown which means that it run successfully. A way to really check if it is issue-free was for make-install but it was not recommended as it will overwrite files to the system.

Thanks to jmcarman from #seneca channel for helping.

Pilot: My First Blog


This is my first time ever to blog and I think it's quite cool.

    I enrolled at SBR600 to know more about open source and open source projects. I am quite fascinated by how open source operates. Programming and coding are the weakest skills I have but I know to myself that I need to learn this and this is a very useful skill as an IT.

    Contact me through:

IRC nick: TheDib
LearnID: jfgiagonia
IRC snippet:















The Raspberry Pidora project interests me. To be able to make cheap programmable computers for use is amazing. Who knows we might be able make computers very affordable and portable at the same time and not having the profit as the main drive. I think this is a great innovation by the developers and I hope in some way I could contribute to this project. It would be very rewarding to know that somehow you were part of a project that changed a part of the world.