From ec58f6e3138ee2aef3e99a3494755b67210c4649 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Thu, 31 Oct 2013 15:54:52 +0100 Subject: [PATCH 01/14] Minor fixes to git-svn --- fdroidserver/common.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fdroidserver/common.py b/fdroidserver/common.py index 100b6087..a8e8c703 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -230,11 +230,11 @@ class vcs_gitsvn(vcs): remote_split = self.remote.split(';') for i in remote_split[1:]: if i.startswith('trunk='): - gitsvn_cmd += '-T %s' % i[6:] + gitsvn_cmd += ' -T %s' % i[6:] elif i.startswith('tags='): - gitsvn_cmd += '-t %s', i[5:] + gitsvn_cmd += ' -t %s' % i[5:] elif i.startswith('branches='): - gitsvn_cmd += '-b %s' % i[9:] + gitsvn_cmd += ' -b %s' % i[9:] if subprocess.call([gitsvn_cmd + " %s %s" % (remote_split[0], self.local)], shell=True) != 0: raise VCSException("Git clone failed") From 387701dcda2344c735693afb8f9bd76d0eaffa8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Thu, 31 Oct 2013 17:21:49 +0100 Subject: [PATCH 02/14] Also remove 'obj' when removing jni dirs --- fdroidserver/build.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fdroidserver/build.py b/fdroidserver/build.py index 58b642c3..e5ccd19b 100644 --- a/fdroidserver/build.py +++ b/fdroidserver/build.py @@ -381,7 +381,7 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d print "Cleaning jni dirs..." for baddir in [ 'libs/armeabi-v7a', 'libs/armeabi', - 'libs/mips', 'libs/x86']: + 'libs/mips', 'libs/x86', 'obj']: badpath = os.path.join(build_dir, baddir) if os.path.exists(badpath): print "Removing '%s'" % badpath From f07cb7e90f7b8e7bc6b873778d3a2873399560eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Thu, 31 Oct 2013 17:22:08 +0100 Subject: [PATCH 03/14] Better gradle signature config filter --- fdroidserver/common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fdroidserver/common.py b/fdroidserver/common.py index 92e866a1..58c8d04c 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -1886,6 +1886,6 @@ def clean_gradle_keys(path, verbose): opened += 1 elif '}' in line: opened -=1 - elif 'signingConfig' not in line: + elif not any(s in line for s in (' signingConfig ',)): o.write(line) From 48e5f61391cef071bee3abb3d05993a315c84180 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Thu, 31 Oct 2013 17:35:13 +0100 Subject: [PATCH 04/14] Forgot to actually use the real repotype variable --- fdroidserver/checkupdates.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fdroidserver/checkupdates.py b/fdroidserver/checkupdates.py index 0006d178..382d758c 100644 --- a/fdroidserver/checkupdates.py +++ b/fdroidserver/checkupdates.py @@ -159,17 +159,17 @@ def check_repomanifest(app, sdk_path, branch=None): # Set up vcs interface and make sure we have the latest code... vcs = common.getvcs(app['Repo Type'], app['Repo'], build_dir, sdk_path) - if vcs.repotype() == 'git': + if repotype == 'git': if branch: branch = 'origin/'+branch vcs.gotorevision(branch) - elif vcs.repotype() == 'git-svn': + elif repotype == 'git-svn': vcs.gotorevision(branch) - elif vcs.repotype() == 'svn': + elif repotype == 'svn': vcs.gotorevision(None) - elif vcs.repotype() == 'hg': + elif repotype == 'hg': vcs.gotorevision(branch) - elif vcs.repotype() == 'bzr': + elif repotype == 'bzr': vcs.gotorevision(None) flavour = None From e080bb39834c37ac2b64fcdf98f78f117af9aab3 Mon Sep 17 00:00:00 2001 From: Ciaran Gultnieks Date: Thu, 31 Oct 2013 16:42:42 +0000 Subject: [PATCH 05/14] Fix mistake in 08287a1f --- fdroidserver/update.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fdroidserver/update.py b/fdroidserver/update.py index 273f1d37..45566d79 100644 --- a/fdroidserver/update.py +++ b/fdroidserver/update.py @@ -611,7 +611,7 @@ def make_index(apps, apks, repodir, archive, categories): if not options.quiet: print "Creating signed index." - print "Key fingerprint:", config['repo_pubkey_fingerprint'] + print "Key fingerprint:", repo_pubkey_fingerprint #Create a jar of the index... p = subprocess.Popen(['jar', 'cf', 'index.jar', 'index.xml'], From 16baeece5874e561d254c16a67f49a351edb4026 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Thu, 31 Oct 2013 17:56:12 +0100 Subject: [PATCH 06/14] Don't remove output dirs twice. --subprojects is useless. --- fdroidserver/common.py | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/fdroidserver/common.py b/fdroidserver/common.py index 58c8d04c..024e3dda 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -1355,7 +1355,6 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, sdk_path, 'maven' not in build and 'gradle' not in build): parms = [os.path.join(sdk_path, 'tools', 'android'), 'update', 'project', '-p', '.'] - parms.append('--subprojects') if 'target' in build: parms.append('-t') parms.append(build['target']) @@ -1369,19 +1368,6 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, sdk_path, print 'Force-removing old build.xml' os.remove(buildxml) - baddirs = [ - 'gen', 'bin', 'obj', # ant - 'libs/armeabi-v7a', 'libs/armeabi', # jni - 'libs/mips', 'libs/x86'] # jni - if 'gradle' in build: - baddirs.append('build') - if 'maven' in build: - baddirs.append('target') - for baddir in baddirs: - badpath = os.path.join(build_dir, baddir) - if os.path.exists(badpath): - print "Removing '%s'" % badpath - shutil.rmtree(badpath) for d in update_dirs: cwd = os.path.join(root_dir, d) # Remove gen and bin dirs in libraries From 8767dc305913aebe6b7e8c0903dab02a4207b800 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Thu, 31 Oct 2013 17:59:45 +0100 Subject: [PATCH 07/14] Fix --auto for the new BV syntax --- fdroidserver/checkupdates.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fdroidserver/checkupdates.py b/fdroidserver/checkupdates.py index 382d758c..fb65405f 100644 --- a/fdroidserver/checkupdates.py +++ b/fdroidserver/checkupdates.py @@ -424,7 +424,8 @@ def main(): latest = build if not gotcur: newbuild = latest.copy() - del newbuild['origlines'] + if 'origlines' in newbuild: + del newbuild['origlines'] newbuild['vercode'] = app['Current Version Code'] newbuild['version'] = app['Current Version'] + suffix print "...auto-generating build for " + newbuild['version'] From 9edc302543480efd28e11f7202c62df72c3e2593 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Thu, 31 Oct 2013 18:20:45 +0100 Subject: [PATCH 08/14] --auto --commit now behaves like fd-commit, consistency --- fdroidserver/checkupdates.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/fdroidserver/checkupdates.py b/fdroidserver/checkupdates.py index fb65405f..1767d31b 100644 --- a/fdroidserver/checkupdates.py +++ b/fdroidserver/checkupdates.py @@ -400,8 +400,9 @@ def main(): if updating: print '...updating to version %s (%s)' % (app['Current Version'], app['Current Version Code']) - name = str('%s (%s)' % (app['Auto Name'], app['id']) if app['Auto Name'] else app['id']) - logmsg = 'Update current version of %s to %s (%s)' % (name, app['Current Version'], app['Current Version Code']) + name = '%s (%s)' % (app['Auto Name'], app['id']) if app['Auto Name'] else app['id'] + ver = "%s (%s)" % (app['Current Version'], app['Current Version Code']) + logmsg = 'Update CV of %s to %s' % (name, ver) if options.auto: mode = app['Auto Update Mode'] @@ -434,7 +435,9 @@ def main(): newbuild['commit'] = commit app['builds'].append(newbuild) writeit = True - logmsg = "Update " + app['id'] + " to " + newbuild['version'] + name = "%s (%s)" % (app['Auto Name'], app['id']) if app['Auto Name'] else app['id'] + ver = "%s (%s)" % (newbuild['version'], newbuild['vercode']) + logmsg = "Update %s to %s" % (name, ver) else: print 'Invalid auto update mode' @@ -443,10 +446,8 @@ def main(): common.write_metadata(metafile, app) if options.commit and logmsg: print "Commiting update for " + metafile - if subprocess.call("git add " + metafile, shell=True) != 0: - print "Git add failed" - sys.exit(1) - if subprocess.call("git commit -m '" + logmsg.replace("'", "\\'") + "'", shell=True) != 0: + if subprocess.call(["git", "commit", "-m", + "'"+logmsg.replace("'", "\\'")+"'", "--", metafile]) != 0: print "Git commit failed" sys.exit(1) From 4bd64de501d8dadb5fdc5f2e4699a5deec7a2c10 Mon Sep 17 00:00:00 2001 From: Ciaran Gultnieks Date: Thu, 31 Oct 2013 22:16:05 +0000 Subject: [PATCH 09/14] Avoid pyflakes error --- fdroidserver/update.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fdroidserver/update.py b/fdroidserver/update.py index 45566d79..16fe6008 100644 --- a/fdroidserver/update.py +++ b/fdroidserver/update.py @@ -425,6 +425,8 @@ def scan_apks(apps, apkcache, repodir, knownapks): return apks, cachechanged +repo_pubkey_fingerprint = None + def make_index(apps, apks, repodir, archive, categories): """Make a repo index. From e24a89916a098f0fd4946b72ab9255d2adfe5726 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Fri, 1 Nov 2013 11:05:41 +0100 Subject: [PATCH 10/14] No quotes in --commit messages --- fdroidserver/checkupdates.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fdroidserver/checkupdates.py b/fdroidserver/checkupdates.py index 1767d31b..97bad1d0 100644 --- a/fdroidserver/checkupdates.py +++ b/fdroidserver/checkupdates.py @@ -447,7 +447,7 @@ def main(): if options.commit and logmsg: print "Commiting update for " + metafile if subprocess.call(["git", "commit", "-m", - "'"+logmsg.replace("'", "\\'")+"'", "--", metafile]) != 0: + logmsg, "--", metafile]) != 0: print "Git commit failed" sys.exit(1) From e53f006d0832e44ccf20b9b692da924320248fd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Fri, 1 Nov 2013 13:19:07 +0100 Subject: [PATCH 11/14] Checkout with --force on git --- fdroidserver/common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fdroidserver/common.py b/fdroidserver/common.py index 024e3dda..9f99a1bb 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -197,7 +197,7 @@ class vcs_git(vcs): self.refreshed = True # Check out the appropriate revision... rev = str(rev if rev else 'origin/master') - if subprocess.call(['git', 'checkout', rev], cwd=self.local) != 0: + if subprocess.call(['git', 'checkout', '-f', rev], cwd=self.local) != 0: raise VCSException("Git checkout failed") # Get rid of any uncontrolled files left behind... if subprocess.call(['git', 'clean', '-dffx'], cwd=self.local) != 0: From 0c8283bc1aab225573a4a01e101b95b68362d885 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Fri, 1 Nov 2013 13:19:29 +0100 Subject: [PATCH 12/14] Also reset --hard and clean -dffx the git submodules --- fdroidserver/common.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/fdroidserver/common.py b/fdroidserver/common.py index 9f99a1bb..52681b84 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -211,6 +211,14 @@ class vcs_git(vcs): if subprocess.call(['git', 'submodule', 'update'], cwd=self.local) != 0: raise VCSException("Git submodule update failed") + if subprocess.call(['git', 'submodule', 'foreach', + 'git', 'reset', '--hard'], + cwd=self.local) != 0: + raise VCSException("Git submodule reset failed") + if subprocess.call(['git', 'submodule', 'foreach', + 'git', 'clean', '-dffx'], + cwd=self.local) != 0: + raise VCSException("Git submodule clean failed") def gettags(self): self.checkrepo() From d507b2e894a556559ea495877ebce5c2a7384879 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Fri, 1 Nov 2013 13:25:50 +0100 Subject: [PATCH 13/14] New metadata field: Vercode Operation --- docs/fdroid.texi | 15 +++++++++++++++ fdroidserver/checkupdates.py | 13 +++++++++---- fdroidserver/common.py | 21 ++++++++++++--------- 3 files changed, 36 insertions(+), 13 deletions(-) diff --git a/docs/fdroid.texi b/docs/fdroid.texi index cbcea84c..3f4ff4d6 100644 --- a/docs/fdroid.texi +++ b/docs/fdroid.texi @@ -476,6 +476,7 @@ The following sections describe the fields recognised within the file. * Requires Root:: * Archive Policy:: * Update Check Mode:: +* Vercode Operation:: * Update Check Data:: * Auto Update Mode:: * Current Version:: @@ -1136,6 +1137,20 @@ again, rather than retrieving a different one. Used in conjunction with @code{Update Check Mode} for certain modes. +@node Vercode Operation +@section Vercode Operation + +@cindex Vercode Operation + +Operation to be applied to the vercode obtained by the defined @code{Update +Check Mode}. @code{%c} will be replaced by the actual vercode, and the whole +string will be passed to python's @code{eval} function. + +Especially useful with apps that we want to compile for different ABIs, but +whose vercodes don't always have trailing zeros. With @code{Vercode Operation} +set at something like @code{%c*10 + 4}, we will be able to track updates and +build three different versions of every upstream version. + @node Archive Policy @section Archive Policy diff --git a/fdroidserver/checkupdates.py b/fdroidserver/checkupdates.py index 97bad1d0..2a6f26ec 100644 --- a/fdroidserver/checkupdates.py +++ b/fdroidserver/checkupdates.py @@ -333,6 +333,7 @@ def main(): logmsg = None tag = None + msg = None mode = app['Update Check Mode'] if mode == 'Tags': (version, vercode, tag) = check_tags(app, config['sdk_path']) @@ -346,17 +347,21 @@ def main(): (version, vercode) = check_http(app) elif mode == 'Static': version = None - vercode = 'Checking disabled' + msg = 'Checking disabled' elif mode == 'None': version = None - vercode = 'Checking disabled' + msg = 'Checking disabled' else: version = None - vercode = 'Invalid update check method' + msg = 'Invalid update check method' + + if vercode and app['Vercode Operation']: + op = app['Vercode Operation'].replace("%c", str(int(vercode))) + vercode = str(eval(op)) updating = False if not version: - print "..." + vercode + print "...%s" % msg elif vercode == app['Current Version Code']: print "...up to date" else: diff --git a/fdroidserver/common.py b/fdroidserver/common.py index 52681b84..91650b30 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -197,7 +197,7 @@ class vcs_git(vcs): self.refreshed = True # Check out the appropriate revision... rev = str(rev if rev else 'origin/master') - if subprocess.call(['git', 'checkout', '-f', rev], cwd=self.local) != 0: + if subprocess.call(['git', 'checkout', '-f', rev], cwd=self.local) != 0: raise VCSException("Git checkout failed") # Get rid of any uncontrolled files left behind... if subprocess.call(['git', 'clean', '-dffx'], cwd=self.local) != 0: @@ -211,14 +211,14 @@ class vcs_git(vcs): if subprocess.call(['git', 'submodule', 'update'], cwd=self.local) != 0: raise VCSException("Git submodule update failed") - if subprocess.call(['git', 'submodule', 'foreach', - 'git', 'reset', '--hard'], - cwd=self.local) != 0: - raise VCSException("Git submodule reset failed") - if subprocess.call(['git', 'submodule', 'foreach', - 'git', 'clean', '-dffx'], - cwd=self.local) != 0: - raise VCSException("Git submodule clean failed") + if subprocess.call(['git', 'submodule', 'foreach', + 'git', 'reset', '--hard'], + cwd=self.local) != 0: + raise VCSException("Git submodule reset failed") + if subprocess.call(['git', 'submodule', 'foreach', + 'git', 'clean', '-dffx'], + cwd=self.local) != 0: + raise VCSException("Git submodule clean failed") def gettags(self): self.checkrepo() @@ -566,6 +566,7 @@ def parse_metadata(metafile, verbose=False): thisinfo['AntiFeatures'] = None thisinfo['Archive Policy'] = None thisinfo['Update Check Mode'] = 'None' + thisinfo['Vercode Operation'] = None thisinfo['Auto Update Mode'] = 'None' thisinfo['Current Version'] = '' thisinfo['Current Version Code'] = '0' @@ -829,6 +830,8 @@ def write_metadata(dest, app, verbose=False): writefield('Archive Policy') writefield('Auto Update Mode') writefield('Update Check Mode') + if app['Vercode Operation']: + writefield('Vercode Operation') if 'Update Check Data' in app: writefield('Update Check Data') if len(app['Current Version']) > 0: From e07d35f91354a5faa5d66e676fd76094dbe10960 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Fri, 1 Nov 2013 13:46:19 +0100 Subject: [PATCH 14/14] New field: scandelete, like scanignore but deleting Also, many improvements: * scanning algorithm is much clearer * Now paths start by '/', which means the repo dir root. - If they don't, '/' is added - If they start by './', the dot is removed - If "." is in the paths, it is replaced by "/" * Handling/removing of problems is much easier * Removed last initfun/funambol bits --- docs/fdroid.texi | 14 ++++---- fdroidserver/common.py | 72 ++++++++++++++++++++++++++++++------------ 2 files changed, 58 insertions(+), 28 deletions(-) diff --git a/docs/fdroid.texi b/docs/fdroid.texi index 3f4ff4d6..fc9a7869 100644 --- a/docs/fdroid.texi +++ b/docs/fdroid.texi @@ -346,7 +346,7 @@ Along similar lines (and only in conjunction with @code{--test}, you can use @code{--force} to force a build of a Disabled application, where normally it would be completely ignored. Similarly a version that was found to contain ELFs or known non-free libraries can be forced to build. See also — -scanignore= in the Build Version section. +scanignore= and scandelete= in the Build Version section. If the build was unsuccessful, you can find out why by looking at the output in the logs/ directory. If that isn't illuminating, try building the app the @@ -908,17 +908,17 @@ You can use $$SDK$$, $$NDK$$ and $$MVN3$$ to substitute the paths to the android SDK and NDK directories, and maven 3 executable respectively e.g. for when you need to run @code{android update project} explicitly. -@item initfun=yes -Enables a selection of mad hacks to make com.funambol.android build. -Probably not useful for any other application. - @item scanignore=path1;path2;... Enables one or more files/paths to be exlcuded from the scan process. This should only be used where there is a very good reason, and probably accompanied by a comment explaining why it is necessary. -When scanning, files whose relative paths start with any of the paths -given here are ignored. +When scanning the source tree for problems, matching files whose relative +paths start with any of the paths given here are ignored. + +@item scandelete=path1;path2;... +Similar to scanignore=, but instead of ignoring files under the given paths, +it tells f-droid to delete the matching files directly. @item build=xxxx As for 'prebuild', but runs during the actual build phase (but before the diff --git a/fdroidserver/common.py b/fdroidserver/common.py index 91650b30..ee5a3513 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -805,7 +805,7 @@ def write_metadata(dest, app, verbose=False): 'oldsdkloc', 'target', 'compilesdk', 'update', 'encoding', 'forceversion', 'forcevercode', 'rm', 'fixtrans', 'fixapos', 'extlibs', 'srclibs', - 'patch', 'prebuild', 'initfun', 'scanignore', 'build', + 'patch', 'prebuild', 'scanignore', 'scandelete', 'build', 'buildjni', 'gradle', 'maven', 'preassemble', 'bindir', 'antcommand', 'novcheck'] @@ -1342,7 +1342,7 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, sdk_path, raise BuildException('Missing subdir ' + root_dir) # Initialise submodules if requred... - if build.get('submodules', 'no') == 'yes': + if build.get('submodules', 'no') == 'yes': if verbose: print "Initialising submodules..." vcs.initsubmodules() @@ -1640,14 +1640,50 @@ def scan_source(build_dir, root_dir, thisbuild): 'youtubeandroidplayerapi', 'bugsense'] - if 'scanignore' in thisbuild: - ignore = [p.strip() for p in thisbuild['scanignore'].split(';')] - else: - ignore = [] - + def getpaths(field): + paths = [] + if field not in thisbuild: + return paths + for p in thisbuild[field].split(';'): + p = p.strip() + if p == '.': + p = '/' + elif p.startswith('./'): + p = p[1:] + elif not p.startswith('/'): + p = '/' + p; + if p not in paths: + paths.append(p) + return paths + + scanignore = getpaths('scanignore') + scandelete = getpaths('scandelete') + ms = magic.open(magic.MIME_TYPE) ms.load() + def toignore(fd): + for i in scanignore: + if fd.startswith(i): + return True + return False + + def todelete(fd): + for i in scandelete: + if fd.startswith(i): + return True + return False + + def removeproblem(what, fd, fp): + print 'Removing %s at %s' % (what, fd) + os.remove(fp) + + def handleproblem(what, fd, fp): + if todelete(fd): + removeproblem(what, fd, fp) + else: + problems.append('Found %s at %s' % (what, fd)) + # Iterate through all files in the source code... for r,d,f in os.walk(build_dir): for curfile in f: @@ -1657,36 +1693,30 @@ def scan_source(build_dir, root_dir, thisbuild): # Path (relative) to the file... fp = os.path.join(r, curfile) - fd = fp[len(build_dir)+1:] + fd = fp[len(build_dir):] # Check if this file has been explicitly excluded from scanning... - ignorethis = False - for i in ignore: - if fd.startswith(i): - ignorethis = True - break - if ignorethis: + if toignore(fd): continue for suspect in usual_suspects: if suspect in curfile.lower(): - problems.append('Found usual supect in filename ' + fp) + handleproblem('usual supect', fd, fp) mime = ms.file(fp) if mime == 'application/x-sharedlib': - problems.append('Found shared library at %s' % fd) + handleproblem('shared library', fd, fp) elif mime == 'application/x-archive': - problems.append('Found static library at %s' % fd) + handleproblem('static library', fd, fp) elif mime == 'application/x-executable': - problems.append('Found binary executable at %s' % fd) + handleproblem('binary executable', fd, fp) elif mime == 'application/jar' and fp.endswith('.apk'): - print 'Removing apk file at %s' % fd - os.remove(fp) + removeproblem('APK file', fd, fp) elif curfile.endswith('.java'): for line in file(fp): if 'DexClassLoader' in line: - problems.append('Found DexClassLoader in ' + fp) + handleproblem('DexClassLoader', fd, fp) break ms.close()