Add <Requires><Action> ... support to scenario api
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user