update: allow repo files to use _ in the file names

_ 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 _.
This commit is contained in:
Hans-Christoph Steiner 2017-05-15 19:47:31 +02:00
parent 84bb41a91f
commit 5d705452f5

View file

@ -849,12 +849,13 @@ def scan_repo_files(apkcache, repodir, knownapks, use_date_from_file=False):
repo_file['versionName'] = shasum repo_file['versionName'] = shasum
# the static ID is the SHA256 unless it is set in the metadata # the static ID is the SHA256 unless it is set in the metadata
repo_file['packageName'] = shasum repo_file['packageName'] = shasum
n = name_utf8.split('_')
n = name_utf8.rsplit('_', maxsplit=1)
if len(n) == 2: if len(n) == 2:
packageName = n[0] packageName = n[0]
versionCode = n[1].split('.')[0] versionCode = n[1].split('.')[0]
if re.match('^-?[0-9]+$', versionCode) \ 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['packageName'] = packageName
repo_file['versionCode'] = int(versionCode) repo_file['versionCode'] = int(versionCode)
srcfilename = name + b'_src.tar.gz' srcfilename = name + b'_src.tar.gz'