[CentOS] Creating Spec file for RPM

Thu Nov 23 18:24:50 UTC 2017
Joseph L. Casale <jcasale at activenetwerx.com>

-----Original Message-----
From: CentOS [mailto:centos-bounces at centos.org] On Behalf Of Andrew W
Sent: Thursday, November 23, 2017 10:39 AM
To: centos at centos.org
Subject: [CentOS] Creating Spec file for RPM
> Im trying to learn how to create RPMs but am a little confused by the
> spec file.
> Im trying to package up some Python scripts, rather than binary files,
> and I want them to be installed in a subdirectory under /usr/local which
> I shall refer to as /usr/local/X
> Ive put the scripts in a tarball under /home/me/X/RPM/SOURCES

You are using rpm-build and not building as root, right?

> but Im getting terribly confused over what to put in the  %build
> %install and %files sections
> If I set $RPM_BUILD_ROOT to /home/me/X/RPM/temp then put
> %prep
> %setup -q
> that will unpack the tarball, yes?, but where to, /home/me/X/RPM/temp ?
> how would I then tell it to move the files I want from there into
> /usr/local/X and set appropriate permissions on them? The examples
> online all assume you have a makefile with a make install target, could
> I simply use the cp command under the %install section? But where am I
> copying from and to?

I have packaged a few Python based applications and it’s a bit different. I can send
you some samples that are simple, but I learned by looking at modules provided by
the base platform and reading their specs.