From aab6c1cbddad82d5f08e49a071f822b1f172d08b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fatih=20A=C5=9F=C4=B1c=C4=B1?= Date: Sat, 25 Sep 2010 20:17:04 +0000 Subject: [PATCH] specfile: Replace "current" string in release/version values With this feature, it is not necessary to hardcode versions/releases used in inter-dependencies. xorg-server-common 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. --- pisi/specfile.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/pisi/specfile.py b/pisi/specfile.py index 72d48a83..75014b05 100644 --- a/pisi/specfile.py +++ b/pisi/specfile.py @@ -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