* 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()
def build(package, authinfo=None):
# wrapper for build op`
if package.endswith('.xml'):
import pisi.build
pisi.build.build(package, authinfo)
#else:
# ...
# wrapper for build op
import pisi.build
pisi.build.build(package, authinfo)
def __is_virtual_upgrade(metadata):
+26 -2
View File
@@ -85,6 +85,27 @@ class Builder:
"""Provides the package build and creation routines"""
#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):
# process args
@@ -671,8 +692,11 @@ class Builder:
# build functions...
def build(pspecfile, authinfo=None):
pb = pisi.build.Builder(pspecfile, authinfo)
def build(pspec, authinfo=None):
if pspec.endswith('.xml'):
pb = Builder(pspec, authinfo)
else:
pb = Builder.from_name(pspec, authinfo)
return pb.build()
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.sort()
for p in list:
source = ctx.sourcedb.get_source(p)
source, repo = ctx.sourcedb.get_source(p)
if self.options.long:
ctx.ui.info(unicode(component))
ctx.ui.info('[Repository: ' + repo + ']')
ctx.ui.info(unicode(source))
else:
lenp = len(p)
#if p in installed_list:
+2 -2
View File
@@ -57,9 +57,9 @@ class SourceDB(object):
order = ctx.repodb.list()
for repo in order:
if s.has_key(repo):
return s[repo]
return (s[repo], repo)
return None
def add_source(self, source_info, repo, txn = None):
assert not source_info.errors()
name = str(source_info.name)