aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMykyta Holubakha <hilobakho@gmail.com>2017-11-25 01:32:24 +0200
committerMykyta Holubakha <hilobakho@gmail.com>2017-11-25 01:32:24 +0200
commit13bd323bd275ff60349afe168a222838fb771e74 (patch)
treedc78a06705de5fed3138ce5291485c9c3adfa5c6
parentremote git repo fixes (diff)
downloadpomu-13bd323bd275ff60349afe168a222838fb771e74.tar.gz
pomu-13bd323bd275ff60349afe168a222838fb771e74.tar.bz2
pomu-13bd323bd275ff60349afe168a222838fb771e74.zip
Unified package source constructors
added slot support to each (except for serialization)
-rw-r--r--pomu/source/bugz.py9
-rw-r--r--pomu/source/file.py9
-rw-r--r--pomu/source/url.py10
3 files changed, 16 insertions, 12 deletions
diff --git a/pomu/source/bugz.py b/pomu/source/bugz.py
index bf528b4..87721a2 100644
--- a/pomu/source/bugz.py
+++ b/pomu/source/bugz.py
@@ -17,13 +17,13 @@ class BzEbuild():
"""A class to represent a local ebuild"""
__name__ = 'fs'
- # slots?
- def __init__(self, bug_id, category, name, version, filemap):
+ def __init__(self, bug_id, filemap, category, name, version, slot='0'):
self.bug_id = bug_id
+ self.filemap = filemap
self.category = category
self.name = name
self.version = version
- self.filemap = filemap
+ self.slot = slot
def fetch(self):
return Package(self.name, '/', self, self.category, self.version, filemap=self.filemap)
@@ -71,8 +71,9 @@ class BugzillaSource():
category = query('category', 'Please enter package category').expect()
name = query('name', 'Please enter package name').expect()
ver = query('version', 'Please specify package version for {}'.format(name)).expect()
+ slot = query('slot', 'Please specify package slot', '0').expect()
fmap = {path.join(category, name, x[2]): x[1] for x in files}
- return Result.Ok(BzEbuild(uri, category, name, ver, fmap))
+ return Result.Ok(BzEbuild(uri, fmap, category, name, ver, slot))
@dispatcher.handler(priority=2)
def parse_link(uri):
diff --git a/pomu/source/file.py b/pomu/source/file.py
index 5dbf25d..25f57c5 100644
--- a/pomu/source/file.py
+++ b/pomu/source/file.py
@@ -15,12 +15,12 @@ class LocalEbuild(PackageBase):
"""A class to represent a local ebuild"""
__name__ = 'fs'
- # slots?
- def __init__(self, category, name, version, path):
+ def __init__(self, path, category, name, version, slot='0'):
+ self.path = path
self.category = category
self.name = name
self.version = version
- self.path = path
+ self.slot = slot
def fetch(self):
return Package(self.name, '/', self, self.category, self.version,
@@ -61,7 +61,8 @@ class LocalEbuildSource(BaseSource):
if not ver:
ver = query('version', 'Please specify package version for {}'.format(basen)).expect()
category = query('category', 'Please enter category for {}'.format(basen), parent).expect()
- return Result.Ok(LocalEbuild(category, name, ver, uri))
+ slot = query('slot', 'Please specify package slot', '0').expect()
+ return Result.Ok(LocalEbuild(uri, category, name, ver, slot))
@dispatcher.handler()
def parse_full(uri):
diff --git a/pomu/source/url.py b/pomu/source/url.py
index 850e69f..4e8b277 100644
--- a/pomu/source/url.py
+++ b/pomu/source/url.py
@@ -16,12 +16,13 @@ class URLEbuild(PackageBase):
"""A class to represent an ebuild fetched from a url"""
__name__ = 'fs'
- def __init__(self, category, name, version, url, contents=None):
+ def __init__(self, url, contents, category, name, version, slot):
+ self.url = url
+ self.contents = contents
self.category = category
self.name = name
self.version = version
- self.url = url
- self.contents = contents
+ self.slot = slot
def fetch(self):
if self.contents:
@@ -69,7 +70,8 @@ class URLGrabberSource(BaseSource):
files = grab(uri)
if not files:
return Result.Err()
- return Result.Ok(URLEbuild(category, name, ver, uri, files[0][1]))
+ slot = query('slot', 'Please specify package slot', '0').expect()
+ return Result.Ok(URLEbuild(uri, files[0][1], category, name, ver, slot))
@dispatcher.handler()
def parse_full(url):