Skip to content

Commit

Permalink
move --kiwi-parameters option parsing into build-recipe
Browse files Browse the repository at this point in the history
Also fix --kiwi-paramters=<arg> handling.
  • Loading branch information
mlschroe committed Apr 16, 2014
1 parent 330bf1d commit b5a9294
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 21 deletions.
28 changes: 10 additions & 18 deletions build
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ old_packages=()
# need to restore build root owner for non-root builds
browner=

# additional kiwi parameters, used for appliance builds with obsrepositories:/ directive
KIWI_PARAMETERS=

# Default uid:gid for the build user
ABUILD_UID=399
ABUILD_GID=399
Expand Down Expand Up @@ -632,7 +629,6 @@ needarg() {

while test -n "$1"; do
PARAM="$1"
UNSTRIPPED_ARG="$2"
ARG="$2"
test "$ARG" = "${ARG#-}" || ARG=
shift
Expand Down Expand Up @@ -699,10 +695,6 @@ while test -n "$1"; do
-baselibs)
CREATE_BASELIBS=true
;;
-kiwi-parameter)
KIWI_PARAMETERS="$KIWI_PARAMETERS $UNSTRIPPED_ARG"
shift
;;
-baselibs-internal)
CREATE_BASELIBS=internal
;;
Expand Down Expand Up @@ -817,7 +809,7 @@ while test -n "$1"; do
-uid)
needarg
ABUILD_ID="$ARG"
if test -n "${ABUILD_ID//[0-9:]/}"; then
if test -n "${ABUILD_ID//[0-9:]/}" ; then
echo "--uid argument must be uid:gid"
cleanup_and_exit
fi
Expand Down Expand Up @@ -858,10 +850,6 @@ while test -n "$1"; do
esac
done

if test -n "$CLEAN_BUILD" ; then
DO_INIT=true
fi

if test -n "$KILL" ; then
test -z "$SRCDIR" || usage
if test -n "$VM_IMAGE" -a -n "$VM_SWAP" -a -n "$VM_TYPE"; then
Expand All @@ -882,6 +870,10 @@ if test -n "$KILL" ; then
cleanup_and_exit 0
fi

if test -n "$CLEAN_BUILD" ; then
DO_INIT=true
fi

if test -n "$VM_TYPE" -a -z "$RUNNING_IN_VM" ; then
if test -z "$VMDISK_FILESYSTEM" -a -n "$BUILD_DIST" ; then
VMDISK_FILESYSTEM=`queryconfig --dist "$BUILD_DIST" --configdir "$CONFIG_DIR" --archpath "$BUILD_ARCH" buildflags vmfstype`
Expand Down Expand Up @@ -1228,10 +1220,10 @@ for RECIPEFILE in "${RECIPEFILES[@]}" ; do
fi

if test -n "$RSYNCSRC" ; then
if test -n "$RSYNCDEST"; then
if test -d "$RSYNCSRC"; then
if ! test -d "$BUILD_ROOT/$RSYNCDEST"; then
echo "ATTENTION! Creating target directory ($BUILD_ROOT/$RSYNCDEST) as its not there."
if test -n "$RSYNCDEST" ; then
if test -d "$RSYNCSRC" ; then
if ! test -d "$BUILD_ROOT/$RSYNCDEST" ; then
echo "ATTENTION! Creating missing target directory ($BUILD_ROOT/$RSYNCDEST)."
mkdir -p $BUILD_ROOT/$RSYNCDEST
fi
echo "Running rsync ..."
Expand All @@ -1240,7 +1232,7 @@ for RECIPEFILE in "${RECIPEFILES[@]}" ; do
RSYNCDONE=true
echo "... done"
else
echo "RSYNCSRC is no directory - skipping"
echo "RSYNCSRC is not a directory - skipping"
fi
else
echo "RSYNCSRC given, but not RSYNCDEST - skipping"
Expand Down
13 changes: 10 additions & 3 deletions build-recipe
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# (C) 2014 SUSE, Inc
#

KIWI_PARAMETERS=

for i in spec dsc kiwi arch preinstallimage ; do
. "$BUILD_DIR/build-recipe-$i"
Expand All @@ -28,9 +29,15 @@ recipe_resultdirs () {
recipe_parse_options() {
case ${PARAM/#--/-} in
-stage)
needarg
BUILD_RPM_BUILD_STAGE="$ARG"
shift
needarg
BUILD_RPM_BUILD_STAGE="$ARG"
shift
;;
-kiwi-parameter)
test -z "$ARG" && ARG="$1"
needarg
KIWI_PARAMETERS="$KIWI_PARAMETERS $ARG"
shift
;;
-*)
return 1
Expand Down

0 comments on commit b5a9294

Please sign in to comment.