mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-16 07:52:35 +03:00
Remove keysigning configs more consistently:
* Do it for srclibs as well as apps * Find all ant *.properties files like we do with gradle ones * Remove extra gradle problems (e.g. changing apk names)
This commit is contained in:
parent
be0b215ead
commit
038a55ae0c
1 changed files with 38 additions and 31 deletions
|
@ -1348,6 +1348,8 @@ def getsrclib(spec, srclib_dir, basepath=False, raw=False, prepare=True, preponl
|
|||
'update', 'project', '-p', libdir]) != 0:
|
||||
raise BuildException( 'Error updating ' + name + ' project')
|
||||
|
||||
remove_signing_keys(libdir)
|
||||
|
||||
if basepath:
|
||||
return sdir
|
||||
return libdir
|
||||
|
@ -1447,18 +1449,7 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, onserver=
|
|||
raise BuildException("Failed to update project at %s" % d,
|
||||
p.stdout, p.stderr)
|
||||
|
||||
# If the app has ant set up to sign the release, we need to switch
|
||||
# that off, because we want the unsigned apk...
|
||||
for propfile in ('build.properties', 'default.properties', 'ant.properties'):
|
||||
if os.path.exists(os.path.join(root_dir, propfile)):
|
||||
if subprocess.call(['sed','-i','s/^key.store/#/',
|
||||
propfile], cwd=root_dir) !=0:
|
||||
raise BuildException("Failed to amend %s" % propfile)
|
||||
for root, dirs, files in os.walk(build_dir):
|
||||
for f in files:
|
||||
if f == 'build.gradle':
|
||||
clean_gradle_keys(os.path.join(root, f))
|
||||
break
|
||||
remove_signing_keys(build_dir)
|
||||
|
||||
# Update the local.properties file...
|
||||
localprops = [ os.path.join(build_dir, 'local.properties') ]
|
||||
|
@ -1928,11 +1919,14 @@ def FDroidPopen(commands, cwd=None):
|
|||
result.returncode = p.returncode
|
||||
return result
|
||||
|
||||
def clean_gradle_keys(path):
|
||||
def remove_signing_keys(build_dir):
|
||||
for root, dirs, files in os.walk(build_dir):
|
||||
if 'build.gradle' in files:
|
||||
path = os.path.join(root, 'build.gradle')
|
||||
|
||||
if options.verbose:
|
||||
print "Cleaning build.gradle of keysigning configs at %s" % path
|
||||
|
||||
lines = None
|
||||
with open(path, "r") as o:
|
||||
lines = o.readlines()
|
||||
|
||||
|
@ -1946,7 +1940,20 @@ def clean_gradle_keys(path):
|
|||
opened += 1
|
||||
elif '}' in line:
|
||||
opened -=1
|
||||
elif not any(s in line for s in (' signingConfig ',)):
|
||||
elif not any(s in line for s in (
|
||||
' signingConfig ',
|
||||
'android.signingConfigs.',
|
||||
'variant.outputFile = ')):
|
||||
o.write(line)
|
||||
|
||||
for propfile in ('build.properties', 'default.properties', 'ant.properties'):
|
||||
if propfile in files:
|
||||
if options.verbose:
|
||||
print "Cleaning %s of keysigning configs at %s" % (propfile,path)
|
||||
path = os.path.join(root, propfile)
|
||||
with open(path, "w") as o:
|
||||
for line in lines:
|
||||
if not line.startswith('key.store'):
|
||||
o.write(line)
|
||||
|
||||
def replace_config_vars(cmd):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue