Hacking
Hacking on Ubuntu Accomplishments
This page provides some guidance for how you can contribute to the Ubuntu Accomplishments system, help fix bugs, and make it better. Thanks to every one of you who contributes to help make it better for our users.
Where We Live
You can see a general overview of the entire project at:
You can also see an overview of all bugs at https://bugs.launchpad.net/ubuntu-accomplishments
Core Ubuntu Accomplishments System
Here is where you can find the different resources as part of the project:
- Ubuntu Accomplishments Daemon - this is the core daemon.
Code - bzr branch lp:ubuntu-accomplishments-daemon
Bugs - https://bugs.launchpad.net/ubuntu-accomplishments-daemon
- Ubuntu Accomplishments Viewer - this is a GTK+ graphical interface that allows to easily browse trophies via GUI.
Code - bzr branch lp:ubuntu-accomplishments-viewer
Bugs - https://bugs.launchpad.net/ubuntu-accomplishments-viewer
Ubuntu Accomplishments System - a wrapper project for Daemon & Viewer, end users can file bugs here, then they are re-assigned to proper project, depending on whether they affect the daemon or the viewer.
- Ubuntu Community Accomplishments - this is a set of accomplishments for the Ubuntu community.
Code - bzr branch lp:ubuntu-community-accomplishments
Bugs - https://bugs.launchpad.net/ubuntu-community-accomplishments
- Ubuntu Accomplishments Extra Information - a collection of translated files used to gather extra info for scripts.
Code - bzr branch lp:ubuntu-accomplishments-extra-information
Bugs - https://bugs.launchpad.net/ubuntu-accomplishments-extra-information
Ubuntu Accomplishments Web Editor
This is the Django-based web editor for editing Ubuntu Accomplishments online.
- Ubuntu Accomplishments Web Editor:
The Architecture
The Ubuntu Accomplishments system is inspired by accomplishments systems used in other systems such as the Sony Playstation 3 trophies, StackExchange Badges, and FitBit Badges. The goal here is to create an accomplishments system that is extensible enough to be used by by local applications on a computer and contributions made to the Ubuntu community.
In performing this work, these are some core goals:
Extensible - this system should be flexible enough that accomplishments at a desktop level (e.g. “Sent Email From Thunderbird” or “Sent First Tweet In Gwibber”) can be achieved, as well as project contributions (e.g. “Filed First Bug”).
Discoverable - the user should be able to see what trophies are available and find out how to achieve them.
Highly Distributed - the solution should be as de-centralized as possible so as to reduce the need for an extensive central service.
Integrated - the solution should be tightly integrated into Ubuntu itself and not just a series of disconnected web-pages.
there are two core types of accomplishments:
Local Accomplishments - accomplishments that are local to your specific computer and do not require verification elsewhere (e.g. completing a level in a game).
Global Accomplishments - accomplishments that require verification from a third party (e.g. filing your first bug in Ubuntu).
All accomplishments have the same kind of format and schema, but local and global accomplishments differ in how they generate trophies.
For local accomplishments (e.g. completing a level on a game on your system), the following files are involved:
.accomplishment - this file outlines some cosmetic details about the accomplishment such as the name (e.g. ‘Level 2 Completed’), an icon (e.g. ‘level2.png’) and what other accomplishments should be completed before this one can be unlocked (e.g. ‘mygame/level1complete’).
.trophy - this file is the generated trophy that represents the completed accomplishment. libaccomplishments-daemon generates it.
Here the .accomplishment file describes the accomplishment and when that accomplishment occurs (e.g. in a game you complete Level 2) the app would call the accomplishments system to process the .accomplishment file and generate the .trophy. This trophy would be added to the Ubuntu One Share for the local trophies.
For Global Accomplishments we need to poll external services to check if an accomplishment has been achieved (e.g. Filing Your First Bug in Launchpad). To perform this polling we need the following:
.accomplishment - this file outlines some cosmetic details about the accomplishment such as the title (e.g. ‘First Bug Filed’), an icon (e.g. ‘default.png’) and what other accomplishments should be completed before this one can be unlocked (e.g. ‘ubuntu-community/registered-on-launchpad’).
A script (for global accomplishments) - a file that contains the logic for determining if an accomplishment has been achieved (e.g. for a ‘First Bug Filed’ accomplishment this is a small Python script that connects to Launchpad to see if you have filed a bug yet).
At regular intervals, the daemon looks to see, for each user on the system, which global accomplishments they have not yet accomplished. For each accomplishment, the system then runs the corresponding script.
A script is expected to exit with a specific exit code:
- 0 - for “the accomplishment is now accomplished”
- 1 - for “the accomplishment is not yet accomplished”
- 2 - for “there was an error”.
If the logic script indicates that the accomplishment was successfully accomplished, the system creates the appropriate .trophy file. However, because this is a global accomplishment, it needs to be validated by a separate service to ensure the user isn’t faking it. As such, this separate hosted service has the same script and verifies it, and then signs it if successfully verified.
Packaging
What follows are basic steps required to build and upload any of the accomplishments packages. This is not meant to be an exhaustive guide.
Prerequisites
- Install build-essential
- Set DEBEMAIL and DEBFULLNAME in your .bash_aliases file (or somewhere it will get picked up). For example:
DEBEMAIL=foo@bar.com DEBFULLNAME='Foo Bar'
- Have gpg key registered on launchpad and also installed on your dev box.
Steps
Modify the debian/changelog. You use dch to do this. Run dch -i to do the initial edit and dch -a to do subsequent ones. Make sure that the email address is correct, the distroseries is correct (precise, for example) and make sure that the version is right. dch will try to set the version for you and it will almost always be wrong.
- Build the binary package with dpkg-buildpackage. Watch for lintian errors, which will start with "W:" or "E:".
dpkg-buildpackage
- Make sure the package looks okay, you may even want to install it somewhere.
Build the source package, this is what you will actually upload. You build it with debuild and a few options. As before watch for lintian errors.
debuild -i -I -sa -S
Load the source.changes file, which will be one directory up from where you are, and look it over to make sure stuff is sane. The file name will be <package>_<version>_source.changes.
- dput the source.changes file. The PPA in launchpad will tell you the exact PPA name to use.
dput <ppa name> ../<package>_<version>_source.changes
- Wait and watch the build and publish take place!
