Difference between revisions of "Platform Team/Guide/Sweets Usage"

From Sugar Labs
Jump to navigation Jump to search
(→‎Current limitations: PK on Gentoo is mostly uselss dueto USE flags)
 
(63 intermediate revisions by 2 users not shown)
Line 1: Line 1:
This guide describes how to use Sugar Labs' [[Platform_Team/Sugar_Doers_Kit|SDK]] for developing core modules.
+
This guide describes how to use Sugar Labs' Packaging Management System. See also [[Platform_Team/Sweets|introduction page]] and [[Platform_Team/Guide/Sweets_Packaging|Packaging guide]].
  
== Requirements ==
+
== Installation ==
  
* Install PackageKit and PackageKit authentication agent from native packages. On Debian-based systems, these packages are {{Code|packagekit}} and {{Code|packagekit-gnome}} (for Gnome Desktop Environment). For Fedora, {{code|PackageKit}} and {{Code|gnome-packagekit}}.
+
=== Required packages ===
  
* PackageKit authentication agent should be launched to let the {{Code|sweets}} command install dependencies. Usually it is started after being logged into a Desktop Environment session (it isn't for Sugar session).
+
First, install PackageKit related packages. The following command will also install Polkit authentication agent for Gnome sessions (if you start sugar emulator from Gnome Desktop Environment).
  
* Clone sweets sources and install it (after the first run you need to relogin to take into account new PATH value, then just run {{Code|sweets}} command):
+
{{Note/important|Important notes for XO users:|Some XO images might mount {{Code|/var/cache/yum}} to the tmpfs. With this limited cache capacity, it will be mostly impossible to install anything of large size from the Fedora repositories. To work around this limitation, become a {{Code|root}} user and enter the {{Code|umount /var/cache/yum}} command in the Terminal activity or a console. To persist this change for subsequent boots, remove the corresponding line from the {{Code|/etc/fstab}} file.}}
  
git clone --recursive git://git.sugarlabs.org/sdk/sweets.git
+
Fedora specific instructions:
  sweets/sweets upgrade
+
  sudo yum install gnome-packagekit
  
== Launch sugar ==
+
Debian and Ubuntu (starting from 11.10) based distributions specific instructions:
  
To launch sugar session:
+
sudo apt-get install gnome-packagekit
  
sweets sdk/sugar
+
Ubuntu (before 11.10) based distributions specific instructions:
  
or to run from Xephyr:
+
sudo apt-get install packagekit-gnome
  
sweets sdk/sugar:emulator
+
After installing PackageKit, you need to restart the DBus system bus. The easiest way is to just restart the machine.
  
It is possible to run different glucose versions via SDK (for now, testing 0.92+ and stable 0.88 based on Dextrose-2), e.g.:
+
=== Install ===
  
sweets sdk/sugar:emulator=0.88
+
Enter in the Terminal activity, or any other terminal:
  
For launch command, all arguments passed after sweet name are treated as launched sweet's arguments. For example, it is possible to run sugar by bassing {{Code|-f}} argument:
+
wget http://download.sugarlabs.org/sweets/sweets/installer.sh
 +
sh installer.sh
  
sweets sdk/sugar:emulator=0.88 -f
+
Relogin from X session to take into account the new PATH environment variable value.
  
== Development workflow with sweets ==
+
Alternatively, {{Code|sweets}} might be run from the [[Platform_Team/Guide/Sweets_Packaging#Run_Sweets_from_sources|sources]].
  
During the first launch, sources will be auto-built and kept in internal storage. To make sweets useful for development, checkout developing project sources in sweets:
+
=== Upgrade ===
  
sweets checkout [''path-to-sources'']
+
Enter in the Terminal activity, or any other terminal:
  
The only thing that is required from sources is having [[Platform Team/Recipe Specification|sweets.recipe]] spec file for non-activity projects or {{Code|activity/activity.info}} (that conforms the same spec) for activities.
+
sweets upgrade
  
After being checked out, this sources might be launched using {{Code|<nowiki>http://</nowiki>sweets.sugarlabs.org/''sweet-value-from-sweets.recipe''}} or just mentioning sweet value:
+
== Usage ==
  
sweets ''sweet''
+
Read the [[Platform_Team/Sweets/Glossary|Sweets Glossary]] to understand the basic concept (and [[Platform_Team/Infrastructure|overview]] of the bigger picture). The rest of the text will operate with the following terms:
  
For glucose projects you can find ready-to-use and all time rebased to upstream, projects in [http://git.sugarlabs.org/sdk SDK] http://git.sugarlabs.org project. For now there are two branches: {{Code|master}} for recent trunk and {{Code|master-0.88}} for 0.88 code based on Dextrose-2 patches.
+
* {{Code|''SWEET''}}, the full ''interface'' URL, like {{Code|http://sweets.sugarlabs.org/sdk/sugar}}, or the short one, like {{Code|sdk/sugar}};
 +
* {{Code|''COMMAND''}}, ''sweet'''s command that indicates how to run a particular ''sweet''; by default, ''sweet''s have only the {{Code|run}} command, but it is possible to have several commands;
 +
* {{Code|''VERSION''}}, ''sweet'''s version
  
Checked out projects will be built according to the {{Code|[Build]}} section commands in {{Code|sweets.recipe}} files. In general, for autotools-based projects, there is no further need for the {{Code|sweets}} command, just run {{Code|make install}} to build current sources and {{Code|make install them}} them to the directory that was specified by {{Code|sweets}} in the configure stage. For glucose projects, there is no need even in calling the {{Code|make}} command, python code will be reused from its original place (see {{Code|binding}} options in [[Platform Team/Recipe Specification|sweets.recipe]] files), change the code and restart sugar.
+
See the [[Platform_Team/Guide/Sugar_via_Sweets|Sugar via Sweets]] guide for real examples of how to use ''Sweets'' to run Sugar Shell.
  
=== Run sweets from X session ===
+
=== Launch ===
  
Place sweets invocation into your {{Code|~/.xsession}} file:
+
To launch a ''sweet'' with verbatim passing of optional {{Code|ARGUMENTS}}:
  
PATH=$HOME/.local/bin:$PATH
+
  sweets ''<SWEET>'' [''<ARGUMENTS>'']
  sweets sdk/sugar
 
  
and create a {{Code|/usr/share/xsessions/sweets.desktop}} desktop file:
+
Sometimes ''sweet''s support several launching commands; it is possible to specify one during the launch:
  
  [Desktop Entry]
+
  sweets ''<SWEET>'':''<COMMAND>''
  Encoding=UTF-8
+
 
  Name=Sweets
+
To run a particular, but not the latest, version:
  GenericName=Sweets
+
 
Exec=/etc/X11/Xsession
+
  sweets ''<SWEET>'' ''=''|''>=''|''<='' ''<VERSION>''
  Type=Application
+
 
 +
To get the full list of available versions:
 +
 
 +
sweets status ''<SWEET>'' -v
 +
 
 +
To get information, e.g., a list of supported commands, about a ''sweet'':
 +
 
 +
  sweets show ''<SWEET>''
 +
 
 +
=== Troubleshooting ===
 +
 
 +
After getting any unpredictable Sweets behaviour, read the following notes.
 +
 
 +
'''Keep feeds up-to-date'''
 +
 
 +
''Feeds'' are being updated from time to time. After experiencing any problems, and for refreshing the local ''feeds'' cache, it will be useful to re-download ''feeds''. Use, once, the {{Code|-R}} command line argument for the launch command (make sure that {{Code|-R}} goes before the {{Code|SWEET}}, because using it afterwards will cause passing it as a {{Code|SWEET}}'s argument):
 +
 
 +
sweets -R ''<SWEET>''
 +
 
 +
'''Analyze dependencies tree'''
 +
 
 +
If {{Code|sweets}} can't find a proper ''implementation'', see the {{Code|e}} lines in the output of:
 +
 
 +
  sweets status ''<SWEET>'' -vdd
 +
 
 +
'''Keep the system in consistent state'''
 +
 
 +
Asking Sweets to launch a sweets might mean installing new packages via PackageKit. In most cases, PackageKit can handle possible issues with native packages and, at worst, will fail as well, in order to stop any further Sweets operations. Nevertheless, it can be useful to keep unbroken native packages.
 +
 
 +
=== Search ===
 +
 
 +
It is possible to search ''sweet''s among locally known ones and those registered on http://sweets.sugarlabs.org (not yet implemented). The search is based on the [http://xapian.org/ Xapian] search engine. Thus, it is possible to use Xapian's [http://xapian.org/docs/queryparser.html query language].
 +
 
 +
For command format is:
 +
 
 +
  sweets search ''<QUERY>''
 +
 
 +
Notice that [http://xapian.org/docs/queryparser.html#partially-entered-query-matching partial] search is enabled. So, the query {{Code|tele}} will be treated as {{Code|tele*}} to search all words that start from {{Code|tele}}.
 +
 
 +
{{Code|sweets}} supports the following search [http://xapian.org/docs/queryparser.html#searching-within-a-probabilistic-field prefixes] based on [[Platform_Team/Recipe_Specification|recipe options]]:
 +
 
 +
* '''interface''' the first interface from the implementations list, e.g., {{Code|http://sweets.sugarlabs.org/sdk/sugar}};
 +
* '''sweet''' the first interface from the implementations list in short Sweets notations, e.g., {{Code|sdk/sugar}};
 +
* '''implement''' the list of implemented interfaces;
 +
* '''associate''' the list of associated interfaces;
 +
* '''name''' the short name of a sweet;
 +
* '''summary''' sweet's summary;
 +
* '''description''' long sweet's description;
 +
* '''category''' list of category names;
 +
* '''license''' list of licenses;
 +
* '''type''' sweet's type, which might be {{Code|library}}, {{Code|application}} or {{Code|activity}};
 +
* '''keep''' if activity, that a sweet is representing, is favorited;
 +
* '''tags''' the list of sweet's tags;
 +
* '''mime_types''' the list of activity MIME types, that a sweet is representing or supports.
 +
 
 +
So, it is possible to search only among particular sweet attributes, like {{Code|name:telepathy}} to search only among particular sweet names.
 +
 
 +
{{Code|sweets}} support additional notation for exact searching in the form of {{Code|''prefix''<nowiki>:=</nowiki>''string''}}. For example the query {{Code|name<nowiki>:=</nowiki>sugar}} will find ''sweet''s only with exactly {{Code|sugar}} as a name and omit names like {{Code|sugar-base}}. If the search string contains spaces, wrap it within double quotes, {{Code|name<nowiki>:=</nowiki>"Sugar Commander"}}. Note, wildcards do not work in the exact search case where asterisks will be treated literally.
  
 
== Current limitations ==
 
== Current limitations ==
  
* For now, {{Code|sweets}} knowns only about glucose dependencies to install them from native packages in Debian, Ubuntu, Fedora, Mandriva, openSUSE, and Gentoo.
+
* For now, {{Code|sweets}} knows only enough about the glucose dependencies to install them from native packages in Debian, Ubuntu, Fedora, Mandriva, openSUSE.
 
* Activities can't reuse sweets benefits.
 
* Activities can't reuse sweets benefits.
  
 
== Feedback ==
 
== Feedback ==
  
* [http://bugs.sugarlabs.org/newticket?component=sweets Submit] your bug report.
+
{{:Platform_Team/Sweets/Feedback}}
* Ask your question on IRC channels, [irc://irc.freenode.net/sugar #sugar] (not logged) or [irc://irc.freenode.net/sugar-newbies #sugar-newbies] (logged).
 

Latest revision as of 12:13, 6 December 2011

This guide describes how to use Sugar Labs' Packaging Management System. See also introduction page and Packaging guide.

Installation

Required packages

First, install PackageKit related packages. The following command will also install Polkit authentication agent for Gnome sessions (if you start sugar emulator from Gnome Desktop Environment).

Notification.png
Important notes for XO users:
Some XO images might mount /var/cache/yum to the tmpfs. With this limited cache capacity, it will be mostly impossible to install anything of large size from the Fedora repositories. To work around this limitation, become a root user and enter the umount /var/cache/yum command in the Terminal activity or a console. To persist this change for subsequent boots, remove the corresponding line from the /etc/fstab file.

Fedora specific instructions:

sudo yum install gnome-packagekit

Debian and Ubuntu (starting from 11.10) based distributions specific instructions:

sudo apt-get install gnome-packagekit

Ubuntu (before 11.10) based distributions specific instructions:

sudo apt-get install packagekit-gnome

After installing PackageKit, you need to restart the DBus system bus. The easiest way is to just restart the machine.

Install

Enter in the Terminal activity, or any other terminal:

wget http://download.sugarlabs.org/sweets/sweets/installer.sh
sh installer.sh

Relogin from X session to take into account the new PATH environment variable value.

Alternatively, sweets might be run from the sources.

Upgrade

Enter in the Terminal activity, or any other terminal:

sweets upgrade

Usage

Read the Sweets Glossary to understand the basic concept (and overview of the bigger picture). The rest of the text will operate with the following terms:

  • SWEET, the full interface URL, like http://sweets.sugarlabs.org/sdk/sugar, or the short one, like sdk/sugar;
  • COMMAND, sweet's command that indicates how to run a particular sweet; by default, sweets have only the run command, but it is possible to have several commands;
  • VERSION, sweet's version

See the Sugar via Sweets guide for real examples of how to use Sweets to run Sugar Shell.

Launch

To launch a sweet with verbatim passing of optional ARGUMENTS:

sweets <SWEET> [<ARGUMENTS>]

Sometimes sweets support several launching commands; it is possible to specify one during the launch:

sweets <SWEET>:<COMMAND>

To run a particular, but not the latest, version:

sweets <SWEET> =|>=|<= <VERSION>

To get the full list of available versions:

sweets status <SWEET> -v

To get information, e.g., a list of supported commands, about a sweet:

sweets show <SWEET>

Troubleshooting

After getting any unpredictable Sweets behaviour, read the following notes.

Keep feeds up-to-date

Feeds are being updated from time to time. After experiencing any problems, and for refreshing the local feeds cache, it will be useful to re-download feeds. Use, once, the -R command line argument for the launch command (make sure that -R goes before the SWEET, because using it afterwards will cause passing it as a SWEET's argument):

sweets -R <SWEET>

Analyze dependencies tree

If sweets can't find a proper implementation, see the e lines in the output of:

sweets status <SWEET> -vdd

Keep the system in consistent state

Asking Sweets to launch a sweets might mean installing new packages via PackageKit. In most cases, PackageKit can handle possible issues with native packages and, at worst, will fail as well, in order to stop any further Sweets operations. Nevertheless, it can be useful to keep unbroken native packages.

Search

It is possible to search sweets among locally known ones and those registered on http://sweets.sugarlabs.org (not yet implemented). The search is based on the Xapian search engine. Thus, it is possible to use Xapian's query language.

For command format is:

sweets search <QUERY>

Notice that partial search is enabled. So, the query tele will be treated as tele* to search all words that start from tele.

sweets supports the following search prefixes based on recipe options:

  • interface the first interface from the implementations list, e.g., http://sweets.sugarlabs.org/sdk/sugar;
  • sweet the first interface from the implementations list in short Sweets notations, e.g., sdk/sugar;
  • implement the list of implemented interfaces;
  • associate the list of associated interfaces;
  • name the short name of a sweet;
  • summary sweet's summary;
  • description long sweet's description;
  • category list of category names;
  • license list of licenses;
  • type sweet's type, which might be library, application or activity;
  • keep if activity, that a sweet is representing, is favorited;
  • tags the list of sweet's tags;
  • mime_types the list of activity MIME types, that a sweet is representing or supports.

So, it is possible to search only among particular sweet attributes, like name:telepathy to search only among particular sweet names.

sweets support additional notation for exact searching in the form of prefix:=string. For example the query name:=sugar will find sweets only with exactly sugar as a name and omit names like sugar-base. If the search string contains spaces, wrap it within double quotes, name:="Sugar Commander". Note, wildcards do not work in the exact search case where asterisks will be treated literally.

Current limitations

  • For now, sweets knows only enough about the glucose dependencies to install them from native packages in Debian, Ubuntu, Fedora, Mandriva, openSUSE.
  • Activities can't reuse sweets benefits.

Feedback

  • Submit your bug report or feature request.
  • Subscribe to the sugar-devel mailing list and email with the subject prefixed with [SWEETS].
  • Ask your question on IRC channels, #sugar (not logged) or #sugar-newbies (logged).