mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-10-05 18:50:09 +02:00
Adapt publish to new format, improve completion
This commit is contained in:
parent
7184ba0f9d
commit
61def95320
@ -12,16 +12,6 @@
|
|||||||
#
|
#
|
||||||
# alias fbuild='fdroid build'
|
# alias fbuild='fdroid build'
|
||||||
# complete -F _fdroid_build fbuild
|
# complete -F _fdroid_build fbuild
|
||||||
#
|
|
||||||
# There are also completion function for '-p com.some.app' aliases:
|
|
||||||
#
|
|
||||||
# alias fbld='fdroid build -v -l -p'
|
|
||||||
# complete -F _fdroid_build_project fbld
|
|
||||||
#
|
|
||||||
# alias fcheckup='fdroid checkupdates -v -p'
|
|
||||||
# complete -F _fdroid_checkupdates_project fcheckup
|
|
||||||
#
|
|
||||||
# This way, one can simply do 'fbld com.some.app' or 'fcheckup com.some.app'
|
|
||||||
|
|
||||||
__fdroid_init() {
|
__fdroid_init() {
|
||||||
COMPREPLY=()
|
COMPREPLY=()
|
||||||
@ -38,21 +28,22 @@ __package() {
|
|||||||
COMPREPLY=( $( compgen -W "$files" -- $cur ) )
|
COMPREPLY=( $( compgen -W "$files" -- $cur ) )
|
||||||
}
|
}
|
||||||
|
|
||||||
__signed_package() {
|
__apk_package() {
|
||||||
files=( repo/*.apk )
|
files=( ${1}/*.apk )
|
||||||
if [ "${files[0]}" == "repo/*.apk" ]; then
|
[ -f "${files[0]}" ] || return
|
||||||
return
|
|
||||||
fi
|
files=( ${files[@]#*/} )
|
||||||
files=( ${files[@]#repo/} )
|
|
||||||
files=${files[@]%_*}
|
files=${files[@]%_*}
|
||||||
COMPREPLY=( $( compgen -W "$files" -- $cur ) )
|
COMPREPLY=( $( compgen -W "$files" -- $cur ) )
|
||||||
}
|
}
|
||||||
|
|
||||||
__signed_vercode() {
|
__apk_vercode() {
|
||||||
local p
|
local p
|
||||||
p=${cur:0:-1}
|
p=${cur:0:-1}
|
||||||
|
|
||||||
files=( repo/${p}_*.apk )
|
files=( ${1}/${p}_*.apk )
|
||||||
|
[ -f "${files[0]}" ] || return
|
||||||
|
|
||||||
files=( ${files[@]#*_} )
|
files=( ${files[@]#*_} )
|
||||||
files=${files[@]%.apk}
|
files=${files[@]%.apk}
|
||||||
COMPREPLY=( $( compgen -P "${p}:" -W "$files" -- $cur ) )
|
COMPREPLY=( $( compgen -P "${p}:" -W "$files" -- $cur ) )
|
||||||
@ -109,10 +100,10 @@ __complete_install() {
|
|||||||
__complete_options
|
__complete_options
|
||||||
return 0;;
|
return 0;;
|
||||||
*:)
|
*:)
|
||||||
__signed_vercode
|
__apk_vercode repo
|
||||||
return 0;;
|
return 0;;
|
||||||
*)
|
*)
|
||||||
__signed_package
|
__apk_package repo
|
||||||
return 0;;
|
return 0;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
@ -130,14 +121,19 @@ __complete_update() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
__complete_publish() {
|
__complete_publish() {
|
||||||
opts="-h -v -p"
|
opts="-h -v"
|
||||||
lopts="--help --verbose --package"
|
lopts="--help --verbose"
|
||||||
case "${prev}" in
|
case "${cur}" in
|
||||||
-p|--package)
|
-*)
|
||||||
__package
|
__complete_options
|
||||||
|
return 0;;
|
||||||
|
*:)
|
||||||
|
__apk_vercode unsigned
|
||||||
|
return 0;;
|
||||||
|
*)
|
||||||
|
__apk_package unsigned
|
||||||
return 0;;
|
return 0;;
|
||||||
esac
|
esac
|
||||||
__complete_options
|
|
||||||
}
|
}
|
||||||
|
|
||||||
__complete_checkupdates() {
|
__complete_checkupdates() {
|
||||||
|
@ -876,7 +876,7 @@ def main():
|
|||||||
# Get all apps...
|
# Get all apps...
|
||||||
allapps = metadata.read_metadata(xref=not options.onserver)
|
allapps = metadata.read_metadata(xref=not options.onserver)
|
||||||
|
|
||||||
apps = common.read_app_args(args, options, allapps, True)
|
apps = common.read_app_args(args, allapps, True)
|
||||||
apps = [app for app in apps if (options.force or not app['Disabled']) and
|
apps = [app for app in apps if (options.force or not app['Disabled']) and
|
||||||
len(app['Repo Type']) > 0 and len(app['builds']) > 0]
|
len(app['Repo Type']) > 0 and len(app['builds']) > 0]
|
||||||
|
|
||||||
|
@ -295,7 +295,7 @@ def main():
|
|||||||
# Get all apps...
|
# Get all apps...
|
||||||
allapps = metadata.read_metadata(options.verbose)
|
allapps = metadata.read_metadata(options.verbose)
|
||||||
|
|
||||||
apps = common.read_app_args(args, options, allapps, False)
|
apps = common.read_app_args(args, allapps, False)
|
||||||
|
|
||||||
if options.gplay:
|
if options.gplay:
|
||||||
for app in apps:
|
for app in apps:
|
||||||
|
@ -38,10 +38,9 @@ def main():
|
|||||||
|
|
||||||
# Parse command line...
|
# Parse command line...
|
||||||
parser = OptionParser()
|
parser = OptionParser()
|
||||||
|
parser = OptionParser(usage="Usage: %prog [options] [APPID[:VERCODE] [APPID[:VERCODE] ...]]")
|
||||||
parser.add_option("-v", "--verbose", action="store_true", default=False,
|
parser.add_option("-v", "--verbose", action="store_true", default=False,
|
||||||
help="Spew out even more information than normal")
|
help="Spew out even more information than normal")
|
||||||
parser.add_option("-p", "--package", default=None,
|
|
||||||
help="Publish only the specified package")
|
|
||||||
(options, args) = parser.parse_args()
|
(options, args) = parser.parse_args()
|
||||||
|
|
||||||
config = common.read_config(options)
|
config = common.read_config(options)
|
||||||
@ -74,9 +73,10 @@ def main():
|
|||||||
# and b) a sane-looking ID that would make its way into the repo.
|
# and b) a sane-looking ID that would make its way into the repo.
|
||||||
# Nonetheless, to be sure, before publishing we check that there are no
|
# Nonetheless, to be sure, before publishing we check that there are no
|
||||||
# collisions, and refuse to do any publishing if that's the case...
|
# collisions, and refuse to do any publishing if that's the case...
|
||||||
apps = metadata.read_metadata()
|
allapps = metadata.read_metadata()
|
||||||
|
vercodes = common.read_pkg_args(args, True)
|
||||||
allaliases = []
|
allaliases = []
|
||||||
for app in apps:
|
for app in allapps:
|
||||||
m = md5.new()
|
m = md5.new()
|
||||||
m.update(app['id'])
|
m.update(app['id'])
|
||||||
keyalias = m.hexdigest()[:8]
|
keyalias = m.hexdigest()[:8]
|
||||||
@ -85,19 +85,19 @@ def main():
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
allaliases.append(keyalias)
|
allaliases.append(keyalias)
|
||||||
if options.verbose:
|
if options.verbose:
|
||||||
print "{0} apps, {0} key aliases".format(len(apps), len(allaliases))
|
print "{0} apps, {0} key aliases".format(len(allapps), len(allaliases))
|
||||||
|
|
||||||
# Process any apks that are waiting to be signed...
|
# Process any apks that are waiting to be signed...
|
||||||
for apkfile in sorted(glob.glob(os.path.join(unsigned_dir, '*.apk'))):
|
for apkfile in sorted(glob.glob(os.path.join(unsigned_dir, '*.apk'))):
|
||||||
|
|
||||||
|
appid, vercode = common.apknameinfo(apkfile)
|
||||||
apkfilename = os.path.basename(apkfile)
|
apkfilename = os.path.basename(apkfile)
|
||||||
i = apkfilename.rfind('_')
|
if vercodes and appid not in vercodes:
|
||||||
if i == -1:
|
continue
|
||||||
raise BuildException("Invalid apk name")
|
if appid in vercodes and vercodes[appid]:
|
||||||
appid = apkfilename[:i]
|
if vercode not in vercodes[appid]:
|
||||||
print "Processing " + appid
|
continue
|
||||||
|
print "Processing " + apkfile
|
||||||
if not options.package or options.package == appid:
|
|
||||||
|
|
||||||
# Figure out the key alias name we'll use. Only the first 8
|
# Figure out the key alias name we'll use. Only the first 8
|
||||||
# characters are significant, so we'll use the first 8 from
|
# characters are significant, so we'll use the first 8 from
|
||||||
|
Loading…
Reference in New Issue
Block a user