s.src_package_globs = ['!/usr/local/*', '/usr*']
s.src_filter_globs = ['!/etc/*']
s.src_likeparent = s.src_likeparent_git
+ s.src_direxcludes = s.src_direxcludes_git
s.report_from_packages = s.report_from_packages_debian
s.cwd = os.getcwd()
s.find_rune_base = "find -type f -perm -004 \! -path '*/tmp/*'"
- s.excludes = ['*~', '*.bak', '*.tmp', '#*#',
+ s.ignores = ['*~', '*.bak', '*.tmp', '#*#', '__pycache__',
'[0-9][0-9][0-9][0-9]-src.cpio']
s.rune_shell = ['/bin/bash', '-ec']
s.show_pathnames = True
def src_filter_glob(s, src): # default s.src_filter
return s.thing_matches_globs(src, s.src_filter_globs)
+ def src_direxcludes_git(s, d):
+ try:
+ excl = open(os.path.join(d, '.gitignore'))
+ except FileNotFoundError:
+ return []
+ r = []
+ for l in excl:
+ l.strip
+ if l.startswith('#'): next
+ if not len(l): next
+ r += l
+ return r
+
def src_likeparent_git(s, src):
try:
os.stat(os.path.join(src, '.git/.'))
def srcdir_find_rune(s, d):
script = s.find_rune_base
- for excl in s.excludes + [s.output_name, s.manifest_name]:
+ ignores = s.ignores + [s.output_name, s.manifest_name]
+ ignores += s.src_direxcludes(d)
+ for excl in ignores:
assert("'" not in excl)
- script += r" \! -name '%s'" % excl
+ script += r" \! -name '%s'" % excl
+ script += r" \! -path '*/%s/*'" % excl
script += ' -print0'
return script