mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-09-19 03:30:12 +02:00
parent
a80938a2aa
commit
81d838dc46
@ -40,6 +40,7 @@ def getvcs(vcstype, remote, local, sdk_path):
|
||||
|
||||
class vcs:
|
||||
def __init__(self, remote, local, sdk_path):
|
||||
|
||||
self.sdk_path = sdk_path
|
||||
|
||||
# It's possible to sneak a username and password in with
|
||||
@ -176,6 +177,7 @@ class vcs_git(vcs):
|
||||
stdout=subprocess.PIPE, cwd=self.local)
|
||||
return p.communicate()[0].splitlines()
|
||||
|
||||
|
||||
class vcs_gitsvn(vcs):
|
||||
|
||||
def repotype(self):
|
||||
@ -262,6 +264,7 @@ class vcs_svn(vcs):
|
||||
self.userargs(), cwd=self.local) != 0:
|
||||
raise VCSException("Svn update failed")
|
||||
|
||||
|
||||
class vcs_hg(vcs):
|
||||
|
||||
def repotype(self):
|
||||
@ -286,6 +289,7 @@ class vcs_hg(vcs):
|
||||
cwd=self.local) != 0:
|
||||
raise VCSException("Hg checkout failed")
|
||||
|
||||
|
||||
class vcs_bzr(vcs):
|
||||
|
||||
def repotype(self):
|
||||
@ -335,6 +339,7 @@ class vcs_srclib(vcs):
|
||||
shutil.copytree(libdir, self.local)
|
||||
return self.local
|
||||
|
||||
|
||||
# Get the type expected for a given metadata field.
|
||||
def metafieldtype(name):
|
||||
if name == 'Description':
|
||||
@ -347,6 +352,7 @@ def metafieldtype(name):
|
||||
return 'obsolete'
|
||||
return 'string'
|
||||
|
||||
|
||||
# Parse metadata for a single application.
|
||||
#
|
||||
# 'metafile' - the filename to read. The package id for the application comes
|
||||
@ -598,6 +604,7 @@ def write_metadata(dest, app):
|
||||
writecomments(None)
|
||||
mf.close()
|
||||
|
||||
|
||||
# Read all metadata. Returns a list of 'app' objects (which are dictionaries as
|
||||
# returned by the parse_metadata function.
|
||||
def read_metadata(verbose=False, xref=True):
|
||||
@ -688,6 +695,7 @@ class DescriptionFormatter:
|
||||
self.ital = not self.ital
|
||||
txt = txt[2:]
|
||||
|
||||
|
||||
def linkify(self, txt):
|
||||
linkified_plain = ''
|
||||
linkified_html = ''
|
||||
@ -794,10 +802,13 @@ def description_html(lines,linkres):
|
||||
ps.end()
|
||||
return ps.text_html
|
||||
|
||||
|
||||
|
||||
# Extract some information from the AndroidManifest.xml at the given path.
|
||||
# Returns (version, vercode, package), any or all of which might be None.
|
||||
# All values returned are strings.
|
||||
def parse_androidmanifest(manifest):
|
||||
|
||||
vcsearch = re.compile(r'.*android:versionCode="([^"]+)".*').search
|
||||
vnsearch = re.compile(r'.*android:versionName="([^"]+)".*').search
|
||||
psearch = re.compile(r'.*package="([^"]+)".*').search
|
||||
@ -819,6 +830,7 @@ def parse_androidmanifest(manifest):
|
||||
vercode = matches.group(1)
|
||||
return (version, vercode, package)
|
||||
|
||||
|
||||
class BuildException(Exception):
|
||||
def __init__(self, value, stdout = None, stderr = None):
|
||||
self.value = value
|
||||
@ -847,6 +859,7 @@ class MetaDataException(Exception):
|
||||
def __str__(self):
|
||||
return repr(self.value)
|
||||
|
||||
|
||||
# Get the specified source library.
|
||||
# Returns the path to it. Normally this is the path to be used when referencing
|
||||
# it, which may be a subdirectory of the actual project. If you want the base
|
||||
@ -854,6 +867,7 @@ class MetaDataException(Exception):
|
||||
# TODO: These are currently just hard-coded in this method. It will be a
|
||||
# metadata-driven system eventually, but not yet.
|
||||
def getsrclib(spec, extlib_dir, sdk_path, basepath=False):
|
||||
|
||||
name, ref = spec.split('@')
|
||||
|
||||
if name == 'GreenDroid':
|
||||
@ -1642,6 +1656,7 @@ def getsrclib(spec, extlib_dir, sdk_path, basepath=False):
|
||||
|
||||
raise BuildException('Unknown srclib ' + name)
|
||||
|
||||
|
||||
# Prepare the source code for a particular build
|
||||
# 'vcs' - the appropriate vcs object for the application
|
||||
# 'app' - the application details from the metadata
|
||||
@ -1660,6 +1675,7 @@ def getsrclib(spec, extlib_dir, sdk_path, basepath=False):
|
||||
# be a subdirectory of it.
|
||||
# 'srclibpaths' is information on the srclibs being used
|
||||
def prepare_source(vcs, app, build, build_dir, extlib_dir, sdk_path, ndk_path, javacc_path, mvn3, verbose=False):
|
||||
|
||||
# Optionally, the actual app source can be in a subdirectory...
|
||||
if 'subdir' in build:
|
||||
root_dir = os.path.join(build_dir, build['subdir'])
|
||||
@ -1987,9 +2003,11 @@ def prepare_source(vcs, app, build, build_dir, extlib_dir, sdk_path, ndk_path, j
|
||||
|
||||
return (root_dir, srclibpaths)
|
||||
|
||||
|
||||
# Scan the source code in the given directory (and all subdirectories)
|
||||
# and return a list of potential problems.
|
||||
def scan_source(build_dir, root_dir, thisbuild):
|
||||
|
||||
problems = []
|
||||
|
||||
# Common known non-free blobs:
|
||||
@ -2059,6 +2077,7 @@ def scan_source(build_dir, root_dir, thisbuild):
|
||||
|
||||
return problems
|
||||
|
||||
|
||||
class KnownApks:
|
||||
|
||||
def __init__(self):
|
||||
|
Loading…
Reference in New Issue
Block a user