Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to convert some Perl code into an RPM. cpanspec does the job very nicely, accepting a .tar.gz file containing the Perl code, and generating a .SPEC file that actually generates a working RPM.

However, I can't work out how to modify the .SPEC file to make it install a desktop file. In principle, it should be as simple as adding these lines:

Source1: myapp.desktop ... desktop-file-install \ --dir=${RPM_BUILD_ROOT}%{_datadir}/applications \ %{SOURCE1} xdg-desktop-icon install --novendor %{SOURCE1}

That doesn't work, any neither does any other variation. Usually, I get an error like this:

error: Installed (but unpackaged) file(s) found: /usr/share/applications/myapp.desktop

I searched google exhaustively and, apparently, no-one in the history of computing has attempted this operation before. Either that, or I'm missing something really obvious.

In case it's helpful, this is the full, minimal .SPEC file:

Name: perl-MyApp Version: 1.0 Release: 1%{?dist} Summary: MyApp Perl module License: Distributable, see COPYING COPYING.LESSER Group: Development/Libraries URL: http://search.cpan.org/dist/MyApp/ Source0: http://www.cpan.org/modules/by-module/MyApp-%{version} +.tar.gz Source1: myapp.desktop BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__i +d_u} -n) BuildArch: noarch BuildRequires: perl(ExtUtils::MakeMaker) Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; e +cho $version)) %description blah blah blah %prep %setup -q -n MyApp-%{version} %build %{__perl} Makefile.PL INSTALLDIRS=vendor make %{?_smp_mflags} %install rm -rf $RPM_BUILD_ROOT make pure_install PERL_INSTALL_ROOT=$RPM_BUILD_ROOT find $RPM_BUILD_ROOT -type f -name .packlist -exec rm -f {} \; find $RPM_BUILD_ROOT -depth -type d -exec rmdir {} 2>/dev/null \; %{_fixperms} $RPM_BUILD_ROOT/* desktop-file-install \ --dir=${RPM_BUILD_ROOT}%{_datadir}/applications \ %{SOURCE1} xdg-desktop-icon install --novendor %{SOURCE1} %check make test %clean rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root,-) %doc CHANGES COPYING COPYING.LESSER README %{perl_vendorlib}/* %{_mandir}/man3/*