aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEinhard Leichtfuß <alguien@respiranto.de>2018-03-26 06:35:56 +0200
committerEinhard Leichtfuß <alguien@respiranto.de>2018-03-26 06:35:56 +0200
commitecdd925ebfd7504853c06d49b2fa7920bac7432c (patch)
treefe726f1117ecdbba5e3e4c5f905064429144eb9d
parentc4db9a23e610b1c2b6760f1e02b77f0afa90909c (diff)
Fix update_all()
- Split update_list() off install_full(). - Properly set up update_all() using install_full(). `- Thereby preventing the issue of multiple update attempts towards single packages. Also, remove some clutter, e.g. unneeded variables. And a little cosmetics, as always.
-rwxr-xr-xauria.sh68
1 files changed, 51 insertions, 17 deletions
diff --git a/auria.sh b/auria.sh
index 08e6c7b..8ac1b14 100755
--- a/auria.sh
+++ b/auria.sh
@@ -53,6 +53,10 @@
# lists
# TODO: Be consistent in the usage of test / [.] / [[.]].
# TODO: (info) parse properly (parse.c)
+# TODO: Prevent asking for password in case of a --needed with effect.
+# `- --needed should no longer be necessary, once update_all is fixed.
+# TODO: Handle failures of single packages in update_all.
+# `- Alternatively, offer a variable skip_updates[] or so.
# CONSIDER: (repo_deps) array vs. (newline separated string)
# CONSIDER: (repo_deps) (space vs. newline) separated string
# CONSIDER: (print_localver,print_repover) removal
@@ -62,6 +66,7 @@
# CONSIDER: Newlines.
# CONSIDER: differentiate dep and build-dep.
# `- Option to remove build-deps after installation.
+# CONSIDER: counter in install_list()
# Q?: When to set retstr to ''.
# IDEA: (print_restriction) consider to use sed.
#
@@ -203,21 +208,19 @@ function update
}
# $1 package: name [. pkgver-comparator . version string]
-# interactive (<- resolve_deps, present_files).
+# interactive (<- resolve_deps, install_list).
function install_full
{
- local pkg pkgbase update a ver localver itype
+ local pkg itype
test -z "$1" && return 4
pkg="$1"
if [[ "$2" == update ]]
then
- update=true
itype=update
inform "Start update procedure for ${pkg}."
else
- update=false
itype=explicit
inform "Start install procedure for ${pkg}."
fi
@@ -228,6 +231,15 @@ function install_full
make_pkgorder || return $?
echo
+ install_list
+}
+
+# Installs all packages in ${aur_pkgorder[@]}, in order.
+# interactive (<- present_files).
+function install_list
+{
+ local pkgbase old_pkgbase_exists
+
for pkg in "${aur_pkgorder[@]}"
do
pkgbase="${aur_pkgbase[$pkg]}"
@@ -241,7 +253,7 @@ function install_full
# Get sources and cd into $aur_root/$pkgbase.
get_sources "$pkgbase" || return $?
- local old_pkgbuild_exists=$retstr
+ old_pkgbuild_exists=$retstr
if ! test -f PKGBUILD
then
@@ -258,32 +270,30 @@ 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
+ makepkg "${makepkg_options[@]}" -si --needed || return 2
fi
+
+ echo
done
}
+# OLD.
# $1 package: name
# interactive (<- get_pkgbase, present_files).
function install_single
{
- local pkg pkgbase update a ver localver
+ local pkg pkgbase ver localver
test -z "$1" && return 4
pkg="$1"
- if [[ "$2" == update ]]
- then
- update=true
+ #if [[ "$2" == update ]]
+ #then
#inform "Start update procedure for ${pkg}."
- else
- update=false
+ #else
#inform "Start install procedure for ${pkg}."
- fi
+ #fi
inform "Fetching package information from AUR..."
#inform "Resolving dependencies..."
@@ -669,9 +679,33 @@ function guess_vcs
[[ "$1" =~ -(git|svn|hg|bzr|cvs|fossil|darcs|rcs|arch|mtn)$ ]]
}
-# interactive (<- update).
+# interactive (<- resolve_deps, install_list).
function update_all
{
+ local pkg
+
+ inform "Start update of all AUR packages."
+
+ for pkg in $(pacman -Qmq)
+ do
+ subinform "Resolving dependencies for ${pkg}..."
+ resolve_deps "$pkg" update '' || return $?
+ done
+ echo
+
+ inform "Flatten dependency tree to a list..."
+ make_pkgorder || return $?
+ echo
+
+ install_list
+}
+
+# OLD.
+# interactive (<- update).
+function update_all_old
+{
+ local pkg
+
for pkg in $(pacman -Qmq)
do
update "$pkg"