[Sugar-devel] [PATCH] Support isolated start
Aleksey Lim
alsroot at member.fsf.org
Fri Oct 22 11:59:28 EDT 2010
Running process is based on injection (how 0install works) of evironment
variables to final application process, e.g., via PYTHONPATH. Patch will let
bazaar.sugarlabs.org build sugar packages, also runnning from git cloned
directories will be supported (i.e., without jhbuild).
---
.gitignore | 3 +-
bin/Makefile.am | 2 +-
bin/sugar | 91 ++++++++++++++++++++++++++++++++++++
bin/sugar-session | 1 -
bin/sugar.in | 82 --------------------------------
configure.ac | 1 -
src/jarabe/config.py.in | 17 ++++---
src/jarabe/model/bundleregistry.py | 7 ++-
sweets.recipe | 49 +++++++++++++++++++
9 files changed, 156 insertions(+), 97 deletions(-)
create mode 100755 bin/sugar
mode change 100644 => 100755 bin/sugar-activity
mode change 100644 => 100755 bin/sugar-control-panel
mode change 100644 => 100755 bin/sugar-install-bundle
mode change 100644 => 100755 bin/sugar-launch
mode change 100644 => 100755 bin/sugar-ui-check
delete mode 100644 bin/sugar.in
create mode 100644 sweets.recipe
diff --git a/.gitignore b/.gitignore
index 047a849..0f7dc7f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -13,6 +13,8 @@ Makefile.in
.*.sw?
*.service
stamp-*
+*.tar.*
+.sweets
# Absolute
@@ -51,7 +53,6 @@ m4/intltool.m4
sugar/browser/_sugarbrowser.c
browser/sugar-marshal.c
browser/sugar-marshal.h
-bin/sugar
shell/extensions/_extensions.c
data/sugar.gtkrc
data/sugar.xml
diff --git a/bin/Makefile.am b/bin/Makefile.am
index 05a9215..bf66dbd 100644
--- a/bin/Makefile.am
+++ b/bin/Makefile.am
@@ -11,4 +11,4 @@ bin_SCRIPTS = \
sugar \
$(python_scripts)
-EXTRA_DIST = $(python_scripts) sugar.in
+EXTRA_DIST = $(python_scripts)
diff --git a/bin/sugar b/bin/sugar
new file mode 100755
index 0000000..9d079ed
--- /dev/null
+++ b/bin/sugar
@@ -0,0 +1,91 @@
+#!/bin/sh
+
+if [ "$(id -u)" -eq 0 -o "$(id -ru)" -eq 0 ] ; then
+ echo Refusing to run as root.
+ exit 3
+fi
+
+usage() {
+ cat <<EOF
+Usage: sugar [OPTION]..
+
+Start Sugar window manager.
+
+Optional arguments.
+ -d, --display DISPLAY Display to start sugar
+ -s, --scaling SCALING Scale Sugar theme
+ Supported values: 72, 100
+EOF
+ exit 0
+}
+
+while [ $# -ne 0 ] ; do
+ case "$1" in
+ -d | --display)
+ shift
+ export DISPLAY="$1"
+ ;;
+ -s | --scaling)
+ shift
+ export SUGAR_SCALING="$1"
+ ;;
+ -h | --help)
+ usage
+ ;;
+ esac
+ shift
+done
+
+# Set default profile dir
+if test -z "$SUGAR_PROFILE"; then
+ export SUGAR_PROFILE=default
+fi
+
+if test "$SUGAR_SHELL_PREFIX"; then
+ include="include \"\$(HOME)/.sugar/gconf.path\""
+ grep "$include" ~/.gconf.path >/dev/null 2>&1 || \
+ echo "$include" >> ~/.gconf.path
+ mkdir -p ~/.sugar
+ echo "xml:readonly:$SUGAR_SHELL_PREFIX/gconf.xml" > ~/.sugar/gconf.path
+ gconftool-2 --shutdown
+fi
+
+if test -z "$SUGAR_SCALING"; then
+ export SUGAR_SCALING=72
+fi
+
+export GTK2_RC_FILES="$(dirname $(dirname $0))/share/sugar/data/sugar-$SUGAR_SCALING.gtkrc"
+
+# Needed for executing wpa_passphrase
+export PATH="$PATH":/sbin:/usr/sbin
+
+if ! test -f "$GTK2_RC_FILES"; then
+ echo "sugar: ERROR: Gtk theme for scaling $SUGAR_SCALING not available in path $GTK2_RC_FILES"
+ exit 1
+fi
+
+# Set default language
+export LANG="${LANG:-en_US.utf8}"
+export LANGUAGE="${LANGUAGE:-${LANG}}"
+
+# Set Sugar's telepathy accounts directory
+export MC_ACCOUNT_DIR=$HOME/.sugar/$SUGAR_PROFILE/accounts
+
+# Workaround until gnome-keyring-daemon lets dbus activate it
+# https://bugzilla.gnome.org/show_bug.cgi?id=628302
+if test "$SUGAR_EMULATOR" = "yes" -a "$(type gnome-keyring-daemon)"; then
+ gnome-keyring-daemon --components=secrets &
+fi
+
+# Source language settings and debug definitions
+if [ -f ~/.i18n ]; then
+ . ~/.i18n
+fi
+if [ -f ~/.sugar/debug ]; then
+ . ~/.sugar/debug
+fi
+
+echo Xcursor.theme: sugar | xrdb -merge
+metacity --no-force-fullscreen -d $DISPLAY &
+
+exec sugar-session
diff --git a/bin/sugar-activity b/bin/sugar-activity
old mode 100644
new mode 100755
diff --git a/bin/sugar-control-panel b/bin/sugar-control-panel
old mode 100644
new mode 100755
diff --git a/bin/sugar-install-bundle b/bin/sugar-install-bundle
old mode 100644
new mode 100755
diff --git a/bin/sugar-launch b/bin/sugar-launch
old mode 100644
new mode 100755
diff --git a/bin/sugar-session b/bin/sugar-session
index 91ebf6f..e2157ba 100755
--- a/bin/sugar-session
+++ b/bin/sugar-session
@@ -218,7 +218,6 @@ def main():
# strings in the module scope.
from jarabe import config
gettext.bindtextdomain('sugar', config.locale_path)
- gettext.bindtextdomain('sugar-toolkit', config.locale_path)
gettext.textdomain('sugar')
from jarabe.desktop import homewindow
diff --git a/bin/sugar-ui-check b/bin/sugar-ui-check
old mode 100644
new mode 100755
diff --git a/bin/sugar.in b/bin/sugar.in
deleted file mode 100644
index 12098db..0000000
--- a/bin/sugar.in
+++ /dev/null
@@ -1,82 +0,0 @@
-#!/bin/sh
-
-if [ "$(id -u)" -eq 0 -o "$(id -ru)" -eq 0 ] ; then
- echo Refusing to run as root.
- exit 3
-fi
-
-usage() {
- cat <<EOF
-Usage: sugar [OPTION]..
-
-Start Sugar window manager.
-
-Optional arguments.
- -d, --display DISPLAY Display to start sugar
- -s, --scaling SCALING Scale Sugar theme
- Supported values: 72, 100
-EOF
- exit 0
-}
-
-while [ $# -ne 0 ] ; do
- case "$1" in
- -d | --display)
- shift
- export DISPLAY="$1"
- ;;
- -s | --scaling)
- shift
- export SUGAR_SCALING="$1"
- ;;
- -h | --help)
- usage
- ;;
- esac
- shift
-done
-
-# Set default profile dir
-if test -z "$SUGAR_PROFILE"; then
- export SUGAR_PROFILE=default
-fi
-
-if test -z "$SUGAR_SCALING"; then
- export SUGAR_SCALING=72
-fi
-
-export GTK2_RC_FILES="@prefix@/share/sugar/data/sugar-$SUGAR_SCALING.gtkrc"
-
-# Needed for executing wpa_passphrase
-export PATH="$PATH":/sbin:/usr/sbin
-
-if ! test -f "$GTK2_RC_FILES"; then
- echo "sugar: ERROR: Gtk theme for scaling $SUGAR_SCALING not available in path $GTK2_RC_FILES"
- exit 1
-fi
-
-# Set default language
-export LANG="${LANG:-en_US.utf8}"
-export LANGUAGE="${LANGUAGE:-${LANG}}"
-
-# Set Sugar's telepathy accounts directory
-export MC_ACCOUNT_DIR=$HOME/.sugar/$SUGAR_PROFILE/accounts
-
-# Workaround until gnome-keyring-daemon lets dbus activate it
-# https://bugzilla.gnome.org/show_bug.cgi?id=628302
-if test "$SUGAR_EMULATOR" = "yes" -a "$(type gnome-keyring-daemon)"; then
- gnome-keyring-daemon --components=secrets &
-fi
-
-# Source language settings and debug definitions
-if [ -f ~/.i18n ]; then
- . ~/.i18n
-fi
-if [ -f ~/.sugar/debug ]; then
- . ~/.sugar/debug
-fi
-
-echo Xcursor.theme: sugar | xrdb -merge
-metacity --no-force-fullscreen -d $DISPLAY &
-
-exec sugar-session
diff --git a/configure.ac b/configure.ac
index 151eaa5..63e756f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -45,7 +45,6 @@ AM_GCONF_SOURCE_2
AC_CONFIG_FILES([
bin/Makefile
-bin/sugar
data/icons/Makefile
data/Makefile
data/sugar-emulator.desktop
diff --git a/src/jarabe/config.py.in b/src/jarabe/config.py.in
index 6c418e9..68c3a62 100644
--- a/src/jarabe/config.py.in
+++ b/src/jarabe/config.py.in
@@ -14,13 +14,14 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-# pylint: disable-msg=C0301
+import os
+from os.path import join
-prefix = '@prefix@'
-data_path = '@prefix@/share/sugar/data'
-shell_path = '@prefix@/share/sugar/shell'
-locale_path = '@prefix@/share/locale'
-ext_path = '@prefix@/share/sugar/extensions'
-activities_path = "@prefix@/share/sugar/activities"
+prefix = os.environ.get('SUGAR_SHELL_PREFIX', '@prefix@')
+data_path = join(prefix, 'share', 'sugar', 'data')
+shell_path = join(prefix, 'share', 'sugar', 'shell')
+locale_path = join(prefix, 'share', 'locale')
+ext_path = join(prefix, 'share', 'sugar', 'extensions')
+activities_path = join(prefix, 'share', 'sugar', 'activities')
+activities_paths = [join(os.sep, 'opt', 'sweets'), activities_path]
version = '@SUCROSE_VERSION@'
-
diff --git a/src/jarabe/model/bundleregistry.py b/src/jarabe/model/bundleregistry.py
index 699e339..a0f8c8e 100644
--- a/src/jarabe/model/bundleregistry.py
+++ b/src/jarabe/model/bundleregistry.py
@@ -57,7 +57,7 @@ class BundleRegistry(gobject.GObject):
self._gio_monitors = []
user_path = env.get_user_activities_path()
- for activity_dir in [user_path, config.activities_path]:
+ for activity_dir in [user_path] + config.activities_paths:
self._scan_directory(activity_dir)
directory = gio.File(activity_dir)
monitor = directory.monitor_directory()
@@ -197,10 +197,11 @@ class BundleRegistry(gobject.GObject):
# Sort by mtime to ensure a stable activity order
bundles = {}
for f in os.listdir(path):
- if not f.endswith('.activity'):
- continue
try:
bundle_dir = os.path.join(path, f)
+ if not os.path.exists(
+ os.path.join(bundle_dir, 'activity', 'activity.info')):
+ continue
if os.path.isdir(bundle_dir):
bundles[bundle_dir] = os.stat(bundle_dir).st_mtime
except Exception:
diff --git a/sweets.recipe b/sweets.recipe
new file mode 100644
index 0000000..13eb4d8
--- /dev/null
+++ b/sweets.recipe
@@ -0,0 +1,49 @@
+[DEFAULT]
+sweet = sugar
+summary = Core UI components
+license = LGPLv2.1+
+homepage = http://git.sugarlabs.org/projects/sugar
+
+version = 0.90.2
+stability = testing
+
+depends = pygtk; gtk; gconf
+
+[Component]
+requires = %(depends)s; sugar-artwork; sugar-toolkit; sugar-datastore
+ pygtksourceview; sugar-presence-service; simplejson
+ metacity >= 2.27; xdpyinfo; xsetroot; dbus; dbus-x11; gvfs; hal
+ openssh-client; libwnck-python; python-xklavier; telepathy-python
+ telepathy-salut >= 0.4; telepathy-gabble >= 0.10
+ telepathy-mission-control >= 5.6
+main = bin/sugar
+binding = SUGAR_SHELL_PREFIX; PATH bin; PYTHONPATH = python
+arch = any
+
+[Component/emulator]
+requires = %(sweet)s; xephyr
+exec = exec sugar-emulator "$@"
+exclude = *
+
+[Build]
+requires = %(depends)s; pkg-config; intltool >= 0.33; make; gcc-c
+cleanup = make distclean; ./autogen.sh
+configure = ./configure
+ --prefix=%(PREFIX)s
+ am_cv_python_pythondir=%(PREFIX)s/python
+ am_cv_python_pyexecdir=%(PREFIX)s/python
+ CFLAGS="%(CFLAGS)s"
+make = make
+install = GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL=1
+ make DESTDIR=%(DESTDIR)s install &&
+ GCONF_CONFIG_SOURCE=xml:merged:%(DESTDIR)s/%(PREFIX)s/gconf.xml
+ gconftool-2 --makefile-install-rule data/sugar.schemas >/dev/null &&
+ chmod a+r %(DESTDIR)s/%(PREFIX)s/gconf.xml/*
+implement = %(install)s &&
+ rm -rf %(DESTDIR)s/%(PREFIX)s/python &&
+ rm -rf %(DESTDIR)s/%(PREFIX)s/bin &&
+ ln -s %(BUILDDIR)s/bin %(DESTDIR)s/%(PREFIX)s/bin &&
+ ln -s %(BUILDDIR)s/src %(DESTDIR)s/%(PREFIX)s/python
+
+[Source]
+exec = ./autogen.sh && make dist
--
1.7.2.2
More information about the Sugar-devel
mailing list