Index: python/univention-upgrade =================================================================== --- python/univention-upgrade (Revision 59502) +++ python/univention-upgrade (Arbeitskopie) @@ -271,6 +271,64 @@ else: dprint(silent, 'none') + ####################################################################### + # APP UPDATE + ####################################################################### + try: + from univention.appcenter.actions import get_action + import univention.appcenter.log as appcenter_log + from argparse import Namespace + app_upgrade = get_action('upgrade') + if app_upgrade is None: + raise ImportError() + except ImportError: + # the new univention.appcenter package is not installed. nevermind + # cannot be a dependency as the app center depends on updater... + pass + else: + # check if component updates are available + dprint(silent, 'Checking for app updates: ', newline=False) + app_upgrade = app_upgrade() + app_upgrade._username = None + appcenter_log.log_to(log_file=LOGFN) + appcenter_log.log_to(stdout=True, log_format='%(message)s', logger='%s.readme' % app_upgrade.logger.name) + appcenter_log._reverse_umc_module_logger() + args = Namespace() + args.all = True + new_apps = list(app_upgrade.iter_apps(args)) + update_available = bool(new_apps) + + if update_available: + run = True + # updates available ==> stop here in "check-mode" + if checkForUpdates: + dprint(silent, 'found') + return True + + dprint(silent, 'found\n') + dprint(silent, 'The following apps can be updated:\n') + for app in new_apps: + dprint(silent, '%(name)s: Version %(old)s can be updated to %(new)s' % {'name': app.name, 'old': app.version, 'new': app.candidate.version}) + dprint(silent, 'Starting univention-app update at %s...' % (time.ctime()), debug=True) + dprint(silent, '\nStarting app update', newline=False) + success = True + for app in new_apps: + if interactive: + run = readcontinue('\nDo you want to update %s [Y|n]?' % app.name) + if run: + time.sleep(1) + + success = app_upgrade.call(app=[app], noninteractive=not interactive) and success + + if not success: + dprint(silent, 'ERROR: app upgrade failed. Please check /var/log/univention/updater.log\n') + sys.exit(1) + dprint(silent, 'univention-app upgrade finished at %s...' % (time.ctime()), debug=True) + dprint(silent, 'done') + time.sleep(1) + else: + dprint(silent, 'none') + # updates available ==> stop here in "check-mode" if checkForUpdates: return False Index: debian/changelog =================================================================== --- debian/changelog (Revision 59502) +++ debian/changelog (Arbeitskopie) @@ -1,3 +1,9 @@ +univention-updater (10.0.53-13) unstable; urgency=low + + * Bug #30417: Update Apps in univention-upgrade + + -- Dirk Wiesenthal Mon, 30 Mar 2015 17:25:06 +0200 + univention-updater (10.0.53-12) unstable; urgency=low * Bug #36044: Reword UCR variable description Index: script/univention-add-app =================================================================== --- script/univention-add-app (Revision 59502) +++ script/univention-add-app (Arbeitskopie) @@ -149,7 +149,7 @@ previously_registered = requested_app.register(component_manager, package_manager) success = package_manager.install(*packages) and success if not success or not legacy_call: - requested_app.unregister_all_and_register(previously_registered) + requested_app.unregister_all_and_register(previously_registered, component_manager, package_manager) subprocess.call(['/usr/sbin/univention-register-apps']) elif manually: component_manager.put_app(requested_app)