<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Sysop Blog &#187; rpmbuild</title>
	<atom:link href="http://sysopblog.com/tag/rpmbuild/feed/" rel="self" type="application/rss+xml" />
	<link>http://sysopblog.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Wed, 21 Apr 2010 20:38:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>When perl and rpm don&#8217;t get along</title>
		<link>http://sysopblog.com/2008/04/when-perl-and-rpm-dont-get-along/</link>
		<comments>http://sysopblog.com/2008/04/when-perl-and-rpm-dont-get-along/#comments</comments>
		<pubDate>Wed, 30 Apr 2008 19:29:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[exclude perl from requires]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[requires included file]]></category>
		<category><![CDATA[rpm requires]]></category>
		<category><![CDATA[rpmbuild]]></category>

		<guid isPermaLink="false">http://sysopblog.com/?p=5</guid>
		<description><![CDATA[Sometimes when building rpm packages you will get an rpm that requires a file that it already contains. This seems pretty lame (which it is) but here is an example and a workaround. Building a package for freepbx we see this output: rpmbuild -ba freepbx.spec --------snip----------------- Provides: config(freepbx) = 2.4.0-0 Requires(interp): /bin/sh /bin/sh Requires(rpmlib): rpmlib(CompressedFileNames) [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes when building rpm packages you will get an rpm that requires a file that it already contains. This seems pretty lame (which it is) but here is an example and a workaround.</p>
<p>Building a package for freepbx we see this output:<br />
<code><br />
rpmbuild -ba freepbx.spec<br />
--------snip-----------------<br />
Provides: config(freepbx) = 2.4.0-0<br />
Requires(interp): /bin/sh /bin/sh<br />
Requires(rpmlib): rpmlib(CompressedFileNames) &lt;= 3.0.4-1 rpmlib(PayloadFilesHavePrefix) &lt;= 4.0-1<br />
Requires(post): /bin/sh<br />
Requires(postun): /bin/sh<br />
Requires: /bin/bash /usr/bin/env /usr/bin/perl /usr/bin/php config(freepbx) = 2.4.0-0 perl(DBI) perl(FindBin) perl(retrieve_parse_amportal_conf.pl)</code></p>
<p><strong>The file we don&#8217;t want is: &#8220;perl(retrieve_parse_amportal_conf.pl)&#8221;</strong></p>
<p>What rpmbuild does is go through the list of files and run &#8220;ldd&#8221; against all executables to find required libraries.<br />
It also goes through each perl file and looks for &#8220;<strong>use </strong>/ <strong>require</strong>&#8221; flags to pull out required perl modules.<br />
When a developer does a legitimate thing like &#8216;<strong>require &#8220;retrieve_parse_amportal_conf.pl</strong>&#8220;&#8216; to include functions and such into their program, rpmbuild sees that this file is needed adds it too it&#8217;s list of required files.</p>
<p>Now rpmbuild also goes through and looks for what packages/files perl programs provide. It does this by scanning through the files and looking for &#8220;<strong>package</strong>&#8220;. If you just have an include file with functions, you don&#8217;t have a complete module and won&#8217;t have the package statement either. Thus rpmbuild will never see your file provides itself! Fortunatly there are a couple work arounds.</p>
<p>In your perl file that rpmbuild is requiring you can define &#8216; <strong>our $RPM_Provides = &#8220;yourfilename.pl&#8221;</strong> &#8216;. rpmbuild will pick this up and happily add it to the provided file list. The other method is slightly more complicated but works well if you don&#8217;t want to patch the source code.</p>
<p>In your rpm spec file under the <strong>%prep</strong> section after the <strong>%setup</strong> add the following code:<br />
<code><br />
cat &lt;&lt; \EOF &gt; %{name}-req<br />
#!/bin/sh<br />
%{__perl_requires} $* |\<br />
sed -e '/perl(yourperlfile.pl)/d'<br />
EOF<br />
%define __perl_requires %{_builddir}/%{name}-%{version}/%{name}-req<br />
chmod 755 %{__perl_requires}<br />
</code></p>
<p>Where <strong>yourperlfile.pl </strong>is the file you want to exclude from the rpm requires check.<br />
This should make your rpm build hapily and exlude that file from the requires check.</p>
<p>If you want to see the actuall files rpmbuild runs take a look at:<br />
/usr/lib/rpm/perl.prov<br />
and<br />
/usr/lib/rpm/perl.req</p>
]]></content:encoded>
			<wfw:commentRss>http://sysopblog.com/2008/04/when-perl-and-rpm-dont-get-along/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
