chiark / gitweb /
update: allow repo files to use _ in the file names
authorHans-Christoph Steiner <hans@eds.org>
Mon, 15 May 2017 17:47:31 +0000 (19:47 +0200)
committerHans-Christoph Steiner <hans@eds.org>
Thu, 18 May 2017 14:13:17 +0000 (16:13 +0200)
_ is a valid character for Java package names, so it should also work in
the repo file naming scheme. This makes it so it only splits the file
name based on the last _.

fdroidserver/update.py

index 1cb2fc4e9acf0a5af22a6853904e404b361bc6cd..41d0bd143375c88954b60492a1230502af7cb644 100644 (file)
@@ -849,12 +849,13 @@ def scan_repo_files(apkcache, repodir, knownapks, use_date_from_file=False):
             repo_file['versionName'] = shasum
             # the static ID is the SHA256 unless it is set in the metadata
             repo_file['packageName'] = shasum
-            n = name_utf8.split('_')
+
+            n = name_utf8.rsplit('_', maxsplit=1)
             if len(n) == 2:
                 packageName = n[0]
                 versionCode = n[1].split('.')[0]
                 if re.match('^-?[0-9]+$', versionCode) \
-                   and common.is_valid_package_name(name_utf8.split('_')[0]):
+                   and common.is_valid_package_name(n[0]):
                     repo_file['packageName'] = packageName
                     repo_file['versionCode'] = int(versionCode)
             srcfilename = name + b'_src.tar.gz'