Debian Codegraph @

pbuilder-satisfydepends-apt

raw
1 #!/bin/bash
2 # Copyright © 2015-2016 Mattia Rizzolo <[email protected]>
3 #
4 # pbuilder -- personal Debian package builder
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 # module to satisfy build dependencies; apt flavor
21
22 set -e
23
24 export PBUILDER_PKGLIBDIR="${PBUILDER_PKGLIBDIR:-$PBUILDER_ROOT/usr/lib/pbuilder}"
25
26 . "$PBUILDER_PKGLIBDIR"/pbuilder-satisfydepends-funcs
27
28 function checkbuilddep_internal () {
29
30 # check whether apt is new enough
31 if package_version_is_older_than apt 1.4~beta3 ; then
32 log.e "APT is not new enough to be used by this dependency resolver."
33 log.e "Please switch to a different resolver."
34 exit 1
35 fi
36 log.i "-> Attempting to satisfy build-dependencies"
37 if [[ "$DEBIAN_CONTROL" = *.dsc ]]; then
38 local DIR="$DEBIAN_CONTROL"
39 elif [[ "$DEBIAN_CONTROL" = *control ]]; then
40 local DIR="${DEBIAN_CONTROL%/control}/../"
41 else
42 log.e "Format of \$DEBIAN_CONTROL not recognized ('$DEBIAN_CONTROL')"
43 exit 1
44 fi
45
46 case "$BINARY_ARCH" in
47 "binary")
48 APTGETOPT[${#APTGETOPT[@]}]='--arch-only'
49 ;;
50 "all")
51 APTGETOPT[${#APTGETOPT[@]}]='--indep-only'
52 ;;
53 "any")
54 ;;
55 *)
56 log.e "\$BINARY_ARCH contains a weird value [$BINARY_ARCH]. Giving up"
57 exit 1
58 ;;
59 esac
60
61 if [[ "$BUILD_ARCH" != "$HOST_ARCH" ]]; then
62 APTGETOPT[${#APTGETOPT[@]}]="--host-architecture=$HOST_ARCH"
63 fi
64
65 $CHROOTEXEC apt-get \
66 -y \
67 "${APTGETOPT[@]}" \
68 build-dep \
69 "$DIR"
70 }
71
72
73 function print_help () {
74 # print out help message
75 cat <<EOF
76 pbuilder-satisfydepends -- satisfy dependencies
77
78 --help: give help
79 --control <file>: specify control file (debian/control, *.dsc) _inside the chroot_
80 --chroot <chroot>: operate inside this chroot
81 --binary-all: include binary-all
82 --binary-arch: include binary-arch only
83 --host-arch <arch>: perform a cross-build targetting this architecture
84 --echo: echo mode, do nothing.
85
86 EOF
87 }
88
89 . "$PBUILDER_PKGLIBDIR"/pbuilder-satisfydepends-checkparams
90