chiark / gitweb /
Be consistent about root_dir/build_dir naming
authorDaniel Martí <mvdan@mvdan.cc>
Sun, 25 Oct 2015 10:41:46 +0000 (11:41 +0100)
committerDaniel Martí <mvdan@mvdan.cc>
Sun, 25 Oct 2015 10:41:46 +0000 (11:41 +0100)
fdroidserver/checkupdates.py
fdroidserver/import.py

index 65c238a399c2b23a173063f45919544f012502f3..4d53ab12f044335cf7b0f3fdc7aa5f3db7b314d9 100644 (file)
@@ -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'])
index 102b56a6f80052ced7377788d62ebed6fc868bdd..3bae24c161ce6557a7ea1e0a70aaf78e33437532 100644 (file)
@@ -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'])