1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-13 02:30:11 +01:00

Some more work on the importer

This commit is contained in:
Ciaran Gultnieks 2012-02-09 09:06:51 +00:00
parent c528bb5dda
commit 006cd46725
2 changed files with 26 additions and 0 deletions

View File

@ -685,6 +685,7 @@ def prepare_source(vcs, app, build, build_dir, extlib_dir, sdk_path, ndk_path, j
# the original behaviour...
buildxml = os.path.join(root_dir, 'build.xml')
if os.path.exists(buildxml):
print 'Force-removing old build.xml'
os.remove(buildxml)
if subprocess.call(parms, cwd=root_dir) != 0:
raise BuildException("Failed to update project")

View File

@ -22,6 +22,7 @@ import os
import shutil
import subprocess
import re
import urllib
from optparse import OptionParser
#Read configuration...
@ -61,12 +62,36 @@ if url.startswith('https://github.com'):
repo = url + '.git'
repotype = 'git'
sourcecode = url
elif url.startswith('http://code.google.com/p/'):
if not url.endswith('/'):
print "Expected format for googlecode url is http://code.google.com/p/PROJECT/"
sys.exit(1)
projecttype = 'googlecode'
sourcecode = url + 'source/checkout'
req = urllib.urlopen(sourcecode)
if req.getcode() != 200:
print 'Unable to find source at ' + sourcecode + ' - return code ' + str(req.getcode())
sys.exit(1)
page = req.read()
index = page.find('hg clone')
if index != -1:
repotype = 'hg'
repo = page[index + 9:]
index = repo.find('<')
if index == -1:
print "Error while getting repo address"
sys.exit(1)
repo = repo[:index]
else:
print "Unable to determine vcs type"
sys.exit(1)
if not projecttype:
print "Unable to determine the project type."
sys.exit(1)
# Get a copy of the source so we can extract some info...
print 'Getting source from ' + repotype + ' repo at ' + repo
src_dir = os.path.join(tmp_dir, 'importer')
if os.path.exists(tmp_dir):
shutil.rmtree(tmp_dir)