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. -A Search only in AUR. Implies -s.
-d Get the package sources (default). Set twice to also get the dependencies. -d Get the package sources (default). Set twice to also get the dependencies.
-n Don't update existing git repos. -n Don't update existing git repos.
-U Print out all outdated AUR packages.
-w <dir> Set the working directory. -w <dir> Set the working directory.
--nossl Set curl's --insecure flag. --nossl Set curl's --insecure flag.

42
prm
View File

@ -24,6 +24,7 @@ usage() {
-A Search only in AUR. Implies -s. -A Search only in AUR. Implies -s.
-d Get the package sources (default). Set twice to also get the dependencies. -d Get the package sources (default). Set twice to also get the dependencies.
-n Don't update existing git repos. -n Don't update existing git repos.
-U Print out all outdated AUR packages.
-w <dir> Set the working directory. -w <dir> Set the working directory.
--nossl Set curl's --insecure flag. --nossl Set curl's --insecure flag.
EOF EOF
@ -63,6 +64,31 @@ aur.info() {
printf '%s' "$pkg_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() { 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 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}" cd "${cfg_workdir}/${pkg_base}"
read -d '' -r -a depends < <( 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 for i in "${depends[@]}"; do
@ -198,6 +225,9 @@ main() {
cfg_aur_url="$2" cfg_aur_url="$2"
shift;; shift;;
(-U)
action='update';;
(-d) (-d)
if [[ "$action" == 'get' ]]; then if [[ "$action" == 'get' ]]; then
flag_get_deps=1 flag_get_deps=1
@ -238,9 +268,9 @@ main() {
if [[ "$1" ]]; then if [[ "$1" ]]; then
package="$1" package="$1"
else # else
usage # usage
return 1 # return 1
fi fi
case "$action" in case "$action" in
@ -302,6 +332,10 @@ main() {
fi fi
fi fi
;; ;;
(update)
aur.get_updates
;;
esac esac
} }