make install_dependencies more reslient to weirdness in different spec files (#8012)
install_dependencies in the containerized_rpmbuild environment was initially done as a quick script to install multiple dependencies in spec files. This change makes it more robust to handle some cases it wouldn't handle.
This commit is contained in:
Родитель
0e84a68e0f
Коммит
64f06a650c
|
@ -146,15 +146,36 @@ get_pkg_dependency() {
|
|||
|
||||
# Install package dependencies listed as BuildRequires in spec
|
||||
install_dependencies() {
|
||||
local PKG=("$@")
|
||||
if [ -z "$PKG" ]; then echo "Please provide pkg name"; return; fi
|
||||
# Accept a single argument, which is a pattern to find spec files.
|
||||
if [ "$#" -ne 1 ]; then
|
||||
echo "Usage: $0 <pkg_pattern>"
|
||||
return 1
|
||||
fi
|
||||
|
||||
local PKG="$1"
|
||||
|
||||
echo "-------- installing build dependencies ---------"
|
||||
spec_file=$SPECS_DIR/$PKG/$PKG.spec
|
||||
dep_list=$(grep "BuildRequires:" $spec_file | cut -d ':' -f 2)
|
||||
for dependency in $dep_list
|
||||
|
||||
# Find all spec files for the package pattern given.
|
||||
spec_file_pattern=$SPECS_DIR/$PKG/$PKG.spec
|
||||
echo "using spec file pattern: '$spec_file_pattern'"
|
||||
spec_files=($spec_file_pattern)
|
||||
|
||||
# Install dependencies for each spec file found, preserving tdnf error codes.
|
||||
echo "found ${#spec_files[@]} spec files; installing dependencies for each spec file sequentially"
|
||||
exit_code=0
|
||||
for spec_file in "${spec_files[@]}"
|
||||
do
|
||||
tdnf install -y $dependency 2>&1
|
||||
echo "installing dependencies for spec file: '$spec_file'"
|
||||
|
||||
# Get the list of dependencies from the spec file.
|
||||
mapfile -t dep_list < <(rpmspec -q --buildrequires $spec_file)
|
||||
|
||||
# Install all the dependencies.
|
||||
tdnf install -y "${dep_list[@]}" || exit_code=$?
|
||||
done
|
||||
|
||||
return $exit_code
|
||||
}
|
||||
|
||||
# use Mariner specific DEFINES
|
||||
|
|
Загрузка…
Ссылка в новой задаче