Packaging:RPM Source Dir

From FedoraProject

(Difference between revisions)
Jump to: navigation, search
(Created page with '== $RPM_SOURCE_DIR or %{_sourcedir} == Packages which use files itemized as Source# files, must refer to those files by their Source# macro name, and must not use $RPM_SOURCE_DI...')
 

Revision as of 20:24, 6 October 2010

$RPM_SOURCE_DIR or %{_sourcedir}

Packages which use files itemized as Source# files, must refer to those files by their Source# macro name, and must not use $RPM_SOURCE_DIR or %{sourcedir} to refer to those files.

This is done to ensure that Fedora SRPMS are properly generated. If a Source# item is renamed, a spec which refers to its old name may succeed locally (because the file is still in %{_sourcedir} along with the new file), but the proper file will not be included in the SRPM.

Incorrect Use:

Source1: php.conf
Source2: php.ini
Source3: macros.php

...

install -m 644 $RPM_SOURCE_DIR/php.conf $RPM_BUILD_ROOT/etc/httpd/conf.d
sed -e "s/@PHP_APIVER@/%{apiver}/;s/@PHP_ZENDVER@/%{zendver}/;s/@PHP_PDOVER@/%{pdover}/" \
    < $RPM_SOURCE_DIR/macros.php > macros.php

Correct Use:

Source1: php.conf
Source2: php.ini
Source3: macros.php

...

install -m 644 %{SOURCE1} $RPM_BUILD_ROOT/etc/httpd/conf.d
sed -e "s/@PHP_APIVER@/%{apiver}/;s/@PHP_ZENDVER@/%{zendver}/;s/@PHP_PDOVER@/%{pdover}/" \
    < %{SOURCE3} > macros.php