webbuild: use distroquery to check and warn about already extisting package when creating a new package
This commit is contained in:
parent
6032d80cdb
commit
3b032d1d8c
@ -1006,7 +1006,12 @@ fi
|
||||
if [ "$REQUEST" = "prepare" -o "$REQUEST" = "updatespec" -o "$REQUEST" = "speccreate" -o \
|
||||
"$REQUEST" = "rebuildspec" -o "$REQUEST" = "renamespec" -o "$REQUEST" = "deletespec" -o \
|
||||
"$REQUEST" = "autodistprepare" -o "$REQUEST" = "autodistupdate" -o "$REQUEST" = "addpkgnote" ]; then
|
||||
echo -n "<output><![CDATA[<hr><b>Console output:</b><div align=left class=output id=outputbottom>"
|
||||
if [ "$REQUEST" = "speccreate" ]; then
|
||||
OUTPUTMODE="outputtop"
|
||||
else
|
||||
OUTPUTMODE="outputbottom"
|
||||
fi
|
||||
echo -n "<output><![CDATA[<hr><b>Console output:</b><div align=left class=output id=$OUTPUTMODE>"
|
||||
echo -n "<pre>"
|
||||
RET=255
|
||||
case $REQUEST in
|
||||
@ -1029,6 +1034,18 @@ if [ "$REQUEST" = "prepare" -o "$REQUEST" = "updatespec" -o "$REQUEST" = "speccr
|
||||
RET=$?
|
||||
;;
|
||||
"speccreate") if [ "$SPECCREATEURL" -a "$PACKAGE" ]; then
|
||||
FOUND_EXISTING=`curl -s "${WEBBUILD_DISTROQUERY_URL}?query=$PACKAGE&search_milestone2=true&search_devel=true&search_sources=true&query_compact=true&replyplain=true" | \
|
||||
sed "s|.*\([0-9][0-9]*\) result.*|\1|"`
|
||||
if [ "$FOUND_EXISTING" != "0" ]; then
|
||||
echo -n "<div align=left class=output id=outputtop style=\"font-family:serif;color:black;background-color:#E0F2D0;\">"
|
||||
echo "<b><font color=red>ERROR: package already exists, please update from appropriate version:</font><b>"
|
||||
echo -n "<hr><b>Search results for \"$PACKAGE\":</b>"
|
||||
curl -s "${WEBBUILD_DISTROQUERY_URL}?query=$PACKAGE&search_milestone2=true&search_devel=true&search_sources=true&query_compact=true&replyplain=true" | \
|
||||
sed "s| \(href=.\)/| \1${SITE_BASE_URL}/|g"
|
||||
echo -n "</div>"
|
||||
RET=1
|
||||
continue
|
||||
else
|
||||
if [ "${SPECCREATEURL/\/}" = "$SPECCREATEURL" ]; then
|
||||
# local source in /SOURCES
|
||||
SPECCREATEURL="../SOURCES/$SPECCREATEURL"
|
||||
@ -1049,10 +1066,11 @@ if [ "$REQUEST" = "prepare" -o "$REQUEST" = "updatespec" -o "$REQUEST" = "speccr
|
||||
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "rpmbuild -bp $PACKAGE.spec --nodeps --define=\"_topdir $SPECVAR_WORKINGHOME/RPM\""
|
||||
RET=$?
|
||||
if [ $RET -eq 0 ]; then
|
||||
:
|
||||
REQUEST_NEXT="showbuilddocs"
|
||||
fi
|
||||
#echo "<br><font color=gold>HINT: don't forget to add build requirements after successful build! Edit specfile and check <i>recreate SRPM</i> before sending the package.</font>"
|
||||
}
|
||||
fi
|
||||
else
|
||||
echo "ERROR: both source archive URL and name are needed."
|
||||
RET=1
|
||||
|
Loading…
Reference in New Issue
Block a user