Add package name to needs{Restart,Reboot} list if an update requires one of these actions.

IMHO, update_databases() method in Install class is suitable for this operation, feel free to move/refactor code if I'm wrong.
This commit is contained in:
Bahadır Kandemir
2009-12-08 15:20:35 +00:00
parent 28b9de601b
commit 26d14982c7
2 changed files with 17 additions and 0 deletions
+4
View File
@@ -1,3 +1,7 @@
2009-12-08 Bahadır Kandemir <bahadir@pardus.org.tr>
* pisi/atomicoperations.py: Add package name to needs{Restart,Reboot}
list if an update requires one of these actions.
2009-12-07 Bahadır Kandemir <bahadir@pardus.org.tr>
* pisi/api.py, pisi/db/install.db, pisi/constants.py: Install DB
changes and API methods for needs{Restart,Reboot} feature.
+13
View File
@@ -449,6 +449,19 @@ class Install(AtomicOperation):
if self.config_later:
self.installdb.mark_pending(self.pkginfo.name)
# get update history
if self.installdb.has_package(self.pkginfo.name):
(version, release, build) = self.installdb.get_version(self.pkginfo.name)
updates = [i for i in self.pkginfo.history if pisi.version.Version(i.release) > pisi.version.Version(release)]
else:
updates = self.pkginfo.history
# need service or system restart?
if pisi.util.any(lambda u:"serviceRestart" in u.required_actions(), updates):
pisi.api.add_needs_restart(self.pkginfo.name)
if pisi.util.any(lambda u:"systemRestart" in u.required_actions(), updates):
pisi.api.add_needs_reboot(self.pkginfo.name)
# filesdb
self.filesdb.add_files(self.metadata.package.name, self.files)