* with_partof added. It is used as:
let_repo_had(HASHALOT, with_partof("system.base"))
But frankly, i don't like this with_partof idea. It is not
natural. I wished to do it like:
HASHALOT = "system/base/hashalot"
But it is much harder to implement. :(
This commit is contained in:
@@ -25,12 +25,13 @@ __trans = gettext.translation('pisi', fallback=True)
|
||||
_ = __trans.ugettext
|
||||
|
||||
class Package:
|
||||
def __init__(self, name, deps = [], cons = [], date = "2006-18-18", ver = "1.0"):
|
||||
def __init__(self, name, deps = [], cons = [], date = "2006-18-18", ver = "1.0", partOf="None"):
|
||||
self.name = name
|
||||
self.dependencies = deps
|
||||
self.conflicts = cons
|
||||
self.version = ver
|
||||
self.date = date
|
||||
self.partOf = partOf
|
||||
self.pspec = None
|
||||
self.actions = None
|
||||
self.create_package()
|
||||
@@ -40,7 +41,8 @@ class Package:
|
||||
|
||||
def create_package(self):
|
||||
pspec = Pspec(self.name, consts.pspec_path)
|
||||
pspec.set_source(consts.homepage, consts.summary % self.name, consts.description % self.name, consts.license)
|
||||
pspec.set_source(consts.homepage, consts.summary % self.name,
|
||||
consts.description % self.name, consts.license, self.partOf)
|
||||
pspec.set_packager(consts.packager_name, consts.packager_email)
|
||||
pspec.set_archive(consts.skel_sha1sum, consts.skel_type, consts.skel_uri)
|
||||
pspec.set_package(self.dependencies, self.conflicts)
|
||||
|
||||
@@ -91,11 +91,11 @@ class Pspec:
|
||||
self.pspec.history.reverse()
|
||||
self.write()
|
||||
|
||||
def set_source(self, homepage, summary, description, license):
|
||||
def set_source(self, homepage, summary, description, license, partOf):
|
||||
self.pspec.source.name = self.name
|
||||
self.pspec.source.homepage = homepage
|
||||
self.pspec.source.license = license
|
||||
self.pspec.source.partOf = "None"
|
||||
self.pspec.source.partOf = partOf
|
||||
self.pspec.source.summary = LocalText("Summary")
|
||||
self.pspec.source.description = LocalText("Description")
|
||||
self.pspec.source.summary["en"] = summary
|
||||
|
||||
@@ -29,6 +29,7 @@ def repo_added_package(package, *args):
|
||||
raise Exception(_("Repo already has package named %s.") % package)
|
||||
|
||||
version = "1.0"
|
||||
partOf = "None"
|
||||
dependencies = []
|
||||
conflicts = []
|
||||
|
||||
@@ -42,7 +43,10 @@ def repo_added_package(package, *args):
|
||||
if with.types == VERSION and with.action == INIT:
|
||||
version = with.data
|
||||
|
||||
repodb[package] = Package(package, dependencies, conflicts, ver=version)
|
||||
if with.types == PARTOF and with.action == INIT:
|
||||
partOf = with.data
|
||||
|
||||
repodb[package] = Package(package, dependencies, conflicts, ver=version, partOf=partOf)
|
||||
|
||||
def repo_removed_package(package):
|
||||
if not repodb.has_key(package):
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
# Authors: Faik Uygur <faik@pardus.org.tr>
|
||||
|
||||
ADDED, REMOVED, INIT = range(3)
|
||||
VERSION, CONFLICT, DEPENDENCY = range(3)
|
||||
PARTOF, VERSION, CONFLICT, DEPENDENCY = range(4)
|
||||
|
||||
class with:
|
||||
def __init__(self):
|
||||
@@ -26,6 +26,9 @@ def with_action(types, action, data):
|
||||
w.data = data
|
||||
return w
|
||||
|
||||
def with_partof(partof):
|
||||
return with_action(PARTOF, INIT, partof)
|
||||
|
||||
def with_version(version):
|
||||
return with_action(VERSION, INIT, version)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user