* add an option to skip indexing sources
This commit is contained in:
+2
-2
@@ -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'))
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
|
||||
+2
-2
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user