mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-05 15:00:30 +03:00
support .fdroid.* metadata file in source root of app being built
This allows app makers to include a .fdroid.(json|xml|yaml|txt) metadata file in the root of the git repo of their app, then they can build it using `fdroid build`. This is useful for developers who want to maintain the fdroid build recipe themselves, and run the fdroid build process for their own builds.
This commit is contained in:
parent
98809fc38f
commit
9abb80b3b7
1 changed files with 24 additions and 1 deletions
|
|
@ -22,6 +22,7 @@ import os
|
||||||
import re
|
import re
|
||||||
import glob
|
import glob
|
||||||
import cgi
|
import cgi
|
||||||
|
import logging
|
||||||
import textwrap
|
import textwrap
|
||||||
import io
|
import io
|
||||||
|
|
||||||
|
|
@ -778,7 +779,10 @@ def read_metadata(xref=True):
|
||||||
for metadatapath in sorted(glob.glob(os.path.join('metadata', '*.txt'))
|
for metadatapath in sorted(glob.glob(os.path.join('metadata', '*.txt'))
|
||||||
+ glob.glob(os.path.join('metadata', '*.json'))
|
+ glob.glob(os.path.join('metadata', '*.json'))
|
||||||
+ glob.glob(os.path.join('metadata', '*.xml'))
|
+ glob.glob(os.path.join('metadata', '*.xml'))
|
||||||
+ glob.glob(os.path.join('metadata', '*.yaml'))):
|
+ glob.glob(os.path.join('metadata', '*.yaml'))
|
||||||
|
+ glob.glob('.fdroid.json')
|
||||||
|
+ glob.glob('.fdroid.xml')
|
||||||
|
+ glob.glob('.fdroid.yaml')):
|
||||||
app = parse_metadata(metadatapath)
|
app = parse_metadata(metadatapath)
|
||||||
if app.id in apps:
|
if app.id in apps:
|
||||||
raise MetaDataException("Found multiple metadata files for " + app.id)
|
raise MetaDataException("Found multiple metadata files for " + app.id)
|
||||||
|
|
@ -824,6 +828,25 @@ def get_default_app_info(metadatapath=None):
|
||||||
else:
|
else:
|
||||||
appid, _ = fdroidserver.common.get_extension(os.path.basename(metadatapath))
|
appid, _ = fdroidserver.common.get_extension(os.path.basename(metadatapath))
|
||||||
|
|
||||||
|
if appid == '.fdroid': # we have local metadata in the app's source
|
||||||
|
if os.path.exists('AndroidManifest.xml'):
|
||||||
|
manifestroot = fdroidserver.common.parse_xml('AndroidManifest.xml')
|
||||||
|
else:
|
||||||
|
pattern = re.compile(""".*manifest\.srcFile\s+'AndroidManifest\.xml'.*""")
|
||||||
|
for root, dirs, files in os.walk(os.getcwd()):
|
||||||
|
if 'build.gradle' in files:
|
||||||
|
p = os.path.join(root, 'build.gradle')
|
||||||
|
with open(p) as f:
|
||||||
|
data = f.read()
|
||||||
|
m = pattern.search(data)
|
||||||
|
if m:
|
||||||
|
logging.debug('Using: ' + os.path.join(root, 'AndroidManifest.xml'))
|
||||||
|
manifestroot = fdroidserver.common.parse_xml(os.path.join(root, 'AndroidManifest.xml'))
|
||||||
|
break
|
||||||
|
if manifestroot is None:
|
||||||
|
raise MetaDataException("Cannot find a packageName for {0}!".format(metadatapath))
|
||||||
|
appid = manifestroot.attrib['package']
|
||||||
|
|
||||||
app = App()
|
app = App()
|
||||||
app.metadatapath = metadatapath
|
app.metadatapath = metadatapath
|
||||||
if appid is not None:
|
if appid is not None:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue