From e5539303ff5f45306a431d8739beb4317aa6cb1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Tue, 11 Feb 2014 17:56:36 +0100 Subject: [PATCH] Get rid of all the debugging flags, not just the ones in the main project --- fdroidserver/common.py | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/fdroidserver/common.py b/fdroidserver/common.py index 53c1718c..07e5a76a 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -660,6 +660,17 @@ def ant_subprojects(root_dir): subprojects.insert(0, relp) return subprojects +def remove_debuggable_flags(root_dir): + # Remove forced debuggable flags + logging.info("Removing debuggable flags") + for root, dirs, files in os.walk(root_dir): + if 'AndroidManifest.xml' in files: + path = os.path.join(root, 'AndroidManifest.xml') + p = FDroidPopen(['sed','-i', + 's/android:debuggable="[^"]*"//g', path]) + if p.returncode != 0: + raise BuildException("Failed to remove debuggable flags of %s" % path) + # Extract some information from the AndroidManifest.xml at the given path. # Returns (version, vercode, package), any or all of which might be None. # All values returned are strings. @@ -816,6 +827,9 @@ def getsrclib(spec, srclib_dir, srclibpaths=[], subdir=None, place_srclib(libdir, n, s_tuple[2]) n+=1 + remove_signing_keys(sdir) + remove_debuggable_flags(sdir) + if prepare: if srclib["Prepare"]: @@ -826,8 +840,6 @@ def getsrclib(spec, srclib_dir, srclibpaths=[], subdir=None, raise BuildException("Error running prepare command for srclib %s" % name, p.stdout) - remove_signing_keys(libdir) - if basepath: libdir = sdir @@ -957,13 +969,7 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, onserver= 'build.gradle'], cwd=gradle_dir) # Remove forced debuggable flags - logging.info("Removing debuggable flags") - for path in manifest_paths(root_dir, flavour): - if not os.path.isfile(path): - continue - if subprocess.call(['sed','-i', - 's/android:debuggable="[^"]*"//g', path]) != 0: - raise BuildException("Failed to remove debuggable flags") + remove_debuggable_flags(root_dir) # Insert version code and number into the manifest if necessary if build['forceversion']: