Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/rpms
diff options
context:
space:
mode:
authorBernie Innocenti <bernie@codewiz.org>2010-08-13 15:01:51 (GMT)
committer Bernie Innocenti <bernie@codewiz.org>2010-08-13 15:01:51 (GMT)
commit3988e83e40469e93832b20424c43e6de44ecf1bd (patch)
tree272c53128241e1d8d24c743e03ff1b9ea5690a90 /rpms
parent38fc03759da713b973f2a324d05ca42da7ef8f90 (diff)
Add microformat updater
Diffstat (limited to 'rpms')
-rw-r--r--rpms/sugar/microformat-updater.patch235
-rw-r--r--rpms/sugar/sugar.spec3
2 files changed, 237 insertions, 1 deletions
diff --git a/rpms/sugar/microformat-updater.patch b/rpms/sugar/microformat-updater.patch
new file mode 100644
index 0000000..c978449
--- /dev/null
+++ b/rpms/sugar/microformat-updater.patch
@@ -0,0 +1,235 @@
+From dextrose-bounces@lists.sugarlabs.org Mon Aug 9 18:32:37 2010
+Return-Path: <dextrose-bounces@lists.sugarlabs.org>
+X-Original-To: bernie@codewiz.org
+Delivered-To: bernie@trinity.develer.com
+Received: from solarsail.media.mit.edu (solarsail.media.mit.edu
+ [18.85.2.155]) by trinity.develer.com (Postfix) with ESMTPS id 875D61D6061
+ for <bernie@codewiz.org>; Mon, 9 Aug 2010 18:32:37 +0200 (CEST)
+X-Virus-Status: Clean
+X-Virus-Scanned: clamav-milter 0.95.3 at trinity.develer.com
+Received: from solarsail.media.mit.edu (localhost [127.0.0.1]) by
+ solarsail.media.mit.edu (Postfix) with ESMTP id 4CC458114; Mon, 9 Aug 2010
+ 12:32:36 -0400 (EDT)
+Received: from mail-pw0-f42.google.com (mail-pw0-f42.google.com
+ [209.85.160.42]) by solarsail.media.mit.edu (Postfix) with ESMTP id
+ 040678109 for <dextrose@lists.sugarlabs.org>; Mon, 9 Aug 2010 12:19:14
+ -0400 (EDT)
+Received: by pwj8 with SMTP id 8so1453272pwj.29 for
+ <dextrose@lists.sugarlabs.org>; Mon, 09 Aug 2010 09:19:14 -0700 (PDT)
+Received: by 10.142.156.14 with SMTP id d14mr13903275wfe.2.1281370754349;
+ Mon, 09 Aug 2010 09:19:14 -0700 (PDT)
+Received: from localhost.localdomain ([59.178.134.11]) by mx.google.com
+ with ESMTPS id t11sm6734499wfc.4.2010.08.09.09.19.10 (version=TLSv1/SSLv3
+ cipher=RC4-MD5); Mon, 09 Aug 2010 09:19:13 -0700 (PDT)
+From: anishmangal2002 <anishmangal2002@gmail.com>
+To: Bernie Innocenti <bernie@codewiz.org>, tch@sugarlabs.org
+Date: Mon, 9 Aug 2010 21:48:03 +0530
+Message-Id: <1281370683-3814-2-git-send-email-anishmangal2002@gmail.com>
+X-Mailer: git-send-email 1.7.2.1
+In-Reply-To: <1281370683-3814-1-git-send-email-anishmangal2002@gmail.com>
+References: <1281370683-3814-1-git-send-email-anishmangal2002@gmail.com>
+X-Mailman-Approved-At: Mon, 09 Aug 2010 12:32:34 -0400
+Cc: anishmangal2002 <anishmangal2002@gmail.com>,
+ dextrose@lists.sugarlabs.org
+Subject: [Dextrose] [PATCH] Add microformat support to updater.
+X-BeenThere: dextrose@lists.sugarlabs.org
+X-Mailman-Version: 2.1.9
+Precedence: list
+List-Id: <dextrose.lists.sugarlabs.org>
+List-Unsubscribe: <http://lists.sugarlabs.org/listinfo/dextrose>,
+ <mailto:dextrose-request@lists.sugarlabs.org?subject=unsubscribe>
+List-Archive: <http://lists.sugarlabs.org/archive/dextrose>
+List-Post: <mailto:dextrose@lists.sugarlabs.org>
+List-Help: <mailto:dextrose-request@lists.sugarlabs.org?subject=help>
+List-Subscribe: <http://lists.sugarlabs.org/listinfo/dextrose>,
+ <mailto:dextrose-request@lists.sugarlabs.org?subject=subscribe>
+MIME-Version: 1.0
+Content-Type: text/plain; charset="us-ascii"
+Sender: dextrose-bounces@lists.sugarlabs.org
+Errors-To: dextrose-bounces@lists.sugarlabs.org
+X-Spam-Status: No, score=-3.1 required=3.5 tests=AWL,BAYES_00,
+ DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,RCVD_IN_DNSWL_MED,RCVD_IN_SORBS_WEB
+ autolearn=ham version=3.3.1
+X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on
+ trinity.develer.com
+Content-Transfer-Encoding: 8bit
+
+
+Signed-off-by: anishmangal2002 <anishmangal2002@gmail.com>
+---
+ .../cpsection/updater/backends/microformat.py | 125 ++++++++++++++++++++
+ extensions/cpsection/updater/model.py | 13 +-
+ 2 files changed, 131 insertions(+), 7 deletions(-)
+ create mode 100644 extensions/cpsection/updater/backends/microformat.py
+
+diff --git a/extensions/cpsection/updater/backends/microformat.py b/extensions/cpsection/updater/backends/microformat.py
+new file mode 100644
+index 0000000..ea7dda1
+--- /dev/null
++++ b/extensions/cpsection/updater/backends/microformat.py
+@@ -0,0 +1,125 @@
++#!/usr/bin/python
++# Copyright (C) 2009, Sugar Labs
++#
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 2 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program; if not, write to the Free Software
++# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
++
++import logging
++from HTMLParser import HTMLParser
++
++import gio
++
++from jarabe import config
++
++#_UPDATE_PATH = 'http://activities.sugarlabs.org/services/update-aslo.php'
++_UPDATE_PATH = 'http://wiki.paraguayeduca.org/index.php/Actividades_y_contenidos'
++
++_fetcher = None
++# flag indicating whether we've parsed the url once or not
++_activity_list_populated = False
++
++_ACTIVITIES_LIST = {}
++
++class _UpdateFetcher(HTMLParser):
++
++ def __init__(self, bundle, completion_cb):
++ # ASLO knows only about stable SP releases
++ major, minor = config.version.split('.')[0:2]
++ sp_version = '%s.%s' % (major, int(minor) + int(minor) % 2)
++ # Reset the HTMLParser.
++ # FIXME: Check why it does not get reset on its own.
++ self.reset()
++ self._activity_id = ''
++ self._activity_url = ''
++ self._activity_version = ''
++ self._inside_activity_version = False
++ self._inside_activity_id = False
++ self._inside_activity_url = False
++
++ url = _UPDATE_PATH
++
++ self._completion_cb = completion_cb
++ self._file = gio.File(url)
++ self._bundle = bundle
++ logging.debug('Fetch %s', url)
++ self._file.load_contents_async(self.__download_file_complete_cb)
++
++ def __download_file_complete_cb(self, gdaemonfile, result):
++ content = self._file.load_contents_finish(result)[0]
++ self.feed(content)
++
++ def handle_endtag(self, tag):
++ if tag == 'body':
++ self._completion_cb(None, None, None, None, None)
++
++ def handle_starttag(self, tag, attrs):
++ if tag == 'span':
++ for attribute,value in attrs:
++ if value == 'olpc-activity-id':
++ self._inside_activity_id = True
++ elif value == 'olpc-activity-version':
++ self._inside_activity_version = True
++ elif value == 'olpc-activity-url':
++ self._inside_activity_url = True
++
++ elif tag == 'a':
++ if self._inside_activity_url:
++ for attribute,value in attrs:
++ if attribute == 'href':
++ self._activity_url = value
++ self._inside_activity_url = False
++
++ def handle_data(self, data):
++ if self._inside_activity_version:
++ self._activity_version = int(data)
++ self._inside_activity_version = False
++ _ACTIVITIES_LIST[self._activity_id] = \
++ {'version':self._activity_version,
++ 'url':self._activity_url,
++ 'size':1}
++ global _activity_list_populated
++ _activity_list_populated = True
++ if self._bundle._bundle_id == self._activity_id:
++ self._completion_cb(self._bundle, self._activity_version,
++ self._activity_url, 0, None)
++ elif self._inside_activity_id:
++ self._activity_id = data
++ self._inside_activity_id = False
++
++def fetch_update_info(bundle, completion_cb):
++ '''Queries the server for a newer version of the ActivityBundle.
++
++ completion_cb receives bundle, version, link, size and possibly an error
++ message:
++
++ def completion_cb(bundle, version, link, size, error_message):
++ '''
++ global _fetcher
++
++ if bundle._bundle_id in _ACTIVITIES_LIST:
++ _fetcher = None
++ completion_cb(bundle,
++ _ACTIVITIES_LIST[bundle._bundle_id]['version'],
++ _ACTIVITIES_LIST[bundle._bundle_id]['url'],
++ _ACTIVITIES_LIST[bundle._bundle_id]['size'], None)
++ return
++
++ global _activity_list_populated
++ if _activity_list_populated == True:
++ completion_cb(bundle, None, None, None, None)
++ else:
++ if _fetcher is not None:
++ raise RuntimeError('Multiple simultaneous requests are not supported')
++
++ _fetcher = _UpdateFetcher(bundle, completion_cb)
+diff --git a/extensions/cpsection/updater/model.py b/extensions/cpsection/updater/model.py
+index 9845371..3ec6888 100755
+--- a/extensions/cpsection/updater/model.py
++++ b/extensions/cpsection/updater/model.py
+@@ -36,8 +36,7 @@ from sugar.bundle.activitybundle import ActivityBundle
+
+ from jarabe.model import bundleregistry
+
+-from backends import aslo
+-
++from backends import microformat
+
+ class UpdateModel(gobject.GObject):
+ __gtype_name__ = 'SugarUpdateModel'
+@@ -72,11 +71,11 @@ class UpdateModel(gobject.GObject):
+ total = len(bundleregistry.get_registry())
+ current = total - len(self._bundles_to_check)
+
+- bundle = self._bundles_to_check.pop()
+- self.emit('progress', UpdateModel.ACTION_CHECKING, bundle.get_name(),
+- current, total)
+-
+- aslo.fetch_update_info(bundle, self.__check_completed_cb)
++ if len(self._bundles_to_check):
++ bundle = self._bundles_to_check.pop()
++ self.emit('progress', UpdateModel.ACTION_CHECKING, bundle.get_name(),
++ current, total)
++ microformat.fetch_update_info(bundle, self.__check_completed_cb)
+
+ def __check_completed_cb(self, bundle, version, link, size, error_message):
+ if error_message is not None:
+--
+1.7.2.1
+
+_______________________________________________
+Dextrose mailing list
+Dextrose@lists.sugarlabs.org
+http://lists.sugarlabs.org/listinfo/dextrose
+
+
diff --git a/rpms/sugar/sugar.spec b/rpms/sugar/sugar.spec
index 1863cb3..2e678d4 100644
--- a/rpms/sugar/sugar.spec
+++ b/rpms/sugar/sugar.spec
@@ -3,7 +3,7 @@
Summary: Constructionist learning platform
Name: sugar
Version: 0.88.1
-Release: 5.27dxo%{?dist}
+Release: 5.28dxo%{?dist}
URL: http://sugarlabs.org/
Source0: http://download.sugarlabs.org/sources/sucrose/glucose/%{name}/%{name}-%{version}.tar.bz2
@@ -59,6 +59,7 @@ Patch500: sl2006-touchpad-device-on-frame.patch
Patch503: cpu-and-memory-resource-indicator.patch
Patch504: sl2064-always-listen-for-NameOwnerChanged-DBus-message.patch
Patch506: jasg-register-rename.patch
+Patch507: microformat-updater.patch
# tch experimental patches
patch601: bundle-Delete-profile-data-only-when-erased.patch