From c72975124a45c9f0e4295ac89c5d73b7e566e182 Mon Sep 17 00:00:00 2001 From: Mattia Rizzolo Date: Thu, 17 Sep 2015 22:11:19 +0000 Subject: normalize some tabs to 4 spaces and correct some indentation Gbp-Dch: Ignore --- pbuilder-satisfydepends-funcs | 84 +++++++++++++++++++++---------------------- 1 file changed, 42 insertions(+), 42 deletions(-) (limited to 'pbuilder-satisfydepends-funcs') 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() { -- cgit v1.2.3