mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-14 15:02:51 +03:00
Some more work on the importer
This commit is contained in:
parent
c528bb5dda
commit
006cd46725
2 changed files with 26 additions and 0 deletions
|
@ -685,6 +685,7 @@ def prepare_source(vcs, app, build, build_dir, extlib_dir, sdk_path, ndk_path, j
|
||||||
# the original behaviour...
|
# the original behaviour...
|
||||||
buildxml = os.path.join(root_dir, 'build.xml')
|
buildxml = os.path.join(root_dir, 'build.xml')
|
||||||
if os.path.exists(buildxml):
|
if os.path.exists(buildxml):
|
||||||
|
print 'Force-removing old build.xml'
|
||||||
os.remove(buildxml)
|
os.remove(buildxml)
|
||||||
if subprocess.call(parms, cwd=root_dir) != 0:
|
if subprocess.call(parms, cwd=root_dir) != 0:
|
||||||
raise BuildException("Failed to update project")
|
raise BuildException("Failed to update project")
|
||||||
|
|
25
import.py
25
import.py
|
@ -22,6 +22,7 @@ import os
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
import re
|
import re
|
||||||
|
import urllib
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
|
|
||||||
#Read configuration...
|
#Read configuration...
|
||||||
|
@ -61,12 +62,36 @@ if url.startswith('https://github.com'):
|
||||||
repo = url + '.git'
|
repo = url + '.git'
|
||||||
repotype = 'git'
|
repotype = 'git'
|
||||||
sourcecode = url
|
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:
|
if not projecttype:
|
||||||
print "Unable to determine the project type."
|
print "Unable to determine the project type."
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
# Get a copy of the source so we can extract some info...
|
# 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')
|
src_dir = os.path.join(tmp_dir, 'importer')
|
||||||
if os.path.exists(tmp_dir):
|
if os.path.exists(tmp_dir):
|
||||||
shutil.rmtree(tmp_dir)
|
shutil.rmtree(tmp_dir)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue