Skip to content

Commit cdc4b5b

Browse files
authored
Mark existing build root directories as writeable (openSUSE#995)
This is needed for building for distributions without --clean that have a readonly root (/), like all fedora/centos family.
1 parent b9d359f commit cdc4b5b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

build

+5
Original file line numberDiff line numberDiff line change
@@ -883,13 +883,18 @@ mkdir_build_root() {
883883
if test -z "$RUNNING_IN_VM" -a \! -O "$BUILD_ROOT" -a "`stat -c %u $BUILD_ROOT`" -ne 0 ; then
884884
cleanup_and_exit 1 "BUILD_ROOT=$BUILD_ROOT must be owned by root. Exit..."
885885
fi
886+
887+
if test -z "$RUNNING_IN_VM" -a -O "$BUILD_ROOT" -a "`stat -c %u $BUILD_ROOT`" -ne 0 ; then
888+
chmod u+w "$BUILD_ROOT"
889+
fi
886890
else
887891
test "$BUILD_ROOT" != "${BUILD_ROOT%/*}" && mkdir -p "${BUILD_ROOT%/*}"
888892
if ! mkdir $BUILD_ROOT ; then
889893
cleanup_and_exit 1 "can not create BUILD_ROOT=$BUILD_ROOT. Exit..."
890894
fi
891895
fi
892896

897+
# For VM based builds as user, the root needs to be writeable
893898
if test ! -w "$BUILD_ROOT" ; then
894899
cleanup_and_exit 1 "Error: BUILD_ROOT=$BUILD_ROOT not writable, try --clean."
895900
fi

0 commit comments

Comments
 (0)