Semicolons are still supported, but commas are now the better standard.
If specified, the package version code in the AndroidManifest.xml is
replaced with the version code for the build. See also forceversion.
-@item rm=<relpath1;relpath2;...>
+@item rm=relpath1,relpath2,...
Specifies the relative paths of files or directories to delete before
the build is done. The paths are relative to the base of the build
directory - i.e. the root of the directory structure checked out from
the source respository - not necessarily the directory that contains
AndroidManifest.xml.
-Multiple files/directories can be specified by separating them with ';'.
+Multiple files/directories can be specified by separating them with ','.
Directories will be recursively deleted.
-@item extlibs=a;b;c
+@item extlibs=a,b,...
Specifies a list of external libraries (jar files) from the
@code{build/extlib} library, which will be placed in the @code{libs} directory
of the project. Separate items with semicolons.
-@item srclibs=[n:]a@@r;[n:]b@@r1;
+@item srclibs=[n:]a@@r,[n:]b@@r1,...
Specifies a list of source libraries or Android projects. Separate items with
semicolons, and each item is of the form name@@rev where name is the predefined
source library name and rev is the revision or tag in source control to use.
android SDK and NDK directories, and maven 3 executable respectively e.g.
for when you need to run @code{android update project} explicitly.
-@item scanignore=path1;path2;...
+@item scanignore=path1,path2,...
Enables one or more files/paths to be exlcuded from the scan process.
This should only be used where there is a very good reason, and
probably accompanied by a comment explaining why it is necessary.
When scanning the source tree for problems, matching files whose relative
paths start with any of the paths given here are ignored.
-@item scandelete=path1;path2;...
+@item scandelete=path1,path2,...
Similar to scanignore=, but instead of ignoring files under the given paths,
it tells f-droid to delete the matching files directly.
if srclib["Srclibs"]:
n=1
- for lib in srclib["Srclibs"].split(','):
+ for lib in srclib["Srclibs"]:
s_tuple = None
for t in srclibpaths:
if t[0] == lib:
# Apply patches if any
if 'patch' in build:
- for patch in build['patch'].split(';'):
+ for patch in build['patch']:
patch = patch.strip()
logging.info("Applying " + patch)
patch_path = os.path.join('metadata', app['id'], patch)
srclibpaths = []
if 'srclibs' in build:
logging.info("Collecting source libraries")
- for lib in build['srclibs'].split(';'):
+ for lib in build['srclibs']:
srclibpaths.append(getsrclib(lib, srclib_dir, srclibpaths,
preponly=onserver))
# Delete unwanted files
if 'rm' in build:
- for part in build['rm'].split(';'):
+ for part in build['rm']:
dest = os.path.join(build_dir, part.strip())
rdest = os.path.abspath(dest)
logging.info("Removing {0}".format(rdest))
libsdir = os.path.join(root_dir, 'libs')
if not os.path.exists(libsdir):
os.mkdir(libsdir)
- for lib in build['extlibs'].split(';'):
+ for lib in build['extlibs']:
lib = lib.strip()
logging.info("...installing extlib {0}".format(lib))
libf = os.path.basename(lib)
paths = []
if field not in thisbuild:
return paths
- for p in thisbuild[field].split(';'):
+ for p in thisbuild[field]:
p = p.strip()
if p == '.':
p = '/'
thisinfo['Subdir'] = None
thisinfo['Prepare'] = None
thisinfo['Srclibs'] = None
- thisinfo['Update Project'] = None
if metafile is None:
return thisinfo
return 'unknown'
return 'string'
+def flagtype(name):
+ if name in ['extlibs', 'srclibs', 'patch', 'rm', 'scanignore', 'scandelete']:
+ return 'list'
+ if name in ['init', 'prebuild', 'build']:
+ return 'script'
+ return 'string'
+
# Parse metadata for a single application.
#
# 'metafile' - the filename to read. The package id for the application comes
if pk not in ordered_flags:
raise MetaDataException("Unrecognised build flag at {0} in {1}".
format(p, metafile.name))
- thisbuild[pk] = pv
+ t = flagtype(pk)
+ if t == 'list':
+ # Port legacy ';' separators
+ thisbuild[pk] = pv.replace(';',',').split(',')
+ elif t == 'string':
+ thisbuild[pk] = pv
+ elif t == 'script':
+ thisbuild[pk] = pv
+ else:
+ raise MetaDataException("Unrecognised build flag type '%s' at %s in %s" % (
+ t, p, metafile.name))
return thisbuild
if not value:
return
value = 'yes'
+ t = flagtype(key)
logging.debug("...writing {0} : {1}".format(key, value))
outline = ' %s=' % key
- outline += '&& \\\n '.join([s.lstrip() for s in value.split('&& ')])
+ if t == 'string':
+ outline += value
+ elif t == 'script':
+ outline += '&& \\\n '.join([s.lstrip() for s in value.split('&& ')])
+ elif t == 'list':
+ outline += ','.join(value) if type(value) == list else value
outline += '\n'
mf.write(outline)