diff --git a/pisi/atomicoperations.py b/pisi/atomicoperations.py index def644bd..4c06b8f0 100644 --- a/pisi/atomicoperations.py +++ b/pisi/atomicoperations.py @@ -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): diff --git a/pisi/build.py b/pisi/build.py index ca840f16..7987d970 100644 --- a/pisi/build.py +++ b/pisi/build.py @@ -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, diff --git a/pisi/cli/commands.py b/pisi/cli/commands.py index 5978350f..3c23fc82 100644 --- a/pisi/cli/commands.py +++ b/pisi/cli/commands.py @@ -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: diff --git a/pisi/sourcedb.py b/pisi/sourcedb.py index 91d2bda0..f8d83290 100644 --- a/pisi/sourcedb.py +++ b/pisi/sourcedb.py @@ -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)