diff options
-rw-r--r-- | pbuilder-satisfydepends | 67 | ||||
-rwxr-xr-x | pbuilder-satisfydepends-aptitude | 10 | ||||
-rwxr-xr-x | pbuilder-satisfydepends-experimental | 61 | ||||
-rwxr-xr-x | pbuilder-satisfydepends-funcs | 4 |
4 files changed, 70 insertions, 72 deletions
diff --git a/pbuilder-satisfydepends b/pbuilder-satisfydepends index 85ca463..e0f7659 100644 --- a/pbuilder-satisfydepends +++ b/pbuilder-satisfydepends @@ -15,9 +15,8 @@ # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - # -# module to satisfy dependency. +# module to satisfy build dependencies; default flavor set -e @@ -40,46 +39,46 @@ function checkbuilddep_internal () { SATISFIED="no" for INSTALLPKG in $(echo "$INSTALLPKGMULTI" | \ awk 'BEGIN{RS="|"} {print}'); do - CURRENTREALPKGNAME=$(echo "$INSTALLPKG" | sed -e 's/^[/]*//' -e 's/[[/(].*//') - if echo "$INSTALLPKG" | grep '\[' > /dev/null ; then + CURRENTREALPKGNAME=$(echo "$INSTALLPKG" | sed -e 's#^/*##' -e 's#[[/(].*##') + if echo "$INSTALLPKG" | grep -q '\['; then if checkbuilddep_archdeps "$INSTALLPKG" "$ARCH"; then SATISFIED="yes" echo " -> This package is not for this architecture" - continue; + continue fi fi - if echo "$INSTALLPKG" | grep '[(]' > /dev/null; then + if echo "$INSTALLPKG" | grep -q '('; then #echo "Debug: $INSTALLPKG" - if ! checkbuilddep_versiondeps ${CURRENTREALPKGNAME} \ - $(echo "$INSTALLPKG" | tr "/" " " | sed 's/^.*([ ]*\(<<\|<=\|>=\|=\|<\|>>\|>\)[ ]*\(.*\)).*$/\1/') \ - $(echo "$INSTALLPKG" | tr "/" " " | sed 's/^.*([ ]*\(<<\|<=\|>=\|=\|<\|>>\|>\)[ ]*\(.*\)).*$/\2/') ; then + if ! checkbuilddep_versiondeps $CURRENTREALPKGNAME \ + $(echo "$INSTALLPKG" | tr "/" " " | sed 's/^.*( *\(<<\|<=\|>=\|=\|<\|>>\|>\) *\(.*\)).*$/\1/') \ + $(echo "$INSTALLPKG" | tr "/" " " | sed 's/^.*( *\(<<\|<=\|>=\|=\|<\|>>\|>\) *\(.*\)).*$/\2/') ; then echo " -> Does not satisfy version, not trying" - continue; + continue fi fi - echo " -> Trying ${CURRENTREALPKGNAME}" + echo " -> Trying $CURRENTREALPKGNAME" - if $CHROOTEXEC /usr/bin/apt-get -s install ${INSTALLPKGLIST} ${CURRENTREALPKGNAME} >& /dev/null; then + if $CHROOTEXEC /usr/bin/apt-get -s install $INSTALLPKGLIST $CURRENTREALPKGNAME >& /dev/null; then SATISFIED="yes" - INSTALLPKGLIST="${INSTALLPKGLIST} ${CURRENTREALPKGNAME}" + INSTALLPKGLIST="$INSTALLPKGLIST $CURRENTREALPKGNAME" else - echo " -> Cannot install ${CURRENTREALPKGNAME}; apt errors follow:" - if $CHROOTEXEC /usr/bin/apt-get -s install ${INSTALLPKGLIST} "${CURRENTREALPKGNAME}"; then + echo " -> Cannot install $CURRENTREALPKGNAME; apt errors follow:" + if $CHROOTEXEC /usr/bin/apt-get -s install $INSTALLPKGLIST "$CURRENTREALPKGNAME"; then : fi # package could not be found. -- looking for alternative. PROVIDED="" - checkbuilddep_provides "${CURRENTREALPKGNAME}" + checkbuilddep_provides "$CURRENTREALPKGNAME" if [ -n "$PROVIDED" ]; then # something provides this package echo " -> Considering $PROVIDED to satisfy the dependency " - if $CHROOTEXEC /usr/bin/apt-get -s install ${INSTALLPKGLIST} ${PROVIDED} >& /dev/null; then + if $CHROOTEXEC /usr/bin/apt-get -s install $INSTALLPKGLIST $PROVIDED >& /dev/null; then SATISFIED="yes"; - INSTALLPKGLIST="${INSTALLPKGLIST} ${PROVIDED}" + INSTALLPKGLIST="$INSTALLPKGLIST $PROVIDED" else # show the error for diagnostic purposes echo " -> Cannot install $PROVIDED; apt errors follow:" - if $CHROOTEXEC /usr/bin/apt-get -s install ${INSTALLPKGLIST} ${PROVIDED}; then + if $CHROOTEXEC /usr/bin/apt-get -s install $INSTALLPKGLIST $PROVIDED; then : fi fi @@ -98,11 +97,11 @@ function checkbuilddep_internal () { done; # now actually install the packages - echo " -> Installing ${INSTALLPKGLIST}" - if ! $CHROOTEXEC apt-get -y --force-yes install ${INSTALLPKGLIST}; then + echo " -> Installing $INSTALLPKGLIST" + if ! $CHROOTEXEC apt-get -y --force-yes install $INSTALLPKGLIST; then echo " -> Trying to fix apt error" # Work around an apt bug which causes configure to fail. - if $CHROOTEXEC dpkg --configure --pending && $CHROOTEXEC apt-get -y --force-yes install ${INSTALLPKGLIST}; then + if $CHROOTEXEC dpkg --configure --pending && $CHROOTEXEC apt-get -y --force-yes install $INSTALLPKGLIST; then echo " -> Apt bug workaround succeeded" elif [ "$CONTINUE_FAIL" != "yes" ]; then echo "E: Unrecoverable error installing build-dependencies." >&2 @@ -114,34 +113,34 @@ function checkbuilddep_internal () { for INSTALLPKG in $(get_control_re "$DEBIAN_CONTROL" "$BC_REGEXP" | tr " " "/" | \ awk 'BEGIN{RS=","} {print}'); do - CURRENTREALPKGNAME=$(echo "$INSTALLPKG" | sed -e 's/^[/]*//' -e 's/[[/(].*//') - echo " -> Considering ${CURRENTREALPKGNAME}" + CURRENTREALPKGNAME=$(echo "$INSTALLPKG" | sed -e 's#^/*##' -e 's#[[/(].*##') + echo " -> Considering $CURRENTREALPKGNAME" - if echo "$INSTALLPKG" | grep '\[' > /dev/null ; then + if echo "$INSTALLPKG" | grep -q '\['; then # this package has arch-conflicts. if checkbuilddep_archdeps "$INSTALLPKG" "$ARCH"; then echo "I: Ignoring other-arch" - continue; + continue fi fi - if echo "$INSTALLPKG" | grep '[(]' > /dev/null ; then + if echo "$INSTALLPKG" | grep -q '('; then # this package has version-conflicts - if ! checkbuilddep_versiondeps ${CURRENTREALPKGNAME} \ - $(echo "$INSTALLPKG" | tr "/" " " | sed 's/^.*([ ]*\(<<\|<=\|>=\|=\|<\|>>\|>\)[ ]*\(.*\)).*$/\1/') \ - $(echo "$INSTALLPKG" | tr "/" " " | sed 's/^.*([ ]*\(<<\|<=\|>=\|=\|<\|>>\|>\)[ ]*\(.*\)).*$/\2/'); then + if ! checkbuilddep_versiondeps $CURRENTREALPKGNAME \ + $(echo "$INSTALLPKG" | tr "/" " " | sed 's/^.*( *\(<<\|<=\|>=\|=\|<\|>>\|>\) *\(.*\)).*$/\1/') \ + $(echo "$INSTALLPKG" | tr "/" " " | sed 's/^.*( *\(<<\|<=\|>=\|=\|<\|>>\|>\) *\(.*\)).*$/\2/'); then echo "I: Satisfies version, not trying" - continue; + continue fi fi # if package exists, remove it. - if $CHROOTEXEC /usr/bin/dpkg -s $(echo "$INSTALLPKG" | tr "/" " " | awk '{print $1}') 2>&1 | grep ^Package: > /dev/null; then - if ! $CHROOTEXEC /usr/bin/apt-get -y remove ${CURRENTREALPKGNAME} ; then + if $CHROOTEXEC /usr/bin/dpkg -s $(echo "$INSTALLPKG" | tr "/" " " | awk '{print $1}') 2>&1 | grep -q ^Package:; then + if ! $CHROOTEXEC /usr/bin/apt-get -y remove $CURRENTREALPKGNAME ; then echo "E: Could not satisfy build-conflicts" >&2 exit 1 fi else - echo "I: ${CURRENTREALPKGNAME} package is not installed, no need to remove" + echo "I: $CURRENTREALPKGNAME package is not installed, no need to remove" fi done echo " -> Finished parsing the build-deps" diff --git a/pbuilder-satisfydepends-aptitude b/pbuilder-satisfydepends-aptitude index 078e2d6..6f94d74 100755 --- a/pbuilder-satisfydepends-aptitude +++ b/pbuilder-satisfydepends-aptitude @@ -39,14 +39,14 @@ function filter_arch_deps() { while read INSTALLPKG; do if echo "$INSTALLPKG" | grep -q '\['; then if checkbuilddep_archdeps "$INSTALLPKG" "$ARCH"; then - continue; + continue fi fi - # output the selected package, removing the arch list - echo "$INSTALLPKG" | sed 's/\[.*\]//' + # output the selected package + echo "$INSTALLPKG" done | - # add " | " between entries - sed '$,$! s/$/ |/' | + # remove the arch list and add " | " between entries + sed 's/\[.*\]//; $,$! s/$/ |/' | xargs --no-run-if-empty done | # add ", " between entries diff --git a/pbuilder-satisfydepends-experimental b/pbuilder-satisfydepends-experimental index ecf9700..39a3a2b 100755 --- a/pbuilder-satisfydepends-experimental +++ b/pbuilder-satisfydepends-experimental @@ -1,6 +1,7 @@ #!/bin/bash # pbuilder -- personal Debian package builder # Copyright (C) 2001,2002,2003,2005-2007 Junichi Uekawa +# Copyright (C) 2006,2007 Loïc Minier # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -15,17 +16,15 @@ # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - # -# module to satisfy dependency. +# module to satisfy build dependencies; experimental flavor set -e . /usr/lib/pbuilder/pbuilder-satisfydepends-funcs -function checkbuilddep_internal () { # Use this function to fulfill the dependency (almost) - +function checkbuilddep_internal () { local ARCH=$(dpkg-architecture -qDEB_HOST_ARCH) local INSTALLPKG local INSTALLPKGLIST @@ -42,23 +41,23 @@ function checkbuilddep_internal () { SATISFIED="no" for INSTALLPKG in $(echo "$INSTALLPKGMULTI" | \ awk 'BEGIN{RS="|"} {print}'); do - CURRENTREALPKGNAME=$(echo "$INSTALLPKG" | sed -e 's/^[/]*//' -e 's/[[/(].*//') - if echo "$INSTALLPKG" | grep '\[' > /dev/null ; then + CURRENTREALPKGNAME=$(echo "$INSTALLPKG" | sed -e 's#^/*##' -e 's#[[/(].*##') + if echo "$INSTALLPKG" | grep -q '\['; then if checkbuilddep_archdeps "$INSTALLPKG" "$ARCH"; then SATISFIED="yes" echo " -> This package is not for this architecture" - continue; + continue fi fi CURRENT_APT_COMMAND="$(versioneddep_to_aptcmd "$INSTALLPKG")" while [ "$SATISFIED" = "no" ]; do - echo " -> Trying to add ${CURRENT_APT_COMMAND}" - if APT_OUTPUT="$( exec 2>&1; LC_ALL=C $CHROOTEXEC /usr/bin/apt-get -s install ${INSTALLPKGLIST} ${CURRENT_APT_COMMAND} )"; then + echo " -> Trying to add $CURRENT_APT_COMMAND" + if APT_OUTPUT="$( exec 2>&1; LC_ALL=C $CHROOTEXEC /usr/bin/apt-get -s install $INSTALLPKGLIST $CURRENT_APT_COMMAND )"; then # success, we're done SATISFIED="yes" - INSTALLPKGLIST="${INSTALLPKGLIST} ${CURRENT_APT_COMMAND}" + INSTALLPKGLIST="$INSTALLPKGLIST $CURRENT_APT_COMMAND" break fi # try to parse APT's output to recognize lines such as: @@ -85,23 +84,23 @@ function checkbuilddep_internal () { break; fi - echo " -> Cannot install ${CURRENT_APT_COMMAND}; apt errors follow:" - if $CHROOTEXEC /usr/bin/apt-get -s install ${INSTALLPKGLIST} "${CURRENT_APT_COMMAND}"; then + echo " -> Cannot install $CURRENT_APT_COMMAND; apt errors follow:" + if $CHROOTEXEC /usr/bin/apt-get -s install $INSTALLPKGLIST "$CURRENT_APT_COMMAND"; then : fi # package could not be found. -- looking for alternative. PROVIDED="" - checkbuilddep_provides "${CURRENTREALPKGNAME}" + checkbuilddep_provides "$CURRENTREALPKGNAME" if [ -n "$PROVIDED" ]; then # something provides this package echo " -> Considering $PROVIDED to satisfy the dependency " - if $CHROOTEXEC /usr/bin/apt-get -s install ${INSTALLPKGLIST} ${PROVIDED} >& /dev/null; then + if $CHROOTEXEC /usr/bin/apt-get -s install $INSTALLPKGLIST $PROVIDED >& /dev/null; then SATISFIED="yes"; - INSTALLPKGLIST="${INSTALLPKGLIST} ${PROVIDED}" + INSTALLPKGLIST="$INSTALLPKGLIST $PROVIDED" else # show the error for diagnostic purposes echo " -> Cannot install $PROVIDED; apt errors follow:" - if $CHROOTEXEC /usr/bin/apt-get -s install ${INSTALLPKGLIST} ${PROVIDED}; then + if $CHROOTEXEC /usr/bin/apt-get -s install $INSTALLPKGLIST $PROVIDED; then : fi fi @@ -119,11 +118,11 @@ function checkbuilddep_internal () { done; # now actually install the packages - echo " -> Installing ${INSTALLPKGLIST}" - if ! $CHROOTEXEC apt-get -y --force-yes install ${INSTALLPKGLIST}; then + echo " -> Installing $INSTALLPKGLIST" + if ! $CHROOTEXEC apt-get -y --force-yes install $INSTALLPKGLIST; then echo " -> Trying to fix apt error" # Work around an apt bug which causes configure to fail. - if $CHROOTEXEC dpkg --configure --pending && $CHROOTEXEC apt-get -y --force-yes install ${INSTALLPKGLIST}; then + if $CHROOTEXEC dpkg --configure --pending && $CHROOTEXEC apt-get -y --force-yes install $INSTALLPKGLIST; then echo " -> Apt bug workaround succeeded" elif [ "$CONTINUE_FAIL" != "yes" ]; then echo "E: Unrecoverable error installing build-dependencies." >&2 @@ -135,34 +134,34 @@ function checkbuilddep_internal () { for INSTALLPKG in $(get_control_re "$DEBIAN_CONTROL" "$BC_REGEXP" | tr " " "/" | \ awk 'BEGIN{RS=","} {print}'); do - CURRENTREALPKGNAME=$(echo "$INSTALLPKG" | sed -e 's/^[/]*//' -e 's/[[/(].*//') - echo " -> Considering ${CURRENTREALPKGNAME}" + CURRENTREALPKGNAME=$(echo "$INSTALLPKG" | sed -e 's#^/*##' -e 's#[[/(].*##') + echo " -> Considering $CURRENTREALPKGNAME" - if echo "$INSTALLPKG" | grep '\[' > /dev/null ; then + if echo "$INSTALLPKG" | grep -q '\['; then # this package has arch-conflicts. if checkbuilddep_archdeps "$INSTALLPKG" "$ARCH"; then echo "I: Ignoring other-arch" - continue; + continue fi fi - if echo "$INSTALLPKG" | grep '[(]' > /dev/null ; then + if echo "$INSTALLPKG" | grep -q '('; then # this package has version-conflicts - if ! checkbuilddep_versiondeps ${CURRENTREALPKGNAME} \ - $(echo "$INSTALLPKG" | tr "/" " " | sed 's/^.*([ ]*\(<<\|<=\|>=\|=\|<\|>>\|>\)[ ]*\(.*\)).*$/\1/') \ - $(echo "$INSTALLPKG" | tr "/" " " | sed 's/^.*([ ]*\(<<\|<=\|>=\|=\|<\|>>\|>\)[ ]*\(.*\)).*$/\2/'); then + if ! checkbuilddep_versiondeps $CURRENTREALPKGNAME \ + $(echo "$INSTALLPKG" | tr "/" " " | sed 's/^.*( *\(<<\|<=\|>=\|=\|<\|>>\|>\) *\(.*\)).*$/\1/') \ + $(echo "$INSTALLPKG" | tr "/" " " | sed 's/^.*( *\(<<\|<=\|>=\|=\|<\|>>\|>\) *\(.*\)).*$/\2/'); then echo "I: Satisfies version, not trying" - continue; + continue fi fi # if package exists, remove it. - if $CHROOTEXEC /usr/bin/dpkg -s $(echo "$INSTALLPKG" | tr "/" " " | awk '{print $1}') 2>&1 | grep ^Package: > /dev/null; then - if ! $CHROOTEXEC /usr/bin/apt-get -y remove ${CURRENTREALPKGNAME} ; then + if $CHROOTEXEC /usr/bin/dpkg -s $(echo "$INSTALLPKG" | tr "/" " " | awk '{print $1}') 2>&1 | grep -q ^Package:; then + if ! $CHROOTEXEC /usr/bin/apt-get -y remove $CURRENTREALPKGNAME ; then echo "E: Could not satisfy build-conflicts" >&2 exit 1 fi else - echo "I: ${CURRENTREALPKGNAME} package is not installed, no need to remove" + echo "I: $CURRENTREALPKGNAME package is not installed, no need to remove" fi done echo " -> Finished parsing the build-deps" diff --git a/pbuilder-satisfydepends-funcs b/pbuilder-satisfydepends-funcs index 0a4d181..0e8270c 100755 --- a/pbuilder-satisfydepends-funcs +++ b/pbuilder-satisfydepends-funcs @@ -113,8 +113,8 @@ function versioneddep_to_aptcmd () { 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/')" + 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" |