From c5147ebb7cf93d284658c1338e24a676988825bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ismael=20Gonz=C3=A1lez?= Date: Sun, 9 Apr 2017 15:23:26 +0200 Subject: [PATCH] Document dependency functions * Move IgnoreDepsChecks() from deps.sh to checks.sh. --- libpacaur/checks.sh | 38 ++++++++++++++++++++++++++++ libpacaur/deps.sh | 60 ++++++++++++++++++++------------------------- 2 files changed, 64 insertions(+), 34 deletions(-) diff --git a/libpacaur/checks.sh b/libpacaur/checks.sh index d637cd9b..0de2e44f 100644 --- a/libpacaur/checks.sh +++ b/libpacaur/checks.sh @@ -57,6 +57,44 @@ IgnoreChecks() { NothingToDo ${aurpkgs[@]} } +## +# Check ignored packages needed as dependencies. +# +# usage: IgnoreDepsChecks() +## +IgnoreDepsChecks() { + local i + # global ignoredpkgs aurpkgs aurdepspkgs rmaurpkgs deps repodepspkgs + [[ -z "${ignoredpkgs[@]}" ]] && return + + # add checked targets + deps=(${aurpkgs[@]}) + + # check dependencies + for i in "${repodepspkgs[@]}"; do + if [[ " ${ignoredpkgs[@]} " =~ " $i " ]]; then + Note "w" $"${colorW}$i${reset}: ignoring package upgrade" + Note "e" $"Unresolved dependency '${colorW}$i${reset}'" + fi + done + for i in "${aurdepspkgs[@]}"; do + # skip already checked dependencies + [[ " ${aurpkgs[@]} " =~ " $i " ]] && continue + [[ " ${rmaurpkgs[@]} " =~ " $i " ]] && Note "e" $"Unresolved dependency '${colorW}$i${reset}'" + + if [[ " ${ignoredpkgs[@]} " =~ " $i " ]]; then + if [[ ! $noconfirm ]]; then + if ! Proceed "y" $"$i dependency is in IgnorePkg/IgnoreGroup. Install anyway?"; then + Note "e" $"Unresolved dependency '${colorW}$i${reset}'" + fi + else + Note "w" $"${colorW}$i${reset}: ignoring package upgrade" + Note "e" $"Unresolved dependency '${colorW}$i${reset}'" + fi + fi + deps+=($i) + done +} ## # Check providers of packages and dependencies. # diff --git a/libpacaur/deps.sh b/libpacaur/deps.sh index 4fd28b9c..56f8d987 100644 --- a/libpacaur/deps.sh +++ b/libpacaur/deps.sh @@ -3,6 +3,12 @@ # deps.sh - functions related to dependency resolution # +## +# Dependency solver that wraps both pacman and AUR packages dependency +# resolution. +# +# usage: DepsSolver() +## DepsSolver() { local i aurpkgsname aurpkgsver aurpkgsaurver aurpkgsconflicts # global aurpkgs aurpkgsnover aurpkgsproviders aurdeps deps json errdeps errdepsnover foreignpkgs repodeps depsAname depsAver depsAood depsQver @@ -98,6 +104,11 @@ DepsSolver() { FindDepsRepo ${repodeps[@]} } +## +# Find dependencies of AUR packages. +# +# usage: FindDepsAur( $aur_packages ) +## FindDepsAur() { local depspkgs depspkgstmp depspkgsaurtmp repodepstmp builtpkg vcsdepspkgs assumedepspkgs local aurversionpkgs aurversionpkgsname aurversionpkgsver aurversionpkgsaurver i j json @@ -263,6 +274,11 @@ FindDepsAur() { fi } +## +# Sort dependencies to ensure correct resolution order. +# +# usage: SortDepsAur( $aur_packages ) +## SortDepsAur() { local i j sortaurpkgs sortdepspkgs sortdepspkgsaur # global checkedsortdepspkgsaur allcheckedsortdepspkgsaur json errdepsnover @@ -312,6 +328,11 @@ SortDepsAur() { fi } +## +# Find dependency errors in AUR packages. +# +# usage: FindDepsAurError( $sorted_dependencies ) +## FindDepsAurError() { local i nexterrdep nextallerrdeps # global errdepsnover errdepslist tsorterrdeps currenterrdep @@ -343,6 +364,11 @@ FindDepsAurError() { fi } +## +# Find dependencies of repository packages. +# +# usage: FindDepsRepo( $repo_packages ) +## FindDepsRepo() { local allrepopkgs providersrepopkgs providersrepopkgsrm i j # global repodeps @@ -371,37 +397,3 @@ FindDepsRepo() { repodepspkgs=($($pacmanbin -T ${allrepopkgs[@]} | sort -u)) } - -IgnoreDepsChecks() { - local i - # global ignoredpkgs aurpkgs aurdepspkgs rmaurpkgs deps repodepspkgs - [[ -z "${ignoredpkgs[@]}" ]] && return - - # add checked targets - deps=(${aurpkgs[@]}) - - # check dependencies - for i in "${repodepspkgs[@]}"; do - if [[ " ${ignoredpkgs[@]} " =~ " $i " ]]; then - Note "w" $"${colorW}$i${reset}: ignoring package upgrade" - Note "e" $"Unresolved dependency '${colorW}$i${reset}'" - fi - done - for i in "${aurdepspkgs[@]}"; do - # skip already checked dependencies - [[ " ${aurpkgs[@]} " =~ " $i " ]] && continue - [[ " ${rmaurpkgs[@]} " =~ " $i " ]] && Note "e" $"Unresolved dependency '${colorW}$i${reset}'" - - if [[ " ${ignoredpkgs[@]} " =~ " $i " ]]; then - if [[ ! $noconfirm ]]; then - if ! Proceed "y" $"$i dependency is in IgnorePkg/IgnoreGroup. Install anyway?"; then - Note "e" $"Unresolved dependency '${colorW}$i${reset}'" - fi - else - Note "w" $"${colorW}$i${reset}: ignoring package upgrade" - Note "e" $"Unresolved dependency '${colorW}$i${reset}'" - fi - fi - deps+=($i) - done -}