| |
@@ -107,9 +107,9 @@
|
| |
del self[key]
|
| |
self[key] = m
|
| |
if key in mods:
|
| |
- self[key] += sorted(mods[key], key = lambda mod: (mod.mmd.version, int(mod.mmd.release)))
|
| |
+ self[key] += sorted(mods[key], key = lambda mod: (mod.mmd.stream, int(mod.mmd.version)))
|
| |
else:
|
| |
- self[key] = sorted(mods[key], key = lambda mod: (mod.mmd.version, int(mod.mmd.release)))
|
| |
+ self[key] = sorted(mods[key], key = lambda mod: (mod.mmd.stream, int(mod.mmd.version)))
|
| |
|
| |
def enable(self, name, profiles):
|
| |
"""
|
| |
@@ -159,8 +159,8 @@
|
| |
if not enabled_mod:
|
| |
continue
|
| |
|
| |
- available_mods = self.get_modules(name, enabled_mod.mmd.version)
|
| |
- available_mods = sorted(available_mods, key = lambda mod: int(mod.mmd.release))
|
| |
+ available_mods = self.get_modules(name, enabled_mod.mmd.stream)
|
| |
+ available_mods = sorted(available_mods, key = lambda mod: int(mod.mmd.version))
|
| |
latest_mod = available_mods[-1]
|
| |
if latest_mod != enabled_mod:
|
| |
to_upgrade.add_module(latest_mod, False)
|
| |
@@ -179,7 +179,7 @@
|
| |
if not enabled_mod:
|
| |
continue
|
| |
available_mods = self.get_modules(name)
|
| |
- available_mods = sorted(available_mods, key = lambda mod: (mod.mmd.version, int(mod.mmd.release)))
|
| |
+ available_mods = sorted(available_mods, key = lambda mod: (mod.mmd.stream, int(mod.mmd.version)))
|
| |
latest_mod = available_mods[-1]
|
| |
if latest_mod != enabled_mod:
|
| |
to_upgrade.add_module(latest_mod, False)
|
| |
@@ -195,8 +195,8 @@
|
| |
if not enabled_mod:
|
| |
raise fm.exceptions.DependencyError("Module {} is not enabled".format(name))
|
| |
|
| |
- available_mods = self.get_modules(name, enabled_mod.mmd.version)
|
| |
- available_mods = sorted(available_mods, key = lambda mod: int(mod.mmd.release))
|
| |
+ available_mods = self.get_modules(name, enabled_mod.mmd.stream)
|
| |
+ available_mods = sorted(available_mods, key = lambda mod: int(mod.mmd.version))
|
| |
latest_mod = available_mods[-1]
|
| |
|
| |
resolver = FmModulesResolver(self)
|
| |
@@ -210,9 +210,9 @@
|
| |
if len(lst) > 2:
|
| |
try:
|
| |
int(lst[-2][0])
|
| |
- release = str(int(lst[-1]))
|
| |
- version = lst[-2]
|
| |
- return '-'.join(lst[:-2]), version, release
|
| |
+ version = str(int(lst[-1]))
|
| |
+ stream = lst[-2]
|
| |
+ return '-'.join(lst[:-2]), stream, version
|
| |
except:
|
| |
pass
|
| |
|
| |
@@ -231,13 +231,13 @@
|
| |
Rebases the module named `name` to version defined by `nvr.
|
| |
"""
|
| |
|
| |
- name, version, release = self._name_to_nvr(nvr)
|
| |
+ name, stream, version = self._name_to_nvr(nvr)
|
| |
enabled_mod = self.get_enabled_module(name)
|
| |
if not enabled_mod:
|
| |
raise fm.exceptions.DependencyError("Module {} is not enabled".format(name))
|
| |
|
| |
- available_mods = self.get_modules(name, version, release)
|
| |
- available_mods = sorted(available_mods, key = lambda mod: (mod.mmd.version, int(mod.mmd.release)))
|
| |
+ available_mods = self.get_modules(name, stream, version)
|
| |
+ available_mods = sorted(available_mods, key = lambda mod: (mod.mmd.stream, int(mod.mmd.version)))
|
| |
latest_mod = available_mods[-1]
|
| |
|
| |
resolver = FmModulesResolver(self)
|
| |
@@ -290,8 +290,8 @@
|
| |
# Modules instance and remove them from cache.
|
| |
for mods in cached_mods.values():
|
| |
for mod in mods:
|
| |
- our_modules = self.get_modules(mod.name, mod.mmd.version,
|
| |
- mod.mmd.release)
|
| |
+ our_modules = self.get_modules(mod.name, mod.mmd.stream,
|
| |
+ mod.mmd.version)
|
| |
if not our_modules or len(our_modules) == 0:
|
| |
self.available_cache.remove(mod)
|
| |
|
| |
@@ -309,9 +309,9 @@
|
| |
if cache and mod.mmd and not self.available_cache.is_valid(mod) and not self.disable_cache:
|
| |
self.available_cache.store(mod)
|
| |
|
| |
- def get_modules(self, name, version = None, release = None):
|
| |
+ def get_modules(self, name, stream = None, version = None):
|
| |
"""
|
| |
- Returns all modules matching the `name` and `version` or `release`
|
| |
+ Returns all modules matching the `name` and `stream` or `version`
|
| |
when defined.
|
| |
"""
|
| |
|
| |
@@ -320,9 +320,9 @@
|
| |
|
| |
mods = []
|
| |
for mod in self[name]:
|
| |
- if version and mod.mmd.version != version:
|
| |
+ if stream and mod.mmd.stream != stream:
|
| |
continue
|
| |
- if release and mod.mmd.release != release:
|
| |
+ if version and mod.mmd.version != version:
|
| |
continue
|
| |
mods.append(mod)
|
| |
|
| |
@@ -350,12 +350,12 @@
|
| |
"""
|
| |
Returns full description of all modules matching the specified `nvr`.
|
| |
"""
|
| |
- name, version, release = self._name_to_nvr(nvr)
|
| |
- mods = self.get_modules(name, version, release)
|
| |
+ name, stream, version = self._name_to_nvr(nvr)
|
| |
+ mods = self.get_modules(name, stream, version)
|
| |
if not mods or len(mods) == 0:
|
| |
raise fm.exceptions.DependencyError("Unknown module {}".format(nvr))
|
| |
|
| |
- mods = sorted(mods, key = lambda mod: (mod.mmd.version, int(mod.mmd.release)))
|
| |
+ mods = sorted(mods, key = lambda mod: (mod.mmd.stream, int(mod.mmd.version)))
|
| |
|
| |
ret = ""
|
| |
did_fetch = False
|
| |
@@ -378,14 +378,14 @@
|
| |
# Get the maximum width of the text we will show in each column
|
| |
# of output.
|
| |
max_name_width = max(len(word) for word in self.keys()) + 4 # padding
|
| |
- max_vr_width = (max(len(mod.mmd.version) + 1 +
|
| |
- len(mod.mmd.release) for mods in self.values()
|
| |
+ max_vr_width = (max(len(mod.mmd.stream) + 1 +
|
| |
+ len(str(mod.mmd.version)) for mods in self.values()
|
| |
for mod in mods) + 4) # padding
|
| |
|
| |
ret = ""
|
| |
for mods in self.values():
|
| |
for mod in mods:
|
| |
- vr = mod.mmd.version + "-" + mod.mmd.release
|
| |
+ vr = mod.mmd.stream + "-" + str(mod.mmd.version)
|
| |
|
| |
# Show output in 3 columns...
|
| |
ret += mod.name.ljust(max_name_width)
|
| |
This repo still assumes old version of python-modulemd with name-version-release. I wanted to use
commands with python3-modulemd-1.0.2 so I modified the code a bit. I think that it is a good idea to share it with you, even though it is not complete support for all commands. Maybe someone (maybe even myself) can continue on it. Or we can throw it off.