RPM-Writing Lab

22 Jan

prepareation
1. Install the required packages:

    yum groupinstall “Fedora Packager”
    yum install rpmlint yum-utils
    
2. Create the ~/rpmbuild directories and the ~/.rpmmacros file by running this command: rpmdev-setuptree

[root@fedora rpmbuild]# ls
BUILD  BUILDROOT  RPMS  SOURCES  SPECS  SRPMS
[root@fedora rpmbuild]

Lab steps
1. Put the package source code (tarball) in ~/rpmbuild/SOURCES

[root@fedora Downloads]# cp ocrad-0.20.tar.gz ~/rpmbuild/SOURCES
 
cd ~/rpmbuild/SPECS

2. Create an empty skeleton spec file: rpmdev-newspec
rpmdev-newspec ocrad
[root@fedora SPECS]# ls
ocrad.spec

3. Edit the specfile
[root@fedora SPECS]# cat ocrad.spec
Name:      ocrad

Version:   0.20     
Release:21%{dist}      
Summary:ocrad package test         

License:free        
URL:http://www.gnu.org/software/ocrad/                              
Source0:  ocrad-0.20.tar.gz                  ocrad-0.20.tar.gz

BuildRequires:gettext
BuildRequires:automake
BuildRequires:autoconf
BuildRequires:libtool  

%description
%prep
%setup -q
%build
%configure
make %{?_smp_mflags}
%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT
%files
%doc
%changelog

4. Attempt to build your package: rpmbuild -ba nameOfPackage.spec
Run
rpmbuild -ba ocrad.spec

Processing files: ocrad-0.20-10.fc16.x86_64
Processing files: ocrad-debuginfo-0.20-10.fc16.x86_64
Checking for unpackaged file(s): /usr/lib/rpm/check-files /root/rpmbuild/BUILDROOT/ocrad-0.20-10.fc16.x86_64
error: Installed (but unpackaged) file(s) found:
   /usr/bin/ocrad
   /usr/include/ocradlib.h
   /usr/libexec/libocrad.a
   /usr/share/info/dir
   /usr/share/info/ocrad.info.gz
   /usr/share/man/man1/ocrad.1.gz

RPM build errors:
    Installed (but unpackaged) file(s) found:
   /usr/bin/ocrad
   /usr/include/ocradlib.h
   /usr/libexec/libocrad.a
   /usr/share/info/dir
   /usr/share/info/ocrad.info.gz
   /usr/share/man/man1/ocrad.1.gz

Advertisements

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s

%d bloggers like this: