From 560dd15464baec042129d0ef309092d2f52b7abd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Wed, 13 Nov 2013 17:29:10 +0100 Subject: [PATCH 1/3] Fix import.py crash --- fdroidserver/import.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fdroidserver/import.py b/fdroidserver/import.py index 402a44f4..4796e4ed 100644 --- a/fdroidserver/import.py +++ b/fdroidserver/import.py @@ -220,7 +220,7 @@ def main(): src_dir = os.path.join(tmp_dir, 'importer') if os.path.exists(src_dir): shutil.rmtree(src_dir) - vcs = common.getvcs(repotype, repo, src_dir, config['sdk_path']) + vcs = common.getvcs(repotype, repo, src_dir) vcs.gotorevision(options.rev) if options.subdir: root_dir = os.path.join(src_dir, options.subdir) From be0b215ead1818d255f29e5c350009cfdbf1296f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Wed, 13 Nov 2013 17:31:35 +0100 Subject: [PATCH 2/3] Fix auto names for apps using RM/branch --- fdroidserver/checkupdates.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fdroidserver/checkupdates.py b/fdroidserver/checkupdates.py index 00aef326..0a417f73 100644 --- a/fdroidserver/checkupdates.py +++ b/fdroidserver/checkupdates.py @@ -345,7 +345,8 @@ def main(): elif mode == 'RepoManifest': (version, vercode) = check_repomanifest(app) elif mode.startswith('RepoManifest/'): - (version, vercode) = check_repomanifest(app, mode[13:]) + tag = mode[13:] + (version, vercode) = check_repomanifest(app, tag) elif mode == 'RepoTrunk': (version, vercode) = check_repotrunk(app) elif mode == 'HTTP': From 038a55ae0ce81500b12a576acdac17a79464e9b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Thu, 14 Nov 2013 14:09:37 +0100 Subject: [PATCH 3/3] 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) --- fdroidserver/common.py | 69 +++++++++++++++++++++++------------------- 1 file changed, 38 insertions(+), 31 deletions(-) diff --git a/fdroidserver/common.py b/fdroidserver/common.py index 3e394354..36fcead5 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -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,26 +1919,42 @@ def FDroidPopen(commands, cwd=None): result.returncode = p.returncode return result -def clean_gradle_keys(path): - if options.verbose: - print "Cleaning build.gradle of keysigning configs at %s" % 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') - lines = None - with open(path, "r") as o: - lines = o.readlines() - - opened = 0 - with open(path, "w") as o: - for line in lines: - if 'signingConfigs ' in line: - opened = 1 - elif opened > 0: - if '{' in line: - opened += 1 - elif '}' in line: - opened -=1 - elif not any(s in line for s in (' signingConfig ',)): - o.write(line) + if options.verbose: + print "Cleaning build.gradle of keysigning configs at %s" % path + + with open(path, "r") as o: + lines = o.readlines() + + opened = 0 + with open(path, "w") as o: + for line in lines: + if 'signingConfigs ' in line: + opened = 1 + elif opened > 0: + if '{' in line: + opened += 1 + elif '}' in line: + opened -=1 + 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): cmd = cmd.replace('$$SDK$$', config['sdk_path'])