chiark / gitweb /
Merge branch 'changelog' of https://gitlab.com/krt/fdroidserver
[fdroidserver.git] / fdroidserver / import.py
index c2f0bbd74700d86b87f94604ce9c04ee5d3bd746..5e0c6b02321618b2902ef9346062feb1d096e593 100644 (file)
@@ -143,12 +143,13 @@ def main():
         repotype = 'git'
         sourcecode = url
         issuetracker = url + '/issues'
+        website = ""
         changelog = url + '/commits'
     elif url.startswith('https://gitlab.com/'):
         projecttype = 'gitlab'
         repo = url
         repotype = 'git'
-        sourcecode = url
+        sourcecode = url + '/tree/HEAD'
         issuetracker = url + '/issues'
     elif url.startswith('https://gitorious.org/'):
         projecttype = 'gitorious'
@@ -228,6 +229,16 @@ def main():
         logging.error("the manual for a list of supported formats, and supply one of those.")
         sys.exit(1)
 
+    # Ensure we have a sensible-looking repo address at this point. If not, we
+    # might have got a page format we weren't expecting. (Note that we
+    # specifically don't want git@...)
+    if ((repotype != 'bzr' and (not repo.startswith('http://') and
+        not repo.startswith('https://') and
+        not repo.startswith('git://'))) or
+            ' ' in repo):
+        logging.error("Repo address '{0}' does not seem to be valid".format(repo))
+        sys.exit(1)
+
     # 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')