index non-recursive yapılabilsin. (--non-recursive or -R)
This commit is contained in:
+3
-2
@@ -308,7 +308,8 @@ def check(package):
|
||||
ctx.ui.info("OK", False)
|
||||
return corrupt
|
||||
|
||||
def index(dirs=None, output='pisi-index.xml', skip_sources=False, skip_signing=False):
|
||||
def index(dirs=None, output='pisi-index.xml', skip_sources=False, skip_signing=False,
|
||||
non_recursive=False):
|
||||
"""accumulate PISI XML files in a directory"""
|
||||
index = Index()
|
||||
if not dirs:
|
||||
@@ -316,7 +317,7 @@ def index(dirs=None, output='pisi-index.xml', skip_sources=False, skip_signing=F
|
||||
for repo_dir in dirs:
|
||||
repo_dir = str(repo_dir)
|
||||
ctx.ui.info(_('* Building index of PISI files under %s') % repo_dir)
|
||||
index.index(repo_dir, skip_sources)
|
||||
index.index(repo_dir, skip_sources, non_recursive)
|
||||
|
||||
if skip_signing:
|
||||
index.write(output, sha1sum=True, compress=File.bz2, sign=None)
|
||||
|
||||
@@ -733,6 +733,9 @@ source and binary packages.
|
||||
self.parser.add_option("-G", "--skip-signing", action="store_true",
|
||||
default=False,
|
||||
help=_("do not sign index."))
|
||||
self.parser.add_option("-R", "--non-recursive", action="store_true",
|
||||
default=False,
|
||||
help=_("do not recurse into directories."))
|
||||
|
||||
def run(self):
|
||||
|
||||
@@ -741,12 +744,14 @@ source and binary packages.
|
||||
if len(self.args)>0:
|
||||
index(self.args, ctx.get_option('output'),
|
||||
skip_sources = ctx.get_option('skip_sources'),
|
||||
skip_signing = ctx.get_option('skip_signing'))
|
||||
skip_signing = ctx.get_option('skip_signing'),
|
||||
non_recursive = ctx.get_option('non_recursive'))
|
||||
elif len(self.args)==0:
|
||||
ctx.ui.info(_('Indexing current directory.'))
|
||||
index(['.'], ctx.get_option('output'),
|
||||
skip_sources = ctx.get_option('skip_sources'),
|
||||
skip_signing = ctx.get_option('skip_signing'))
|
||||
skip_signing = ctx.get_option('skip_signing'),
|
||||
non_recursive = ctx.get_option('non_recursive'))
|
||||
self.finalize()
|
||||
|
||||
|
||||
|
||||
+3
-1
@@ -86,7 +86,7 @@ class Index(XmlFile):
|
||||
tmpdir = os.path.join(ctx.config.index_dir(), repo)
|
||||
File.check_signature(filename, tmpdir)
|
||||
|
||||
def index(self, repo_uri, skip_sources=False):
|
||||
def index(self, repo_uri, skip_sources=False, non_recursive=False):
|
||||
self.repo_dir = repo_uri
|
||||
for root, dirs, files in os.walk(repo_uri):
|
||||
for fn in files:
|
||||
@@ -100,6 +100,8 @@ class Index(XmlFile):
|
||||
self.add_spec(os.path.join(root, fn), repo_uri)
|
||||
if fn == 'distribution.xml':
|
||||
self.add_distro(os.path.join(root, fn))
|
||||
if non_recursive:
|
||||
del dirs[0:]
|
||||
|
||||
def update_db(self, repo, txn = None):
|
||||
for comp in self.components:
|
||||
|
||||
Reference in New Issue
Block a user