Merge branch 'pre-indexv1-fixes' into 'master'

pre index-v1 fixes

See merge request !220
This commit is contained in:
Hans-Christoph Steiner 2017-03-07 10:39:41 +00:00
commit 19b3d7f00d
3 changed files with 13 additions and 18 deletions

View file

@ -1,8 +1,8 @@
#!/bin/bash # fdroid(1) completion -*- shell-script -*-
# #
# bash-completion - part of the FDroid server tools # bash-completion - part of the FDroid server tools
# Bash completion for the fdroid main tools
# #
# Copyright (C) 2013-2017 Hans-Christoph Steiner <hans@eds.org>
# Copyright (C) 2013, 2014 Daniel Martí <mvdan@mvdan.cc> # Copyright (C) 2013, 2014 Daniel Martí <mvdan@mvdan.cc>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
@ -18,17 +18,6 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# 'fdroid' is completed automatically, but aliases to it are not.
# For instance, to alias 'fd' to 'fdroid' and have competion available:
#
# alias fd='fdroid'
# complete -F _fdroid fd
#
# One can use completion on aliased subcommands as follows:
#
# alias fbuild='fdroid build'
# complete -F _fdroid_build fbuild
__fdroid_init() { __fdroid_init() {
COMPREPLY=() COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}" cur="${COMP_WORDS[COMP_CWORD]}"

View file

@ -2163,8 +2163,11 @@ def get_per_app_repos():
def is_repo_file(filename): def is_repo_file(filename):
'''Whether the file in a repo is a build product to be delivered to users''' '''Whether the file in a repo is a build product to be delivered to users'''
return os.path.isfile(filename) \ return os.path.isfile(filename) \
and not filename.endswith('.asc') \
and not filename.endswith('.sig') \
and os.path.basename(filename) not in [ and os.path.basename(filename) not in [
'index.jar', 'index.jar',
'index_unsigned.jar',
'index.xml', 'index.xml',
'index.html', 'index.html',
'categories.txt', 'categories.txt',

View file

@ -737,7 +737,8 @@ def scan_apks(apkcache, repodir, knownapks, use_date_from_apk=False):
apk['nativecode'].append(arch[1:-1]) apk['nativecode'].append(arch[1:-1])
elif line.startswith('uses-permission:'): elif line.startswith('uses-permission:'):
perm_match = re.match(permission_pat, line).groupdict() perm_match = re.match(permission_pat, line).groupdict()
if perm_match['maxSdkVersion']:
perm_match['maxSdkVersion'] = int(perm_match['maxSdkVersion'])
permission = UsesPermission( permission = UsesPermission(
perm_match['name'], perm_match['name'],
perm_match['maxSdkVersion'] perm_match['maxSdkVersion']
@ -746,7 +747,8 @@ def scan_apks(apkcache, repodir, knownapks, use_date_from_apk=False):
apk['uses-permission'].add(permission) apk['uses-permission'].add(permission)
elif line.startswith('uses-permission-sdk-23:'): elif line.startswith('uses-permission-sdk-23:'):
perm_match = re.match(permission_pat, line).groupdict() perm_match = re.match(permission_pat, line).groupdict()
if perm_match['maxSdkVersion']:
perm_match['maxSdkVersion'] = int(perm_match['maxSdkVersion'])
permission_sdk_23 = UsesPermissionSdk23( permission_sdk_23 = UsesPermissionSdk23(
perm_match['name'], perm_match['name'],
perm_match['maxSdkVersion'] perm_match['maxSdkVersion']
@ -1217,7 +1219,8 @@ def make_index(apps, sortedids, apks, repodir, archive):
hashel.appendChild(doc.createTextNode(apk[hash_type])) hashel.appendChild(doc.createTextNode(apk[hash_type]))
apkel.appendChild(hashel) apkel.appendChild(hashel)
addElement('size', str(apk['size']), doc, apkel) addElement('size', str(apk['size']), doc, apkel)
addElement('sdkver', str(apk['minSdkVersion']), doc, apkel) addElementIfInApk('sdkver', apk,
'minSdkVersion', doc, apkel)
addElementIfInApk('targetSdkVersion', apk, addElementIfInApk('targetSdkVersion', apk,
'targetSdkVersion', doc, apkel) 'targetSdkVersion', doc, apkel)
addElementIfInApk('maxsdkver', apk, addElementIfInApk('maxsdkver', apk,
@ -1249,13 +1252,13 @@ def make_index(apps, sortedids, apks, repodir, archive):
permel = doc.createElement('uses-permission') permel = doc.createElement('uses-permission')
permel.setAttribute('name', permission.name) permel.setAttribute('name', permission.name)
if permission.maxSdkVersion is not None: if permission.maxSdkVersion is not None:
permel.setAttribute('maxSdkVersion', permission.maxSdkVersion) permel.setAttribute('maxSdkVersion', '%d' % permission.maxSdkVersion)
apkel.appendChild(permel) apkel.appendChild(permel)
for permission_sdk_23 in sorted(apk['uses-permission-sdk-23']): for permission_sdk_23 in sorted(apk['uses-permission-sdk-23']):
permel = doc.createElement('uses-permission-sdk-23') permel = doc.createElement('uses-permission-sdk-23')
permel.setAttribute('name', permission_sdk_23.name) permel.setAttribute('name', permission_sdk_23.name)
if permission_sdk_23.maxSdkVersion is not None: if permission_sdk_23.maxSdkVersion is not None:
permel.setAttribute('maxSdkVersion', permission_sdk_23.maxSdkVersion) permel.setAttribute('maxSdkVersion', '%d' % permission_sdk_23.maxSdkVersion)
apkel.appendChild(permel) apkel.appendChild(permel)
if 'nativecode' in apk: if 'nativecode' in apk:
addElement('nativecode', ','.join(sorted(apk['nativecode'])), doc, apkel) addElement('nativecode', ','.join(sorted(apk['nativecode'])), doc, apkel)