[CentOS] Creating Spec file for RPM

Thu Nov 23 18:31:30 UTC 2017
Antonio Trande <anto.trande at gmail.com>

On 23/11/2017 19:24, Joseph L. Casale wrote:
> -----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?
> 

No special permissions.
Use 'rpmbuild' tool that works in a dedicated directory in your home.

See https://wiki.centos.org/HowTos/SetupRpmBuildEnvironment

-- 
---
Antonio Trande
Fedora Project
mailto 'sagitter at fedoraproject dot org'
GPG key: 0x5E212EE1D35568BE
GPG key server: https://keys.fedoraproject.org/