2 # recipe specific functions for the build script
4 ################################################################
6 # Copyright (c) 1995-2014 SUSE Linux Products GmbH
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 or 3 as
10 # published by the Free Software Foundation.
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.
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
22 ################################################################
27 for i in spec dsc kiwi arch preinstallimage mock livebuild debootstrap; do
28 . "$BUILD_DIR/build-recipe-$i"
32 recipe_setup_$BUILDTYPE "$@"
36 recipe_prepare_$BUILDTYPE "$@"
40 recipe_build_$BUILDTYPE "$@"
43 recipe_resultdirs () {
44 recipe_resultdirs_$BUILDTYPE "$@"
47 recipe_parse_options() {
48 case ${PARAM/#--/-} in
51 BUILD_RPM_BUILD_STAGE="$ARG"
55 test -z "$ARG" && ARG="$1"
57 KIWI_PARAMETERS="$KIWI_PARAMETERS $ARG"
68 recipe_set_buildtype() {
70 case ${RECIPEFILE##_service:*:} in
71 *.spec|*.src.rpm) BUILDTYPE=spec ;;
72 *.dsc) BUILDTYPE=dsc ;;
73 *.kiwi) BUILDTYPE=kiwi ;;
74 PKGBUILD) BUILDTYPE=arch ;;
75 _preinstallimage) BUILDTYPE=preinstallimage ;;
76 *.livebuild) BUILDTYPE=livebuild ;;
78 if test -z "$BUILDTYPE" ; then
79 echo "I don't know how to build $RECIPEFILE"
82 # we can't query right after vm startup, so we put the BUILDENGINE in the build.data
83 if test -z "$RUNNING_IN_VM" ; then
85 if test -n "$BUILD_DIST" ; then
86 BUILDENGINE=`queryconfig buildengine --dist "$BUILD_DIST" --configdir "$CONFIG_DIR" --archpath "$BUILD_ARCH"`
87 test "$BUILDENGINE" = UNDEFINED && BUILDENGINE=
90 if test "$BUILDENGINE" = mock -a "$BUILDTYPE" = spec ; then
93 if test "$BUILDENGINE" = debootstrap -a "$BUILDTYPE" = dsc ; then
98 # expands all directories into files
99 expand_recipe_directories() {
100 local f t ff found types
101 if test -z "$RECIPEFILES" ; then
104 set -- "${RECIPEFILES[@]}"
108 if test "$f" = "${f#/}" ; then
111 if test -d "$f" ; then
112 if test -z "$types" ; then
113 if test -n "$BUILD_DIST" ; then
114 case $(queryconfig --dist "$BUILD_DIST" --configdir "$CONFIG_DIR" --archpath "$BUILD_ARCH" type) in
116 kiwi) types=".kiwi" ;;
117 arch) types="PKGBUILD" ;;
118 livebuild) types=".livebuild" ;;
121 types="$types .spec .dsc PKGBUILD .kiwi .src.rpm .nosrc.rpm"
125 for ff in "$f"/*$t ; do
126 test -f "$ff" || continue
127 RECIPEFILES=("${RECIPEFILES[@]}" "$ff")
130 test -n "$found" && break
133 RECIPEFILES[${#RECIPEFILES[@]}]="$f"
136 if test -z "$RECIPEFILES" ; then
137 echo "no recipe files found in $@. exit..."