March 2012
M T W T F S S
« Feb   Apr »
 1234
567891011
12131415161718
19202122232425
262728293031  
160

Refs

Categories

Archives

profile for slm on Stack Exchange, a network of free, community-driven Q&A sites

Delicious Bookmarks for March 1st from 14:29 to 18:04

These are my links for March 1st from 14:29 to 18:04:

Delicious Bookmarks for March 1st from 00:44 to 10:08

These are my links for March 1st from 00:44 to 10:08:

CentOS RPM Tutorial Part 4 - Another Example of Rolling your Own .spec File

Getting Started

In this 4th installment of my series on RPM packages I’m going to show another example where I package up a tarball that I’ve created, and roll it into an RPM file. For this example I’ll be packaging up a Perl script and a man page. NOTE: Refer to my previous posts (part 1, part 2, & part 3) regarding Building your own RPMs.

The RPM Spec File

For this example I’ve prepared a Perl script called dirsplit, and a man page that goes with it by putting them into the following directory structure, and tarred the directory up:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# directory tree
% tree dirsplit-1.1.11 -F
dirsplit-1.1.11
`-- usr/
    |-- bin/
    |   `-- dirsplit*
    `-- share/
        `-- man/
            `-- man1/
                `-- dirsplit.1.gz
 
5 directories, 2 files
 
# tar the directory up
% tar zcvf dirsplit-1.1.11.tar.gz dirsplit-1.1.11

I then copied the file dirsplit-1.1.11.tar.gz to my rpmbuild area, ~/rpmbuild/SOURCES/. I then created the following SPEC file, dirsplit.spec, and placed the file in the rpmbuild area, ~/rpmbuild/SPEC/.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# FILE: ~/rpmbuild/SPECS/dirsplit.spec
 
Summary:    dirsplit utility
Name:       dirsplit
Version:    1.1.11
Release:    1%{?dist}
SOURCE0:    dirsplit-%{version}.tar.gz
 
Requires:   perl >= 4:5.8.1
License:    GPLv2
Group:      Applications/System
BuildArch:  noarch
BuildRoot:  %{_tmppath}/%{name}-buildroot
 
%description -n dirsplit
dirsplit
 
%prep
%setup -q
 
%build
 
%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT
cp -R * $RPM_BUILD_ROOT/.
 
%clean
rm -rf $RPM_BUILD_ROOT
 
%files -n dirsplit
%defattr(-,root,root)
%{_bindir}/dirsplit
%{_mandir}/man1/dirsplit.*
 
%changelog
* Tue Feb 21 2012 Sam Mingolelli <rpms @lamolabs.org> - 1.1.11-1
- Initial creation
 
# vim: ts=2 nolist :
</rpms>

Building the RPM

I then built an RPM & SRPM using the SPEC file.


…. Continue reading → CentOS RPM Tutorial Part 4 – Another Example of Rolling your Own .spec File »»