pck-update.in: don't replace build requirement block if it contains a conditional macro; basic support for rich deps

This commit is contained in:
Silvan Calarco 2021-05-08 12:13:41 +02:00
parent 5203151334
commit 7350b61bb2

View File

@ -2124,7 +2124,6 @@ ${proxy:+--proxy $proxy} ${proxy_user:+--proxy-user $proxy_user} \
$USER_RPMDEFINE_OPTS $rpmbuild_opts $rpm_root_opts \ $USER_RPMDEFINE_OPTS $rpmbuild_opts $rpm_root_opts \
$SRPM_SPECFILE_WITH_PATH 2>&1" || $SRPM_SPECFILE_WITH_PATH 2>&1" ||
notify.error $"rpmbuild exited with error code":" \`$?'" notify.error $"rpmbuild exited with error code":" \`$?'"
notify.debug "define_list_name = (${define_list_name[*]})" notify.debug "define_list_name = (${define_list_name[*]})"
notify.debug "define_list_value = (${define_list_value[*]})" notify.debug "define_list_value = (${define_list_value[*]})"
@ -2299,6 +2298,9 @@ build the list of the build requirements""${NORM}"
elif [ "${req:0:1}" = "/" ]; then elif [ "${req:0:1}" = "/" ]; then
# file requirement; ignore # file requirement; ignore
: :
elif [ "${req:0:1}" = "(" ]; then
# rich requirement; add as it is
buildreq="$line"
elif [ "${req:0:7}" = "rpmlib(" -o \ elif [ "${req:0:7}" = "rpmlib(" -o \
"${req:0:7}" = "config(" -o \ "${req:0:7}" = "config(" -o \
"${req:0:5}" = "rtld(" -o \ "${req:0:5}" = "rtld(" -o \
@ -2315,7 +2317,7 @@ build the list of the build requirements""${NORM}"
sed "s|\(.*\)-[^-]*-[^-]*|\1|") sed "s|\(.*\)-[^-]*-[^-]*|\1|")
[ "$buildreq" ] && break [ "$buildreq" ] && break
done done
[ "$buildreq" ] || echo "BuildRequires: $req" [ "$buildreq" ] || buildreq="$req"
elif [ "${req}" = "python(abi)" ]; then elif [ "${req}" = "python(abi)" ]; then
# FIXME: libpython-devel should be defined in autospec.conf # FIXME: libpython-devel should be defined in autospec.conf
# python requirement # python requirement
@ -2402,26 +2404,30 @@ $(echo $solibpath | sed "s|-[0-9.]*\.so|.so|")"
fi fi
done ) | sort -u >> $frequires done ) | sort -u >> $frequires
[ "$replace_autobuildreq" = 1 ] &&
notify.note "
${NOTE}"$"replacing the AUTOBUILDREQ block by:""${NORM}"
notify.note " notify.note "
## AUTOBUILDREQ-BEGIN" ## AUTOBUILDREQ-BEGIN"
cat $frequires cat $frequires
notify.note "## AUTOBUILDREQ-END notify.note "## AUTOBUILDREQ-END"
"
if [ "$replace_autobuildreq" = 1 ]; then if [ "$replace_autobuildreq" = 1 ]; then
sed -n '/^## AUTOBUILDREQ-BEGIN/,/^## AUTOBUILDREQ-END/p' \
$SRPM_SPECFILE_WITH_PATH | grep -q "%if" && skip_replace_autobuildreq=1
if [ "$skip_replace_autobuildreq" ]; then
notify.note "${NOTE}"$"
skipping replacing the AUTOBUILDREQ block because it contains a conditional macro""${NORM}"
else
notify.note "${NOTE}"$"
Replacing the AUTOBUILDREQ block and recreating the SRPM""${NORM}"
sed -i "/^## AUTOBUILDREQ/d" $frequires sed -i "/^## AUTOBUILDREQ/d" $frequires
sed -i -ne "/## AUTOBUILDREQ-BEGIN/{p;r $frequires" \ sed -i -ne "/## AUTOBUILDREQ-BEGIN/{p;r $frequires" \
-e ':a;n;/## AUTOBUILDREQ-END/{p;b};ba};p' \ -e ':a;n;/## AUTOBUILDREQ-END/{p;b};ba};p' \
$SRPM_SPECFILE_WITH_PATH $SRPM_SPECFILE_WITH_PATH
notify.note "
${NOTE}"$"recreating the SRPM""${NORM}"
eval "\ eval "\
rpmbuild -bs $USER_RPMDEFINE_OPTS $rpmbuild_opts \ rpmbuild -bs $USER_RPMDEFINE_OPTS $rpmbuild_opts \
$SRPM_SPECFILE_WITH_PATH 2>&1" $SRPM_SPECFILE_WITH_PATH 2>&1"
fi fi
fi
rm -f $frequires rm -f $frequires
;; ;;