Debian Codegraph @

pbuilder-satisfydepends-aptitude

raw
1 #! /bin/bash
2 # pbuilder -- personal Debian package builder
3 # Copyright © 2001-2007 Junichi Uekawa <[email protected]>
4 # 2007 Loïc Minier <[email protected]>
5 #
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
10 #
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 ###############################################################################
20
21 # module to satisfy build dependencies; aptitude flavor
22
23 set -e
24
25 export PBUILDER_PKGLIBDIR="${PBUILDER_PKGLIBDIR:-$PBUILDER_ROOT/usr/lib/pbuilder}"
26
27 . "$PBUILDER_PKGLIBDIR"/pbuilder-satisfydepends-funcs
28
29 function checkbuilddep_internal () {
30 # Use this function to fulfill the dependency (almost)
31 local ARCH=$($CHROOTEXEC dpkg-architecture -qDEB_HOST_ARCH)
32 local BUILD_DEP_DEB_DIR
33 local BUILD_DEP_DEB_CONTROL
34 local DEPENDS
35 local CONFLICTS
36 echo " -> Attempting to satisfy build-dependencies"
37 DEPENDS="$(get_build_deps | filter_arch_deps "$ARCH" |
38 filter_restriction_deps "$DEB_BUILD_PROFILES" )"
39 CONFLICTS="$(get_build_conflicts | filter_arch_deps "$ARCH" |
40 filter_restriction_deps "$DEB_BUILD_PROFILES" )"
41 echo " -> Creating pbuilder-satisfydepends-dummy package"
42 BUILD_DEP_DEB_DIR="/tmp/satisfydepends-aptitude"
43 BUILD_DEP_DEB_CONTROL="$BUILD_DEP_DEB_DIR/pbuilder-satisfydepends-dummy/DEBIAN/control"
44 $CHROOTEXEC mkdir -p "$BUILD_DEP_DEB_DIR/pbuilder-satisfydepends-dummy/DEBIAN/"
45 $CHROOTEXEC sh -c "cat >\"$BUILD_DEP_DEB_CONTROL\"" <<EOF
46 Package: pbuilder-satisfydepends-dummy
47 Version: 0.invalid.0
48 Architecture: $ARCH
49 Maintainer: Debian Pbuilder Team <[email protected]>
50 Description: Dummy package to satisfy dependencies with aptitude - created by pbuilder
51 This package was created automatically by pbuilder to satisfy the
52 build-dependencies of the package being currently built.
53 EOF
54 if [ -n "$DEPENDS" ]; then
55 $CHROOTEXEC sh -c "echo \"Depends: $DEPENDS\" >>\"$BUILD_DEP_DEB_CONTROL\""
56 fi
57 if [ -n "$CONFLICTS" ]; then
58 $CHROOTEXEC sh -c "echo \"Conflicts: $CONFLICTS\" >>\"$BUILD_DEP_DEB_CONTROL\""
59 fi
60 $CHROOTEXEC sh -c "cat \"$BUILD_DEP_DEB_CONTROL\""
61 $CHROOTEXEC sh -c "dpkg-deb -b \"$BUILD_DEP_DEB_DIR/pbuilder-satisfydepends-dummy\""
62 $CHROOTEXEC dpkg \
63 --force-depends \
64 --force-conflicts \
65 -i "$BUILD_DEP_DEB_DIR/pbuilder-satisfydepends-dummy.deb" || true
66 $CHROOTEXEC env XDG_CACHE_HOME=/root aptitude \
67 -y \
68 --without-recommends -o APT::Install-Recommends=false \
69 "${APTITUDEOPT[@]}" \
70 -o Aptitude::ProblemResolver::StepScore=100 \
71 -o "Aptitude::ProblemResolver::Hints::KeepDummy=reject pbuilder-satisfydepends-dummy :UNINST" \
72 -o Aptitude::ProblemResolver::Keep-All-Level=55000 \
73 -o Aptitude::ProblemResolver::Remove-Essential-Level=maximum \
74 install \
75 pbuilder-satisfydepends-dummy
76 # check whether the aptitude's resolver kept the package
77 if ! $CHROOTEXEC dpkg -l pbuilder-satisfydepends-dummy 2>/dev/null | grep -q ^ii; then
78 echo "Aptitude couldn't satisfy the build dependencies"
79 exit 1
80 fi
81 echo " -> Finished parsing the build-deps"
82 }
83
84
85 function print_help () {
86 # print out help message
87 cat <<EOF
88 pbuilder-satisfydepends -- satisfy dependencies
89 Copyright 2002-2007 Junichi Uekawa <[email protected]>
90
91 --help: give help
92 --control: specify control file (debian/control, *.dsc)
93 --chroot: operate inside chroot
94 --binary-all: include binary-all
95 --binary-arch: include binary-arch only
96 --echo: echo mode, do nothing. (--force-version required for most operation)
97 --force-version: skip version check.
98 --continue-fail: continue even when failed.
99
100 EOF
101 }
102
103 . "$PBUILDER_PKGLIBDIR"/pbuilder-satisfydepends-checkparams
104