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:
Fatih Aşıcı
2010-03-18 08:04:31 +00:00
parent 5e579badbc
commit 4d0d4f33f4
4 changed files with 23 additions and 41 deletions
+5 -9
View File
@@ -605,16 +605,12 @@ def get_package_requirements(packages):
except Exception: #FIXME: Should catch RepoItemNotFound exception
pass
(version, release, build) = installdb.get_version(i_pkg)
release = int(release)
version, release, build = installdb.get_version(i_pkg)
pkg_types, pkg_actions = pkg.get_update_types_and_actions(release)
for update in pkg.history:
if int(update.release) <= release:
break
for action in update.required_actions():
if action in actions:
requirements[action].append(pkg.name)
for action_name, action_package in pkg_actions:
if action_name in actions:
requirements[action_name].append(pkg.name)
return requirements
+9 -12
View File
@@ -514,22 +514,19 @@ class Install(AtomicOperation):
if self.config_later:
self.installdb.mark_pending(self.pkginfo.name)
# get update history
# need service or system restart?
if self.installdb.has_package(self.pkginfo.name):
(version, release, build) = self.installdb.get_version(self.pkginfo.name)
updates = []
for update in self.pkginfo.history:
if update.release == release:
break
updates.append(update)
types, actions = self.pkginfo.get_update_types_and_actions(release)
else:
updates = self.pkginfo.history
types, actions = self.pkginfo.get_update_types_and_actions("1")
# 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)
for action_name, action_package in actions:
package_name = action_package or self.pkginfo.name
if action_name == "serviceRestart":
pisi.api.add_needs_restart(package_name)
elif action_name == "systemRestart":
pisi.api.add_needs_reboot(package_name)
# filesdb
self.filesdb.add_files(self.metadata.package.name, self.files)
+9 -14
View File
@@ -57,14 +57,8 @@ def find_upgrades(packages, replaces):
(version, release, build, distro, distro_release) = installdb.get_version_and_distro_release(i_pkg)
if security_only:
security_update = False
for update in pkg.history:
if update.release == release:
break
if update.type == "security":
security_update = True
break
if not security_update:
types, actions = pkg.get_update_types_and_actions(release)
if "security" not in types:
continue
if pkg.distribution == distro and \
@@ -256,17 +250,18 @@ def plan_upgrade(A, force_replaced=True, replaces=None):
for x in B:
pkg = packagedb.get_package(x)
(version, release, build) = installdb.get_version(x)
for update in pkg.history:
if update.release == release:
break
types, actions = pkg.get_update_types_and_actions(release)
if "reverseDependencyUpdate" in update.required_actions():
for name, dep in packagedb.get_rev_deps(x):
for action_name, action_package in actions:
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):
continue
Bp.add(name)
G_f.add_plain_dep(name, x)
G_f.add_plain_dep(name, target_package)
B = Bp
if ctx.config.get_option('debug'):
-6
View File
@@ -118,12 +118,6 @@ class Update:
t_Email = [autoxml.String, 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):
s = self.date
s += ", ver=" + self.version