aboutsummaryrefslogtreecommitdiff
path: root/pbuilder-satisfydepends-funcs
diff options
context:
space:
mode:
authorMattia Rizzolo <mattia@mapreri.org>2015-09-17 22:11:19 +0000
committerMattia Rizzolo <mattia@mapreri.org>2015-09-17 22:11:19 +0000
commitc72975124a45c9f0e4295ac89c5d73b7e566e182 (patch)
treebf52069366acece31467069fe0fc1192faff25b6 /pbuilder-satisfydepends-funcs
parent39b22a89b899515e43b959fd43fbc1ddb1ac096b (diff)
downloadpbuilder-c72975124a45c9f0e4295ac89c5d73b7e566e182.tar
pbuilder-c72975124a45c9f0e4295ac89c5d73b7e566e182.tar.gz
normalize some tabs to 4 spaces and correct some indentation
Gbp-Dch: Ignore
Diffstat (limited to 'pbuilder-satisfydepends-funcs')
-rwxr-xr-xpbuilder-satisfydepends-funcs84
1 files changed, 42 insertions, 42 deletions
diff --git a/pbuilder-satisfydepends-funcs b/pbuilder-satisfydepends-funcs
index da226a1..12ae25a 100755
--- a/pbuilder-satisfydepends-funcs
+++ b/pbuilder-satisfydepends-funcs
@@ -21,13 +21,13 @@
package_versions() {
- local PACKAGE="$1"
- LC_ALL=C $CHROOTEXEC /usr/bin/apt-cache show "$PACKAGE" | sed -n 's/^Version: //p'
+ local PACKAGE="$1"
+ LC_ALL=C $CHROOTEXEC /usr/bin/apt-cache show "$PACKAGE" | sed -n 's/^Version: //p'
}
candidate_version() {
- local PACKAGE="$1"
- LC_ALL=C $CHROOTEXEC apt-cache policy "$PACKAGE" | sed -n 's/ *Candidate: //p'
+ local PACKAGE="$1"
+ LC_ALL=C $CHROOTEXEC apt-cache policy "$PACKAGE" | sed -n 's/ *Candidate: //p'
}
checkbuilddep_versiondeps() {
@@ -37,13 +37,13 @@ checkbuilddep_versiondeps() {
local PACKAGEVERSIONS=$( package_versions "$PACKAGE" | xargs)
# no versioned provides.
if [ "${FORCEVERSION}" = "yes" ]; then
- return 0;
+ return 0;
fi
for PACKAGEVERSION in $PACKAGEVERSIONS ; do
- if dpkg --compare-versions "$PACKAGEVERSION" "$COMPARESTRING" "$DEPSVERSION"; then
- # satisfies depends
- return 0;
- fi
+ if dpkg --compare-versions "$PACKAGEVERSION" "$COMPARESTRING" "$DEPSVERSION"; then
+ # satisfies depends
+ return 0;
+ fi
done
echo " Tried versions: $PACKAGEVERSIONS"
# cannot satisfy depends
@@ -274,49 +274,49 @@ checkbuilddep_provides() {
local PACKAGENAME="$1"
# PROVIDED needs to be used outside of this function.
PROVIDED=$($CHROOTEXEC /usr/bin/apt-cache showpkg $PACKAGENAME \
- | awk '{p=0}/^Reverse Provides:/,/^$/{p=1}{if(p && ($0 !~ "Reverse Provides:")){PACKAGE=$1}} END{print PACKAGE}')
+ | awk '{p=0}/^Reverse Provides:/,/^$/{p=1}{if(p && ($0 !~ "Reverse Provides:")){PACKAGE=$1}} END{print PACKAGE}')
}
# returns either "package=version", to append to an apt-get install line, or
# package
versioneddep_to_aptcmd() {
- local INSTALLPKG="$1"
+ local INSTALLPKG="$1"
- local PACKAGE
- local PACKAGE_WITHVERSION
- local PACKAGEVERSIONS
- local CANDIDATE_VERSION
- local COMPARESTRING
- local DEPSVERSION
+ local PACKAGE
+ local PACKAGE_WITHVERSION
+ local PACKAGEVERSIONS
+ local CANDIDATE_VERSION
+ local COMPARESTRING
+ local DEPSVERSION
- PACKAGE="$(echo "$INSTALLPKG" | sed -e 's/^[/]*//' -e 's/[[/(].*//')"
- PACKAGE_WITHVERSION="$PACKAGE"
+ PACKAGE="$(echo "$INSTALLPKG" | sed -e 's/^[/]*//' -e 's/[[/(].*//')"
+ PACKAGE_WITHVERSION="$PACKAGE"
- # if not versionned, we skip directly to outputting $PACKAGE
- if echo "$INSTALLPKG" | grep '[(]' > /dev/null; then
- # package versions returned by APT, in reversed order
- PACKAGEVERSIONS="$( package_versions "$PACKAGE" | tac | xargs )"
- CANDIDATE_VERSION="$( candidate_version "$PACKAGE" )"
+ # if not versionned, we skip directly to outputting $PACKAGE
+ if echo "$INSTALLPKG" | grep '[(]' > /dev/null; then
+ # package versions returned by APT, in reversed order
+ PACKAGEVERSIONS="$( package_versions "$PACKAGE" | tac | xargs )"
+ CANDIDATE_VERSION="$( candidate_version "$PACKAGE" )"
- COMPARESTRING="$(echo "$INSTALLPKG" | tr "/" " " | sed 's/^.*( *\(<<\|<=\|>=\|=\|<\|>>\|>\) *\(.*\)).*$/\1/')"
- DEPSVERSION="$(echo "$INSTALLPKG" | tr "/" " " | sed 's/^.*( *\(<<\|<=\|>=\|=\|<\|>>\|>\) *\(.*\)).*$/\2/')"
- # if strictly versionned, we skip to outputting that version
- if [ "=" = "$COMPARESTRING" ]; then
- PACKAGE_WITHVERSION="$PACKAGE=$DEPSVERSION"
- else
- # try the candidate version, then all available versions (asc)
- for VERSION in $CANDIDATE_VERSION $PACKAGEVERSIONS; do
- if dpkg --compare-versions "$VERSION" "$COMPARESTRING" "$DEPSVERSION"; then
- if [ $VERSION != $CANDIDATE_VERSION ]; then
- PACKAGE_WITHVERSION="$PACKAGE=$VERSION"
- fi
- break;
- fi
- done
- fi
- fi
+ COMPARESTRING="$(echo "$INSTALLPKG" | tr "/" " " | sed 's/^.*( *\(<<\|<=\|>=\|=\|<\|>>\|>\) *\(.*\)).*$/\1/')"
+ DEPSVERSION="$(echo "$INSTALLPKG" | tr "/" " " | sed 's/^.*( *\(<<\|<=\|>=\|=\|<\|>>\|>\) *\(.*\)).*$/\2/')"
+ # if strictly versionned, we skip to outputting that version
+ if [ "=" = "$COMPARESTRING" ]; then
+ PACKAGE_WITHVERSION="$PACKAGE=$DEPSVERSION"
+ else
+ # try the candidate version, then all available versions (asc)
+ for VERSION in $CANDIDATE_VERSION $PACKAGEVERSIONS; do
+ if dpkg --compare-versions "$VERSION" "$COMPARESTRING" "$DEPSVERSION"; then
+ if [ $VERSION != $CANDIDATE_VERSION ]; then
+ PACKAGE_WITHVERSION="$PACKAGE=$VERSION"
+ fi
+ break;
+ fi
+ done
+ fi
+ fi
- echo "$PACKAGE_WITHVERSION"
+ echo "$PACKAGE_WITHVERSION"
}
print_help() {