chiark / gitweb /
Get rid of all the debugging flags, not just the ones in the main project
authorDaniel Martí <mvdan@mvdan.cc>
Tue, 11 Feb 2014 16:56:36 +0000 (17:56 +0100)
committerDaniel Martí <mvdan@mvdan.cc>
Tue, 11 Feb 2014 16:56:36 +0000 (17:56 +0100)
fdroidserver/common.py

index 53c1718c5e9c0876696ae0a1a9d91cceb18c4165..07e5a76aacf1267f10eb4cffe42418478d59787e 100644 (file)
@@ -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']: