aboutsummaryrefslogtreecommitdiffstats
path: root/Tools/scripts
diff options
context:
space:
mode:
authorsobomax <sobomax@FreeBSD.org>2002-01-04 04:01:58 +0800
committersobomax <sobomax@FreeBSD.org>2002-01-04 04:01:58 +0800
commit0b685dcea9b47a2e088c76b319ed6c0fb33c557b (patch)
tree0668d7593d9e67ab416dcd4418f2cefc8578a199 /Tools/scripts
parent9e95b77ad9f0a80ea1a0c9a7c7157c4c3c95809c (diff)
downloadfreebsd-ports-gnome-0b685dcea9b47a2e088c76b319ed6c0fb33c557b.tar.gz
freebsd-ports-gnome-0b685dcea9b47a2e088c76b319ed6c0fb33c557b.tar.zst
freebsd-ports-gnome-0b685dcea9b47a2e088c76b319ed6c0fb33c557b.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.
Diffstat (limited to 'Tools/scripts')
-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)