From 3632a6374446c1104ac9dcdb028c58cfd358e2c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eray=20=C3=96zkural?= Date: Thu, 23 Mar 2006 12:13:19 +0000 Subject: [PATCH] * add an option to skip indexing sources --- pisi/api.py | 4 ++-- pisi/cli/commands.py | 5 ++++- pisi/index.py | 4 ++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/pisi/api.py b/pisi/api.py index 1310e919..be01b0ef 100644 --- a/pisi/api.py +++ b/pisi/api.py @@ -292,13 +292,13 @@ def check(package): ctx.ui.info("OK", False) return corrupt -def index(dirs, output = 'pisi-index.xml'): +def index(dirs, output = 'pisi-index.xml', skip_sources=False): index = Index() if not dirs: dirs = ['.'] for repo_dir in dirs: ctx.ui.info(_('* Building index of PISI files under %s') % repo_dir) - index.index(repo_dir) + index.index(repo_dir, skip_sources) index.write(output) ctx.ui.info(_('* Index file written')) diff --git a/pisi/cli/commands.py b/pisi/cli/commands.py index 9fa33513..52f034cb 100644 --- a/pisi/cli/commands.py +++ b/pisi/cli/commands.py @@ -680,6 +680,9 @@ source and binary packages. self.parser.add_option("-o", "--output", action="store", default='pisi-index.xml', help=_("index output file")) + self.parser.add_option("-S", "--skip-sources", action="store_true", + default=False, + help=_("do not index pisi spec files.")) def run(self): @@ -689,7 +692,7 @@ source and binary packages. index(self.args, ctx.get_option('output')) elif len(self.args)==0: ctx.ui.info(_('Indexing current directory.')) - index('.', ctx.get_option('output')) + index('.', ctx.get_option('output'), skip_sources = ctx.get_option('skip_sources')) self.finalize() diff --git a/pisi/index.py b/pisi/index.py index a1245518..933e61b9 100644 --- a/pisi/index.py +++ b/pisi/index.py @@ -66,7 +66,7 @@ class Index(XmlFile): self.read(self.filepath) - def index(self, repo_uri): + def index(self, repo_uri, skip_sources=False): self.repo_dir = repo_uri for root, dirs, files in os.walk(repo_uri): for fn in files: @@ -76,7 +76,7 @@ class Index(XmlFile): if fn == 'component.xml': ctx.ui.info(_('Adding %s to component index') % fn) self.add_component(os.path.join(root, fn)) - if fn == 'pspec.xml': + if fn == 'pspec.xml' and not skip_sources: self.add_spec(os.path.join(root, fn), repo_uri) def update_db(self, repo, txn = None):