Re: Scripts for generating rpm's

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2 Mar 2004, David O'Dell wrote:

> What are people using to generate the list for the %files macro?
> I've been using a script I found on cpan.org (make_rpm.pl) but it has 
> its limitations.
> Such as it doesn't provide a way to add commands in the %post section.
> Looking for a better way.
> Thanks in advance.
>
The key is to establish a build root other than /.  If your doing this
then you can do something like following in %install:

	find $RPM_BUILD_ROOT | while read f
	do
		# Remove the build root.
		$tgtpath=$(echo $f|sed -e "s|^${RPM_BUILD_ROOT}||")
		if [ -d $f ] 
		then
			echo "%dir %attrib(555, root, root) ${tgtpath}"
		elif [ -x $f ]
		then
			echo "%attrib(555, root, root) ${tgtpath}"
		else
			echo "%attrib(444, root, root) ${tgtpath}"
		fi
	done > "%{_builddir}/%{name}-%{version}/files.dat"

Then at the %files you would do:

	%files -f %{_builddir}/%{name}-%{version}/files.dat

Now of course this is just some simple bash code that you would
want to expand upon to meet your packages requirements.  The main 
point is that its simple to make some code that walks the build root
and based on policies you define generates a file to be read in 
by %files which defines what files should be in your package.

One tool that may be helpful, if you want to just generate your spec
file is RPM::Specfile (see it on cpan).  I use this to generate 
spec files for rpmdb rpms of my company's distro.

Cheers...james


_______________________________________________
Rpm-list mailing list
Rpm-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/rpm-list

[Index of Archives]     [RPM Ecosystem]     [Linux Kernel]     [Red Hat Install]     [PAM]     [Red Hat Watch]     [Red Hat Development]     [Red Hat]     [Gimp]     [Yosemite News]     [IETF Discussion]

  Powered by Linux