diff --git a/webbuild/webbuild-cgi b/webbuild/webbuild-cgi index 4b27fc2..6629af7 100755 --- a/webbuild/webbuild-cgi +++ b/webbuild/webbuild-cgi @@ -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 "Console output:
" + if [ "$REQUEST" = "speccreate" ]; then + OUTPUTMODE="outputtop" + else + OUTPUTMODE="outputbottom" + fi + echo -n "Console output:
" echo -n "
"
    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 $PACKAGE new package in `print_environment_descr $ENVIRONMENT` 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 "
" + echo "ERROR: package already exists, please update from appropriate version:" + echo -n "
Search results for \"$PACKAGE\":" + 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 "
" + RET=1 + continue + else + if [ "${SPECCREATEURL/\/}" = "$SPECCREATEURL" ]; then + # local source in /SOURCES + SPECCREATEURL="../SOURCES/$SPECCREATEURL" fi - #echo "
HINT: don't forget to add build requirements after successful build! Edit specfile and check recreate SRPM before sending the package." - } + 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 $PACKAGE new package in `print_environment_descr $ENVIRONMENT` 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