update denpendencies version
[tools/build.git] / build-pkg
1 #
2 # binary package specific functions for the build script
3 #
4 ################################################################
5 #
6 # Copyright (c) 1995-2014 SUSE Linux Products GmbH
7 #
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License version 2 as
10 # published by the Free Software Foundation.
11 #
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 # GNU General Public License for more details.
16 #
17 # You should have received a copy of the GNU General Public License
18 # along with this program (see the file COPYING); if not, write to the
19 # Free Software Foundation, Inc.,
20 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
21 #
22 ################################################################
23
24 for i in rpm deb arch ; do
25     . "$BUILD_DIR/build-pkg-$i"
26 done
27
28 pkg_initdb() {
29     pkg_initdb_$PSUF "$@"
30 }
31
32 pkg_prepare() {
33     pkg_prepare_$PSUF "$@"
34 }
35
36 pkg_install() {
37     pkg_install_$PSUF "$@"
38 }
39
40 pkg_verify_installed() {
41     pkg_verify_installed_$PSUF "$@"
42 }
43
44 pkg_erase() {
45     pkg_erase_$PSUF "$@"
46 }
47
48 pkg_cumulate() {
49     pkg_cumulate_$PSUF "$@"
50 }
51
52 pkg_finalize() {
53     pkg_finalize_$PSUF "$@"
54 }
55
56 pkg_preinstall() {
57     pkg_preinstall_$PSUF "$@"
58 }
59
60 pkg_runscripts() {
61     pkg_runscripts_$PSUF "$@"
62 }
63
64 pkg_autodetect_type() {
65     if test -n "$PREINSTALL_IMAGE" ; then
66         echo "cannot autodetect build type when using a preinstall image" >&2
67         cleanup_and_exit 1
68     fi
69     PSUF=
70     test -e $BUILD_ROOT/.init_b_cache/rpms/rpm.rpm && PSUF=rpm
71     test -e $BUILD_ROOT/.init_b_cache/rpms/dpkg.deb && PSUF=deb
72     test -e $BUILD_ROOT/.init_b_cache/rpms/pacman.arch && PSUF=arch
73     if test -z "$PSUF" ; then
74         echo "could not autodetect package type" >&2
75         cleanup_and_exit 1
76     fi
77 }
78
79 pkg_set_type() {
80     PSUF=`queryconfig binarytype --dist "$BUILD_DIST" --configdir "$CONFIG_DIR" --archpath "$BUILD_ARCH"`
81     test "$PSUF" = UNDEFINED && PSUF=
82     case "$PSUF" in
83         rpm|deb|arch)
84             ;;
85         '')
86             pkg_autodetect_type
87             ;;
88         *)
89             echo "unknown package type '$PSUF'" >&2
90             cleanup_and_exit 1
91             ;;
92     esac
93 }