Skip to content

Commit

Permalink
Kernel window: Remove obsolete code
Browse files Browse the repository at this point in the history
  • Loading branch information
clefebvre committed May 8, 2018
1 parent 5e84645 commit 14d5178
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 33 deletions.
21 changes: 1 addition & 20 deletions usr/lib/linuxmint/mintUpdate/checkKernels.py
Expand Up @@ -9,24 +9,9 @@
current_version = subprocess.check_output("uname -r", shell = True).decode("utf-8").replace("-generic", "").strip()

cache = apt.Cache()

recommended_kernel = None
if 'linux-kernel-generic' in cache:
recommended_kernel = cache['linux-kernel-generic'].candidate.version
recommended_image = None
if 'linux-image-generic' in cache:
try:
recommended_image = cache['linux-image-generic'].candidate.version
versions = recommended_image.split(".")
recommended_image = "%s.%s.%s-%s" % (versions[0], versions[1], versions[2], versions[3])
except:
pass #best effort

for pkg in cache:
installed = 0
used = 0
recommended_stability = 0
recommended_security = 0
installable = 0
pkg_version = ""
package = pkg.name
Expand All @@ -41,10 +26,6 @@
pkg_version = pkg.candidate.version
if version == current_version:
used = 1
if recommended_kernel is not None and version in recommended_kernel:
recommended_stability = 1
if recommended_image is not None and recommended_image in version:
recommended_security = 1

# provide a representation of the version which helps sorting the kernels
version_array = pkg_version.replace("-", ".").split(".")
Expand All @@ -56,7 +37,7 @@
element = "0%s" % element
versions.append(element)

resultString = "KERNEL###%s###%s###%s###%s###%s###%s###%s###%s" % (".".join(versions), version, pkg_version, installed, used, recommended_stability, recommended_security, installable)
resultString = "KERNEL###%s###%s###%s###%s###%s###%s" % (".".join(versions), version, pkg_version, installed, used, installable)
print(resultString.encode("utf-8").decode('ascii', 'xmlcharrefreplace'))

except:
Expand Down
15 changes: 2 additions & 13 deletions usr/lib/linuxmint/mintUpdate/kernelwindow.py
Expand Up @@ -241,29 +241,18 @@ def __init__(self, application):
pages_needed = []
for kernel in kernels:
values = kernel.split('###')
if len(values) == 9:
if len(values) == 7:
status = values[0]
if status != "KERNEL":
continue
(status, version_id, version, pkg_version, installed, used, recommended_stability, recommended_security, installable) = values
(status, version_id, version, pkg_version, installed, used, installable) = values
installed = (installed == "1")
used = (used == "1")
title = ""
if used:
title = _("Active")
elif installed:
title = _("Installed")
recommend = None
# if recommended_security == "1":
# recommend = _("Recommended for security")
# elif recommended_stability == "1":
# recommend = _("Recommended for stability")

if recommend is not None:
if title == "":
title = recommend
else:
title = "%s - %s" % (recommend, title)

installable = (installable == "1")
label = version
Expand Down

0 comments on commit 14d5178

Please sign in to comment.