mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-15 15:32:30 +03:00
build: set default config for .fdroid.* metadata
The default config for .fdroid.* metadata that is included in a git repo is different than for the standard metadata/ layout because the expectations are different. In this case, the most common user will be the app developer working on the latest update of the app on their own machine.
This commit is contained in:
parent
3e6b263c8e
commit
578218a8b0
2 changed files with 29 additions and 11 deletions
|
@ -1002,17 +1002,25 @@ def main():
|
|||
|
||||
options, parser = parse_commandline()
|
||||
|
||||
metadata_files = glob.glob('.fdroid.*[a-z]') # ignore files ending in ~
|
||||
if os.path.isdir('metadata'):
|
||||
pass
|
||||
elif len(metadata_files) == 0:
|
||||
raise FDroidException("No app metadata found, nothing to process!")
|
||||
elif len(metadata_files) > 1:
|
||||
# The defaults for .fdroid.* metadata that is included in a git repo are
|
||||
# different than for the standard metadata/ layout because expectations
|
||||
# are different. In this case, the most common user will be the app
|
||||
# developer working on the latest update of the app on their own machine.
|
||||
local_metadata_files = common.get_local_local_metadata_files()
|
||||
if len(local_metadata_files) == 1: # there is local metadata in an app's source
|
||||
config = dict(common.default_config)
|
||||
# `fdroid build` should build only the latest version by default since
|
||||
# most of the time the user will be building the most recent update
|
||||
if not options.all:
|
||||
options.latest = True
|
||||
elif len(local_metadata_files) > 1:
|
||||
raise FDroidException("Only one local metadata file allowed! Found: "
|
||||
+ " ".join(metadata_files))
|
||||
|
||||
if not options.appid and not options.all:
|
||||
parser.error("option %s: If you really want to build all the apps, use --all" % "all")
|
||||
+ " ".join(local_metadata_files))
|
||||
else:
|
||||
if not os.path.isdir('metadata') and len(local_metadata_files) == 0:
|
||||
raise FDroidException("No app metadata found, nothing to process!")
|
||||
if not options.appid and not options.all:
|
||||
parser.error("option %s: If you really want to build all the apps, use --all" % "all")
|
||||
|
||||
config = common.read_config(options)
|
||||
|
||||
|
|
|
@ -214,7 +214,7 @@ def read_config(opts, config_file='config.py'):
|
|||
with io.open(config_file, "rb") as f:
|
||||
code = compile(f.read(), config_file, 'exec')
|
||||
exec(code, None, config)
|
||||
elif len(glob.glob('.fdroid.[a-z]*')) == 0:
|
||||
elif len(get_local_metadata_files()) == 0:
|
||||
logging.critical("Missing config file - is this a repo directory?")
|
||||
sys.exit(2)
|
||||
|
||||
|
@ -361,6 +361,16 @@ def write_password_file(pwtype, password=None):
|
|||
config[pwtype + 'file'] = filename
|
||||
|
||||
|
||||
def get_local_metadata_files():
|
||||
'''get any metadata files local to an app's source repo
|
||||
|
||||
This tries to ignore anything that does not count as app metdata,
|
||||
including emacs cruft ending in ~ and the .fdroid.key*pass.txt files.
|
||||
|
||||
'''
|
||||
return glob.glob('.fdroid.[a-jl-z]*[a-rt-z]')
|
||||
|
||||
|
||||
# Given the arguments in the form of multiple appid:[vc] strings, this returns
|
||||
# a dictionary with the set of vercodes specified for each package.
|
||||
def read_pkg_args(args, allow_vercodes=False):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue