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

Allow for leading and trailing whitespaces in ';'-separated lists (e.g. update= abc ; def ; ...)

This commit is contained in:
Daniel Martí 2013-09-11 13:45:02 +02:00
parent fba8fb839c
commit 9257690f95
2 changed files with 9 additions and 4 deletions

View File

@ -240,6 +240,7 @@ def build_server(app, thisbuild, vcs, build_dir, output_dir, sdk_path, force):
if 'extlibs' in thisbuild:
ftp.chdir('/home/vagrant/build/extlib')
for lib in thisbuild['extlibs'].split(';'):
lib = lib.strip()
lp = lib.split('/')
for d in lp[:-1]:
if d not in ftp.listdir():
@ -252,6 +253,7 @@ def build_server(app, thisbuild, vcs, build_dir, output_dir, sdk_path, force):
srclibpaths = []
if 'srclibs' in thisbuild:
for lib in thisbuild['srclibs'].split(';'):
lib = lib.strip()
name, _ = lib.split('@')
if options.verbose:
print "Processing srclib '" + name + "'"
@ -399,7 +401,7 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
if jni_components == 'yes':
jni_components = ['']
else:
jni_components = jni_components.split(';')
jni_components = [c.strip() for c in jni_components.split(';')]
ndkbuild = os.path.join(ndk_path, "ndk-build")
for d in jni_components:
if options.verbose:

View File

@ -1194,7 +1194,7 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, sdk_path,
if 'target' in build:
parms.append('-t')
parms.append(build['target'])
update_dirs = updatemode.split(';')
update_dirs = [d.strip() for d in updatemode.split(';')]
# Force build.xml update if necessary...
if updatemode == 'force' or 'target' in build:
if updatemode == 'force':
@ -1266,7 +1266,7 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, sdk_path,
# Delete unwanted file...
if 'rm' in build:
for part in build['rm'].split(';'):
dest = os.path.join(build_dir, part)
dest = os.path.join(build_dir, part.strip())
if os.path.exists(dest):
os.remove(dest)
@ -1327,6 +1327,7 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, sdk_path,
if not os.path.exists(libsdir):
os.mkdir(libsdir)
for lib in build['extlibs'].split(';'):
lib = lib.strip()
libf = os.path.basename(lib)
shutil.copyfile(os.path.join(extlib_dir, lib),
os.path.join(libsdir, libf))
@ -1336,6 +1337,7 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, sdk_path,
if 'srclibs' in build:
print "Collecting source libraries..."
for lib in build['srclibs'].split(';'):
lib = lib.strip()
name, _ = lib.split('@')
srclibpaths.append((name, getsrclib(lib, srclib_dir, sdk_path, ndk_path, mvn3, preponly=onserver)))
basesrclib = vcs.getsrclib()
@ -1353,6 +1355,7 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, sdk_path,
# Apply patches if any
if 'patch' in build:
for patch in build['patch'].split(';'):
patch = patch.strip()
print "Applying " + patch
patch_path = os.path.join('metadata', app['id'], patch)
if subprocess.call(['patch', '-p1',
@ -1516,7 +1519,7 @@ def scan_source(build_dir, root_dir, thisbuild):
'jpct-ae']
if 'scanignore' in thisbuild:
ignore = thisbuild['scanignore'].split(';')
ignore = [p.strip() for p in thisbuild['scanignore'].split(';')]
else:
ignore = []