aboutsummaryrefslogtreecommitdiffstats
path: root/Tools
diff options
context:
space:
mode:
authorMaxim Sobolev <sobomax@FreeBSD.org>2002-01-04 04:01:58 +0800
committerMaxim Sobolev <sobomax@FreeBSD.org>2002-01-04 04:01:58 +0800
commit77beb0d36a1f257c0138847e8a3f62b65a8a7ab7 (patch)
tree80bdae73ecdaf5d8f9cd46352de7a0c4d348fb59 /Tools
parent8d8281f8f0bfed58fa0f0475c3ed781a62420c7c (diff)
downloadfreebsd-ports-77beb0d36a1f257c0138847e8a3f62b65a8a7ab7.tar.gz
freebsd-ports-77beb0d36a1f257c0138847e8a3f62b65a8a7ab7.tar.zst
freebsd-ports-77beb0d36a1f257c0138847e8a3f62b65a8a7ab7.zip
- Use `::' as a combination of symbols to replace `/' in patchfile name;
- don't reset size of corresponding patchfile to zero if no differencies were found between original and modified file.
Notes
Notes: svn path=/head/; revision=52538
Diffstat (limited to 'Tools')
-rwxr-xr-xTools/scripts/patchtool.py40
1 files changed, 22 insertions, 18 deletions
diff --git a/Tools/scripts/patchtool.py b/Tools/scripts/patchtool.py
index ec786d332534..d66f6b2874ab 100755
--- a/Tools/scripts/patchtool.py
+++ b/Tools/scripts/patchtool.py
@@ -49,7 +49,7 @@ class Vars:
DEV_NULL = '/dev/null'
ETC_MAKE_CONF = '/etc/make.conf'
- SLASH_REPL_SYMBOL = '_' # The sysmbol to replace '/' when auto-generating
+ SLASH_REPL_SYMBOL = '::' # The sysmbol to replace '/' when auto-generating
# patchnames
@@ -195,26 +195,30 @@ def gendiff(path, wrksrc, outfile = ''):
Vars.DEV_NULL, path)
if outfile != '':
- cmdline = '( %s && %s ) 1>%s 2>%s' % (IDGEN_CMD, cmdline, outfile, \
- Vars.DEV_NULL)
+ cmdline = '( %s && %s ) 2>%s' % (IDGEN_CMD, cmdline, Vars.DEV_NULL)
+
savedir = os.getcwd()
os.chdir(wrksrc)
- exitstat = os.system(cmdline)
- if os.WIFEXITED(exitstat):
- exitval = os.WEXITSTATUS(exitstat)
- if exitval == 0: # No differences were found
- if outfile != '':
- os.unlink(outfile)
- retval = False
- retmsg = 'no differencies found between original and current ' \
+ pipe = popen2.Popen3(cmdline)
+ outbuf = pipe.fromchild.readlines()
+ for stream in (pipe.fromchild, pipe.tochild):
+ stream.close()
+ exitval = os.WEXITSTATUS(pipe.wait())
+ if exitval == 0: # No differences were found
+ retval = False
+ retmsg = 'no differencies found between original and current ' \
'version of "%s"' % fullpath
- elif exitval == 1: # Some differences were found
- retval = True
- retmsg = ''
- else: # Error occured
- raise ECmdError('"%s"' % cmdline, \
- 'external command returned non-zero error code')
- # Not reached #
+ elif exitval == 1: # Some differences were found
+ if (outfile != ''):
+ open(outfile, 'w').writelines(outbuf)
+ else:
+ sys.stdout.writelines(outbuf)
+ retval = True
+ retmsg = ''
+ else: # Error occured
+ raise ECmdError('"%s"' % cmdline, \
+ 'external command returned non-zero error code')
+ # Not reached #
os.chdir(savedir)
return (retval, retmsg)