mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-05 23:10:29 +03:00
Have all multi-value build flags work similarly
Semicolons are still supported, but commas are now the better standard.
This commit is contained in:
parent
5125b52e39
commit
24c9232398
3 changed files with 37 additions and 15 deletions
|
|
@ -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
|
If specified, the package version code in the AndroidManifest.xml is
|
||||||
replaced with the version code for the build. See also forceversion.
|
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
|
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
|
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
|
directory - i.e. the root of the directory structure checked out from
|
||||||
the source respository - not necessarily the directory that contains
|
the source respository - not necessarily the directory that contains
|
||||||
AndroidManifest.xml.
|
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.
|
Directories will be recursively deleted.
|
||||||
|
|
||||||
@item extlibs=a;b;c
|
@item extlibs=a,b,...
|
||||||
Specifies a list of external libraries (jar files) from the
|
Specifies a list of external libraries (jar files) from the
|
||||||
@code{build/extlib} library, which will be placed in the @code{libs} directory
|
@code{build/extlib} library, which will be placed in the @code{libs} directory
|
||||||
of the project. Separate items with semicolons.
|
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
|
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
|
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.
|
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.
|
android SDK and NDK directories, and maven 3 executable respectively e.g.
|
||||||
for when you need to run @code{android update project} explicitly.
|
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.
|
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
|
This should only be used where there is a very good reason, and
|
||||||
probably accompanied by a comment explaining why it is necessary.
|
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
|
When scanning the source tree for problems, matching files whose relative
|
||||||
paths start with any of the paths given here are ignored.
|
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,
|
Similar to scanignore=, but instead of ignoring files under the given paths,
|
||||||
it tells f-droid to delete the matching files directly.
|
it tells f-droid to delete the matching files directly.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -815,7 +815,7 @@ def getsrclib(spec, srclib_dir, srclibpaths=[], subdir=None,
|
||||||
|
|
||||||
if srclib["Srclibs"]:
|
if srclib["Srclibs"]:
|
||||||
n=1
|
n=1
|
||||||
for lib in srclib["Srclibs"].split(','):
|
for lib in srclib["Srclibs"]:
|
||||||
s_tuple = None
|
s_tuple = None
|
||||||
for t in srclibpaths:
|
for t in srclibpaths:
|
||||||
if t[0] == lib:
|
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
|
# Apply patches if any
|
||||||
if 'patch' in build:
|
if 'patch' in build:
|
||||||
for patch in build['patch'].split(';'):
|
for patch in build['patch']:
|
||||||
patch = patch.strip()
|
patch = patch.strip()
|
||||||
logging.info("Applying " + patch)
|
logging.info("Applying " + patch)
|
||||||
patch_path = os.path.join('metadata', app['id'], 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 = []
|
srclibpaths = []
|
||||||
if 'srclibs' in build:
|
if 'srclibs' in build:
|
||||||
logging.info("Collecting source libraries")
|
logging.info("Collecting source libraries")
|
||||||
for lib in build['srclibs'].split(';'):
|
for lib in build['srclibs']:
|
||||||
srclibpaths.append(getsrclib(lib, srclib_dir, srclibpaths,
|
srclibpaths.append(getsrclib(lib, srclib_dir, srclibpaths,
|
||||||
preponly=onserver))
|
preponly=onserver))
|
||||||
|
|
||||||
|
|
@ -1005,7 +1005,7 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, onserver=
|
||||||
|
|
||||||
# Delete unwanted files
|
# Delete unwanted files
|
||||||
if 'rm' in build:
|
if 'rm' in build:
|
||||||
for part in build['rm'].split(';'):
|
for part in build['rm']:
|
||||||
dest = os.path.join(build_dir, part.strip())
|
dest = os.path.join(build_dir, part.strip())
|
||||||
rdest = os.path.abspath(dest)
|
rdest = os.path.abspath(dest)
|
||||||
logging.info("Removing {0}".format(rdest))
|
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')
|
libsdir = os.path.join(root_dir, 'libs')
|
||||||
if not os.path.exists(libsdir):
|
if not os.path.exists(libsdir):
|
||||||
os.mkdir(libsdir)
|
os.mkdir(libsdir)
|
||||||
for lib in build['extlibs'].split(';'):
|
for lib in build['extlibs']:
|
||||||
lib = lib.strip()
|
lib = lib.strip()
|
||||||
logging.info("...installing extlib {0}".format(lib))
|
logging.info("...installing extlib {0}".format(lib))
|
||||||
libf = os.path.basename(lib)
|
libf = os.path.basename(lib)
|
||||||
|
|
@ -1119,7 +1119,7 @@ def scan_source(build_dir, root_dir, thisbuild):
|
||||||
paths = []
|
paths = []
|
||||||
if field not in thisbuild:
|
if field not in thisbuild:
|
||||||
return paths
|
return paths
|
||||||
for p in thisbuild[field].split(';'):
|
for p in thisbuild[field]:
|
||||||
p = p.strip()
|
p = p.strip()
|
||||||
if p == '.':
|
if p == '.':
|
||||||
p = '/'
|
p = '/'
|
||||||
|
|
|
||||||
|
|
@ -381,7 +381,6 @@ def parse_srclib(metafile, **kw):
|
||||||
thisinfo['Subdir'] = None
|
thisinfo['Subdir'] = None
|
||||||
thisinfo['Prepare'] = None
|
thisinfo['Prepare'] = None
|
||||||
thisinfo['Srclibs'] = None
|
thisinfo['Srclibs'] = None
|
||||||
thisinfo['Update Project'] = None
|
|
||||||
|
|
||||||
if metafile is None:
|
if metafile is None:
|
||||||
return thisinfo
|
return thisinfo
|
||||||
|
|
@ -451,6 +450,13 @@ def metafieldtype(name):
|
||||||
return 'unknown'
|
return 'unknown'
|
||||||
return 'string'
|
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.
|
# Parse metadata for a single application.
|
||||||
#
|
#
|
||||||
# 'metafile' - the filename to read. The package id for the application comes
|
# '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:
|
if pk not in ordered_flags:
|
||||||
raise MetaDataException("Unrecognised build flag at {0} in {1}".
|
raise MetaDataException("Unrecognised build flag at {0} in {1}".
|
||||||
format(p, metafile.name))
|
format(p, metafile.name))
|
||||||
|
t = flagtype(pk)
|
||||||
|
if t == 'list':
|
||||||
|
# Port legacy ';' separators
|
||||||
|
thisbuild[pk] = pv.replace(';',',').split(',')
|
||||||
|
elif t == 'string':
|
||||||
thisbuild[pk] = pv
|
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
|
return thisbuild
|
||||||
|
|
||||||
|
|
@ -732,9 +748,15 @@ def write_metadata(dest, app):
|
||||||
if not value:
|
if not value:
|
||||||
return
|
return
|
||||||
value = 'yes'
|
value = 'yes'
|
||||||
|
t = flagtype(key)
|
||||||
logging.debug("...writing {0} : {1}".format(key, value))
|
logging.debug("...writing {0} : {1}".format(key, value))
|
||||||
outline = ' %s=' % key
|
outline = ' %s=' % key
|
||||||
|
if t == 'string':
|
||||||
|
outline += value
|
||||||
|
elif t == 'script':
|
||||||
outline += '&& \\\n '.join([s.lstrip() for s in value.split('&& ')])
|
outline += '&& \\\n '.join([s.lstrip() for s in value.split('&& ')])
|
||||||
|
elif t == 'list':
|
||||||
|
outline += ','.join(value) if type(value) == list else value
|
||||||
outline += '\n'
|
outline += '\n'
|
||||||
mf.write(outline)
|
mf.write(outline)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue