diff --git a/pisi-cli b/pisi-cli index fb2a283c..6d9ef4e7 100755 --- a/pisi-cli +++ b/pisi-cli @@ -41,7 +41,7 @@ def handle_exception(exception, value, tb): elif isinstance(value, db.DBRunRecoveryError): ui.error(_("""A database operation has been aborted. You should run pisi again for normal DB recovery procedure. Make sure you have free disk space. -You only have to run rebuild-db if there is file corruption.""")) +You have to run rebuild-db only when there is file corruption.""")) elif isinstance(value, pisi.Exception): show_traceback = True ui.error(_("""Unhandled internal exception. diff --git a/pisi/__init__.py b/pisi/__init__.py index cc3a101e..811a0e19 100644 --- a/pisi/__init__.py +++ b/pisi/__init__.py @@ -12,9 +12,9 @@ # PiSi version -__version__ = "1.0.4" +__version__ = "1.0.5" -__dbversion__ = "1.0.4" +__dbversion__ = "1.0.5" __all__ = [ 'api', 'config', 'packagedb', 'installdb', 'search' ] diff --git a/pisi/cli/commands.py b/pisi/cli/commands.py index 669ba5c5..531d808e 100644 --- a/pisi/cli/commands.py +++ b/pisi/cli/commands.py @@ -339,7 +339,7 @@ to be downloaded from a repository containing sources. def options(self): buildno_opts(self) ignoredep_opt(self) - self.parser.add_option("-O", "--output-dir", action="store", default=".", + self.parser.add_option("-O", "--output-dir", action="store", default=None, help=_("output directory for produced packages")) self.parser.add_option("-A", "--ignore-action-errors", action="store_true", default=False, @@ -353,11 +353,48 @@ to be downloaded from a repository containing sources. return self.init(database = True) - ctx.ui.info(_('Output directory: %s') % ctx.config.options.output_dir) + if ctx.get_option('output_dir'): + ctx.ui.info(_('Output directory: %s') % ctx.config.options.output_dir) + else: + ctx.ui.info(_('Outputting packages in the working directory.')) + ctx.config.options.output_dir = '.' + for x in self.args: pisi.api.build(x, self.authInfo) self.finalize() + +class Emerge(Build): + """Build and install a PISI source package from repository + +Usage: build ... + +You should give the name of a source package to be +downloaded from a repository containing sources. + +""" + __metaclass__ = autocommand + + def __init__(self): + super(Emerge, self).__init__() + + name = ("Emerge", "em") + + def run(self): + if not self.args: + self.help() + return + + self.init(database = True) + if ctx.get_option('output_dir'): + ctx.ui.info(_('Output directory: %s') % ctx.config.options.output_dir) + else: + ctx.ui.info(_('Outputting binary packages in the package cache.')) + ctx.config.options.output_dir = ctx.config.packages_dir() + + pisi.api.emerge(self.args) + self.finalize() + class PackageOp(Command): """Abstract package operation command""" diff --git a/pisi/index.py b/pisi/index.py index be56d9cf..0e275412 100644 --- a/pisi/index.py +++ b/pisi/index.py @@ -45,7 +45,7 @@ class Index(XmlFile): tag = "PISI" - t_Sources = [ [specfile.Source], autoxml.optional, "Source"] + t_Specs = [ [specfile.SpecFile], autoxml.optional, "SpecFile"] t_Packages = [ [metadata.Package], autoxml.optional, "Package"] t_Components = [ [component.Component], autoxml.optional, "Component"] @@ -77,7 +77,7 @@ class Index(XmlFile): ctx.ui.info(_('Adding %s to component index') % fn) self.add_component(os.path.join(root, fn)) if fn == 'pspec.xml': - self.add_source(os.path.join(root, fn), repo_uri) + self.add_spec(os.path.join(root, fn), repo_uri) def update_db(self, repo): pkgdb = packagedb.get_db(repo) @@ -86,8 +86,8 @@ class Index(XmlFile): ctx.componentdb.update_component(comp) for pkg in self.packages: pkgdb.add_package(pkg) - for src in self.sources: - ctx.sourcedb.add_source(src, repo) + for sf in self.specs: + ctx.sourcedb.add_spec(sf, repo) def add_package(self, path, repo_uri): package = Package(path, 'r') @@ -121,7 +121,7 @@ class Index(XmlFile): ctx.ui.error(_('Component in %s is corrupt') % path) #ctx.ui.error(str(Error(*errs))) - def add_source(self, path, repo_uri): + def add_spec(self, path, repo_uri): ctx.ui.info(_('Adding %s to source index') % path) sf = specfile.SpecFile() sf.read(path) @@ -134,4 +134,4 @@ class Index(XmlFile): sf.source.sourceURI = os.path.realpath(path) else: # create relative path by default sf.source.sourceURI = util.removepathprefix(repo_uri, path) - self.sources.append(sf.source) + self.specs.append(sf) diff --git a/pisi/operations.py b/pisi/operations.py index 7d89f36d..829fd8a5 100644 --- a/pisi/operations.py +++ b/pisi/operations.py @@ -607,10 +607,9 @@ installed in the respective order to satisfy dependencies: ctx.ui.notify(ui.packagestogo, order = order) - ctx.config.output_dir = ctx.config.packages_dir() for x in order: package_names, blah = atomicoperations.build(x) - install(package_names) # handle inter-package deps here + install_pkg_files(package_names) # handle inter-package deps here def plan_emerge(A): diff --git a/pisi/sourcedb.py b/pisi/sourcedb.py index 8a496824..fe1ef5a9 100644 --- a/pisi/sourcedb.py +++ b/pisi/sourcedb.py @@ -48,11 +48,11 @@ class SourceDB(object): list.append(pkg) # for some reason we couldn't return self.d.items()!! --exa return list - def has_source(self, name): + def has_spec(self, name): name = str(name) return self.d.has_key(name) - def get_source(self, name): + def get_spec(self, name): name = str(name) s = self.d[name] order = ctx.repodb.list() @@ -65,22 +65,22 @@ class SourceDB(object): name = str(name) return self.dpkgtosrc[name] - def add_source(self, source_info, repo, txn = None): - assert not source_info.errors() - name = str(source_info.name) + def add_spec(self, spec, repo, txn = None): + assert not spec.errors() + name = str(spec.source.name) repo = str(repo) def proc(txn): if not self.d.has_key(name): s = dict() else: s = self.d.get(name, txn) - s[repo] = source_info + s[repo] = spec self.d.put(name, s, txn) - for pkg in source_info.packages: + for pkg in spec.packages: self.dpkgtosrc.put(pkg.name, name, txn) self.d.txn_proc(proc, txn) - def remove_source(self, name, repo): + def remove_specfile(self, name, repo): name = str(name) repo = str(repo) def proc(txn):