webbuild-cgi: fix rpmbuild -bs and other rpmbuild calls by passing correct %_topdir according to environment

This commit is contained in:
Silvan Calarco 2014-06-10 00:19:26 +02:00
parent 6dd2bb37bc
commit 2dd4d2632d

View File

@ -1044,7 +1044,7 @@ if [ "$REQUEST" = "prepare" -o "$REQUEST" = "updatespec" -o "$REQUEST" = "speccr
[ $RET -eq 0 ] && { [ $RET -eq 0 ] && {
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`" 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 # prepare
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "rpmbuild -bp $PACKAGE.spec --nodeps" $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "rpmbuild -bp $PACKAGE.spec --nodeps --define=\"_topdir $SPECVAR_WORKINGHOME/RPM\""
RET=$? RET=$?
if [ $RET -eq 0 ]; then if [ $RET -eq 0 ]; then
REQUEST_NEXT="showbuilddocs" REQUEST_NEXT="showbuilddocs"
@ -1738,7 +1738,7 @@ case $REQUEST in
fi fi
;; ;;
"autospecupdatescheck") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "$AUTOSPEC_CMD -u $PACKAGE -a2"; RET=$? ;; "autospecupdatescheck") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "$AUTOSPEC_CMD -u $PACKAGE -a2"; RET=$? ;;
"rpmprepare") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "rpmbuild -bp $PACKAGE.spec --nodeps"; RET=$? ;; "rpmprepare") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "rpmbuild -bp $PACKAGE.spec --nodeps --define=\"_topdir $SPECVAR_WORKINGHOME/RPM\""; RET=$? ;;
"rpmbuild") [ "$RPMFORCE" = "true" ] && RPMFORCEADD="--force-build" "rpmbuild") [ "$RPMFORCE" = "true" ] && RPMFORCEADD="--force-build"
[ "$RPMBUILDARCH" -a "$RPMBUILDARCH" != "${AUTOPORT_ARCH[$ENVIRONMENT]}" ] && \ [ "$RPMBUILDARCH" -a "$RPMBUILDARCH" != "${AUTOPORT_ARCH[$ENVIRONMENT]}" ] && \
RPMARCHADD="-A $RPMBUILDARCH --define \"cross_target_cpu=$RPMBUILDARCH\"" RPMARCHADD="-A $RPMBUILDARCH --define \"cross_target_cpu=$RPMBUILDARCH\""
@ -1751,7 +1751,10 @@ case $REQUEST in
} }
;; ;;
"srpmbuild") [ "$RPMFORCE" = "true" ] && RPMFORCEADD="--nodeps" "srpmbuild") [ "$RPMFORCE" = "true" ] && RPMFORCEADD="--nodeps"
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "rpmbuild -bs --define=\"_sourcedir $SPECVAR_WORKINGHOME/RPM/SOURCES\" $RPMFORCEADD $PACKAGE.spec" $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE \
"rpmbuild -bs \
--define=\"_topdir $SPECVAR_WORKINGHOME/RPM\" \
$RPMFORCEADD $PACKAGE.spec"
RET=$? ;; RET=$? ;;
"autospeclistcheck") "autospeclistcheck")
[ "$RPMBUILDARCH" -a "$RPMBUILDARCH" != "${AUTOPORT_ARCH[$ENVIRONMENT]}" ] && \ [ "$RPMBUILDARCH" -a "$RPMBUILDARCH" != "${AUTOPORT_ARCH[$ENVIRONMENT]}" ] && \
@ -1771,7 +1774,9 @@ case $REQUEST in
fi ;; fi ;;
"sendpackage") if [ "$SENDREPOSITORY" ]; then "sendpackage") if [ "$SENDREPOSITORY" ]; then
if [ "$SENDRECREATESRPM" = "true" ]; then if [ "$SENDRECREATESRPM" = "true" ]; then
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "rpmbuild -bs --define=\"_sourcedir $SPECVAR_WORKINGHOME/RPM/SOURCES\" $PACKAGE.spec $RPMFORCEADD && $AUTOSPEC_CMD -u $PACKAGE -a10 --server $SENDREPOSITORY" $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "rpmbuild -bs \
--define=\"_topdir $SPECVAR_WORKINGHOME/RPM\" \
$PACKAGE.spec $RPMFORCEADD && $AUTOSPEC_CMD -u $PACKAGE -a10 --server $SENDREPOSITORY"
RET=$? RET=$?
else else
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "$AUTOSPEC_CMD -u $PACKAGE -a10 --server $SENDREPOSITORY" $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "$AUTOSPEC_CMD -u $PACKAGE -a10 --server $SENDREPOSITORY"
@ -1788,7 +1793,9 @@ case $REQUEST in
"sendsource") [ "$RPMFORCE" = "true" ] && RPMFORCEADD="--nodeps" "sendsource") [ "$RPMFORCE" = "true" ] && RPMFORCEADD="--nodeps"
if [ "$SENDREPOSITORY" ]; then if [ "$SENDREPOSITORY" ]; then
if [ "$SENDRECREATESRPM" = "true" ]; then if [ "$SENDRECREATESRPM" = "true" ]; then
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "rpmbuild -bs --define=\"_sourcedir $SPECVAR_WORKINGHOME/RPM/SOURCES\" $PACKAGE.spec $RPMFORCEADD && $AUTOSPEC_CMD -u $PACKAGE -a10 --server $SENDREPOSITORY --norpm" $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "rpmbuild -bs \
--define=\"_topdir $SPECVAR_WORKINGHOME/RPM\" \
$PACKAGE.spec $RPMFORCEADD && $AUTOSPEC_CMD -u $PACKAGE -a10 --server $SENDREPOSITORY --norpm"
RET=$? RET=$?
if [ $RET -eq 0 ]; then if [ $RET -eq 0 ]; then
social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"sent edited <b>$PACKAGE</b> source to <b>$SENDREPOSITORY</b>\" STIME=`date +%s`" social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"sent edited <b>$PACKAGE</b> source to <b>$SENDREPOSITORY</b>\" STIME=`date +%s`"