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 collax preinstallimage simpleimage mock livebuild snapcraft debootstrap debbuild; 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 snapcraft.yaml) BUILDTYPE=snapcraft ;;
76 build.collax) BUILDTYPE=collax ;;
77 _preinstallimage) BUILDTYPE=preinstallimage ;;
78 simpleimage) BUILDTYPE=simpleimage ;;
79 *.livebuild) BUILDTYPE=livebuild ;;
81 if test -z "$BUILDTYPE" ; then
82 echo "I don't know how to build $RECIPEFILE"
85 # we can't query right after vm startup, so we put the BUILDENGINE in the build.data
86 if test -z "$RUNNING_IN_VM" ; then
88 if test -n "$BUILD_DIST" ; then
89 BUILDENGINE=`queryconfig buildengine --dist "$BUILD_DIST" --configdir "$CONFIG_DIR" --archpath "$BUILD_ARCH"`
90 test "$BUILDENGINE" = UNDEFINED && BUILDENGINE=
93 if test "$BUILDENGINE" = mock -a "$BUILDTYPE" = spec ; then
96 if test "$BUILDENGINE" = debootstrap -a "$BUILDTYPE" = dsc ; then
99 if test "$BUILDENGINE" = debbuild -a "$BUILDTYPE" = spec ; then
104 # expands all directories into files
105 expand_recipe_directories() {
106 local f t ff found types
107 if test -z "$RECIPEFILES" ; then
110 set -- "${RECIPEFILES[@]}"
114 if test "$f" = "${f#/}" ; then
117 if test -d "$f" ; then
118 if test -z "$types" ; then
119 if test -n "$BUILD_DIST" ; then
120 case $(queryconfig --dist "$BUILD_DIST" --configdir "$CONFIG_DIR" --archpath "$BUILD_ARCH" type) in
122 kiwi) types=".kiwi" ;;
123 arch) types="PKGBUILD" ;;
124 collax) types="build.collax" ;;
125 livebuild) types=".livebuild" ;;
126 snapcraft) types="snapcraft.yaml" ;;
129 types="$types .spec .dsc PKGBUILD build.collax .kiwi .src.rpm .nosrc.rpm simpleimage snapcraft.yaml"
133 for ff in "$f"/*$t ; do
134 test -f "$ff" || continue
135 RECIPEFILES=("${RECIPEFILES[@]}" "$ff")
138 test -n "$found" && break
141 RECIPEFILES[${#RECIPEFILES[@]}]="$f"
144 if test -z "$RECIPEFILES" ; then
145 echo "no recipe files found in $@. exit..."