}
__package() {
- files="$(__by_ext txt) $(__by_ext yaml) $(__by_ext json) $(__by_ext xml)"
+ files="$(__by_ext txt) $(__by_ext yml) $(__by_ext json) $(__by_ext xml)"
COMPREPLY=( $( compgen -W "$files" -- $cur ) )
}
}
}
-_fd-commit() {
- __package
-}
-
complete -F _fdroid fdroid
-complete -F _fd-commit fd-commit
return 0
+++ /dev/null
-#!/bin/bash
-#
-# fd-commit - part of the F-Droid server tools
-# Commits updates to apps, allowing you to edit the commit messages
-#
-# Copyright (C) 2013-2014 Daniel Marti <mvdan@mvdan.cc>
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# 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/>.
-
-commands=()
-
-if [ ! -d metadata ]; then
- if [ -d ../metadata ]; then
- cd ..
- else
- echo "No metadata files found!"
- exit 2
- fi
-fi
-
-while read line; do
-
- case "$line" in
- *'??'*'metadata/'*'.txt') new=true ;;
- *'M'*'metadata/'*'.txt') new=false ;;
- *) continue ;;
- esac
-
- file=${line##* }
- id=${file##*/}
- id=${id%.txt*}
-
- if [ $# -gt 0 ]; then
- case "$@" in
- *" $id "*) ;; # Middle
- "$id "*) ;; # Start
- *" $id") ;; # End
- "$id") ;; # Alone
- *) continue ;; # Missing
- esac
- fi
-
- [ -d metadata/$id ] && extra=metadata/$id || extra=
-
- name= autoname=
- while read l; do
- case "$l" in
- 'Auto Name:'*) autoname=${l#*:} ;;
- 'Name:'*) name=${l#*:} ;;
- 'Summary:'*) break ;;
- esac
- done < "$file"
-
- if [ -n "$name" ]; then
- fullname="$name"
- elif [ -n "$autoname" ]; then
- fullname="$autoname"
- else
- fullname="$id"
- fi
-
- if $new; then
- message="New app: $fullname"
- else
- onlybuild=true
- newbuild=false
- disable=false
- while read line; do
- case "$line" in
- '-Build:'*) onlybuild=false ;;
- '+Build:'*)
- $newbuild && onlybuild=false
- newbuild=true
- build=${line#*:}
- version=${build%%,*}
- build=${build#*,}
- vercode=${build%%,*}
- ;;
- '+'*'disable='*)
- $newbuild && $onlybuild && disable=true
- ;;
- esac
- done < <(git diff HEAD -- "$file")
-
- if $newbuild && $onlybuild; then
- if $disable; then
- message="Don't update $fullname to $version ($vercode)"
- else
- message="Update $fullname to $version ($vercode)"
- fi
- else
- message="$fullname:"
- fi
- fi
-
- message=${message//\"/\\\"}
- commands+=("git add -- $file $extra && git commit -m \"$message\" -e -v")
-
-done < <(git status --porcelain metadata)
-
-[ -z "$commands" ] && exit 0
-
-git reset >/dev/null
-for cmd in "${commands[@]}"; do
- eval "$cmd"
- git reset >/dev/null
-done
def add_metadata_arguments(parser):
'''add common command line flags related to metadata processing'''
- parser.add_argument("-W", default='error',
- help=_("force errors to be warnings, or ignore"))
+ parser.add_argument("-W", choices=['error', 'warn', 'ignore'], default='error',
+ help=_("force metadata errors (default) to be warnings, or to be ignored."))
import subprocess
import sys
import tempfile
+import yaml
from urllib.parse import urlparse
from argparse import ArgumentParser
rsakey = paramiko.RSAKey.from_private_key_file(privkey)
fingerprint = base64.b64encode(hashlib.sha256(rsakey.asbytes()).digest()).decode('ascii').rstrip('=')
- ssh_private_key_file = os.path.join(tmp_dir, 'debug_keystore_' + fingerprint + '_id_rsa')
+ ssh_private_key_file = os.path.join(tmp_dir, 'debug_keystore_'
+ + fingerprint.replace('/', '_') + '_id_rsa')
shutil.move(privkey, ssh_private_key_file)
pub = rsakey.get_name() + ' ' + rsakey.get_base64() + ' ' + ssh_private_key_file
icon_path = os.path.join(git_mirror_path, 'icon.png')
try:
import qrcode
- img = qrcode.make(repo_url)
- with open(icon_path, 'wb') as fp:
- fp.write(img)
+ qrcode.make(repo_url).save(icon_path)
except Exception:
exampleicon = os.path.join(common.get_examples_dir(), 'fdroid-icon.png')
shutil.copy(exampleicon, icon_path)
except subprocess.CalledProcessError:
pass
+ app_url = clone_url[:-len(NIGHTLY)]
+ template = dict()
+ template['AuthorName'] = clone_url.split('/')[4]
+ template['AuthorWebSite'] = '/'.join(clone_url.split('/')[:4])
+ template['Categories'] = ['nightly']
+ template['SourceCode'] = app_url
+ template['IssueTracker'] = app_url + '/issues'
+ template['Summary'] = 'Nightly build of ' + urlparse(app_url).path[1:]
+ template['Description'] = template['Summary']
+ with open('template.yml', 'w') as fp:
+ yaml.dump(template, fp)
+
subprocess.check_call(['fdroid', 'update', '--rename-apks', '--create-metadata', '--verbose'],
cwd=repo_basedir)
common.local_rsync(options, repo_basedir + '/metadata/', git_mirror_metadatadir + '/')
shutil.rmtree(os.path.dirname(ssh_private_key_file))
else:
+ if not os.path.isfile(KEYSTORE_FILE):
+ androiddir = os.path.dirname(KEYSTORE_FILE)
+ if not os.path.exists(androiddir):
+ os.mkdir(androiddir)
+ logging.info(_('created {path}').format(path=androiddir))
+ logging.error(_('{path} does not exist! Create it by running:').format(path=KEYSTORE_FILE)
+ + '\n keytool -genkey -v -keystore ' + KEYSTORE_FILE + ' -storepass android \\'
+ + '\n -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000 \\'
+ + '\n -dname "CN=Android Debug,O=Android,C=US"')
+ sys.exit(1)
ssh_dir = os.path.join(os.getenv('HOME'), '.ssh')
os.makedirs(os.path.dirname(ssh_dir), exist_ok=True)
privkey = _ssh_key_from_debug_keystore()
with open('template.yml') as f:
metatxt = f.read()
if 'name' in apk and apk['name'] != '':
- metatxt = re.sub(r'^(((Auto)?Name|Summary):).*$',
+ metatxt = re.sub(r'''^(((Auto)?Name|Summary):)[ '"\.]*$''',
r'\1 ' + apk['name'],
metatxt,
flags=re.IGNORECASE | re.MULTILINE)
PY_FILES="fdroid makebuildserver setup.py examples/*.py buildserver/*.py fdroidserver/*.py"
PY_TEST_FILES="tests/*.TestCase"
SH_FILES="hooks/pre-commit"
- BASH_FILES="fd-commit jenkins-build-all jenkins-setup-build-environment jenkins-test completion/bash-completion buildserver/provision-*"
+ BASH_FILES="jenkins-build-all jenkins-setup-build-environment jenkins-test completion/bash-completion buildserver/provision-*"
RB_FILES="buildserver/Vagrantfile"
else
# if actually committing right now, then only run on the files
('https://dl.google.com/android/repository/platform-26_r02.zip',
'2aafa7d19c5e9c4b643ee6ade3d85ef89dc2f79e8383efdb9baf7fddad74b52a'),
('https://dl.google.com/android/repository/platform-27_r01.zip',
- '96ddff1a5034fcc4340f2d482635eeaccaa6707b6b0f82d26d1435476a2f52e5'),
+ 'cbba6f8fcf025e1b533326746763aa1d6e2cf4001b1b441602bb44d253bc49ac'),
('https://dl.google.com/android/repository/build-tools_r17-linux.zip',
'4c8444972343a19045236f6924bd7f12046287c70dace96ab88b2159c8ec0e74'),
('https://dl.google.com/android/repository/build-tools_r18.0.1-linux.zip',
url='https://f-droid.org',
license='AGPL-3.0',
packages=['fdroidserver', 'fdroidserver.asynchronousfilereader'],
- scripts=['fdroid', 'fd-commit', 'makebuildserver'],
+ scripts=['fdroid', 'makebuildserver'],
data_files=get_data_files(),
python_requires='>=3.4',
cmdclass={'versioncheck': VersionCheckCommand},