mirror of
https://git.freebsd.org/ports.git
synced 2025-07-18 01:39:16 -04:00
Strip out date/time from +++/--- headers in generated patchfiles, so that they
don't generate extra hunk each time patchfile is updated.
This commit is contained in:
parent
9b15174c84
commit
4570e0b23c
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=119419
1 changed files with 12 additions and 11 deletions
|
@ -179,8 +179,6 @@ def getrelpath(path, wrksrc):
|
||||||
# "FreeBSD" cvs id.
|
# "FreeBSD" cvs id.
|
||||||
#
|
#
|
||||||
def gendiff(path, wrksrc, outfile = ''):
|
def gendiff(path, wrksrc, outfile = ''):
|
||||||
IDGEN_CMD = '%s "\\n\\$%s\\$\\n\\n"' % (Vars.PRINTF_CMD, Vars.CVS_ID)
|
|
||||||
|
|
||||||
fullpath = os.path.join(wrksrc, path)
|
fullpath = os.path.join(wrksrc, path)
|
||||||
if not os.path.isfile(fullpath):
|
if not os.path.isfile(fullpath):
|
||||||
raise IOError(errno.ENOENT, fullpath)
|
raise IOError(errno.ENOENT, fullpath)
|
||||||
|
@ -188,20 +186,18 @@ def gendiff(path, wrksrc, outfile = ''):
|
||||||
|
|
||||||
cmdline = ''
|
cmdline = ''
|
||||||
if os.path.isfile(fullpath + Vars.DIFF_SUFX): # Normal diff
|
if os.path.isfile(fullpath + Vars.DIFF_SUFX): # Normal diff
|
||||||
cmdline = '%s %s %s%s %s' % (Vars.DIFF_CMD, Vars.DIFF_ARGS, path, \
|
path_orig = path + Vars.DIFF_SUFX
|
||||||
Vars.DIFF_SUFX, path)
|
cmdline = '%s %s %s %s' % (Vars.DIFF_CMD, Vars.DIFF_ARGS, path_orig, path)
|
||||||
elif os.path.isfile(fullpath + Vars.RCSDIFF_SUFX): # RCS diff
|
elif os.path.isfile(fullpath + Vars.RCSDIFF_SUFX): # RCS diff
|
||||||
|
path_orig = path
|
||||||
cmdline = '%s %s %s' % (Vars.RCSDIFF_CMD, Vars.DIFF_ARGS, path)
|
cmdline = '%s %s %s' % (Vars.RCSDIFF_CMD, Vars.DIFF_ARGS, path)
|
||||||
else: # New file
|
else: # New file
|
||||||
cmdline = '%s %s %s %s' % (Vars.DIFF_CMD, Vars.DIFF_ARGS, \
|
path_orig = Vars.DEV_NULL
|
||||||
Vars.DEV_NULL, path)
|
cmdline = '%s %s %s %s' % (Vars.DIFF_CMD, Vars.DIFF_ARGS, path_orig, path)
|
||||||
|
|
||||||
if outfile != '':
|
|
||||||
cmdline = '( %s && %s ) 2>%s' % (IDGEN_CMD, cmdline, Vars.DEV_NULL)
|
|
||||||
|
|
||||||
savedir = os.getcwd()
|
savedir = os.getcwd()
|
||||||
os.chdir(wrksrc)
|
os.chdir(wrksrc)
|
||||||
pipe = popen2.Popen3(cmdline)
|
pipe = popen2.Popen3(cmdline, True)
|
||||||
outbuf = pipe.fromchild.readlines()
|
outbuf = pipe.fromchild.readlines()
|
||||||
for stream in (pipe.fromchild, pipe.tochild):
|
for stream in (pipe.fromchild, pipe.tochild):
|
||||||
stream.close()
|
stream.close()
|
||||||
|
@ -212,6 +208,11 @@ def gendiff(path, wrksrc, outfile = ''):
|
||||||
'version of "%s"' % fullpath
|
'version of "%s"' % fullpath
|
||||||
elif exitval == 1: # Some differences were found
|
elif exitval == 1: # Some differences were found
|
||||||
if (outfile != ''):
|
if (outfile != ''):
|
||||||
|
outbuf[0] = '--- %s\n' % path_orig
|
||||||
|
outbuf[1] = '+++ %s\n' % path
|
||||||
|
outbuf.insert(0, '\n')
|
||||||
|
outbuf.insert(0, '$%s$\n' % Vars.CVS_ID)
|
||||||
|
outbuf.insert(0, '\n')
|
||||||
open(outfile, 'w').writelines(outbuf)
|
open(outfile, 'w').writelines(outbuf)
|
||||||
else:
|
else:
|
||||||
sys.stdout.writelines(outbuf)
|
sys.stdout.writelines(outbuf)
|
||||||
|
|
Loading…
Add table
Reference in a new issue