chiark
/
gitweb
/
~mdw
/
hippotat
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
wip ownsource, before system stuff
[hippotat]
/
hippotatlib
/
ownsource.py
diff --git
a/hippotatlib/ownsource.py
b/hippotatlib/ownsource.py
index b434f32294c4a71207a012764dea453ff76721d7..fab7365825edd0155a934cf6cd4cf346b2af8c0d 100644
(file)
--- a/
hippotatlib/ownsource.py
+++ b/
hippotatlib/ownsource.py
@@
-33,13
+33,14
@@
class SourceShipmentPreparer():
s.rune_portmanteau = r'''
outfile=$1; shift
rm -f "$outfile"
s.rune_portmanteau = r'''
outfile=$1; shift
rm -f "$outfile"
- GZIP=-9 tar zcf "$outfile" "$@"
'
+ GZIP=-9 tar zcf "$outfile" "$@"
'''
s.manifest_name='0000-MANIFEST.txt'
# private
s._destdir = destdir
s._outcounter = 0
s._manifest = []
'''
s.manifest_name='0000-MANIFEST.txt'
# private
s._destdir = destdir
s._outcounter = 0
s._manifest = []
+ s._dirmap = { }
def src_filter_glob(s, src): # default s.src_filter
for pat in s.src_filter_globs:
def src_filter_glob(s, src): # default s.src_filter
for pat in s.src_filter_globs:
@@
-99,24
+100,33
@@
class SourceShipmentPreparer():
script += ' -print0'
return script
script += ' -print0'
return script
+ def manifest_append(s, name, infol):
+ s._manifest.append((name, ' '.join(infol)))
+
def new_output_name(s, nametail, infol):
s._outcounter += 1
name = '%04d-%s' % (s._outcounter, nametail)
def new_output_name(s, nametail, infol):
s._outcounter += 1
name = '%04d-%s' % (s._outcounter, nametail)
- s.
_manifest.append((name, ' '.join(infol))
)
+ s.
manifest_append(name, infol
)
return name
return name
- def new_output_fh(s, nametail, infol):
- name = s.new_output_name(nametail, infol)
- return s.open_output_fh(name, 'wb')
-
def open_output_fh(s, name, mode):
return open(os.path.join(s._destdir, name), mode)
def mk_from_dir(s, d, infol):
def open_output_fh(s, name, mode):
return open(os.path.join(s._destdir, name), mode)
def mk_from_dir(s, d, infol):
+ try: name = s._dirmap[d]
+ except KeyError: pass
+ else:
+ s.manifest_append(name, infol)
+ return
+
if s.show_pathnames: infol.append(d)
find_rune = s.src_find_rune(d)
total_rune = s.rune_cpio % find_rune
if s.show_pathnames: infol.append(d)
find_rune = s.src_find_rune(d)
total_rune = s.rune_cpio % find_rune
- fh = s.new_output_fh('src.cpio', infol)
+
+ name = s.new_output_name('src.cpio', infol)
+ s._dirmap[d] = name
+ fh = s.open_output_fh(name, 'wb')
+
subprocess.run(s.rune_shell + [total_rune],
cwd=d,
stdin=subprocess.DEVNULL,
subprocess.run(s.rune_shell + [total_rune],
cwd=d,
stdin=subprocess.DEVNULL,
@@
-144,7
+154,7
@@
class SourceShipmentPreparer():
cmdl.append(name)
print('%s\t%s' % (name,info), file=mfh)
mfh.close()
cmdl.append(name)
print('%s\t%s' % (name,info), file=mfh)
mfh.close()
- subprocess.run(
s.rune_shell +
cmdl,
+ subprocess.run(cmdl,
cwd=s._destdir,
stdin=subprocess.DEVNULL,
stdout=sys.stderr,
cwd=s._destdir,
stdin=subprocess.DEVNULL,
stdout=sys.stderr,