Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 310763 - eutils.eclass: Let me set MimeType in make_desktop_entry
Summary: eutils.eclass: Let me set MimeType in make_desktop_entry
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-03-22 17:38 UTC by Jim Ramsay (lack) (RETIRED)
Modified: 2010-03-23 03:43 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Pass MimeType in to make_desktop_entry in an environment variable (eutils-mimetype.patch,1.03 KB, patch)
2010-03-22 17:41 UTC, Jim Ramsay (lack) (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jim Ramsay (lack) (RETIRED) gentoo-dev 2010-03-22 17:38:26 UTC
I've been using a copy of make_desktop_entry for a while now in rox.eclass because I've got at least one package where I'd like to set up the MimeType field in my .desktop file, and cannot currently do so with eutils.

I'd like to stop using a copy (which bit me once already in bug #306203) and this would be a lot easier if I could either:

1) Somehow pass my list of mime-types to make_desktop_entry
2) Get the name of the .desktop file created by make_desktop_entry so I can just append my special stuff on to it.

My personal vote is for (1), and since you've already got a bunch of optional parameters (and I don't want to set Path just to set MimeType), I would suggest using an environment variable.

I've got a test implementation that does this, will attach the patch shortly.
Comment 1 Jim Ramsay (lack) (RETIRED) gentoo-dev 2010-03-22 17:41:00 UTC
Created attachment 224739 [details, diff]
Pass MimeType in to make_desktop_entry in an environment variable

Here's the patch as promised.  It checks for the optional environment MIME_TYPE_LIST and if found appends it onto the .desktop file.
Comment 2 SpanKY gentoo-dev 2010-03-22 19:44:37 UTC
Comment on attachment 224739 [details, diff]
Pass MimeType in to make_desktop_entry in an environment variable

passing arguments via environment is shoddy.  extend the argument list to take an optional 6th argument -- arbitrary items to append to the .desktop file.  then people can append whatever they want and we dont have to special case each additional field.
Comment 3 Jim Ramsay (lack) (RETIRED) gentoo-dev 2010-03-22 20:19:01 UTC
(In reply to comment #2)
> (From update of attachment 224739 [details, diff])
> passing arguments via environment is shoddy.  extend the argument list to take
> an optional 6th argument -- arbitrary items to append to the .desktop file. 
> then people can append whatever they want and we dont have to special case each
> additional field.

That's fine.

The last issue with your suggested solution is: What if I don't want to set "Path" (the optional 5th argument)?
Comment 4 SpanKY gentoo-dev 2010-03-22 20:25:28 UTC
like all the args, an empty string is the same as not specified

although this brings up a related point ... perhaps we should turn the 5th argument into the arbitrary one.  after all, the 5th argument merely expands into "Path=$5".

should be easy to transition ...
if [[ $5 != *=* ]] ; then
    ewarn "Please update your ebuild to use Path=$5"
    extra="Path=$5"
else
    extra=$5
fi
Comment 5 Jim Ramsay (lack) (RETIRED) gentoo-dev 2010-03-22 20:51:43 UTC
(In reply to comment #4)
> although this brings up a related point ... perhaps we should turn the 5th
> argument into the arbitrary one.  after all, the 5th argument merely expands
> into "Path=$5".

Beautiful, I'd vote for that.