added security package mark

pull/2/head
Hans P. Möller 4 years ago
parent 131b40b2b4
commit da74c198e2

1
debian/changelog vendored

@ -2,6 +2,7 @@ lubuntu-update-notifier (0.4dev) UNRELEASED; urgency=medium
* Added internationalization support. * Added internationalization support.
* Added packages version info. * Added packages version info.
* Added security package mark.
-- Hans P Möller <hmollercl@lubuntu.me> Sat, 12 Sep 2020 13:59:25 -0300 -- Hans P Möller <hmollercl@lubuntu.me> Sat, 12 Sep 2020 13:59:25 -0300

@ -0,0 +1 @@
./lubuntu-notifier.py -u 0 -s 0 -p ./lubuntu-upgrader

@ -27,10 +27,28 @@ import gettext
from PyQt5.QtWidgets import (QWidget, QApplication, QLabel, QDialogButtonBox, from PyQt5.QtWidgets import (QWidget, QApplication, QLabel, QDialogButtonBox,
QHBoxLayout, QVBoxLayout, QTreeWidget, QHBoxLayout, QVBoxLayout, QTreeWidget,
QTreeWidgetItem) QTreeWidgetItem, QHeaderView)
from PyQt5.QtCore import Qt from PyQt5.QtCore import Qt
from PyQt5.QtGui import QIcon from PyQt5.QtGui import QIcon
DISTRO = subprocess.check_output(
["lsb_release", "-c", "-s"],
universal_newlines=True).strip()
def isSecurityUpgrade(ver):
" check if the given version is a security update (or masks one) "
security_pockets = [("Ubuntu", "%s-security" % DISTRO),
("UbuntuESM", "%s-infra-security" % DISTRO),
("UbuntuESMApps", "%s-apps-security" % DISTRO),
("gNewSense", "%s-security" % DISTRO),
("Debian", "%s-updates" % DISTRO)]
for (file, index) in ver.file_list:
for origin, archive in security_pockets:
if (file.archive == archive and file.origin == origin):
return True
return False
class Dialog(QWidget): class Dialog(QWidget):
''' UI ''' ''' UI '''
@ -60,6 +78,13 @@ class Dialog(QWidget):
self.label.setAlignment(Qt.AlignHCenter) self.label.setAlignment(Qt.AlignHCenter)
self.tw = QTreeWidget() self.tw = QTreeWidget()
if self.security_upgrades > 0:
self.tw.setColumnCount(2)
self.tw.setHeaderLabels([_('Affected Packages'),
_('Security')])
self.tw.header().setSectionResizeMode(0, QHeaderView.Stretch)
self.tw.header().setStretchLastSection(False)
else:
self.tw.setColumnCount(1) self.tw.setColumnCount(1)
self.tw.setHeaderLabels([_('Affected Packages')]) self.tw.setHeaderLabels([_('Affected Packages')])
self.tw.setHeaderHidden(True) self.tw.setHeaderHidden(True)
@ -117,19 +142,26 @@ class Dialog(QWidget):
if len(pkg_install) > 0: if len(pkg_install) > 0:
toInstall = QTreeWidgetItem([_('Install')]) toInstall = QTreeWidgetItem([_('Install')])
for p in pkg_install: for p in pkg_install:
td_child = QTreeWidgetItem([p[0].name]) td_child = QTreeWidgetItem([p[0].name + " / "
+ p[1].ver_str])
if isSecurityUpgrade(p[1]):
td_child.setIcon(1, QIcon.fromTheme("security-high"))
toInstall.setIcon(1, QIcon.fromTheme("security-high"))
toInstall.addChild(td_child) toInstall.addChild(td_child)
td_child.addChild(QTreeWidgetItem([p[1].ver_str])) # td_child.addChild(QTreeWidgetItem([p[1].ver_str]))
toInstall.setIcon(0, toInstall.setIcon(0, QIcon.fromTheme(
QIcon.fromTheme("system-software-install")) "system-software-install"))
self.tw.addTopLevelItem(toInstall) self.tw.addTopLevelItem(toInstall)
if len(pkg_upgrade) > 0: if len(pkg_upgrade) > 0:
toUpgrade = QTreeWidgetItem([_('Upgrade')]) toUpgrade = QTreeWidgetItem([_('Upgrade')])
for p in pkg_upgrade: for p in pkg_upgrade:
td_child = QTreeWidgetItem([p[0].name]) td_child = QTreeWidgetItem(
[p[0].name + " / " + p[0].current_ver.ver_str +
" -> " + p[1].ver_str])
if isSecurityUpgrade(p[1]) or p[0].name == 'vlc-bin':
td_child.setIcon(1, QIcon.fromTheme("security-high"))
toUpgrade.setIcon(1, QIcon.fromTheme("security-high"))
toUpgrade.addChild(td_child) toUpgrade.addChild(td_child)
td_child.addChild(QTreeWidgetItem(
[p[0].current_ver.ver_str + " -> " + p[1].ver_str]))
toUpgrade.setIcon(0, QIcon.fromTheme("system-software-update")) toUpgrade.setIcon(0, QIcon.fromTheme("system-software-update"))
self.tw.addTopLevelItem(toUpgrade) self.tw.addTopLevelItem(toUpgrade)

@ -0,0 +1 @@
https://apt-team.pages.debian.net/python-apt/library/apt_pkg.html
Loading…
Cancel
Save