Hi,

Since we ported all tests under gettext-tools/tests to use 'init.sh' a
while ago, temporary file cleanups have been unnecessary.  I've just
removed all of them.  If you plan to contribute a new test case, no need
to worry about that anymore.

I wouldn't post the actual patch here since it is too large, but for the
record, I'm attaching the script I used.

Thanks,
--
Daiki Ueno
#!/usr/bin/python

import sys, re

prev = None
def skip_empty():
    while True:
        line = sys.stdin.readline()
        if line == "":
            return ""
        if line.rstrip() != "":
            return line

line = sys.stdin.readline()
while line != "":
    if re.match(" *tmpfiles=\"", line):
        if prev != None:
            print(prev.rstrip('\n'))
        prev = None
        line = sys.stdin.readline()
    elif re.match("trap 'rm -fr \$tmpfiles'", line) or \
         re.match(" *rm -fr \$tmpfiles$", line):
        if prev != None:
            print(prev.rstrip('\n'))
        prev = None
        line = skip_empty()
    elif re.match('test \$\? = 0 \|\| \{ rm -fr \$tmpfiles; exit 1; \}', line):
        print(prev.rstrip('\n') + " || exit 1")
        prev = None
        line = sys.stdin.readline()
    else:
        line = re.sub("rm -fr \$tmpfiles; *", '', line)
        if prev != None:
            print(prev.rstrip('\n'))
        prev = line
        line = sys.stdin.readline()

if prev != None:
    print(prev.rstrip('\n'))

Reply via email to