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/*

In reply to Use cpanspec to create an RPM with a desktop file by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.