From: Daniel Martí Date: Sun, 25 Oct 2015 10:41:46 +0000 (+0100) Subject: Be consistent about root_dir/build_dir naming X-Git-Tag: 0.5.0~29 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=fa55ec0e8789d4b64c2e97605046d1030311e18a;p=fdroidserver.git Be consistent about root_dir/build_dir naming --- diff --git a/fdroidserver/checkupdates.py b/fdroidserver/checkupdates.py index 65c238a3..4d53ab12 100644 --- a/fdroidserver/checkupdates.py +++ b/fdroidserver/checkupdates.py @@ -117,10 +117,11 @@ def check_tags(app, pattern): vcs.gotorevision(None) + root_dir = build_dir flavours = [] if len(app['builds']) > 0: if app['builds'][-1]['subdir']: - build_dir = os.path.join(build_dir, app['builds'][-1]['subdir']) + root_dir = os.path.join(build_dir, app['builds'][-1]['subdir']) if app['builds'][-1]['gradle']: flavours = app['builds'][-1]['gradle'] @@ -145,7 +146,7 @@ def check_tags(app, pattern): vcs.gotorevision(tag) # Only process tags where the manifest exists... - paths = common.manifest_paths(build_dir, flavours) + paths = common.manifest_paths(root_dir, flavours) version, vercode, package = \ common.parse_androidmanifests(paths, app['Update Check Ignore']) if not app_matches_packagename(app, package) or not version or not vercode: @@ -204,17 +205,18 @@ def check_repomanifest(app, branch=None): elif repotype == 'bzr': vcs.gotorevision(None) + root_dir = build_dir flavours = [] if len(app['builds']) > 0: if app['builds'][-1]['subdir']: - build_dir = os.path.join(build_dir, app['builds'][-1]['subdir']) + root_dir = os.path.join(build_dir, app['builds'][-1]['subdir']) if app['builds'][-1]['gradle']: flavours = app['builds'][-1]['gradle'] - if not os.path.isdir(build_dir): + if not os.path.isdir(root_dir): return (None, "Subdir '" + app['builds'][-1]['subdir'] + "'is not a valid directory") - paths = common.manifest_paths(build_dir, flavours) + paths = common.manifest_paths(root_dir, flavours) version, vercode, package = \ common.parse_androidmanifests(paths, app['Update Check Ignore']) diff --git a/fdroidserver/import.py b/fdroidserver/import.py index 102b56a6..3bae24c1 100644 --- a/fdroidserver/import.py +++ b/fdroidserver/import.py @@ -132,28 +132,28 @@ def get_metadata_from_url(app, url): # Get a copy of the source so we can extract some info... logging.info('Getting source from ' + repotype + ' repo at ' + repo) - 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) + build_dir = os.path.join(tmp_dir, 'importer') + if os.path.exists(build_dir): + shutil.rmtree(build_dir) + vcs = common.getvcs(repotype, repo, build_dir) vcs.gotorevision(options.rev) - root_dir = get_subdir(src_dir) + root_dir = get_subdir(build_dir) app['Repo Type'] = repotype app['Repo'] = repo - return root_dir, src_dir + return root_dir, build_dir config = None options = None -def get_subdir(src_dir): +def get_subdir(build_dir): if options.subdir: - return os.path.join(src_dir, options.subdir) + return os.path.join(build_dir, options.subdir) - return src_dir + return build_dir def main(): @@ -178,10 +178,10 @@ def main(): app['Update Check Mode'] = "Tags" root_dir = None - src_dir = None + build_dir = None if options.url: - root_dir, src_dir = get_metadata_from_url(app, options.url) + root_dir, build_dir = get_metadata_from_url(app, options.url) elif os.path.isdir('.git'): if options.url: app['Web Site'] = options.url @@ -242,8 +242,8 @@ def main(): # Keep the repo directory to save bandwidth... if not os.path.exists('build'): os.mkdir('build') - if src_dir is not None: - shutil.move(src_dir, os.path.join('build', package)) + if build_dir is not None: + shutil.move(build_dir, os.path.join('build', package)) with open('build/.fdroidvcs-' + package, 'w') as f: f.write(app['Repo Type'] + ' ' + app['Repo'])