Commit 580d39bf authored by Vitaly Lipatov's avatar Vitaly Lipatov

epm play: speedup --list and --list-all (eterbug #17418)

parent 6d5e529c
......@@ -52,6 +52,8 @@ __is_app_installed()
__get_app_package()
{
grep -oP "^PKGNAME=[\"']*\K[^\"']+" "$psdir/$1.sh" && return
# fallback if PKGNAME is not set directly
__run_script "$1" --package-name "$2" "$3" 2>/dev/null
}
......@@ -69,9 +71,12 @@ __list_app_packages_table()
{
local name
for name in $(__list_all_app) ; do
local pkg="$(__get_app_package $name)"
[ -n "$pkg" ] || continue
echo "$pkg $name"
local pkg
for pkg in $(__get_app_package $name) ; do
echo "$pkg $name"
# check only first package
break
done
done
}
......@@ -127,10 +132,11 @@ __list_installed_packages()
__epm_play_list_installed()
{
local i
local arch="$SYSTEMARCH"
if [ -n "$short" ] ; then
for i in $(__list_installed_app) ; do
# skip hidden apps
local desc="$(__get_app_description $i)"
local desc="$(__get_app_description $i $arch)"
[ -n "$desc" ] || continue
echo "$i"
done
......@@ -139,7 +145,7 @@ __epm_play_list_installed()
[ -n "$quiet" ] || echo "Installed applications:"
for i in $(__list_installed_app) ; do
# skip hidden apps
local desc="$(__get_app_description $i)"
local desc="$(__get_app_description $i $arch)"
[ -n "$desc" ] || continue
[ -n "$quiet" ] || echo -n " "
printf "%-20s - %s\n" "$i" "$desc"
......
......@@ -47,7 +47,12 @@ __list_all_app()
# args: script, host arch
__get_app_description()
{
__run_script "$1" --description "$2" 2>/dev/null
local arch="$2"
#__run_script "$1" --description "$arch" 2>/dev/null
#return
if grep -q '^SUPPORTEDARCHES=.*\<'"$arch"'\>' "$psdir/$1.sh" || grep -q "^SUPPORTEDARCHES=[\"'][\"']$" "$psdir/$1.sh" || grep -q -v "^SUPPORTEDARCHES=" "$psdir/$1.sh" ; then
grep -oP "^DESCRIPTION=[\"']*\K[^\"']+" "$psdir/$1.sh" | sed -e 's| *#*$||'
fi
}
__check_play_script()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment