I try to build a simple noarch
package. I build the package with:
rpmbuild -bb --build-in-place --define "_topdir $(pwd)/rpm" typeset-pdf.spec
This is the specification:
Name: typeset-pdf
Version: 1.0
Release: 1%{?dist}
Summary: Typeset PDF
License: Proprietary
BuildArch: noarch
%description
Use TeX templates to typeset PDF files.
%prep
%build
%install
install -D -t %{buildroot}/%{_bindir} %{name}
install -D -t %{buildroot}/%{_datadir}/%{name}/lieferschein \
lieferschein/lieferschein.tex.tt \
lieferschein/logo.eps
%files
%{_bindir}/%{name}
%{_datadir}/%{name}/lieferschein/lieferschein.tex.tt
%{_datadir}/%{name}/lieferschein/logo.eps
%changelog
The contents of the %install
and %files
sections is almost identical. Is it possible to avoid this redundancy? Can I use the contents of the %files
section anyhow in the %install
section?
Is it possible to avoid this redundancy
Yes, doing something like (very approximate code!):
%install
<your install commands>
find %{buildroot} > installed-files
%files -f installed-files
But this is delicate and you will run into trouble packaging /usr/bin/
and other system directories.
I would recommend you not avoiding these duplicates. This is how rpm
works and it has its value (especially when creating multiple packages with the same spec file). Note that in the %install
section you need to create /usr/bin/
etc, while you should not package them under %files
.
Note also that under %files
you can specify a directory which will package the directory recursively:
%files
%{_bindir}/%{name}
%{_datadir}/%{name}
would suffice in your case.
Again: make sure to package all files and directories that belong to your package, but nothing more. Every file and directory can only belong to one rpm
package. Forgetting to package your top directory for example will leave it lying around when you uninstall your rpm
.