From bb2a4c9d69619cccdf1065a389f325eb8c6d01c3 Mon Sep 17 00:00:00 2001 From: Faik Uygur Date: Fri, 4 Dec 2009 09:16:04 +0000 Subject: [PATCH] Add ... support to scenario api --- pisi/scenarioapi/package.py | 9 +++++++-- pisi/scenarioapi/pspec.py | 9 +++++++-- pisi/scenarioapi/withops.py | 5 ++++- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/pisi/scenarioapi/package.py b/pisi/scenarioapi/package.py index f8ce6aa5..c4b884d2 100644 --- a/pisi/scenarioapi/package.py +++ b/pisi/scenarioapi/package.py @@ -69,9 +69,14 @@ class Package: return os.path.basename(found[0]) def version_bump(self, *args): + self.pspec.update_history(self.date, self.version) + for _with in args: if _with.types == CONFLICT and _with.action == ADDED: self.pspec.add_conflicts(_with.data) + + if _with.types == REQUIRES and _with.action == ADDED: + self.pspec.add_requires(_with.data) if _with.types == CONFLICT and _with.action == REMOVED: self.pspec.remove_conflicts(_with.data) @@ -84,8 +89,8 @@ class Package: if _with.types == VERSION and _with.action == INIT: self.version = _with.data - - self.pspec.update_history(self.date, self.version) + + self.pspec.write() self.actions.name = self.name self.actions.write() self.create_pisi() diff --git a/pisi/scenarioapi/pspec.py b/pisi/scenarioapi/pspec.py index 092a213b..98d05b20 100644 --- a/pisi/scenarioapi/pspec.py +++ b/pisi/scenarioapi/pspec.py @@ -10,7 +10,7 @@ # Please read the COPYING file. # -from pisi.specfile import SpecFile, Package, Update, Path +from pisi.specfile import SpecFile, Package, Update, Path, Action from pisi.dependency import Dependency from pisi.conflict import Conflict from pisi.pxml.autoxml import LocalText @@ -101,7 +101,12 @@ class Pspec: self.update = new self.pspec.history.append(self.update) self.pspec.history.reverse() - self.write() + + def add_requires(self, actions): + for action in actions: + new = Action() + new.action = action + self.pspec.history[0].requires.append(new) def set_source(self, homepage, summary, description, license, partOf): self.pspec.source.name = self.name diff --git a/pisi/scenarioapi/withops.py b/pisi/scenarioapi/withops.py index dd1eb634..4bb7baad 100644 --- a/pisi/scenarioapi/withops.py +++ b/pisi/scenarioapi/withops.py @@ -12,7 +12,7 @@ # ADDED, REMOVED, INIT = range(3) -PARTOF, VERSION, CONFLICT, DEPENDENCY = range(4) +PARTOF, VERSION, CONFLICT, DEPENDENCY, REQUIRES = range(5) class With: def __init__(self): @@ -34,6 +34,9 @@ def with_version(version): def with_conflicts(*cons): return with_action(CONFLICT, INIT, cons) +def with_requiring_actions(*action): + return with_action(REQUIRES, ADDED, action) + def with_dependencies(*deps): return with_action(DEPENDENCY, INIT, deps)