for build in app['builds']:
writecomments('build:' + build['version'])
mf.write('Build Version:')
- mf.write('\\\n'.join(build['origlines']) + '\n')
+ if build.has_key('origlines'):
+ # Keeping the original formatting if we loaded it from a file...
+ mf.write('\\\n'.join(build['origlines']) + '\n')
+ else:
+ mf.write(build['version'] + ',' + build['vercode'] + ',' +
+ build['commit'])
+ for key,value in build.iteritems():
+ if key not in ['version', 'vercode', 'commit']:
+ mf.write(',' + key + '=' + value)
+ mf.write('\n')
if len(app['builds']) > 0:
mf.write('\n')
writefield('Update Check Mode')
print 'Unable to find source at ' + sourcecode + ' - return code ' + str(req.getcode())
sys.exit(1)
page = req.read()
+ repotype = None
index = page.find('hg clone')
if index != -1:
repotype = 'hg'
print "Error while getting repo address"
sys.exit(1)
repo = repo[:index]
- else:
+ if not repotype:
+ index=page.find('git clone')
+ if index != -1:
+ repotype = 'git'
+ repo = page[index + 10:]
+ index = repo.find('<')
+ if index == -1:
+ print "Error while getting repo address"
+ sys.exit(1)
+ repo = repo[:index]
+ if not repotype:
print "Unable to determine vcs type"
sys.exit(1)
# Extract some information...
vcsearch = re.compile(r'.*android:versionCode="([^"]+)".*').search
-vnsearch = re.compile(r'.*android:versionName="([^"]+)".').search
+vnsearch = re.compile(r'.*android:versionName="([^"]+)".*').search
psearch = re.compile(r'.*package="([^"]+)".*').search
version = None
vercode = None
# Make sure it's actually new...
for app in apps:
if app['id'] == package:
- print "Package ' + package + ' already exists"
+ print "Package " + package + " already exists"
sys.exit(1)
# Construct the metadata...
app['Source Code'] = sourcecode
app['Repo Type'] = repotype
app['Repo'] = repo
+
+# Create a build line...
+build = {}
+build['version'] = version
+build['vercode'] = vercode
+build['commit'] = '?'
+if options.subdir:
+ build['subdir'] = options.subdir
+if os.path.exists(os.path.join(root_dir, 'jni')):
+ build['buildjni'] = 'yes'
+app['builds'].append(build)
+app['comments'].append(('build:' + version,
+ "#Generated by import.py - check this is the right version, and find the right commit!"))
+
metafile = os.path.join('metadata', package + '.txt')
common.write_metadata(metafile, app)
print "Wrote " + metafile