* implement repository builds

* fix: return repo from sourcedb
This commit is contained in:
Eray Özkural
2006-03-08 01:52:26 +00:00
parent 67938150e3
commit 7044a622bf
4 changed files with 34 additions and 12 deletions
+3 -6
View File
@@ -430,12 +430,9 @@ def remove_single(package_name):
Remove(package_name).run() Remove(package_name).run()
def build(package, authinfo=None): def build(package, authinfo=None):
# wrapper for build op` # wrapper for build op
if package.endswith('.xml'): import pisi.build
import pisi.build pisi.build.build(package, authinfo)
pisi.build.build(package, authinfo)
#else:
# ...
def __is_virtual_upgrade(metadata): def __is_virtual_upgrade(metadata):
+26 -2
View File
@@ -85,6 +85,27 @@ class Builder:
"""Provides the package build and creation routines""" """Provides the package build and creation routines"""
#FIXME: this class and every other class must use URLs as paths! #FIXME: this class and every other class must use URLs as paths!
@staticmethod
def from_name(name, authinfo = None):
# download package and return an installer object
# find package in repository
src, reponame = ctx.sourcedb.get_source(name)
if src:
src_uri = URI(src.sourceURI)
if src_uri.is_absolute_path():
pkg_path = str(src_uri)
else:
repo = ctx.repodb.get_repo(reponame)
src_path = os.path.join(os.path.dirname(repo.indexuri.get_uri()),
str(src_uri.path()))
ctx.ui.debug(_("Source URI: %s") % src_path)
return Builder(src_path, authinfo)
else:
raise Error(_("Source %s not found in any active repository.") % name)
def __init__(self, specuri, authinfo = None): def __init__(self, specuri, authinfo = None):
# process args # process args
@@ -671,8 +692,11 @@ class Builder:
# build functions... # build functions...
def build(pspecfile, authinfo=None): def build(pspec, authinfo=None):
pb = pisi.build.Builder(pspecfile, authinfo) if pspec.endswith('.xml'):
pb = Builder(pspec, authinfo)
else:
pb = Builder.from_name(pspec, authinfo)
return pb.build() return pb.build()
order = {"none": 0, order = {"none": 0,
+3 -2
View File
@@ -964,9 +964,10 @@ Gives a brief list of sources published in the repositories.
list = ctx.sourcedb.list() list = ctx.sourcedb.list()
list.sort() list.sort()
for p in list: for p in list:
source = ctx.sourcedb.get_source(p) source, repo = ctx.sourcedb.get_source(p)
if self.options.long: if self.options.long:
ctx.ui.info(unicode(component)) ctx.ui.info('[Repository: ' + repo + ']')
ctx.ui.info(unicode(source))
else: else:
lenp = len(p) lenp = len(p)
#if p in installed_list: #if p in installed_list:
+1 -1
View File
@@ -57,7 +57,7 @@ class SourceDB(object):
order = ctx.repodb.list() order = ctx.repodb.list()
for repo in order: for repo in order:
if s.has_key(repo): if s.has_key(repo):
return s[repo] return (s[repo], repo)
return None return None
def add_source(self, source_info, repo, txn = None): def add_source(self, source_info, repo, txn = None):