Merge branch 'fix-push-requests' into 'master'

Fix push requests

Two bug fixes found in the process of implementing the client side of the push requests in https://gitlab.com/fdroid/fdroidclient/merge_requests/386

This is related to !156.

See merge request !160
This commit is contained in:
Daniel Martí 2016-08-26 22:26:17 +00:00
commit b92ee2b5c6
4 changed files with 16 additions and 10 deletions

View file

@ -273,7 +273,7 @@ echo "Making output for $srcfile"
echo " in `pwd`" echo " in `pwd`"
mkdir -p "$outdir/" mkdir -p "$outdir/"
taropts="--mtime=@$timestamp --mode=go=rX,u+rw,a-s" taropts="--mtime=@$timestamp --mode=go=rX,u+rw,a-s --sort=name"
cmd="$SETLANG $MAKEINFO -o $PACKAGE.info $commonarg $infoarg \"$srcfile\"" cmd="$SETLANG $MAKEINFO -o $PACKAGE.info $commonarg $infoarg \"$srcfile\""
echo "Generating info... ($cmd)" echo "Generating info... ($cmd)"
eval "$cmd" eval "$cmd"

View file

@ -248,9 +248,9 @@ The repository of older versions of applications from the main demo repository.
# } # }
# It is possible for the server operator to specify lists of apps that # It is possible for the server operator to specify lists of apps that
# must be installed or deleted on the client (aka "push installs). If # must be installed or uninstalled on the client (aka "push installs).
# the user has opted in, or the device is already setup to respond to # If the user has opted in, or the device is already setup to respond
# these requests, then fdroidclient will automatically install/delete # to these requests, then F-Droid will automatically install/uninstall
# the packageNames listed. This is protected by the same signing key # the packageNames listed. This is protected by the same signing key
# as the app index metadata. # as the app index metadata.
# #
@ -260,7 +260,7 @@ The repository of older versions of applications from the main demo repository.
# 'us.replicant', # 'us.replicant',
# } # }
# #
# delete_list = { # uninstall_list = {
# 'com.facebook.orca', # 'com.facebook.orca',
# 'com.android.vending', # 'com.android.vending',
# } # }

View file

@ -895,11 +895,17 @@ def make_index(apps, sortedids, apks, repodir, archive, categories):
repoel = doc.createElement("repo") repoel = doc.createElement("repo")
mirrorcheckfailed = False mirrorcheckfailed = False
mirrors = []
for mirror in config.get('mirrors', []): for mirror in config.get('mirrors', []):
base = os.path.basename(urllib.parse.urlparse(mirror).path.rstrip('/')) base = os.path.basename(urllib.parse.urlparse(mirror).path.rstrip('/'))
if config.get('nonstandardwebroot') is not True and base != 'fdroid': if config.get('nonstandardwebroot') is not True and base != 'fdroid':
logging.error("mirror '" + mirror + "' does not end with 'fdroid'!") logging.error("mirror '" + mirror + "' does not end with 'fdroid'!")
mirrorcheckfailed = True mirrorcheckfailed = True
# must end with / or urljoin strips a whole path segment
if mirror.endswith('/'):
mirrors.append(mirror)
else:
mirrors.append(mirror + '/')
if mirrorcheckfailed: if mirrorcheckfailed:
sys.exit(1) sys.exit(1)
@ -911,7 +917,7 @@ def make_index(apps, sortedids, apks, repodir, archive, categories):
repoel.setAttribute("url", config['archive_url']) repoel.setAttribute("url", config['archive_url'])
addElement('description', config['archive_description'], doc, repoel) addElement('description', config['archive_description'], doc, repoel)
urlbasepath = os.path.basename(urllib.parse.urlparse(config['archive_url']).path) urlbasepath = os.path.basename(urllib.parse.urlparse(config['archive_url']).path)
for mirror in config.get('mirrors', []): for mirror in mirrors:
addElement('mirror', urllib.parse.urljoin(mirror, urlbasepath), doc, repoel) addElement('mirror', urllib.parse.urljoin(mirror, urlbasepath), doc, repoel)
else: else:
@ -922,7 +928,7 @@ def make_index(apps, sortedids, apks, repodir, archive, categories):
repoel.setAttribute("url", config['repo_url']) repoel.setAttribute("url", config['repo_url'])
addElement('description', config['repo_description'], doc, repoel) addElement('description', config['repo_description'], doc, repoel)
urlbasepath = os.path.basename(urllib.parse.urlparse(config['repo_url']).path) urlbasepath = os.path.basename(urllib.parse.urlparse(config['repo_url']).path)
for mirror in config.get('mirrors', []): for mirror in mirrors:
addElement('mirror', urllib.parse.urljoin(mirror, urlbasepath), doc, repoel) addElement('mirror', urllib.parse.urljoin(mirror, urlbasepath), doc, repoel)
repoel.setAttribute("version", str(METADATA_VERSION)) repoel.setAttribute("version", str(METADATA_VERSION))
@ -953,7 +959,7 @@ def make_index(apps, sortedids, apks, repodir, archive, categories):
repoel.setAttribute("pubkey", extract_pubkey().decode('utf-8')) repoel.setAttribute("pubkey", extract_pubkey().decode('utf-8'))
root.appendChild(repoel) root.appendChild(repoel)
for command in ('install', 'delete'): for command in ('install', 'uninstall'):
packageNames = [] packageNames = []
key = command + '_list' key = command + '_list'
if key in config: if key in config:

View file

@ -147,13 +147,13 @@ $fdroid init
cp -a $WORKSPACE/tests/metadata $WORKSPACE/tests/repo $REPOROOT/ cp -a $WORKSPACE/tests/metadata $WORKSPACE/tests/repo $REPOROOT/
echo "accepted_formats = ['json', 'txt', 'xml', 'yml']" >> config.py echo "accepted_formats = ['json', 'txt', 'xml', 'yml']" >> config.py
echo "install_list = 'org.adaway'" >> config.py echo "install_list = 'org.adaway'" >> config.py
echo "delete_list = {'com.android.vending', 'com.facebook.orca',}" >> config.py echo "uninstall_list = {'com.android.vending', 'com.facebook.orca',}" >> config.py
$fdroid update --verbose $fdroid update --verbose
test -e repo/index.xml test -e repo/index.xml
test -e repo/index.jar test -e repo/index.jar
grep -F '<application id=' repo/index.xml > /dev/null grep -F '<application id=' repo/index.xml > /dev/null
grep -F '<install packageName=' repo/index.xml > /dev/null grep -F '<install packageName=' repo/index.xml > /dev/null
grep -F '<delete packageName=' repo/index.xml > /dev/null grep -F '<uninstall packageName=' repo/index.xml > /dev/null
#------------------------------------------------------------------------------# #------------------------------------------------------------------------------#