1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-14 11:00:10 +01:00

Only notify of those gradle/ant files that were stripped of signing keys

This commit is contained in:
Daniel Martí 2013-11-15 12:42:39 +01:00
parent 67b6106a55
commit d7906fe07b

View File

@ -1936,9 +1936,10 @@ def remove_signing_keys(build_dir):
for root, dirs, files in os.walk(build_dir): for root, dirs, files in os.walk(build_dir):
if 'build.gradle' in files: if 'build.gradle' in files:
path = os.path.join(root, 'build.gradle') path = os.path.join(root, 'build.gradle')
changed = False
if options.verbose: if options.verbose:
print "Cleaning build.gradle of keysigning configs at %s" % path print "Cleaned build.gradle of keysigning configs at %s" % path
with open(path, "r") as o: with open(path, "r") as o:
lines = o.readlines() lines = o.readlines()
@ -1948,27 +1949,35 @@ def remove_signing_keys(build_dir):
for line in lines: for line in lines:
if 'signingConfigs ' in line: if 'signingConfigs ' in line:
opened = 1 opened = 1
changed = True
elif opened > 0: elif opened > 0:
if '{' in line: if '{' in line:
opened += 1 opened += 1
elif '}' in line: elif '}' in line:
opened -=1 opened -=1
elif not any(s in line for s in ( elif any(s in line for s in (
' signingConfig ', ' signingConfig ',
'android.signingConfigs.', 'android.signingConfigs.',
'variant.outputFile = ')): 'variant.outputFile = ')):
changed = True
else:
o.write(line) o.write(line)
for propfile in ('build.properties', 'default.properties', 'ant.properties'): for propfile in ('build.properties', 'default.properties', 'ant.properties'):
if propfile in files: if propfile in files:
if options.verbose:
print "Cleaning %s of keysigning configs at %s" % (propfile,path)
path = os.path.join(root, propfile) path = os.path.join(root, propfile)
changed = False
with open(path, "w") as o: with open(path, "w") as o:
for line in lines: for line in lines:
if not line.startswith('key.store'): if line.startswith('key.store'):
changed = True
else:
o.write(line) o.write(line)
if changed and options.verbose:
print "Cleaned %s of keysigning configs at %s" % (propfile,path)
def replace_config_vars(cmd): def replace_config_vars(cmd):
cmd = cmd.replace('$$SDK$$', config['sdk_path']) cmd = cmd.replace('$$SDK$$', config['sdk_path'])
cmd = cmd.replace('$$NDK$$', config['ndk_path']) cmd = cmd.replace('$$NDK$$', config['ndk_path'])