Add support to specify update types and actions for each sub-package
Following is an example to specify "security" type and
"reverseDependencyUpdate" action for different sub-packages.
<Update release="30">
<Date>2010-02-17</Date>
<Version>2.4.18</Version>
<Comment> ... </Comment>
<Type package="libdrm-intel">security</Type>
<Requires>
<Action package="libdrm-nouveau">reverseDependencyUpdate</Action>
</Requires>
<Name>Fatih Aşıcı</Name>
<Email>fatih@pardus.org.tr</Email>
</Update>
It is also possible to specify different targets for the actions. In the
following example, new release of mod_php package requires a restart of apache
service.
<Update release="30">
<Date>2010-02-17</Date>
<Version>5.2.13</Version>
<Comment> ... </Comment>
<Requires>
<Action package="mod_php" targetPackage="apache">serviceRestart</Action>
</Requires>
<Name>Fatih Aşıcı</Name>
<Email>fatih@pardus.org.tr</Email>
</Update>
This commit is contained in:
+5
-9
@@ -605,16 +605,12 @@ def get_package_requirements(packages):
|
|||||||
except Exception: #FIXME: Should catch RepoItemNotFound exception
|
except Exception: #FIXME: Should catch RepoItemNotFound exception
|
||||||
pass
|
pass
|
||||||
|
|
||||||
(version, release, build) = installdb.get_version(i_pkg)
|
version, release, build = installdb.get_version(i_pkg)
|
||||||
release = int(release)
|
pkg_types, pkg_actions = pkg.get_update_types_and_actions(release)
|
||||||
|
|
||||||
for update in pkg.history:
|
for action_name, action_package in pkg_actions:
|
||||||
if int(update.release) <= release:
|
if action_name in actions:
|
||||||
break
|
requirements[action_name].append(pkg.name)
|
||||||
|
|
||||||
for action in update.required_actions():
|
|
||||||
if action in actions:
|
|
||||||
requirements[action].append(pkg.name)
|
|
||||||
|
|
||||||
return requirements
|
return requirements
|
||||||
|
|
||||||
|
|||||||
@@ -514,22 +514,19 @@ class Install(AtomicOperation):
|
|||||||
if self.config_later:
|
if self.config_later:
|
||||||
self.installdb.mark_pending(self.pkginfo.name)
|
self.installdb.mark_pending(self.pkginfo.name)
|
||||||
|
|
||||||
# get update history
|
# need service or system restart?
|
||||||
if self.installdb.has_package(self.pkginfo.name):
|
if self.installdb.has_package(self.pkginfo.name):
|
||||||
(version, release, build) = self.installdb.get_version(self.pkginfo.name)
|
(version, release, build) = self.installdb.get_version(self.pkginfo.name)
|
||||||
updates = []
|
types, actions = self.pkginfo.get_update_types_and_actions(release)
|
||||||
for update in self.pkginfo.history:
|
|
||||||
if update.release == release:
|
|
||||||
break
|
|
||||||
updates.append(update)
|
|
||||||
else:
|
else:
|
||||||
updates = self.pkginfo.history
|
types, actions = self.pkginfo.get_update_types_and_actions("1")
|
||||||
|
|
||||||
# need service or system restart?
|
for action_name, action_package in actions:
|
||||||
if pisi.util.any(lambda u:"serviceRestart" in u.required_actions(), updates):
|
package_name = action_package or self.pkginfo.name
|
||||||
pisi.api.add_needs_restart(self.pkginfo.name)
|
if action_name == "serviceRestart":
|
||||||
if pisi.util.any(lambda u:"systemRestart" in u.required_actions(), updates):
|
pisi.api.add_needs_restart(package_name)
|
||||||
pisi.api.add_needs_reboot(self.pkginfo.name)
|
elif action_name == "systemRestart":
|
||||||
|
pisi.api.add_needs_reboot(package_name)
|
||||||
|
|
||||||
# filesdb
|
# filesdb
|
||||||
self.filesdb.add_files(self.metadata.package.name, self.files)
|
self.filesdb.add_files(self.metadata.package.name, self.files)
|
||||||
|
|||||||
@@ -57,14 +57,8 @@ def find_upgrades(packages, replaces):
|
|||||||
(version, release, build, distro, distro_release) = installdb.get_version_and_distro_release(i_pkg)
|
(version, release, build, distro, distro_release) = installdb.get_version_and_distro_release(i_pkg)
|
||||||
|
|
||||||
if security_only:
|
if security_only:
|
||||||
security_update = False
|
types, actions = pkg.get_update_types_and_actions(release)
|
||||||
for update in pkg.history:
|
if "security" not in types:
|
||||||
if update.release == release:
|
|
||||||
break
|
|
||||||
if update.type == "security":
|
|
||||||
security_update = True
|
|
||||||
break
|
|
||||||
if not security_update:
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if pkg.distribution == distro and \
|
if pkg.distribution == distro and \
|
||||||
@@ -256,17 +250,18 @@ def plan_upgrade(A, force_replaced=True, replaces=None):
|
|||||||
for x in B:
|
for x in B:
|
||||||
pkg = packagedb.get_package(x)
|
pkg = packagedb.get_package(x)
|
||||||
(version, release, build) = installdb.get_version(x)
|
(version, release, build) = installdb.get_version(x)
|
||||||
for update in pkg.history:
|
types, actions = pkg.get_update_types_and_actions(release)
|
||||||
if update.release == release:
|
|
||||||
break
|
|
||||||
|
|
||||||
if "reverseDependencyUpdate" in update.required_actions():
|
for action_name, action_package in actions:
|
||||||
for name, dep in packagedb.get_rev_deps(x):
|
if action_name == "reverseDependencyUpdate":
|
||||||
|
target_package = action_package or x
|
||||||
|
for name, dep in packagedb.get_rev_deps(target_package):
|
||||||
if name in G_f.vertices() or not is_upgradable(name):
|
if name in G_f.vertices() or not is_upgradable(name):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
Bp.add(name)
|
Bp.add(name)
|
||||||
G_f.add_plain_dep(name, x)
|
G_f.add_plain_dep(name, target_package)
|
||||||
|
|
||||||
B = Bp
|
B = Bp
|
||||||
|
|
||||||
if ctx.config.get_option('debug'):
|
if ctx.config.get_option('debug'):
|
||||||
|
|||||||
@@ -118,12 +118,6 @@ class Update:
|
|||||||
t_Email = [autoxml.String, autoxml.optional]
|
t_Email = [autoxml.String, autoxml.optional]
|
||||||
t_Requires = [[Action], autoxml.optional]
|
t_Requires = [[Action], autoxml.optional]
|
||||||
|
|
||||||
def required_actions(self):
|
|
||||||
if self.requires != None:
|
|
||||||
return map(lambda x:str(x), self.requires)
|
|
||||||
else:
|
|
||||||
return []
|
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
s = self.date
|
s = self.date
|
||||||
s += ", ver=" + self.version
|
s += ", ver=" + self.version
|
||||||
|
|||||||
Reference in New Issue
Block a user