Changeset - aa2cd3016a2b
[Not reviewed]
default
0 4 0
Dennis Fink - 7 years ago 2013-05-19 16:20:48
the_metalgamer@hackerspace.lu
updated to 0.3.0 now uses assoicative arrays and doesn't fail on non existend packages in the aur result
4 files changed with 33 insertions and 14 deletions:
0 comments (0 inline, 0 general)
README.rst
Show inline comments
...
 
@@ -9,7 +9,7 @@ Yet another AUR helper
 
:Author:         Dennis Fink <the_metalgamer@hackerspace.lu>
 
:Date:           2013-03-04
 
:Copyright:      GPLv3+
 
:Version:        Yaah 0.2.1
 
:Version:        Yaah 0.3.0
 
:Manual section: 8
 
:Manual group:   Yaah Manual
 

	
man/man8/yaah.8.gz
Show inline comments
 
binary diff not shown
yaah
Show inline comments
...
 
@@ -20,7 +20,7 @@
 
#:                                                     precedence over -v and
 
#:                                                     --verbose
 
#: Requirements: jshon <http://kmkeen.com/jshon/>
 
#:      Version: 0.2.1
 
#:      Version: 0.3.0
 
#:      Created: 2013-02-26
 
#:     Revision: 2013-03-08
 
#:       Author: Dennis Fink <the_metalgamer@hackerspace.lu>
...
 
@@ -43,7 +43,7 @@ umask $UMASK
 
SCRIPTNAME=${0##*/}
 
DESCRIPTION="Yet another AUR helper"
 
DATE_OF_CREATION=2013-02-26
 
VERSION=0.2.1
 
VERSION=0.3.0
 
AUTHOR="Dennis Fink <the_metalgamer@hackerspace.lu>"
 

	
 
readonly SCRIPTNAME DESCRIPTION DATE_OF_CREATION VERSION AUTHOR
...
 
@@ -173,9 +173,9 @@ search() {
 

	
 
    for i in $(seq 0 $(( $number -1 )) ); do
 

	
 
        local package=$(jshon -Q -e results -e $i <<< $aur_response)
 
        local package=$(jshon -Q -e results -e $i <<< "$aur_response")
 

	
 
        local package_name=$(jshon -Q -e Name <<< $package)
 
        local package_name=$(jshon -Q -e Name <<< "$package")
 
        local package_version=$(jshon -Q -e Version <<< $package)
 
        local package_description=$(jshon -Q -e Description <<< $package)
 
        local out_of_date=$(jshon -Q -e OutOfDate <<< $package)
...
 
@@ -232,13 +232,13 @@ query_online_version () {
 

	
 
        msg "Getting version of online packages."
 

	
 
        declare -a packages=("${!1}")
 
        eval "declare -A packages="${1#*=}
 
        local arguments=""
 

	
 
        msg_verbose2 "Creating argument list."
 

	
 
        for package in "${packages[@]}"; do
 
            arguments+="&arg\[\]=${package%\ *}"
 
        for package in "${!packages[@]}"; do
 
            arguments+="&arg\[\]=${package}"
 
        done
 

	
 
        msg_verbose1 "Sending query to AUR."
...
 
@@ -262,20 +262,28 @@ query_online_version () {
 

	
 
            msg_verbose2 "Extracting package name."
 

	
 
            local package_name=${packages[$i]%\ *}
 
            local package=$(jshon -Q -e results -e $i <<< "$aur_response")
 
            local package_name=$(jshon -Q -e Name <<< "$package")
 
            package_name=${package_name//\"}
 

	
 
            msg_verbose2 "Extracting old package version."
 

	
 
            local old_package_version=${packages[$i]#*\ }
 
            local old_package_version=${packages[$package_name]}
 

	
 
            msg_verbose2 "Extracting new package version."
 

	
 
            local new_package_version=$(jshon -Q -e results -e $i -e Version \
 
                <<< $aur_response)
 
            local new_package_version=$(jshon -Q -e Version \ <<< "$package")
 

	
 
            new_package_version=${new_package_version//\"}
 

	
 
            check_version $package_name $old_package_version $new_package_version
 
            unset packages[$package_name]
 
        done
 

	
 
        msg_verbose2 "Check for missing packages."
 

	
 
        for package in "${!packages[@]}"; do
 
            msg "$package was not found."
 
        done
 
    else
 
        error "Not enough parameters supplied"
...
 
@@ -307,7 +315,18 @@ query_local_version () {
 
        msg_verbose2 "Sorting package array!"
 

	
 
        sorted_packages=($(sort <<<"${packages[*]}"))
 
        query_online_version sorted_packages[@]
 

	
 
        msg_verbose2 "Creating associative array!"
 

	
 
        declare -A associative_packages
 

	
 
        for package in "${sorted_packages[@]}"; do
 
            local package_name=${package%\ *}
 
            local package_version=${package#*\ }
 
            associative_packages[$package_name]=$package_version
 
        done
 

	
 
        query_online_version "$(declare -p associative_packages)"
 
    else
 
        error "Packages could not be loaded!"
 
        return 2
yaah.rst
Show inline comments
...
 
@@ -9,7 +9,7 @@ Yet another AUR helper
 
:Author:         Dennis Fink <the_metalgamer@hackerspace.lu>
 
:Date:           2013-03-04
 
:Copyright:      GPLv3+
 
:Version:        Yaah 0.2.1
 
:Version:        Yaah 0.3.0
 
:Manual section: 8
 
:Manual group:   Yaah Manual
 

	
0 comments (0 inline, 0 general)