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