build-avoidance: ensure we can write to a copied build environment.

A centos build using build avoidance will fail if the
upstream reference build is read only. The read only
is replicated in the user's build environment, and any
packages that need to be updates (since the reference
build) will fail with reason 'permission denied'

A read only reference build is rare, but can occur to
preserve important reference builds, such as a release build
or the last build prior tothe introduction of a major feature.

Solution is to add a chmod to ensure writability of copied content.

Closes-Bug: 1958156
Change-Id: Id7c4d9b90fe4b44cc8b1b351767a5dd74dc30e9a
Signed-off-by: Scott Little <scott.little@windriver.com>
This commit is contained in:
Scott Little 2022-01-14 11:32:43 -05:00
parent c013b30a87
commit f3ba3ca0f1
1 changed files with 24 additions and 1 deletions

View File

@ -576,12 +576,24 @@ build_avoidance_copy_dir_rsync () {
>&2 echo "Error: $FUNCNAME (${LINENO}): BUILD_AVOIDANCE_URL no set"
return 1
fi
if [ "$VERBOSE" != "" ]; then
FLAGS="$FLAGS -v"
echo "rsync $FLAGS '$BUILD_AVOIDANCE_URL/$FROM/' '$TO/'"
fi
rsync $FLAGS "$BUILD_AVOIDANCE_URL/$FROM/" "$TO/"
return $?
if [ $? -ne 0 ]; then
>&2 echo "Error: $FUNCNAME (${LINENO}): command failed: rsync $FLAGS '$BUILD_AVOIDANCE_URL/$FROM/' '$TO/'"
return 1
fi
chmod -R 'ug+w' "$TO/"
if [ $? -ne 0 ]; then
>&2 echo "Error: $FUNCNAME (${LINENO}): command failed: chmod -R 'ug+w' '$TO/'"
return 1
fi
return 0
}
#
@ -604,7 +616,18 @@ build_avoidance_copy_file_rsync () {
FLAGS="$FLAGS -v"
echo "rsync $FLAGS '$BUILD_AVOIDANCE_URL/$FROM' '$TO'"
fi
rsync $FLAGS "$BUILD_AVOIDANCE_URL/$FROM" "$TO"
if [ $? -ne 0 ]; then
>&2 echo "Error: $FUNCNAME (${LINENO}): command failed: rsync $FLAGS '$BUILD_AVOIDANCE_URL/$FROM' '$TO'"
return 1
fi
chmod -R 'ug+w' "$TO"
if [ $? -ne 0 ]; then
>&2 echo "Error: $FUNCNAME (${LINENO}): command failed: chmod -R 'ug+w' '$TO'"
return 1
fi
return $?
}