1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-04 22:40:12 +01:00

Merge branch 'remove_glay_repotrunk' into 'master'

Remove --gplay option and UpdateCheckMode "RepoTrunk"

See merge request fdroid/fdroidserver!1402
This commit is contained in:
Jochen Sprickerhof 2023-11-21 07:27:08 +00:00
commit ecb6b599b6
3 changed files with 2 additions and 83 deletions

View File

@ -155,7 +155,7 @@ __complete_publish() {
__complete_checkupdates() {
opts="-v -q"
lopts="--verbose --quiet --auto --autoonly --commit --gplay --allow-dirty"
lopts="--verbose --quiet --auto --autoonly --commit --allow-dirty"
case "${cur}" in
-*)
__complete_options

View File

@ -26,8 +26,6 @@ import subprocess
import sys
from argparse import ArgumentParser
import traceback
import html
from distutils.version import LooseVersion
import logging
import copy
import urllib.parse
@ -343,56 +341,6 @@ def check_repomanifest(app: metadata.App, branch: Optional[str] = None) -> tuple
raise FDroidException(_("Couldn't find any version information"))
def check_repotrunk(app):
if app.RepoType == 'srclib':
build_dir = Path('build/srclib') / app.Repo
repotype = common.getsrclibvcs(app.Repo)
else:
build_dir = Path('build') / app.id
repotype = app.RepoType
if repotype not in ('git-svn', ):
raise MetaDataException(_('RepoTrunk update mode only makes sense in git-svn repositories'))
# Set up vcs interface and make sure we have the latest code...
vcs = common.getvcs(app.RepoType, app.Repo, build_dir)
vcs.gotorevision(None)
ref = vcs.getref()
return (ref, ref)
# Check for a new version by looking at the Google Play Store.
# Returns (None, "a message") if this didn't work, or (version, None) for
# the details of the current version.
def check_gplay(app):
time.sleep(15)
url = 'https://play.google.com/store/apps/details?id=' + app.id
headers = {'User-Agent': 'Mozilla/5.0 (X11; Linux i686; rv:18.0) Gecko/20100101 Firefox/18.0'}
req = urllib.request.Request(url, None, headers)
try:
resp = urllib.request.urlopen(req, None, 20) # nosec B310 URL base is hardcoded above
page = resp.read().decode()
except urllib.error.HTTPError as e:
return (None, str(e.code))
except Exception as e:
return (None, 'Failed:' + str(e))
version = None
m = re.search('itemprop="softwareVersion">[ ]*([^<]+)[ ]*</div>', page)
if m:
version = html.unescape(m.group(1))
if version == 'Varies with device':
return (None, 'Device-variable version, cannot use this method')
if not version:
return (None, "Couldn't find version")
return (version.strip(), None)
def try_init_submodules(app: metadata.App, last_build: metadata.Build, vcs: common.vcs):
"""Try to init submodules if the last build entry uses them.
@ -591,8 +539,6 @@ def checkupdates_app(app: metadata.App) -> None:
elif mode.startswith('RepoManifest/'):
tag = mode[13:]
(version, vercode) = check_repomanifest(app, tag)
elif mode == 'RepoTrunk':
(version, vercode) = check_repotrunk(app)
elif mode == 'HTTP':
(version, vercode) = check_http(app)
elif mode in ('None', 'Static'):
@ -767,8 +713,6 @@ def main():
help=_("Commit changes"))
parser.add_argument("--allow-dirty", action="store_true", default=False,
help=_("Run on git repo that has uncommitted changes"))
parser.add_argument("--gplay", action="store_true", default=False,
help=_("Only print differences with the Play Store"))
metadata.add_metadata_arguments(parser)
options = parser.parse_args()
metadata.warnings_action = options.W
@ -786,31 +730,6 @@ def main():
apps = common.read_app_args(options.appid, allapps, False)
if options.gplay:
for appid, app in apps.items():
version, reason = check_gplay(app)
if version is None:
if reason == '404':
logging.info("{0} is not in the Play Store".format(_getappname(app)))
else:
logging.info("{0} encountered a problem: {1}".format(_getappname(app), reason))
if version is not None:
stored = app.CurrentVersion
if not stored:
logging.info("{0} has no Current Version but has version {1} on the Play Store"
.format(_getappname(app), version))
elif LooseVersion(stored) < LooseVersion(version):
logging.info("{0} has version {1} on the Play Store, which is bigger than {2}"
.format(_getappname(app), version, stored))
else:
if stored != version:
logging.info("{0} has version {1} on the Play Store, which differs from {2}"
.format(_getappname(app), version, stored))
else:
logging.info("{0} has the same version {1} on the Play Store"
.format(_getappname(app), version))
return
processed = []
failed = dict()
exit_code = 0

View File

@ -453,7 +453,7 @@ valuetypes = {
["AutoUpdateMode"]),
FieldValidator("Update Check Mode",
r"^(Tags|Tags .+|RepoManifest|RepoManifest/.+|RepoTrunk|HTTP|Static|None)$",
r"^(Tags|Tags .+|RepoManifest|RepoManifest/.+|HTTP|Static|None)$",
["UpdateCheckMode"])
}