specfile: Replace "current" string in release/version values

With this feature, it is not necessary to hardcode versions/releases
used in inter-dependencies.

    <RuntimeDependencies>
        <Dependency release="current">xorg-server-common</Dependency>
    </RuntimeDependencies>

The "current" value will be replaced by the release of the source
package that this spec file defines. This is done when building
the package so that binary packages and index files do not include
"current" string.
This commit is contained in:
Fatih Aşıcı
2010-09-25 20:17:04 +00:00
parent 93a755e8dc
commit aab6c1cbdd
+19 -1
View File
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2005 - 2007, TUBITAK/UEKAE
# Copyright (C) 2005-2010, TUBITAK/UEKAE
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
@@ -392,6 +392,24 @@ class SpecFile(xmlfile.XmlFile):
t_Components = [ [component.Component], autoxml.optional, "Component"]
t_Groups = [ [group.Group], autoxml.optional, "Group"]
def decode_hook(self, node, errs, where):
current_version = self.history[0].version
current_release = self.history[0].release
for package in self.packages:
deps = package.packageDependencies + package.packageAnyDependencies
for dep in deps:
for attr_name, attr_value in dep.__dict__.items():
if attr_value != "current":
continue
if attr_name.startswith("version"):
dep.__dict__[attr_name] = current_version
elif attr_name.startswith("release"):
dep.__dict__[attr_name] = current_release
def getSourceVersion(self):
return self.history[0].version