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,30 +1034,43 @@ if [ "$REQUEST" = "prepare" -o "$REQUEST" = "updatespec" -o "$REQUEST" = "speccr
|
||||
RET=$?
|
||||
;;
|
||||
"speccreate") if [ "$SPECCREATEURL" -a "$PACKAGE" ]; then
|
||||
if [ "${SPECCREATEURL/\/}" = "$SPECCREATEURL" ]; then
|
||||
# local source in /SOURCES
|
||||
SPECCREATEURL="../SOURCES/$SPECCREATEURL"
|
||||
fi
|
||||
AUTOSPEC_CMDLINE="-n $PACKAGE -o $PACKAGE.spec"
|
||||
#DECODEDURL=`cgi_decodevar $SPECCREATEURL`
|
||||
[ "$SPECCREATETYPE" ] && AUTOSPEC_CMDLINE="$AUTOSPEC_CMDLINE -t $SPECCREATETYPE"
|
||||
[ "$SPECCREATEVERSION" ] && AUTOSPEC_CMDLINE="$AUTOSPEC_CMDLINE -v $SPECCREATEVERSION"
|
||||
[ "$SPECCREATEGITBRANCH" ] && AUTOSPEC_CMDLINE="$AUTOSPEC_CMDLINE --git-branch $SPECCREATEGITBRANCH"
|
||||
[ "$USER_FULLNAME" -a "$USER_EMAIL" ] && AUTOSPEC_CMDLINE="$AUTOSPEC_CMDLINE --packager-fullname=\"$USER_FULLNAME\" --packager-email=\"$USER_EMAIL\""
|
||||
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "$AUTOSPEC_CMD -s \"$SPECCREATEURL\" $AUTOSPEC_CMDLINE \
|
||||
--changelog \"package created using the webbuild interface\""
|
||||
RET=$?
|
||||
[ $RET -eq 0 ] && {
|
||||
eval `$SUDO_WRAPPER specinfo $ENVIRONMENT "$USER" $PACKAGE ""`
|
||||
social_log "SUSER=$USER SEMAIL=$USER_EMAIL STARGET=developers STEXT=\"is working on <b>$PACKAGE</b> new package in <b>`print_environment_descr $ENVIRONMENT`</b> environment\" STIME=`date +%s`"
|
||||
# prepare
|
||||
$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"
|
||||
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"
|
||||
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>"
|
||||
}
|
||||
AUTOSPEC_CMDLINE="-n $PACKAGE -o $PACKAGE.spec"
|
||||
#DECODEDURL=`cgi_decodevar $SPECCREATEURL`
|
||||
[ "$SPECCREATETYPE" ] && AUTOSPEC_CMDLINE="$AUTOSPEC_CMDLINE -t $SPECCREATETYPE"
|
||||
[ "$SPECCREATEVERSION" ] && AUTOSPEC_CMDLINE="$AUTOSPEC_CMDLINE -v $SPECCREATEVERSION"
|
||||
[ "$SPECCREATEGITBRANCH" ] && AUTOSPEC_CMDLINE="$AUTOSPEC_CMDLINE --git-branch $SPECCREATEGITBRANCH"
|
||||
[ "$USER_FULLNAME" -a "$USER_EMAIL" ] && AUTOSPEC_CMDLINE="$AUTOSPEC_CMDLINE --packager-fullname=\"$USER_FULLNAME\" --packager-email=\"$USER_EMAIL\""
|
||||
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "$AUTOSPEC_CMD -s \"$SPECCREATEURL\" $AUTOSPEC_CMDLINE \
|
||||
--changelog \"package created using the webbuild interface\""
|
||||
RET=$?
|
||||
[ $RET -eq 0 ] && {
|
||||
eval `$SUDO_WRAPPER specinfo $ENVIRONMENT "$USER" $PACKAGE ""`
|
||||
social_log "SUSER=$USER SEMAIL=$USER_EMAIL STARGET=developers STEXT=\"is working on <b>$PACKAGE</b> new package in <b>`print_environment_descr $ENVIRONMENT`</b> environment\" STIME=`date +%s`"
|
||||
# prepare
|
||||
$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
|
||||
}
|
||||
fi
|
||||
else
|
||||
echo "ERROR: both source archive URL and name are needed."
|
||||
RET=1
|
||||
|
Loading…
Reference in New Issue
Block a user