diff --git a/README.md b/README.md
index 09d54f3..179d9fe 100644
--- a/README.md
+++ b/README.md
@@ -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
Set the working directory.
--nossl Set curl's --insecure flag.
diff --git a/prm b/prm
index 3273c9d..579e593 100755
--- a/prm
+++ b/prm
@@ -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 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
}