1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-10-03 17:50:11 +02:00

Merge branch 'fix-appid-checks' into 'master'

fix Application ID checks

See merge request fdroid/fdroidserver!582
This commit is contained in:
Michael Pöhn 2018-09-25 10:50:16 +00:00
commit 019ec6d4ba
21 changed files with 52 additions and 30 deletions

View File

@ -77,7 +77,7 @@ APK_NAME_REGEX = re.compile(r'^([a-zA-Z][\w.]*)_(-?[0-9]+)_?([0-9a-f]{7})?\.apk'
APK_ID_TRIPLET_REGEX = re.compile(r"^package: name='(\w[^']*)' versionCode='([^']+)' versionName='([^']*)'")
STANDARD_FILE_NAME_REGEX = re.compile(r'^(\w[\w.]*)_(-?[0-9]+)\.\w+')
FDROID_PACKAGE_NAME_REGEX = re.compile(r'''^[a-f0-9]+$''', re.IGNORECASE)
STRICT_APPLICATION_ID_REGEX = re.compile(r'''(?:^[a-z_]+(?:\d*[a-zA-Z_]*)*)(?:\.[a-z_]+(?:\d*[a-zA-Z_]*)*)*$''')
STRICT_APPLICATION_ID_REGEX = re.compile(r'''(?:^[a-zA-Z]+(?:\d*[a-zA-Z_]*)*)(?:\.[a-zA-Z]+(?:\d*[a-zA-Z_]*)*)+$''')
VALID_APPLICATION_ID_REGEX = re.compile(r'''(?:^[a-z_]+(?:\d*[a-zA-Z_]*)*)(?:\.[a-z_]+(?:\d*[a-zA-Z_]*)*)*$''',
re.IGNORECASE)
@ -3268,7 +3268,7 @@ def deploy_build_log_with_rsync(appid, vercode, log_content,
if retcode:
logging.warning(_("failed deploying build logs to '{path}'").format(path=webroot))
else:
logging.info(_("deployeded build logs to '{path}'").format(path=webroot))
logging.info(_("deployed build logs to '{path}'").format(path=webroot))
def get_per_app_repos():

View File

@ -99,7 +99,7 @@ def main():
parser.add_argument("--no-deploy", action="store_true", default=False,
help=_("Do not deploy the new files to the repo"))
parser.add_argument("--file", default='app/build/outputs/apk/*.apk',
help=_('The the file to be included in the repo (path or glob)'))
help=_('The file to be included in the repo (path or glob)'))
parser.add_argument("--no-checksum", action="store_true", default=False,
help=_("Don't use rsync checksums"))
# TODO add --with-btlog

View File

@ -1071,7 +1071,7 @@ def scan_apk(apk_file):
raise BuildException(_("{appid} from {path} is not a valid Java Package Name!")
.format(appid=apk['packageName'], path=apk_file))
elif not common.is_strict_application_id(apk['packageName']):
logging.warning(_("{appid} from {path} is not a valid Java Package Name!")
logging.warning(_("{appid} from {path} is not a valid Android Package Name!")
.format(appid=apk['packageName'], path=apk_file))
# Get the signature, or rather the signing key fingerprints

View File

@ -1483,7 +1483,7 @@ msgid "The root dir for local_copy_dir \"{path}\" does not exist!"
msgstr "dir གྱི་རྩ་བ་ for local_copy_dir \"{path}\" མིན་འདུག!"
#: ../fdroidserver/nightly.py
msgid "The the file to be included in the repo (path or glob)"
msgid "The file to be included in the repo (path or glob)"
msgstr "(path or glob)རེ་པོ་ནང་ཚུད་པའི་ཡིག་ཆ།"
#: ../fdroidserver/publish.py

View File

@ -1530,7 +1530,7 @@ msgid "The root dir for local_copy_dir \"{path}\" does not exist!"
msgstr "Das Wurzelverzeichnis für local_copy_dir \"{path}\" existiert nicht!"
#: ../fdroidserver/nightly.py
msgid "The the file to be included in the repo (path or glob)"
msgid "The file to be included in the repo (path or glob)"
msgstr "Die in das Repo aufzunehmende Datei (Pfad oder Glob)"
#: ../fdroidserver/publish.py

View File

@ -1501,7 +1501,7 @@ msgid "The root dir for local_copy_dir \"{path}\" does not exist!"
msgstr ""
#: ../fdroidserver/nightly.py
msgid "The the file to be included in the repo (path or glob)"
msgid "The file to be included in the repo (path or glob)"
msgstr ""
#: ../fdroidserver/publish.py

View File

@ -1425,7 +1425,7 @@ msgid "The root dir for local_copy_dir \"{path}\" does not exist!"
msgstr ""
#: ../fdroidserver/nightly.py
msgid "The the file to be included in the repo (path or glob)"
msgid "The file to be included in the repo (path or glob)"
msgstr ""
#: ../fdroidserver/publish.py

View File

@ -1435,7 +1435,7 @@ msgid "The root dir for local_copy_dir \"{path}\" does not exist!"
msgstr ""
#: ../fdroidserver/nightly.py
msgid "The the file to be included in the repo (path or glob)"
msgid "The file to be included in the repo (path or glob)"
msgstr ""
#: ../fdroidserver/publish.py

View File

@ -1424,7 +1424,7 @@ msgid "The root dir for local_copy_dir \"{path}\" does not exist!"
msgstr ""
#: ../fdroidserver/nightly.py
msgid "The the file to be included in the repo (path or glob)"
msgid "The file to be included in the repo (path or glob)"
msgstr ""
#: ../fdroidserver/publish.py
@ -1771,7 +1771,7 @@ msgstr ""
#: ../fdroidserver/common.py
#, python-brace-format
msgid "deployeded build logs to '{path}'"
msgid "deployed build logs to '{path}'"
msgstr ""
#: /usr/lib/python3.5/argparse.py /usr/lib/python3.6/argparse.py

View File

@ -1466,7 +1466,7 @@ msgid "The root dir for local_copy_dir \"{path}\" does not exist!"
msgstr ""
#: ../fdroidserver/nightly.py
msgid "The the file to be included in the repo (path or glob)"
msgid "The file to be included in the repo (path or glob)"
msgstr ""
#: ../fdroidserver/publish.py

View File

@ -1463,7 +1463,7 @@ msgid "The root dir for local_copy_dir \"{path}\" does not exist!"
msgstr ""
#: ../fdroidserver/nightly.py
msgid "The the file to be included in the repo (path or glob)"
msgid "The file to be included in the repo (path or glob)"
msgstr ""
#: ../fdroidserver/publish.py

View File

@ -1402,7 +1402,7 @@ msgid "The root dir for local_copy_dir \"{path}\" does not exist!"
msgstr ""
#: ../fdroidserver/nightly.py
msgid "The the file to be included in the repo (path or glob)"
msgid "The file to be included in the repo (path or glob)"
msgstr ""
#: ../fdroidserver/publish.py

View File

@ -1408,7 +1408,7 @@ msgid "The root dir for local_copy_dir \"{path}\" does not exist!"
msgstr ""
#: ../fdroidserver/nightly.py
msgid "The the file to be included in the repo (path or glob)"
msgid "The file to be included in the repo (path or glob)"
msgstr ""
#: ../fdroidserver/publish.py

View File

@ -1431,7 +1431,7 @@ msgid "The root dir for local_copy_dir \"{path}\" does not exist!"
msgstr ""
#: ../fdroidserver/nightly.py
msgid "The the file to be included in the repo (path or glob)"
msgid "The file to be included in the repo (path or glob)"
msgstr ""
#: ../fdroidserver/publish.py

View File

@ -1413,7 +1413,7 @@ msgid "The root dir for local_copy_dir \"{path}\" does not exist!"
msgstr ""
#: ../fdroidserver/nightly.py
msgid "The the file to be included in the repo (path or glob)"
msgid "The file to be included in the repo (path or glob)"
msgstr ""
#: ../fdroidserver/publish.py

View File

@ -1465,7 +1465,7 @@ msgid "The root dir for local_copy_dir \"{path}\" does not exist!"
msgstr ""
#: ../fdroidserver/nightly.py
msgid "The the file to be included in the repo (path or glob)"
msgid "The file to be included in the repo (path or glob)"
msgstr ""
#: ../fdroidserver/publish.py

View File

@ -1408,7 +1408,7 @@ msgid "The root dir for local_copy_dir \"{path}\" does not exist!"
msgstr ""
#: ../fdroidserver/nightly.py
msgid "The the file to be included in the repo (path or glob)"
msgid "The file to be included in the repo (path or glob)"
msgstr ""
#: ../fdroidserver/publish.py

View File

@ -1490,7 +1490,7 @@ msgid "The root dir for local_copy_dir \"{path}\" does not exist!"
msgstr ""
#: ../fdroidserver/nightly.py
msgid "The the file to be included in the repo (path or glob)"
msgid "The file to be included in the repo (path or glob)"
msgstr ""
#: ../fdroidserver/publish.py

View File

@ -1419,7 +1419,7 @@ msgid "The root dir for local_copy_dir \"{path}\" does not exist!"
msgstr ""
#: ../fdroidserver/nightly.py
msgid "The the file to be included in the repo (path or glob)"
msgid "The file to be included in the repo (path or glob)"
msgstr ""
#: ../fdroidserver/publish.py

View File

@ -1441,7 +1441,7 @@ msgid "The root dir for local_copy_dir \"{path}\" does not exist!"
msgstr "local_copy_dir \"{path}\" 根目錄不存在!"
#: ../fdroidserver/nightly.py
msgid "The the file to be included in the repo (path or glob)"
msgid "The file to be included in the repo (path or glob)"
msgstr "包含在此軟體庫的檔案 (path 或 glob)"
#: ../fdroidserver/publish.py

View File

@ -172,16 +172,38 @@ class CommonTest(unittest.TestCase):
self.assertFalse(fdroidserver.common.is_apk_and_debuggable_androguard(apkfile),
'androguard missed <application android:debuggable="">!')
VALID_STRICT_PACKAGE_NAMES = [
"An.stop",
"SpeedoMeterApp.main",
"a2dp.Vol",
"au.com.darkside.XServer",
"click.dummer.UartSmartwatch",
"com.Bisha.TI89EmuDonation",
"com.MarcosDiez.shareviahttp",
"com.Pau.ImapNotes2",
"com.app.Zensuren",
"com.darshancomputing.BatteryIndicator",
"com.geecko.QuickLyric",
"com.genonbeta.TrebleShot",
"com.gpl.rpg.AndorsTrail",
"com.hobbyone.HashDroid",
"com.moez.QKSMS",
"com.platypus.SAnd",
"com.prhlt.aemus.Read4SpeechExperiments",
"de.syss.MifareClassicTool",
"org.fdroid.fdroid",
"org.f_droid.fdr0ID",
]
def test_is_valid_package_name(self):
for name in ["cafebabe",
"org.fdroid.fdroid",
"org.f_droid.fdr0ID",
"SpeedoMeterApp.main",
"05041684efd9b16c2888b1eddbadd0359f655f311b89bdd1737f560a10d20fb8"]:
for name in self.VALID_STRICT_PACKAGE_NAMES + [
"_SpeedoMeterApp.main",
"05041684efd9b16c2888b1eddbadd0359f655f311b89bdd1737f560a10d20fb8"]:
self.assertTrue(fdroidserver.common.is_valid_package_name(name),
"{0} should be a valid package name".format(name))
for name in ["0rg.fdroid.fdroid",
".f_droid.fdr0ID",
"trailingdot.",
"org.fdroid/fdroid",
"/org.fdroid.fdroid"]:
self.assertFalse(fdroidserver.common.is_valid_package_name(name),
@ -189,17 +211,17 @@ class CommonTest(unittest.TestCase):
def test_is_strict_application_id(self):
"""see also tests/valid-package-names/"""
for name in ["org.fdroid.fdroid",
"org.f_droid.fdr0ID"]:
for name in self.VALID_STRICT_PACKAGE_NAMES:
self.assertTrue(fdroidserver.common.is_strict_application_id(name),
"{0} should be a strict application id".format(name))
for name in ["0rg.fdroid.fdroid",
".f_droid.fdr0ID",
"oneword",
"trailingdot.",
"cafebabe",
"SpeedoMeterApp.main",
"org.fdroid/fdroid",
"/org.fdroid.fdroid",
"_SpeedoMeterApp.main",
"05041684efd9b16c2888b1eddbadd0359f655f311b89bdd1737f560a10d20fb8"]:
self.assertFalse(fdroidserver.common.is_strict_application_id(name),
"{0} should not be a strict application id".format(name))