diff --git a/docs/fdroid.texi b/docs/fdroid.texi index b584deb7..faead290 100644 --- a/docs/fdroid.texi +++ b/docs/fdroid.texi @@ -884,22 +884,22 @@ which architecture or platform the apk is designed to run on. If specified, the package version code in the AndroidManifest.xml is replaced with the version code for the build. See also forceversion. -@item rm= +@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. @@ -947,7 +947,7 @@ You can use $$SDK$$, $$NDK$$ and $$MVN3$$ to substitute the paths to the 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. @@ -955,7 +955,7 @@ 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. diff --git a/fdroidserver/common.py b/fdroidserver/common.py index 6eac3d0e..15dc9ed6 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -815,7 +815,7 @@ def getsrclib(spec, srclib_dir, srclibpaths=[], subdir=None, 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: @@ -894,7 +894,7 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, onserver= # 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) @@ -906,7 +906,7 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, onserver= 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)) @@ -1005,7 +1005,7 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, 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)) @@ -1030,7 +1030,7 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, onserver= 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) @@ -1119,7 +1119,7 @@ def scan_source(build_dir, root_dir, thisbuild): 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 = '/' diff --git a/fdroidserver/metadata.py b/fdroidserver/metadata.py index 51b2529f..88548d57 100644 --- a/fdroidserver/metadata.py +++ b/fdroidserver/metadata.py @@ -381,7 +381,6 @@ def parse_srclib(metafile, **kw): thisinfo['Subdir'] = None thisinfo['Prepare'] = None thisinfo['Srclibs'] = None - thisinfo['Update Project'] = None if metafile is None: return thisinfo @@ -451,6 +450,13 @@ def metafieldtype(name): 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 @@ -507,7 +513,17 @@ def parse_metadata(metafile): 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 @@ -732,9 +748,15 @@ def write_metadata(dest, app): 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)