[oe] broken shared-mime-info and MIME typing
Koen Kooi
k.kooi at student.utwente.nl
Thu Dec 4 15:45:29 UTC 2008
On 04-12-08 16:33, Stanislav Brabec wrote:
> Koen Kooi wrote:
>
>>> This would not work. Without freedesktop.org.xml the command
>>> "update-mime-database /usr/share/mime" will ruin the database.
>> That does work, had you looked a bit better:
>>
>> mime.bbclass does:
>> rdepends.append("freedesktop-mime-info")
>
> My mistake, NOTE says different. But problem 1 is still valid for manual
> calling of "update-mime-database /usr/share/mime" on a system, that does
> not have freedesktop-mime-info.
>
> 2., 3. and 4. were just a suggestions, 5. is a minor issue.
>
> See attached patch (untested), which should do 2., 3. and 4.
> Issue 5 fix is not done yet.
>
>> I tested it on 2 devices and it does the right thing:
>> freedesktop.org.xml gets installed before the update-mime-database
>> command is run.
>
> Yes, it works for packages. Actually users of locales will get
> freedesktop-mime-info automatically due to 5.
>
> diff --git a/classes/mime.bbclass b/classes/mime.bbclass
> index a214c11..75c1db9 100644
> --- a/classes/mime.bbclass
> +++ b/classes/mime.bbclass
> @@ -5,9 +5,6 @@ if [ "$1" = configure ]; then
> if [ -x ${bindir}/update-mime-database ] ; then
> echo "Updating MIME database... this may take a while."
> update-mime-database $D${datadir}/mime
> - else
> - echo "Missing ${bindir}/update-mime-database, update of mime database failed!"
> - exit 1
> fi
> fi
> }
> @@ -17,9 +14,6 @@ if [ "$1" = remove ] || [ "$1" = upgrade ]; then
> if [ -x ${bindir}/update-mime-database ] ; then
> echo "Updating MIME database... this may take a while."
> update-mime-database $D${datadir}/mime
> - else
> - echo "Missing ${bindir}/update-mime-database, update of mime database failed!"
> - exit 1
> fi
> fi
> }
You want it to error out of u-m-d is not found, since the purpose of the
postinst (updating the database) couldn't be done. Do you have a
use-case for this non-error behaviour?
> @@ -50,7 +44,9 @@ python populate_packages_append () {
> postrm += bb.data.getVar('mime_postrm', d, 1)
> bb.data.setVar('pkg_postrm_%s' % pkg, postrm, d)
> bb.note("adding shared-mime-info dependency to %s" % pkg)
> - rdepends = explode_deps(bb.data.getVar('RDEPENDS_' + pkg, d, 0) or bb.data.getVar('RDEPENDS', d, 0) or "")
> - rdepends.append("freedesktop-mime-info")
> - bb.data.setVar('RDEPENDS_' + pkg, " " + " ".join(rdepends), d)
> + rrecommends = explode_deps(bb.data.getVar('RRECOMMENDS_' + pkg, d, 0) or bb.data.getVar('RRECOMMENDS', d, 0) or "")
> + rrecommends.append("freedesktop-mime-info")
> + bb.data.setVar('RRECOMMENDS_' + pkg, " " + " ".join(rrecommends), d)
I'm not sure what the above accomplished, apart from making it easier to
shoot yourself in the foot. What's the usecase for allowing to install
the xml files, but not the update tool (assuming you applied the changes
below)?
> +FILES_${PN} += "${datadir}/mime/packages"
I'm not so sure on that one, but I guess recipes can put the package
theu want the xml file in before ${PN} in PACKAGES
> diff --git a/packages/shared-mime-info/shared-mime-info_0.51.bb b/packages/shared-mime-info/shared-mime-info_0.51.bb
> index 31a7df1..cb1f329 100644
> --- a/packages/shared-mime-info/shared-mime-info_0.51.bb
> +++ b/packages/shared-mime-info/shared-mime-info_0.51.bb
> @@ -10,6 +10,6 @@ do_install_append() {
> # freedesktop.org.xml is huge and only needed when updating the db
> # mime.bbclass will add the dependency on it automagically
> PACKAGES =+ "freedesktop-mime-info"
> -FILES_freedesktop-mime-info = "${datadir}/mime/packages/freedesktop.org.xml"
> +FILES_freedesktop-mime-info = "${datadir}/mime/packages/freedesktop.org.xml ${bindir}/update-mime-database"
> RDEPENDS_freedesktop-mime-info = "shared-mime-info"
If you're going to package those together you should name the package
'update-mime-database' to avoid confusion when people want to install
the utils and do 'opkg list | grep mime'.
regards,
Koen
More information about the Openembedded-devel
mailing list