chiark
/
gitweb
/
~ian
/
hippotat.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
56ffddf
)
ownsource: try to honour .gitignore
author
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Tue, 4 Apr 2017 15:50:40 +0000
(16:50 +0100)
committer
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Tue, 4 Apr 2017 15:50:40 +0000
(16:50 +0100)
hippotatlib/ownsource.py
patch
|
blob
|
history
diff --git
a/hippotatlib/ownsource.py
b/hippotatlib/ownsource.py
index 218661a5ec006e34aca6358bb2df2988b59df2f7..4369cb954696057edf5e5e3b5807f215fa98786f 100644
(file)
--- a/
hippotatlib/ownsource.py
+++ b/
hippotatlib/ownsource.py
@@
-16,10
+16,11
@@
class SourceShipmentPreparer():
s.src_package_globs = ['!/usr/local/*', '/usr*']
s.src_filter_globs = ['!/etc/*']
s.src_likeparent = s.src_likeparent_git
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.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
'[0-9][0-9][0-9][0-9]-src.cpio']
s.rune_shell = ['/bin/bash', '-ec']
s.show_pathnames = True
@@
-57,6
+58,19
@@
class SourceShipmentPreparer():
def src_filter_glob(s, src): # default s.src_filter
return s.thing_matches_globs(src, s.src_filter_globs)
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 src_likeparent_git(s, src):
try:
os.stat(os.path.join(src, '.git/.'))
@@
-101,9
+115,12
@@
class SourceShipmentPreparer():
def srcdir_find_rune(s, d):
script = s.find_rune_base
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)
assert("'" not in excl)
- script += r" \! -name '%s'" % excl
+ script += r" \! -name '%s'" % excl
+ script += r" \! -path '*/%s/*'" % excl
script += ' -print0'
return script
script += ' -print0'
return script