diff options
Diffstat (limited to 'rpms/sugar/0067-sugar-install-bundle-skip-older-bundles-by-default-a.patch')
-rw-r--r-- | rpms/sugar/0067-sugar-install-bundle-skip-older-bundles-by-default-a.patch | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/rpms/sugar/0067-sugar-install-bundle-skip-older-bundles-by-default-a.patch b/rpms/sugar/0067-sugar-install-bundle-skip-older-bundles-by-default-a.patch new file mode 100644 index 0000000..ac8c967 --- /dev/null +++ b/rpms/sugar/0067-sugar-install-bundle-skip-older-bundles-by-default-a.patch @@ -0,0 +1,82 @@ +From 8d4d7de12b2288827b01af64562a6a19194d5761 Mon Sep 17 00:00:00 2001 +From: Sascha Silbe <silbe@activitycentral.com> +Date: Mon, 5 Sep 2011 15:10:34 +0000 +Subject: [PATCH sugar 67/74] sugar-install-bundle: skip older bundles by + default, accept multiple bundles + +If the user has already installed a newer version of an activity, +sugar-install-bundle shouldn't overwrite it. Since there might be cases where +this is still useful we provide an option to force installing the bundle even +if it's the same or even an older version. + +The changes necessary to parse the CLI options also add back the support for +installing multiple bundles in one invocation. + +Signed-off-by: Sascha Silbe <silbe@activitycentral.com> +Reviewed-by: James Cameron <quozl@laptop.org> +--- + bin/sugar-install-bundle | 34 +++++++++++++++++++++++----------- + 1 files changed, 23 insertions(+), 11 deletions(-) + +diff --git a/bin/sugar-install-bundle b/bin/sugar-install-bundle +index d0b6fc5..47b0084 100644 +--- a/bin/sugar-install-bundle ++++ b/bin/sugar-install-bundle +@@ -1,17 +1,26 @@ + #!/usr/bin/env python + import gettext ++from optparse import OptionParser + import sys + + from sugar.bundle.activitybundle import ActivityBundle ++from sugar.bundle.bundle import AlreadyInstalledException + + from jarabe import config ++from jarabe.model import bundleregistry + + from dbus.mainloop.glib import DBusGMainLoop + + +-def cmd_help(): +- print _('Usage: sugar-install-bundle [ bundlename ] \n\n' +- 'Install an activity bundle (.xo). \n') ++def install_bundle(name, force): ++ bundle = ActivityBundle(name) ++ registry = bundleregistry.get_registry() ++ try: ++ registry.install(bundle, force_downgrade=force) ++ except AlreadyInstalledException: ++ print _("%s: %r or newer is already installed") % (sys.argv[0], name) ++ else: ++ print _('%s: %r installed.') % (sys.argv[0], name) + + + gettext.bindtextdomain('sugar', config.locale_path) +@@ -19,13 +28,16 @@ gettext.bindtextdomain('sugar-toolkit', config.locale_path) + gettext.textdomain('sugar') + _ = gettext.gettext + +-if len(sys.argv) != 2: +- cmd_help() +- sys.exit(2) ++parser = OptionParser(usage=_('usage: %prog [options] {bundle}'), ++ description=_('Install an activity bundle (.xo)')) ++parser.add_option('-f', '--force', dest='force', ++ help=_("Install bundle even if it isn't newer than" ++ " what's currently installed"), ++ action='store_true', default=False) ++options, args = parser.parse_args() ++if not args: ++ parser.error(_('no bundle given')) + + DBusGMainLoop(set_as_default=True) +- +-bundle = ActivityBundle(sys.argv[1]) +-bundle.install() +- +-print _('%s: %r installed.') % (sys.argv[0], sys.argv[1]) ++for file_name in args: ++ install_bundle(file_name, options.force) +-- +1.7.6 + |