From c4db9a23e610b1c2b6760f1e02b77f0afa90909c Mon Sep 17 00:00:00 2001 From: Einhard Leichtfuß Date: Mon, 26 Mar 2018 05:28:34 +0200 Subject: Cosmetics (code and output) --- auria.sh | 42 ++++++++++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/auria.sh b/auria.sh index 1d29877..08e6c7b 100755 --- a/auria.sh +++ b/auria.sh @@ -36,11 +36,13 @@ # depends (or similar). # PROBLEM: The AUR RPC does not search for provides (e.g. dictd-foldoc). # PROBLEM/NOPROBLEM: Things may change while downloading things (e.g. deps). +# TODO: Fix update_all +# `- Do not update packages more than once. +# `- Do not update if AUR version and local version match. # TODO: search: append (group) [installed{ :verstring}] if applicable # - group not easily available; # - installed is probably time consuming - alpm could be used. # TODO: use guess_devel. -# TODO: differentiate dep and build-dep. # TODO: differentiate errors and failures in return codes (mostly done). # TODO: conflicts. # TODO: find packages only providing a dep (e.g. commonist->java-environment) @@ -49,17 +51,18 @@ # TODO: use inform/note/subinform properly. # TODO: remove package from repo_deps, if it later gets added to the aur # lists -# TODO: modify and use parse for info. # TODO: Be consistent in the usage of test / [.] / [[.]]. -# TODO: (ask:MARK 1) Handle "" and . # TODO: (info) parse properly (parse.c) # CONSIDER: (repo_deps) array vs. (newline separated string) # CONSIDER: (repo_deps) (space vs. newline) separated string # CONSIDER: (print_localver,print_repover) removal # CONSIDER: Use `local var=value' at beginning of functions. # CONSIDER: Remove repo_deps[]. +# CONSIDER: inform about what packages will be installed. +# CONSIDER: Newlines. +# CONSIDER: differentiate dep and build-dep. +# `- Option to remove build-deps after installation. # Q?: When to set retstr to ''. -# Q?: Is aur_itype[] needed? # IDEA: (print_restriction) consider to use sed. # # NOTE: (jq) `// empty' converts null to empty, which becomes "". @@ -212,22 +215,30 @@ function install_full then update=true itype=update - #inform "Start update procedure for ${pkg}." + inform "Start update procedure for ${pkg}." else update=false itype=explicit - #inform "Start install procedure for ${pkg}." + inform "Start install procedure for ${pkg}." fi #inform "Fetching package information from AUR..." - inform "Resolving dependencies..." + subinform "Resolving dependencies..." resolve_deps "$pkg" $itype '' || return $? make_pkgorder || return $? + echo for pkg in "${aur_pkgorder[@]}" do pkgbase="${aur_pkgbase[$pkg]}" + if [[ "${aur_itype[$pkg]}" == update ]] + then + inform "Update ${pkg}..." + else + inform "Install ${pkg}..." + fi + # Get sources and cd into $aur_root/$pkgbase. get_sources "$pkgbase" || return $? local old_pkgbuild_exists=$retstr @@ -247,6 +258,9 @@ function install_full if [[ "${aur_itype[$pkg]}" == dep ]] then makepkg "${makepkg_options[@]}" -si --asdeps || return 2 + elif [[ "${aur_itype[$pkg]}" == update ]] + then + makepkg "${makepkg_options[@]}" -si --needed || return 2 else makepkg "${makepkg_options[@]}" -si || return 2 fi @@ -300,7 +314,7 @@ function install_single # $1 package: name # $2 package: name [. pkgver-comparator . version string] -# $3 json file: filename +# $3 json file (info): filename # $4 installation type: (dep|explicit|update) # $retstr result: numeric id {on success} # interactive {if several pkgbases match}. @@ -370,16 +384,18 @@ function get_sources cp PKGBUILD "${tmp}/PKGBUILD" || return 4 old_pkgbuild_exists=true fi - inform "Pulling updates from AUR..." + subinform "Pulling updates from AUR..." git pull || return 4 else cd "$git_dir" || return 4 - inform "Cloning sources from AUR..." + subinform "Cloning sources from AUR..." git clone "https://aur.archlinux.org/${pkgbase}.git" "${pkgbase}" \ || return 4 cd "${pkgbase}" || return 4 fi + echo + retstr=$old_pkgbuild_exists } @@ -552,6 +568,7 @@ function make_pkgorder fi } +# OLD. function install_deptree { local pkg @@ -778,6 +795,7 @@ function info # $2 question: string # returns yes / no: (0|1) # interactive. +# Note, that ^D is considered as a default answer. function ask { # -l auto-converts everything to lower case. @@ -802,8 +820,8 @@ function ask default="x" fi - local -l reply - read reply # MARK 1 + local -l reply # -l converts to lowercase + read reply if [[ "$reply" =~ ^y(es)?$ ]] then -- cgit v1.2.3