Category: tracker

In harmattan, if you want to access certain resources (E.G. Tracker) you need to ask for permission to the Security FW. It is not as bad as it sounds. You just need to add a file in your package explaining what “tokens” do you need. Then depending on where your package comes from and some other ingredients, the security FW decides if your application is worthy of such a privilege.

Today I was packaging a very first version of Mussorgsky in QML which requires the “TrackerReadAccess” token (to query Tracker via dbus). So far I have been working in the command line tool where a aegis-su -r TrackerReadAccess python was enough. But how to do the same when the application is installed?

  1. Create a $PACKAGE_NAME.aegis file under your debian/ directory. There you need to declare what tokens you want for what binary. Example: in mussorgsky.aegis I request “TrackerReadAccess” for “/usr/lib/mussorgsky/”, which is the executable that starts my program.
  2. Put the aegis file in the package. Using CDBS is almost the same as in C++, without the include of

    # Add this to the debian/rules file
    PACKAGE_TARGETS := $(foreach pkg,$(DEB_ALL_PACKAGES),binary/$(pkg))
    [ ! -f debian/$(notdir $@).aegis ] || aegis-deb-add -control \
    debian/$(notdir $@)/DEBIAN/control .. debian/$(notdir $@).aegis=_aegis

  3. Make your package build-depend on aegis-builder (>=1.4)

