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.
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 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.
(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)?
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
(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.
looks like only two packages actually use the 5th arg (mythtv and boinc), so ive updated them and committed this, and wont bother with a notification to g-d btw, the 5th arg takes a printf string to make it easier to add multiple lines (i.e. \n) http://sources.gentoo.org/eclass/eutils.eclass?r1=1.340&r2=1.341 http://sources.gentoo.org/media-tv/mythtv/mythtv-0.22_p22824-r1.ebuild?r1=1.3&r2=1.4 http://sources.gentoo.org/media-tv/mythtv/mythtv-0.22_p22860.ebuild?r1=1.2&r2=1.3 http://sources.gentoo.org/media-tv/mythtv/mythtv-0.22_p23069.ebuild?r1=1.5&r2=1.6 http://sources.gentoo.org/media-tv/mythtv/mythtv-0.23_alpha22857.ebuild?r1=1.3&r2=1.4 http://sources.gentoo.org/sci-misc/boinc/boinc-6.10.18.ebuild?r1=1.4&r2=1.5 http://sources.gentoo.org/sci-misc/boinc/boinc-6.10.36.ebuild?r1=1.1&r2=1.2