Skip to content
This repository has been archived by the owner on May 31, 2018. It is now read-only.

Commit

Permalink
Document dependency functions
Browse files Browse the repository at this point in the history
* Move IgnoreDepsChecks() from deps.sh to checks.sh.
  • Loading branch information
ismaelgv committed Apr 9, 2017
1 parent 13e8d7d commit c5147eb
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 34 deletions.
38 changes: 38 additions & 0 deletions libpacaur/checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
#
Expand Down
60 changes: 26 additions & 34 deletions libpacaur/deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -343,6 +364,11 @@ FindDepsAurError() {
fi
}

##
# Find dependencies of repository packages.
#
# usage: FindDepsRepo( $repo_packages )
##
FindDepsRepo() {
local allrepopkgs providersrepopkgs providersrepopkgsrm i j
# global repodeps
Expand Down Expand Up @@ -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
}

0 comments on commit c5147eb

Please sign in to comment.