Then you build your package. It should install nicely and your application run without problems on the device. Still, a couple of remarks:

  • The token must go to a executable script (with #!/usr/bin/python on its first line). python will not work. The path is absolute.
  • After installing the package, do NOT modify the installed files if they request a token. Security FW will discover an unexpected change in the file and lock the device (ops! reflash). Imported files and other resources can be modified.

Happy hacking.


Tomorrow I go to the Meego Summit FI in Tampere. I will talk there about Tracker, as usual, but this time sharing happily the stage with Adrien Bustany.

The plan is to talk about what Tracker does NOW in a very pragmatical way, explain the limits we have hit, and give a hint on the more or less experimental ideas we have for the future. Less philosophy, less history and much more pragmatic information, compared with my previous talks. Believe or not, I won’t mention “RDF” or “ontology” at all.

Tracker is nowadays ready to use, and Meego (even if it is only for 1.2) will be the first environment where all its potential can be shown with real information. Combine this with QML and pyside (python bindings) and everything is in place to write very easily surprising applications.

Hello planet GNOME, glad to be in this planet after so many years reading it. Probably you were able to skip my Tracker presentations in different conferences… so now I try via blog. And my first post brings good news.

From now on (it has just landed in master), Tracker libraries are accessible via gobject-introspection. You can manipulate the information via libtracker-sparql or write new miners using libtracker-miner in any language with gobject-introspection support (E.G. python). A snipped of code is worth a thousand words:

#!/usr/bin/env python
import gi
from gi.repository import Tracker

conn = Tracker.SparqlConnection.get (None)
cursor = conn.query ("SELECT ?u WHERE { ?u a nie:InformationElement. }", None)

while ( (None)):
      print cursor.get_string (0)

This is a synchronous query to the store. Note that you have a cursor to access the results: they will be retrieved from the DB only when needed. Using this while building a model for the UI should show quite a performance improvement compared with the old DBus API. And if you fancy more the asynchronous way of coding, the code looks like this. You can open the connection, run the query and retrieve the results all asynchronously.

When it comes to miners (processes retrieving information), here is a skeleton of an implementation: a subclass of Miner overriding few methods. Install with the usual dbus files and you have a miner that can be started/stoped/monitored with the Tracker tools.

libtracker-sparql is our recommended way to use tracker, the DBus API can be considered internal, and now with gobject-introspection it is available from different languages than C or vala. Combine this with libpeas (also using GI) and then we can easily write plugins showing information from Tracker into applications like EOG or totem… Interesting!

A couple of weeks ago, we updated Tracker to load its configuration using GSettings instead of its own old-fashioned .cfg files. GSettings is an API to manipulate key=value pairs that abstracts the backend (keyfiles, gconf, dconf…) where they are actually stored.

This was a good change in a lot of senses, but it was breaking our functional tests. We have a suite of tests that we like to run once Tracker is installed in the system. They check if the basic functionality is working fine: the store starts, the miner starts, basic Sparql is processed fine, crawling/monitoring a directory is ok… Some of those tests rely on booting tracker with an specific configuration and with gsettings that isn’t as easy as defining a new XDG_CONFIG_DIR anymore. Well, lets fix the tests then.

My first idea was to hack our GSettings object to load data from the system or from a keyfile, depending on an environment variable: very portable, but is an ugly hack and the code paths start to differ a lot. Then i discovered the DConf profiles. Only works when gsettings is using dconf and needs to install a system-wide profile, but otherwise (in code and test setup) is nice.

It took me more time than expected due some stupid mistakes here and there using dconf:

  • Profile names can only use alphanumeric and underscore characters. A profile like “tracker-test” won’t work (because is not a valid dbus name), but “trackertest” is fine. (Wiki updated now)
  • Do NOT set XDG_CONFIG_DIR in the environment (Bug reported). I guess that the client is using the variable to look for the DB but the writing daemon is not, so the results are not the expected
  • If at the same time you are changing the dconf schemas, make sure to remove old files from /usr/share/glib-2.0/schemas, run /usr/bin/glib-compile-schemas /usr/share/glib-2.0/schemas and remove any old dconf database (in ~/.config/dconf) including “user”. Otherwise if some code is using the old schema, it won’t complain but the values will be wrong.
  • DConf uses the GVariant serialization, so be careful when setting lists.

I hope this saves some time to the next person trying to test something that uses dconf for its settings.

I guess neither Tomboy nor Tracker need much introduction. If you have both of them on your computer, you have probably wondered “why Tracker doesn’t index my Tomboy notes?”. Good point. You are not the only one thinking that;  somebody even opened a bug about it and here comes a solution.

It is a plugin for Tomboy (a NoteAddin in their terminology) that writes the information of the note into Tracker making it searchable on the desktop (E.G. using tracker-needle). The code is available in gitorious. Checkout, compile and install (you can use make install-data-local in src/ to install it on your $HOME). Well, you also need the latest tracker from GIT until we release 0.10.2 (soon) because i needed to add a “Note” class there.

The current status is “It works on my computer” but is safe to try because this plugin only exports data and never touches the original notes, so there is no risk of losing any information. Feedback is very welcome!

Time flies, code flows and a new stable release of Tracker is here. Already 0.10, and a lot of improvements everywhere. Maybe another day i can write about the internals, but the big news for the developers using (or eager to use) tracker is libtracker-sparql.

libtracker-sparql is our client library to query/update data in Tracker. GObject-oriented, written in vala, easy and straight-forward: open a connection, run a query, retrieve the results. Look how easy the example looks.

Under the hood a lot of things happen. It allows sync and async queries. Also it chooses the best method to talk with tracker, depending on your versions of dbus and sqlite. Both libraries got new features and we use all of them: if your dbus is recent enough tracker will try to use the “fd-passing” feature (the processes only exchange a file descriptor to read from, instead of a huge string), and if your sqlite is recent enough it has WAL (the new journaling system) and your process will open the database directly (only for reading), no more dbus to transfer results!!

All this technicalities improve a lot the performance (less or better dbus usage) but thanks to WAL we can offer a very valuable new feature: cursors. If the application is reading directly from the DB, the results will be loaded when needed. This wasn’t possible in a dbus-based API where the client needed either to retrieve everything (very slow) or simulate cursors with LIMIT and OFFSET.

libtracker-sparql is convenient enough to start using it in different programs. The next obvious steps are to enable the gobject-introspection, and to build a live model on top of it. In the Q-World it is done, so definitely is possible.

Mussorgsky 0.4

And here comes a new release of mussorgsky, with some features that should help you to have a even more beautiful Album view in your N900 media player:

  • By default mussorgsky uses “artist + album” to search online for the album art. Now it is possible to choose manually the search string to find better results:
  • Added the alternative to unset the album art, reverting it to the default icon
  • The list of songs can be filtered, switching between “all songs” or “songs with incomplete metadata”
  • Albums with special characters in their name (like ‘&’) are now handled correctly.

And few UI improvements here and there:

  • The buttons in the main screen have now shadows with rounded corners when clicked
  • The play, next, back buttons in the edit view come from the mediaplayer theme
  • When a song has no metadata at all, it is listed using its filename

It is already available in extras-devel, hope you enjoy it. And finally, thanks to Eric, Aapo and Claudio for their very valuable comments and help!

Zeitgeist hackfest

Zeitgeist is an “event logger”. It registers the activity of the user on the desktop, what documents uses, when, while talking with who, combined with what… and then different UIs can consume this data to show a Journal of activity, a better relevance in the searches, related documents to the one you are working on and [write your own cool idea here].

Tracker and Zeitgeist are complementary projects: Tracker knows the documents, Zeitgeist knows the activities. We (tracker developers) have been talking with Zeitgeist developers before and have a common understanding about the big picture. Now is time to start fixing details, and I’ll be next week in the Zeitgeist hackfest to work on that.

By the way, with some patience and fixing few details, Zeitgeist and Tracker 0.7 can be installed in maemo5. Catching few events here and there, zeitgeist can grab some basic informacion, and somebody could write a Journal home-screen applet, like the call log, but about all kind of activities/documents… Quite an interesting project.

Travel sponsored by GNOME FoundationBack in Helsinki after attending last week, sponsored by GNOME Foundation, to the Encuentro Linux 2009 in Valparaiso, Chile. My original plan was to talk about Tracker in the dedicated GNOME Day; but from the very first day it was clear that the people was very curious about maemo5 and specially the n900, so i decided to talk more about this. I recognize that makes me feel very proud to show an N900 and hear a WOW and see amazed faces.

So, the first talk (in an informal event between organizers and speakers) was about the N900 and some Q&A about it and maemo5. The people were mainly linux enthusiast, so lots of good questions about how to develop on it and the technology involved.

The first of the official talks (during the GNOME day) was about maemo5, what is it, relation with the desktop and how to contribute. I explained also one of the coolest things in maemo (IMHO): all the extras-devel/extras-testing/extras process. Your pet-application (or not so pet when you spend hours and hours on it) can easily reach a lot of users in few clicks. Well, few clicks on your side, and few more on the community side.

The second and last talk was about Tracker. The usual introduction to the basic concepts, and a couple of demos. I was happy to show that using tracker you can get “The last blog post of the user who sent me this song”. Sounds like a lab example, but it mixes RSS, contacts, files and activity, and you can easily see a plugin in totem using this.

About the event itself, the audience was more on the university side of life and people using free software in their companies/work; so a lot of curiosity for new projects and general conversation about open source. There were some people looking for a place to contribute in GNOME; I gave them few hints how to do it via tracker (e.g. writing plugins to Eye of GNOME), so let see if we get fresh blood in the community.

Finally, i want to say thanks to the organizers there, from Encuentro Linux and GNOME Day. They made everything easy, treated me really great, showed me a little bit of Chile and made me feel really warmly welcome. Thanks, guys!

Encuentro Linux 2009 – Chile

Otra vez al aeropuerto. Voy a Chile al Encuentro Linux en Valparaiso/Viña del mar, donde daré dos presentaciones. Una general sobre tracker para todos los publicos:que es, para que sirve, que se puede y que no hacer con el, y como creemos que encaja en GNOME; y otra técnica explicando como implementamos esas ideas, explicando las palabras malditas (ontologias, RDF, Sparql….).

Para que las 20 horas de viaje cundan, estaré tambien unos dias de turisteo por alli. A ver que tal es el otro extremo del mundo.