This commit is contained in:
Jack L. Frost 2015-09-23 18:05:45 +03:00
parent 8e2ed7b9f9
commit 351a03c515
2 changed files with 39 additions and 4 deletions

View File

@ -10,6 +10,7 @@ A very simple AUR/ABS helper. Doesn't build packages, only gets the sources.
-A Search only in AUR. Implies -s.
-d Get the package sources (default). Set twice to also get the dependencies.
-n Don't update existing git repos.
-U Print out all outdated AUR packages.
-w <dir> Set the working directory.
--nossl Set curl's --insecure flag.

42
prm
View File

@ -24,6 +24,7 @@ usage() {
-A Search only in AUR. Implies -s.
-d Get the package sources (default). Set twice to also get the dependencies.
-n Don't update existing git repos.
-U Print out all outdated AUR packages.
-w <dir> Set the working directory.
--nossl Set curl's --insecure flag.
EOF
@ -63,6 +64,31 @@ aur.info() {
printf '%s' "$pkg_aur_info"
}
aur.get_updates() {
declare -a foreign_packages
declare p_aur_info p_localver p_aur_version
read -d '' -r -a foreign_packages < <( pacman -Qqm )
for p in "${foreign_packages[@]}"; do
unset p_aur_info
read -r p_aur_info < <( aur.info "$p" )
if [[ "$p_aur_info" ]]; then
read -r p_aur_version < <(
jshon -e results -e Version -u <<< "$p_aur_info"
)
read -r _ p_localver < <( pacman -Q "$p" )
if (( $(vercmp "$p_aur_version" "$p_localver") )); then
printf '%s\n' "$p"
fi
fi
done
}
aur.get() {
declare i pkg_aur_info pkg_base tarball_path depends makedepends dep_name aur_api_multireq dep_name aur_deps_api_data aur_deps_count aur_deps
@ -97,7 +123,8 @@ aur.get() {
cd "${cfg_workdir}/${pkg_base}"
read -d '' -r -a depends < <(
jshon -e results -e Depends -a -u -p -p -e MakeDepends -a -u <<< "$pkg_aur_info" 2>/dev/null
jshon -e results -e Depends -a -u <<< "$pkg_aur_info" 2>/dev/null
jshon -e results -e MakeDepends -a -u <<< "$pkg_aur_info" 2>/dev/null
)
for i in "${depends[@]}"; do
@ -198,6 +225,9 @@ main() {
cfg_aur_url="$2"
shift;;
(-U)
action='update';;
(-d)
if [[ "$action" == 'get' ]]; then
flag_get_deps=1
@ -238,9 +268,9 @@ main() {
if [[ "$1" ]]; then
package="$1"
else
usage
return 1
# else
# usage
# return 1
fi
case "$action" in
@ -302,6 +332,10 @@ main() {
fi
fi
;;
(update)
aur.get_updates
;;
esac
}