mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-10-05 18:50:09 +02:00
[scanner] Deep copy json structs (Closes: #985)
The lists in the DEFAULT_JSON_PER_BUILD where only initialized and thus
shared between builds resulting in accumulating the entries over all
versions. As per 2f5d780c4
DEFAULT_JSON_PER_BUILD is used as an API, so
use deepcopy to work around it.
This commit is contained in:
parent
cc59aa9e9f
commit
253f2e5fef
@ -23,6 +23,7 @@ import re
|
|||||||
import sys
|
import sys
|
||||||
import traceback
|
import traceback
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
|
from copy import deepcopy
|
||||||
import logging
|
import logging
|
||||||
import itertools
|
import itertools
|
||||||
|
|
||||||
@ -35,7 +36,7 @@ config = None
|
|||||||
options = None
|
options = None
|
||||||
|
|
||||||
DEFAULT_JSON_PER_BUILD = {'errors': [], 'warnings': [], 'infos': []} # type: ignore
|
DEFAULT_JSON_PER_BUILD = {'errors': [], 'warnings': [], 'infos': []} # type: ignore
|
||||||
json_per_build = DEFAULT_JSON_PER_BUILD
|
json_per_build = deepcopy(DEFAULT_JSON_PER_BUILD)
|
||||||
|
|
||||||
MAVEN_URL_REGEX = re.compile(r"""\smaven\s*{.*?(?:setUrl|url)\s*=?\s*(?:uri)?\(?\s*["']?([^\s"']+)["']?[^}]*}""",
|
MAVEN_URL_REGEX = re.compile(r"""\smaven\s*{.*?(?:setUrl|url)\s*=?\s*(?:uri)?\(?\s*["']?([^\s"']+)["']?[^}]*}""",
|
||||||
re.DOTALL)
|
re.DOTALL)
|
||||||
@ -479,7 +480,7 @@ def main():
|
|||||||
else:
|
else:
|
||||||
logging.info(_("{appid}: no builds specified, running on current source state")
|
logging.info(_("{appid}: no builds specified, running on current source state")
|
||||||
.format(appid=appid))
|
.format(appid=appid))
|
||||||
json_per_build = DEFAULT_JSON_PER_BUILD
|
json_per_build = deepcopy(DEFAULT_JSON_PER_BUILD)
|
||||||
json_per_appid['current-source-state'] = json_per_build
|
json_per_appid['current-source-state'] = json_per_build
|
||||||
count = scan_source(build_dir)
|
count = scan_source(build_dir)
|
||||||
if count > 0:
|
if count > 0:
|
||||||
@ -489,7 +490,7 @@ def main():
|
|||||||
app['Builds'] = []
|
app['Builds'] = []
|
||||||
|
|
||||||
for build in app.get('Builds', []):
|
for build in app.get('Builds', []):
|
||||||
json_per_build = DEFAULT_JSON_PER_BUILD
|
json_per_build = deepcopy(DEFAULT_JSON_PER_BUILD)
|
||||||
json_per_appid[build.versionCode] = json_per_build
|
json_per_appid[build.versionCode] = json_per_build
|
||||||
|
|
||||||
if build.disable and not options.force:
|
if build.disable and not options.force:
|
||||||
|
Loading…
Reference in New Issue
Block a user