chiark / gitweb /
Merge branch 'submodules_ucm' into 'master'
authorMarcus <bubuiic@aol.com>
Mon, 4 Dec 2017 16:29:11 +0000 (16:29 +0000)
committerMarcus <bubuiic@aol.com>
Mon, 4 Dec 2017 16:29:11 +0000 (16:29 +0000)
checkupdates: don't fail when we can't init submodules

Closes #231

See merge request fdroid/fdroidserver!395

fdroidserver/checkupdates.py
fdroidserver/common.py
fdroidserver/exception.py

index 02baa061d54f085471a188a5a17bda95cc8585df..a303f7fe6c3fcd17c306e974aa527cc5a90bb0c4 100644 (file)
@@ -33,7 +33,7 @@ import copy
 from . import _
 from . import common
 from . import metadata
-from .exception import VCSException, FDroidException, MetaDataException
+from .exception import VCSException, NoSubmodulesException, FDroidException, MetaDataException
 
 
 # Check for a new version by looking at a document retrieved via HTTP.
@@ -110,8 +110,7 @@ def check_tags(app, pattern):
 
         last_build = app.get_last_build()
 
-        if last_build.submodules:
-            vcs.initsubmodules()
+        try_init_submodules(app, last_build, vcs)
 
         hpak = None
         htag = None
@@ -207,8 +206,7 @@ def check_repomanifest(app, branch=None):
         if len(app.builds) > 0:
             last_build = app.builds[-1]
 
-        if last_build.submodules:
-            vcs.initsubmodules()
+        try_init_submodules(app, last_build, vcs)
 
         hpak = None
         hver = None
@@ -300,6 +298,19 @@ def check_gplay(app):
     return (version.strip(), None)
 
 
+def try_init_submodules(app, last_build, vcs):
+    """Try to init submodules if the last build entry used them.
+    They might have been removed from the app's repo in the meantime,
+    so if we can't find any submodules we continue with the updates check.
+    If there is any other error in initializing them then we stop the check.
+    """
+    if last_build.submodules:
+        try:
+            vcs.initsubmodules()
+        except NoSubmodulesException:
+            logging.info("No submodules present for {}".format(app.Name))
+
+
 # Return all directories under startdir that contain any of the manifest
 # files, and thus are probably an Android project.
 def dirs_with_manifest(startdir):
index 74e96ce83cbe923289571c28b37d88fe5acfdf84..a6dc54f00de7ce617cfcd72c676ef32989791b60 100644 (file)
@@ -53,7 +53,8 @@ from distutils.util import strtobool
 
 import fdroidserver.metadata
 from fdroidserver import _
-from fdroidserver.exception import FDroidException, VCSException, BuildException, VerificationException
+from fdroidserver.exception import FDroidException, VCSException, NoSubmodulesException,\
+    BuildException, VerificationException
 from .asynchronousfilereader import AsynchronousFileReader
 
 
@@ -883,7 +884,7 @@ class vcs_git(vcs):
         self.checkrepo()
         submfile = os.path.join(self.local, '.gitmodules')
         if not os.path.isfile(submfile):
-            raise VCSException(_("No git submodules available"))
+            raise NoSubmodulesException(_("No git submodules available"))
 
         # fix submodules not accessible without an account and public key auth
         with open(submfile, 'r') as f:
index 51481c564a90d52d13612e340379b45d8558e117..f9f876ce6890da8792a106e029f110d6027967db 100644 (file)
@@ -39,6 +39,10 @@ class VCSException(FDroidException):
     pass
 
 
+class NoSubmodulesException(VCSException):
+    pass
+
+
 class BuildException(FDroidException):
     pass