Univention Bugzilla – Attachment 5803 Details for
Bug 33728
Rename App ID for Tine 2.0
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Rename tine20org to tine20
bug33728.patch (text/plain), 6.16 KB, created by
Dirk Wiesenthal
on 2014-02-25 15:08 CET
(
hide
)
Description:
Rename tine20org to tine20
Filename:
MIME Type:
Creator:
Dirk Wiesenthal
Created:
2014-02-25 15:08 CET
Size:
6.16 KB
patch
obsolete
>Index: scripts/univention-rename-app >=================================================================== >--- scripts/univention-rename-app (Revision 0) >+++ scripts/univention-rename-app (Revision 0) >@@ -0,0 +1,91 @@ >+#!/usr/bin/python2.6 >+# -*- coding: utf-8 -*- >+# >+# Univention App Center >+# univention-rename-app >+# >+# Copyright 2014 Univention GmbH >+# >+# http://www.univention.de/ >+# >+# All rights reserved. >+# >+# The source code of this program is made available >+# under the terms of the GNU Affero General Public License version 3 >+# (GNU AGPL V3) as published by the Free Software Foundation. >+# >+# Binary versions of this program provided by Univention to you as >+# well as other copyrighted, protected or trademarked materials like >+# Logos, graphics, fonts, specific documentations and configurations, >+# cryptographic keys etc. are subject to a license agreement between >+# you and Univention and not subject to the GNU AGPL V3. >+# >+# In the case you use this program under the terms of the GNU AGPL V3, >+# the program is provided 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 Affero General Public License for more details. >+# >+# You should have received a copy of the GNU Affero General Public >+# License with the Debian GNU/Linux or Univention distribution in file >+# /usr/share/common-licenses/AGPL-3; if not, see >+# <http://www.gnu.org/licenses/>. >+# >+ >+import sys >+from optparse import OptionParser >+ >+from univention.lib.package_manager import PackageManager >+from univention.updater import UniventionUpdater >+from univention.config_registry import ConfigRegistry >+from univention.management.console.modules.appcenter.util import ComponentManager, install_opener >+from univention.management.console.modules.appcenter.app_center import Application >+ >+ucr = ConfigRegistry() >+ucr.load() >+ >+def rename(old_id, new_id): >+ install_opener(ucr) >+ app = Application.find(old_id) >+ if not app: >+ app = Application.find(new_id) >+ if not app: >+ sys.stderr.write('Found neither OLD_ID nor NEW_ID.\n') >+ raise ValueError() >+ uu = UniventionUpdater(False) >+ component_manager = ComponentManager(ucr, uu) >+ package_manager = PackageManager(lock=False) >+ >+ if not app.is_installed(package_manager, strict=False): >+ sys.stdout.write('%s is not installed. Fine, nothing to do.\n' % app.name) >+ return >+ >+ app.set_id(old_id) >+ app.unregister_all_and_register(None, component_manager, package_manager) >+ app.tell_ldap(ucr, package_manager, inform_about_error=False) >+ >+ app.set_id(new_id) >+ app.register(component_manager, package_manager) >+ app.tell_ldap(ucr, package_manager, inform_about_error=False) >+ >+if __name__ == '__main__': >+ usage = '%prog OLD_ID NEW_ID' >+ description = '%prog changes the internal ID of an application. This means:' \ >+ '(1) unregister OLD_ID, remove from LDAP' \ >+ '(2) register NEW_ID, add to LDAP' >+ parser = OptionParser(usage=usage, description=description) >+ options, args = parser.parse_args() >+ try: >+ old_id, new_id = args >+ except ValueError: >+ parser.print_usage() >+ sys.exit(1) >+ try: >+ rename(old_id, new_id) >+ except Exception as exc: >+ sys.stderr.write('univention-rename-app did not succeed.\n') >+ sys.exit(1) >+ else: >+ sys.stdout.write('Rename done.\n') >+ sys.exit(0) >+ >Index: debian/univention-management-console-module-appcenter.install >=================================================================== >--- debian/univention-management-console-module-appcenter.install (Revision 47811) >+++ debian/univention-management-console-module-appcenter.install (Arbeitskopie) >@@ -2,3 +2,4 @@ > ldap/*.schema usr/share/univention-management-console-module-appcenter > ldap/*.acl usr/share/univention-management-console-module-appcenter > scripts/univention-register-apps usr/sbin/ >+scripts/univention-rename-app usr/sbin/ >Index: debian/univention-management-console-module-appcenter.postinst >=================================================================== >--- debian/univention-management-console-module-appcenter.postinst (Revision 47751) >+++ debian/univention-management-console-module-appcenter.postinst (Arbeitskopie) >@@ -70,5 +70,9 @@ > " > fi > >+if dpkg --compare-versions "$2" lt-nl 3.0.51-3; then >+ /usr/sbin/univention-rename-app tine20org tine20 >+fi >+ > exit 0 > >Index: umc/python/appcenter/app_center.py >=================================================================== >--- umc/python/appcenter/app_center.py (Revision 48083) >+++ umc/python/appcenter/app_center.py (Arbeitskopie) >@@ -341,12 +341,14 @@ > if self.get(ikey): > self._options[ikey] = urljoin('%s/' % self.get_metainf_url(), self.get(ikey)) > >+ # versions will be set to something meaningful by Application.all() >+ self.versions = [self] >+ > # save important meta data >- self.id = self._options['id'] = self._options['id'].lower() >+ self.id = self.ldap_id = self.ldap_container = None >+ self.set_id(self._options['id']) > self.name = self._options['name'] > self.version = self._options['version'] >- self.ldap_container = 'cn=%s,cn=apps,cn=univention,%s' % (self.id, ucr.get('ldap/base')) >- self.ldap_id = '%s_%s' % (self.id, self.version) > > # get the name of the component > m = self._reg_component_id.match(url) >@@ -368,6 +370,18 @@ > # is set by all() > self.candidate = None > >+ def set_id(self, app_id, recursive=True): >+ if recursive: >+ for iapp in self.versions: >+ # will call also for self! >+ iapp.set_id(app_id, recursive=False) >+ else: >+ app_id = app_id.lower() >+ self.id = app_id >+ self._options['id'] = app_id >+ self.ldap_id = '%s_%s' % (self.id, self.get('version')) >+ self.ldap_container = 'cn=%s,cn=apps,cn=univention,%s' % (self.id, ucr.get('ldap/base')) >+ > def get(self, key): > '''Helper function to access configuration elements of the application's .ini > file. If element is not given, returns (for string elements) an empty string. >Index: umc/js/de.po >=================================================================== >--- umc/js/de.po (Revision 48029) >+++ umc/js/de.po (Arbeitskopie) >@@ -1019,9 +1019,6 @@ > #~ "aus, <em>nachdem</em> Sie die Applikation auf diesem System installiert " > #~ "haben." > >-#~ msgid "Buy" >-#~ msgstr "Kaufen" >- > #~ msgid "Categories" > #~ msgstr "Kategorien" >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
|
Diff
Attachments on
bug 33728
:
5802
| 5803