diff options
author | lool <lool> | 2006-12-09 15:00:42 +0000 |
---|---|---|
committer | lool <lool> | 2006-12-09 15:00:42 +0000 |
commit | 6cdecabba778624bd90392acebbdee5a7cea04a4 (patch) | |
tree | 9a38c80a045d4b553304af36ef9d677d852a4709 /pbuilder-satisfydepends-experimental | |
parent | 23b6d8ccbf9203ae1cb6091858b3298338396f23 (diff) | |
download | pbuilder-6cdecabba778624bd90392acebbdee5a7cea04a4.tar pbuilder-6cdecabba778624bd90392acebbdee5a7cea04a4.tar.gz |
* pbuilder-satisfydepends-experimental: small optimization: return the
exact requested version when a strictly versionned dependency is used.
Diffstat (limited to 'pbuilder-satisfydepends-experimental')
-rwxr-xr-x | pbuilder-satisfydepends-experimental | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/pbuilder-satisfydepends-experimental b/pbuilder-satisfydepends-experimental index d0cf38e..d544f28 100755 --- a/pbuilder-satisfydepends-experimental +++ b/pbuilder-satisfydepends-experimental @@ -114,17 +114,22 @@ function versioneddep_to_aptcmd () { PACKAGEVERSIONS="$( package_versions "$PACKAGE" | tac | xargs )" CANDIDATE_VERSION="$( candidate_version "$PACKAGE" )" - # try the candidate version, then all available versions (asc) COMPARESTRING="$(echo "$INSTALLPKG" | tr "/" " " | sed 's/^.*([ ]*\(<<\|<=\|>=\|=\|<\|>>\|>\)[ ]*\(.*\)).*$/\1/')" DEPSVERSION="$(echo "$INSTALLPKG" | tr "/" " " | sed 's/^.*([ ]*\(<<\|<=\|>=\|=\|<\|>>\|>\)[ ]*\(.*\)).*$/\2/')" - for VERSION in $CANDIDATE_VERSION $PACKAGEVERSIONS; do - if dpkg --compare-versions "$VERSION" "$COMPARESTRING" "$DEPSVERSION"; then - if [ $VERSION != $CANDIDATE_VERSION ]; then - PACKAGE_WITHVERSION="$PACKAGE=$VERSION" + # 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 - break; - fi - done + done + fi fi echo "$PACKAGE_WITHVERSION" |