Univention Bugzilla – Attachment 10463 Details for
Bug 51865
The univention updater needs to be updated in UCS 4.4 to find UCS 5.0
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
POC Upgrade
0001-Upgrade.patch (text/plain), 6.59 KB, created by
Jürn Brodersen
on 2020-08-21 09:35:38 CEST
(
hide
)
Description:
POC Upgrade
Filename:
MIME Type:
Creator:
Jürn Brodersen
Created:
2020-08-21 09:35:38 CEST
Size:
6.59 KB
patch
obsolete
>From 8c1a008fe20dba4bf6697ea1ddf75893ad584574 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?J=C3=BCrn=20Brodersen?= <brodersen@univention.de> >Date: Wed, 19 Aug 2020 16:17:33 +0200 >Subject: [PATCH] Upgrade >Organization: Univention GmbH, Bremen, Germany > >--- > base/univention-updater/debian/changelog | 6 +++ > .../modules/univention/updater/tools.py | 48 ++++++++++++++++--- > .../python/univention-updater | 8 ++-- > 3 files changed, 53 insertions(+), 9 deletions(-) > >diff --git a/base/univention-updater/debian/changelog b/base/univention-updater/debian/changelog >index fdf428b7fd..8b1bdc55ff 100644 >--- a/base/univention-updater/debian/changelog >+++ b/base/univention-updater/debian/changelog >@@ -1,3 +1,9 @@ >+univention-updater (14.0.2-17) unstable; urgency=medium >+ >+ * test upgrade >+ >+ -- Jürn Brodersen <brodersen@univention.de> Wed, 19 Aug 2020 14:19:18 +0200 >+ > univention-updater (14.0.2-16) unstable; urgency=medium > > * Bug #46465: call postup.sh after setting version/version >diff --git a/base/univention-updater/modules/univention/updater/tools.py b/base/univention-updater/modules/univention/updater/tools.py >index 68916c84b1..916adefe49 100644 >--- a/base/univention-updater/modules/univention/updater/tools.py >+++ b/base/univention-updater/modules/univention/updater/tools.py >@@ -71,6 +71,7 @@ import tempfile > import shutil > import logging > import atexit >+import json > try: > from typing import Any, AnyStr, Dict, Generator, Iterable, Iterator, List, Optional, Sequence, Set, Tuple, Type, Union # noqa F401 > except ImportError: >@@ -295,6 +296,21 @@ class UCSRepoPool(_UCSRepo): > return "clean %s%s" % (server, super(UCSRepoPool, self)._format(fmt)) > > >+class UCSRepoPoolUCS500(_UCSRepo): >+ """ >+ Minimal ucs500 repo implementation for get_sh_files. >+ """ >+ >+ def __init__(self, **kw): >+ # type: (**Any) -> None >+ kw.setdefault('version', UCS_Version.FORMAT) >+ kw.setdefault('patch', UCS_Version.FULLFORMAT) >+ super(UCSRepoPoolUCS500, self).__init__(**kw) >+ >+ def path(self, filename): >+ return "dists/ucs500/" + filename >+ >+ > class UCSRepoPoolNoArch(_UCSRepo): > """ > Flat Debian APT repository without explicit architecture subdirectory. >@@ -956,11 +972,28 @@ class UniventionUpdater(object): > if major < 99: > yield {'major': major + 1, 'minor': 0, 'patchlevel': 0} > >+ def is_ucs500_released(): >+ # type: () -> bool >+ _code, _size, releases = self.server.access(None, 'releases.json', get=True) >+ try: >+ majors = json.loads(releases)['releases'] >+ minors = [r for r in majors if r['major'] == 5][0]['minors'] >+ patchlevels = [r for r in minors if r['minor'] == 0][0]['patchlevels'] >+ if [r for r in patchlevels if r['patchlevel'] == 0]: >+ return True >+ except (ValueError, KeyError) as exc: >+ ud.debug(ud.NETWORK, ud.ALL, "releases.json malformed: %s" % exc) >+ return False >+ > for ver in versions(version.major, version.minor, version.patchlevel): > repo = UCSRepoPool(prefix=self.server, part='maintained', **ver) > self.log.info('Checking for version %s', repo) > try: >- assert self.server.access(repo) >+ if ver['major'] > 4 and version.major == 4: >+ if not is_ucs500_released(): >+ return None >+ else: >+ assert self.server.access(repo) > self.log.info('Found version %s', repo.path()) > failed = set() > for component in components: >@@ -1050,10 +1083,13 @@ class UniventionUpdater(object): > mmp_version = UCS_Version(version) > current_components = self.get_current_components() > >- result = [ >- ver.deb(server) >- for server, ver in self._iterate_version_repositories(mmp_version, mmp_version, self.parts, self.architectures) >- ] >+ if mmp_version.major > 4 and mmp_version.minor == 0 and mmp_version.patchlevel == 0: >+ result = ['deb {server} ucs500 main'.format(server=self.server)] >+ else: >+ result = [ >+ ver.deb(server) >+ for server, ver in self._iterate_version_repositories(mmp_version, mmp_version, self.parts, self.architectures) >+ ] > for component in components: > repos = [] # type: List[str] > try: >@@ -1901,7 +1937,7 @@ class UniventionUpdater(object): > os.chmod(name, 0o744) > if size == len(script): > ud.debug(ud.NETWORK, ud.INFO, "%s saved to %s" % (uri, name)) >- if struct.part.endswith('/component'): >+ if hasattr(struct, 'part') and struct.part.endswith('/component'): > comp[phase].append((name, str(struct.patch))) > else: > main[phase].append((name, str(struct.patch))) >diff --git a/base/univention-updater/python/univention-updater b/base/univention-updater/python/univention-updater >index ab43bbaa47..8e3eba9466 100755 >--- a/base/univention-updater/python/univention-updater >+++ b/base/univention-updater/python/univention-updater >@@ -73,7 +73,7 @@ from univention.admindiary.events import UPDATE_STARTED, UPDATE_FINISHED_SUCCESS > > from univention.updater.errors import PreconditionError, ConfigurationError, RequiredComponentError, VerificationError, DownloadError > from univention.updater.ucs_version import UCS_Version >-from univention.updater.tools import UniventionUpdater, LocalUpdater >+from univention.updater.tools import UniventionUpdater, LocalUpdater, UCSRepoPoolUCS500 > from univention.updater.locking import UpdaterLock > from univention.updater.commands import cmd_update, cmd_dist_upgrade > >@@ -538,8 +538,10 @@ def main(): > add_temporary_sources_list(updater.release_update_temporary_sources_list(nextversion)) > try: > phase = 'preup' >- >- rel = updater._iterate_version_repositories(new_version, new_version, ('maintained',), []) >+ if new_version.major > 4 and new_version.minor == 0 and new_version.patchlevel == 0: >+ rel = [(updater.server, UCSRepoPoolUCS500(major=new_version.major, minor=new_version.minor, patchlevel=new_version.patchlevel))] >+ else: >+ rel = updater._iterate_version_repositories(new_version, new_version, ('maintained',), []) > > components = updater.get_components() > # components = filter(lambda c: 'current' in ucr.get('repository/online/component/%s/version' % c, '').split(','), components) >-- >2.25.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 51865
: 10463