Permalink
Browse files

Exclude repositories from ftp browser

There is no need to browse into the repositories on the main website.
It's still possible to browse there directly on the ftp servers of course,
for those that need to debug a repository install and things like that.
  • Loading branch information...
1 parent fdb9858 commit 0b4eff93e27cc50a84fcd89025e5b7f2faeabff5 @mhagander mhagander committed Oct 18, 2013
Showing with 11 additions and 5 deletions.
  1. +11 −5 tools/ftp/spider_ftp.py
View
@@ -13,6 +13,10 @@
import codecs
import urllib2
+# Directories, specified from the root of the ftp tree and down, that
+# will be recursively excluded from the pickle.
+exclude_roots = ['/repos', ]
+
allnodes = {}
def read_file(fn):
@@ -37,11 +41,13 @@ def parse_directory(dirname, rootlen):
'd': os.readlink(fn),
}
else:
- # This is a subdirectory, recurse into it
- parse_directory(fn, rootlen)
- mynode[f] = {
- 't': 'd',
- }
+ # This is a subdirectory, recurse into it, unless it happens
+ # to be on our exclude list.
+ if not fn[rootlen:] in exclude_roots:
+ parse_directory(fn, rootlen)
+ mynode[f] = {
+ 't': 'd',
+ }
else:
# This a file
stat = os.stat(fn)

0 comments on commit 0b4eff9

Please sign in to comment.