chiark / gitweb /
build: check that metadata is present before creating tmp dirs
authorHans-Christoph Steiner <hans@eds.org>
Tue, 4 Aug 2015 14:09:44 +0000 (16:09 +0200)
committerHans-Christoph Steiner <hans@eds.org>
Fri, 12 Feb 2016 07:33:22 +0000 (08:33 +0100)
Before, `fdroid build` would create some subdirs, then fail when it could
not read the metadata via metadata.read_metadata().  This checks before
whether there is any metadata available, and warns the user accordingly.

fdroidserver/build.py

index 021e1041910ce4398a480cada6cbb3a5efc1ddbc..12cc61c144d57894fda53d8be57ad9e2f62d5ea1 100644 (file)
@@ -1001,6 +1001,15 @@ def main():
     global options, config
 
     options, parser = parse_commandline()
+
+    metadata_files = glob.glob('.fdroid.*[a-z]')  # ignore files ending in ~
+    if len(metadata_files) > 1:
+        raise FDroidException("Only one local metadata file allowed! Found: "
+                              + " ".join(metadata_files))
+
+    if not os.path.isdir('metadata') and len(metadata_files) == 0:
+        raise FDroidException("No app metadata found, nothing to process!")
+
     if not options.appid and not options.all:
         parser.error("option %s: If you really want to build all the apps, use --all" % "all")