"
else
echo -n "id=outputtop>"
@@ -1080,60 +1243,55 @@ if [ "$REQUEST" != "" ]; then
fi
case $REQUEST in
- "showpatch") $SUDO_WRAPPER 0 $ENVIRONMENT $PACKAGE "autodist-tool makepatch $PACKAGE"; RET=$? ;;
- "removepatch") $SUDO_WRAPPER 0 $ENVIRONMENT $PACKAGE "autodist-tool makepatch $PACKAGE remove"
+ "smartupgrade") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "export LANG=C;sudo smart update && sudo smart upgrade"
+ RET=$?
+ ;;
+ "showpatch") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "autodist-tool makepatch $PACKAGE"; RET=$? ;;
+ "removepatch") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "autodist-tool makepatch $PACKAGE remove"
RET=$?
if [ $RET -eq 0 ]; then
social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"removed the autodist patch for
$PACKAGE\" STIME=`date +%s`"
fi ;;
- "updatepatch") $SUDO_WRAPPER 0 $ENVIRONMENT $PACKAGE "autodist-tool makepatch $PACKAGE update"
+ "autopatch") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "autodist-tool makepatch $PACKAGE auto"
+ RET=$?
+ if [ $RET -eq 0 ]; then
+ social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"made an autodist patch for
$PACKAGE\" STIME=`date +%s`"
+ fi ;;
+ "updatepatch") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "autodist-tool makepatch $PACKAGE update"
RET=$?
if [ $RET -eq 0 ]; then
social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"made an autodist
update patch for
$PACKAGE\" STIME=`date +%s`"
fi ;;
- "buildpatch") $SUDO_WRAPPER 0 $ENVIRONMENT $PACKAGE "autodist-tool makepatch $PACKAGE build"
+ "buildpatch") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "autodist-tool makepatch $PACKAGE build"
RET=$?
if [ $RET -eq 0 ]; then
social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"made an autodist
build patch for
$PACKAGE\" STIME=`date +%s`"
fi ;;
- "showscheduled") $SUDO_WRAPPER 0 $ENVIRONMENT $PACKAGE "autodist-tool schedule"; RET=$? ;;
- "schedule") $SUDO_WRAPPER 0 $ENVIRONMENT $PACKAGE "autodist-tool schedule $PACKAGE"
+ "showscheduled") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "autodist-tool schedule"; RET=$? ;;
+ "schedule") if [ "$SCHEDULEVERSION" ]; then
+ $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "autodist-tool schedule $AUTODISTJOB#$SCHEDULEVERSION"
+ RET=$?
+ if [ $RET -eq 0 ]; then
+ social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"scheduled autodist job
$AUTODISTJOB for update to version $SCHEDULEVERSION\" STIME=`date +%s`"
+ fi
+ else
+ $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "autodist-tool schedule $AUTODISTJOB"
+ RET=$?
+ if [ $RET -eq 0 ]; then
+ social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"scheduled autodist job
$PAUTODISTJOB for automatic update\" STIME=`date +%s`"
+ fi
+ fi
+ ;;
+ "unschedule") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "autodist-tool unschedule $AUTODISTJOB"
RET=$?
if [ $RET -eq 0 ]; then
- social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"scheduled autodist job
$PACKAGE\" STIME=`date +%s`"
+ social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"unscheduled autodist job
$AUTODISTJOB\" STIME=`date +%s`"
fi ;;
- "unschedule") $SUDO_WRAPPER 0 $ENVIRONMENT $PACKAGE "autodist-tool unschedule $PACKAGE"
- RET=$?
- if [ $RET -eq 0 ]; then
- social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"unscheduled autodist job
$PACKAGE\" STIME=`date +%s`"
- fi ;;
- "skip") $SUDO_WRAPPER 0 $ENVIRONMENT $PACKAGE "autodist-tool skip $PACKAGE"
+ "skip") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "autodist-tool skip $AUTODISTJOB"
RET=$?
if [ $RET -eq 0 ]; then
- social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"added autodist job
$PACKAGE to skipped list\" STIME=`date +%s`"
+ social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"added autodist job
$AUTODISTJOB to skipped list\" STIME=`date +%s`"
fi ;;
- "autodistprepare") [ "$AUTODISTFORCE" = "true" ] && AUTODISTADD="--force" || AUTODISTADD=
- autodistjobs=
- if [ "$AUTODISTPKGS" ]; then
- for p in $AUTODISTPKGS; do
- autodistjobs="$autodistjobs $AUTODISTJOB/$p"
- done
- else
- autodistjobs="$AUTODISTJOB"
- fi
- $SUDO_WRAPPER 0 $ENVIRONMENT "" "autodist -v -p $autodistjobs --repository ${AUTOPORT_BASE_REPOSITORY[$ENVIRONMENT]} --arch $AUTODISTARCH $AUTODISTADD"
- RET=$? ;;
- "autodistupdate") [ "$AUTODISTFORCE" = "true" ] && AUTODISTADD="--force" || AUTODISTADD=
- autodistjobs=
- if [ "$AUTODISTPKGS" ]; then
- for p in $AUTODISTPKGS; do
- autodistjobs="$autodistjobs $AUTODISTJOB/$p"
- done
- else
- autodistjobs="$AUTODISTJOB"
- fi
- $SUDO_WRAPPER 0 $ENVIRONMENT "" "autodist -v -u $autodistjobs --repository ${AUTOPORT_BASE_REPOSITORY[$ENVIRONMENT]} --arch $AUTODISTARCH $AUTODISTADD"
- RET=$? ;;
"autodistbuild") [ "$AUTODISTFORCE" = "true" ] && AUTODISTADD="--force" || AUTODISTADD=
autodistjobs=
if [ "$AUTODISTPKGS" ]; then
@@ -1143,7 +1301,7 @@ case $REQUEST in
else
autodistjobs="$AUTODISTJOB"
fi
- $SUDO_WRAPPER background $ENVIRONMENT "" "autodist -v -b $autodistjobs --repository ${AUTOPORT_BASE_REPOSITORY[$ENVIRONMENT]} --arch $AUTODISTARCH $AUTODISTADD"
+ $SUDO_WRAPPER background $ENVIRONMENT "$USER" "$PACKAGE" "autodist -v -b $autodistjobs --repository ${AUTOPORT_BASE_REPOSITORY[$ENVIRONMENT]} --arch $AUTODISTARCH $AUTODISTADD"
RET=$?
#[ $RET -eq 0 ] && social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"successfully built
$PACKAGE\" STIME=`date +%s`"
;;
@@ -1156,7 +1314,7 @@ case $REQUEST in
else
autodistjobs="$AUTODISTJOB"
fi
- $SUDO_WRAPPER 0 $ENVIRONMENT "" "autodist -v -i $autodistjobs --repository ${AUTOPORT_BASE_REPOSITORY[$ENVIRONMENT]} --arch $AUTODISTARCH $AUTODISTADD"
+ $SUDO_WRAPPER background $ENVIRONMENT "$USER" "$PACKAGE" "autodist -v -i $autodistjobs --repository ${AUTOPORT_BASE_REPOSITORY[$ENVIRONMENT]} --arch $AUTODISTARCH $AUTODISTADD"
RET=$? ;;
"autodistsend") [ "$AUTODISTFORCE" = "true" ] && AUTODISTADD="--force" || AUTODISTADD=
autodistjobs=
@@ -1167,71 +1325,67 @@ case $REQUEST in
else
autodistjobs="$AUTODISTJOB"
fi
- $SUDO_WRAPPER 0 $ENVIRONMENT "" "autodist -v -s $autodistjobs --repository ${AUTOPORT_BASE_REPOSITORY[$ENVIRONMENT]} --server $SENDREPOSITORY --arch $AUTODISTARCH $AUTODISTADD"
+ $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "autodist -v -s $autodistjobs --repository ${AUTOPORT_BASE_REPOSITORY[$ENVIRONMENT]} --server $SENDREPOSITORY --arch $AUTODISTARCH $AUTODISTADD"
RET=$?
- [ $RET -eq 0 ] && social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"sent
$PACKAGE to
$SENDREPOSITORY\" STIME=`date +%s`"
+ [ $RET -eq 0 ] && social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"sent
$AUTODISTPKGS to
$SENDREPOSITORY\" STIME=`date +%s`"
;;
- "autoport") $SUDO_WRAPPER background $ENVIRONMENT $PACKAGE "autoport $PACKAGE -r $REPOSITORY -v"
+ "autoport") $SUDO_WRAPPER background $ENVIRONMENT "$USER" $PACKAGE "autoport $PACKAGE -r $REPOSITORY -v"
RET=$?
;;
- "buildrootfiles") $SUDO_WRAPPER 0 $ENVIRONMENT $PACKAGE "cd @RPMBUILDROOT@ && find @BUILDROOT@"; RET=$? ;;
- "autospecupdatescheck") $SUDO_WRAPPER 0 $ENVIRONMENT $PACKAGE "autospec -u $PACKAGE -a2"; RET=$? ;;
- "rpmprepare") $SUDO_WRAPPER 0 $ENVIRONMENT $PACKAGE "rpmbuild -bp $PACKAGE.spec"; RET=$? ;;
- "rpmbuild") echo "`date` - RPMBUILD=$PACKAGE USER=$USER ENVIRONMENT=$ENVIRONMENT" >> $WEBBUILD_STATEDIR/buildingnow_log
- [ "$RPMFORCE" = "true" ] && RPMFORCEADD="--force-build"
- [ "$RPMBUILDARCH" -a "$RPMBUILDARCH" != "${AUTOPORT_ARCH[$ENVIRONMENT]}" ] && \
- RPMARCHADD="-A $RPMBUILDARCH --define \"cross_target_cpu=$RPMBUILDARCH\""
- $SUDO_WRAPPER background $ENVIRONMENT $PACKAGE "autospec -u $PACKAGE -a5,6 $RPMFORCEADD $RPMARCHADD"
-# && echo \"Webbuild HINT: now you may want to click on 'build requirements', add build requirements in .spec file and then 'recreate SRPMS'\""
- RET=$?
-# if [ $RET -eq 0 ]; then
-# social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"successfully built
$PACKAGE\" STIME=`date +%s`"
-# fi
- sed -i "|RPMBUILD=$PACKAGE USER=$USER ENVIRONMENT=$ENVIRONMENT|d" $WEBBUILD_STATEDIR/buildingnow_log
- ;;
- "srpmbuild") $SUDO_WRAPPER 0 $ENVIRONMENT $PACKAGE "rpmbuild -bs $PACKAGE.spec"
+ "buildrootfiles") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "cd @RPMBUILDROOT@ && find @BUILDROOT@"; RET=$? ;;
+ "autospecupdatescheck") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "autospec -u $PACKAGE -a2"; RET=$? ;;
+ "rpmprepare") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "rpmbuild -bp $PACKAGE.spec --nodeps"; RET=$? ;;
+ "rpmbuild") [ "$RPMFORCE" = "true" ] && RPMFORCEADD="--force-build"
+ [ "$RPMBUILDARCH" -a "$RPMBUILDARCH" != "${AUTOPORT_ARCH[$ENVIRONMENT]}" ] && \
+ RPMARCHADD="-A $RPMBUILDARCH --define \"cross_target_cpu=$RPMBUILDARCH\""
+ $SUDO_WRAPPER background $ENVIRONMENT "$USER" $PACKAGE "autospec -u $PACKAGE -a5,6 $RPMFORCEADD $RPMARCHADD"
+# && echo \"Webbuild HINT: now you may want to click on 'build requirements', add build requirements in .spec file and then 'recreate SRPMS'\""
+ RET=$?
+ ;;
+ "srpmbuild") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "rpmbuild -bs --define=\"_sourcedir @WORKINGHOME@/RPM/SOURCES\" $PACKAGE.spec"
RET=$? ;;
"autospeclistcheck")
[ "$RPMBUILDARCH" -a "$RPMBUILDARCH" != "${AUTOPORT_ARCH[$ENVIRONMENT]}" ] && \
RPMARCHADD="-A $RPMBUILDARCH --define \"cross_target_cpu=$RPMBUILDARCH\""
- $SUDO_WRAPPER 0 $ENVIRONMENT $PACKAGE "autospec -u $PACKAGE -a5 --list-check $RPMARCHADD"
+ $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "autospec -u $PACKAGE -a5 --list-check $RPMARCHADD"
RET=$? ;;
- "autospecbuildreq") $SUDO_WRAPPER 0 $ENVIRONMENT $PACKAGE "autospec -u $PACKAGE -a6"
+ "autospecbuildreq") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "autospec -u $PACKAGE -a6"
RET=$? ;;
- "rpmchecks") $SUDO_WRAPPER 0 $ENVIRONMENT $PACKAGE "autospec -u $PACKAGE -a8"; RET=$? ;;
- "rpmsimulateinstall") $SUDO_WRAPPER 0 $ENVIRONMENT $PACKAGE "autospec -u $PACKAGE -a7"; RET=$? ;;
+ "rpmchecks") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "autospec -u $PACKAGE -a8"; RET=$? ;;
+ "rpmsimulateinstall") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "autospec -u $PACKAGE -a7"; RET=$? ;;
"rpminstall") if [ "$USER_CANINSTALL" ]; then
[ "$RPMFORCE" = "true" ] && RPMFORCEADD="--force-install"
- $SUDO_WRAPPER 0 $ENVIRONMENT $PACKAGE "autospec -u $PACKAGE -a11 $RPMFORCEADD"; RET=$?
+ $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "autospec -u $PACKAGE -a11 $RPMFORCEADD"; RET=$?
else
echo "Install function disabled."
RET=1
fi ;;
- "addpatch") if [ "$ADDPATCHURL" -a "$ADDPATCHNAME" ]; then
- $SUDO_WRAPPER 0 $ENVIRONMENT $PACKAGE "curl -s -k \"$ADDPATCHURL\" -o ../SOURCES/$PACKAGE-$ADDPATCHNAME.patch"
- RET=$?
- [ $RET -eq 0 ] && echo "Patch added with name $PACKAGE-$ADDPATCHNAME.patch"
- else
- echo "Patch URL or destination name not provided."
- RET=1
- fi ;;
- "sendpackage") $SUDO_WRAPPER 0 $ENVIRONMENT $PACKAGE "autospec -u $PACKAGE -a10 --server $SENDREPOSITORY"
+ "sendpackage") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "autospec -u $PACKAGE -a10 --server $SENDREPOSITORY"
RET=$?
if [ $RET -eq 0 ]; then
social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"sent
$PACKAGE to
$SENDREPOSITORY\" STIME=`date +%s`"
fi ;;
"sendsource") [ "$RPMFORCE" = "true" ] && RPMFORCEADD="--force --nodeps"
if [ "$SENDREPOSITORY" ]; then
- $SUDO_WRAPPER 0 $ENVIRONMENT $PACKAGE "rpmbuild -bs $PACKAGE.spec $RPMFORCEADD && autospec -u $PACKAGE -a10 --server $SENDREPOSITORY --norpm"
+ $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "rpmbuild -bs --define=\"_sourcedir @WORKINGHOME@/RPM/SOURCES\" $PACKAGE.spec $RPMFORCEADD && autospec -u $PACKAGE -a10 --server $SENDREPOSITORY --norpm"
RET=$?
else
echo "ERROR: send repository is not defined."
RET=255
fi ;;
+ "addpatch") if [ "$ADDPATCHURL" -a "$ADDPATCHNAME" ]; then
+ $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "curl -skL \"$ADDPATCHURL\" -o ../SOURCES/$PACKAGE-$ADDPATCHNAME.patch"
+ RET=$?
+ [ $RET -eq 0 ] && echo "Patch added with name $PACKAGE-$ADDPATCHNAME.patch"
+ else
+ echo "Patch URL or destination name not provided."
+ RET=1
+ fi ;;
"repositoryimport")
for p in $PACKAGES; do
[ "$REPOSITORYSIMULATE" = "true" -o ! "$USER_CANMAINTAIN" ] && SIMULATEADD="-s" || SIMULATEADD=
- $SUDO_WRAPPER 0 local "$PACKAGE" "openmamba-repository import $SENDREPOSITORY $p -d $REPOSITORYIMPORTTO $SIMULATEADD -y"
+ [ "$REPOSITORYFORCE" = "true" ] && FORCEADD="-f"
+ $SUDO_WRAPPER 0 local "$USER" "$PACKAGE" "openmamba-repository import $SENDREPOSITORY $p -d $REPOSITORYIMPORTTO $SIMULATEADD $FORCEADD -y"
RET=$?
if [ ! "$SIMULATEADD" -a $RET -eq 0 ]; then
social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"imported
$p from
$SENDREPOSITORY to
$REPOSITORYIMPORTTO\" STIME=`date +%s`"
@@ -1242,7 +1396,8 @@ case $REQUEST in
"repositoryrelease")
for p in $PACKAGES; do
[ "$REPOSITORYSIMULATE" = "true" -o ! "$USER_CANMAINTAIN" ] && SIMULATEADD="-s" || SIMULATEADD=
- $SUDO_WRAPPER 0 local "$PACKAGE" "openmamba-repository release $SENDREPOSITORY $p -d $REPOSITORYIMPORTTO $SIMULATEADD -y"
+ [ "$REPOSITORYFORCE" = "true" ] && SIMULATEADD="$SIMULATEADD -f"
+ $SUDO_WRAPPER 0 local "$USER" "$PACKAGE" "openmamba-repository release $SENDREPOSITORY $p -d $REPOSITORYIMPORTTO $SIMULATEADD -y"
RET=$?
if [ ! "$SIMULATEADD" -a $RET -eq 0 ]; then
social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"released
$p from
$SENDREPOSITORY to
$REPOSITORYIMPORTTO\" STIME=`date +%s`"
@@ -1252,7 +1407,7 @@ case $REQUEST in
;;
"repositorydiff")
for p in $PACKAGES; do
- $SUDO_WRAPPER 0 local "" "openmamba-repository diff $SENDREPOSITORY $p -d $REPOSITORYIMPORTTO"
+ $SUDO_WRAPPER 0 local "$USER" "" "openmamba-repository diff $SENDREPOSITORY $p -d $REPOSITORYIMPORTTO"
RET=$?
[ $RET -eq 0 ] || break
done
@@ -1260,7 +1415,7 @@ case $REQUEST in
"repositoryarchive")
for p in $PACKAGES; do
[ "$REPOSITORYSIMULATE" = "true" -o ! "$USER_CANMAINTAIN" ] && SIMULATEADD="-s" || SIMULATEADD=
- $SUDO_WRAPPER 0 local "$PACKAGE" "openmamba-repository archive $SENDREPOSITORY $p -y"
+ $SUDO_WRAPPER 0 local "$USER" "$PACKAGE" "openmamba-repository archive $SENDREPOSITORY $p -y"
RET=$?
if [ ! "$SIMULATEADD" -a $RET -eq 0 ]; then
social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"archived
$p from
$SENDREPOSITORY\" STIME=`date +%s`"
@@ -1270,23 +1425,23 @@ case $REQUEST in
;;
"repositorysync")
if [ "$REPOSITORY" ]; then
- $SUDO_WRAPPER background local "" "/etc/cron.hourly/20-openmamba-apt $REPOSITORY"
+ $SUDO_WRAPPER background local "$USER" "" "/etc/cron.hourly/20-openmamba-apt $REPOSITORY"
RET=$?
- [ $RET -eq 0 ] && $SUDO_WRAPPER background local "" "/etc/cron.hourly/40-openmamba-rsync $REPOSITORY"
+ [ $RET -eq 0 ] && $SUDO_WRAPPER background local "$USER" "" "/etc/cron.hourly/40-openmamba-rsync $REPOSITORY"
RET=$?
[ $RET -eq 0 ] || break
fi
;;
- "autoportnp") $SUDO_WRAPPER keeplog $ENVIRONMENT $PACKAGE "autoport -np $PACKAGE"; RET=$? ;;
+ "autoportnp") $SUDO_WRAPPER background $ENVIRONMENT "$USER" $PACKAGE "autoport -v -np $PACKAGE"; RET=$? ;;
"autoportlog") cat "$AUTOPORTLOGDIR/current.log"; RET=$? ;;
- "allowedgroups") $SUDO_WRAPPER 0 $ENVIRONMENT "" "autospec --eval rpm_allowed_groups"; RET=$? ;;
- "approvedlicenses") $SUDO_WRAPPER 0 $ENVIRONMENT "" "autospec --eval rpm_approved_licenses | grep -v \"^#\"" | \
+ "allowedgroups") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "autospec --eval rpm_allowed_groups"; RET=$? ;;
+ "approvedlicenses") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "autospec --eval rpm_approved_licenses | grep -v \"^#\"" | \
while read line; do
echo $line
done
RET=0
;;
- "builddirfiles") $SUDO_WRAPPER 0 $ENVIRONMENT $PACKAGE "cd @RPMBUILDDIR@ && find @BUILDDIR@"; RET=$? ;;
+ "builddirfiles") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "cd @RPMBUILDDIR@ && find @BUILDDIR@"; RET=$? ;;
"showchangelogs"|"showbuilddocs"|"showlicenses")
if [ "$REQUEST" = "showchangelogs" ]; then
PATTERN="-iname changelog -or -iname news -and -type f"
@@ -1295,7 +1450,7 @@ case $REQUEST in
elif [ "$REQUEST" = "showbuilddocs" ]; then
PATTERN="-iname readme\* -or -iname install\* -or -iname todo\* -or -iname pkgbuild\* -and -type f"
fi
- files=`$SUDO_WRAPPER 0 $ENVIRONMENT $PACKAGE "cd @RPMBUILDDIR@/@BUILDDIR@ && find . $PATTERN -maxdepth 2"`
+ files=`$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "cd @RPMBUILDDIR@/@BUILDDIR@ && find . $PATTERN -maxdepth 2"`
cnt=0
for f in $files; do
echo -n "
$f"
@@ -1303,13 +1458,16 @@ case $REQUEST in
echo -n "
"
for f in $files; do
echo -n "
File $f:
"
- $SUDO_WRAPPER 0 $ENVIRONMENT $PACKAGE "cd @RPMBUILDDIR@/@BUILDDIR@ && cat $f"
+ $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE \
+ "cd @RPMBUILDDIR@/@BUILDDIR@ && head -c 10240 $f | sed \"s|<|\<|g;s|[[:cntrl:]]\[[0-9;]*m||g\"" | \
+ tee /tmp/prova5
RET=$?
echo -n "
"
done
;;
- "configurehelp") $SUDO_WRAPPER 0 $ENVIRONMENT $PACKAGE "cd @RPMBUILDDIR@/@BUILDDIR@ && ./configure --help"; RET=$? ;;
- "showmacrosfile") $SUDO_WRAPPER 0 $ENVIRONMENT $PACKAGE "cat /etc/rpm/macros.$MACROSFILE"; RET=$? ;;
+ "configurehelp") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "cd @RPMBUILDDIR@/@BUILDDIR@ && ./configure --help"; RET=$? ;;
+ "configurelog") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "cd @RPMBUILDDIR@/@BUILDDIR@ && cat config.log"; RET=$? ;;
+ "showmacrosfile") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "cat /etc/rpm/macros.$MACROSFILE"; RET=$? ;;
*) RET=0 ;;
esac
@@ -1331,7 +1489,7 @@ if [ "$MAINTAINERMODE" = "true" ]; then
echo -n "
Repository maintenance:
"
-# echo -n "
"
# repository compare
- echo -n ""
# repository import
- echo -n ""`\"+p+\"`cgi_encodevar " from $REPOSITORY to "`\"+getSelectedValueById('repositoryimportto')+"
echo -n "\"`cgi_encodevar "?"`\""
echo -n "); class=redbutton>"
# repository release
- echo -n ""`\"+p+\"`cgi_encodevar " in $REPOSITORY to "`\"+getSelectedValueById('repositoryimportto')+"
echo -n "\"`cgi_encodevar "?"`\""
echo -n "); class=redbutton>"
# repository archive
- echo -n ""`\"+p+\"`cgi_encodevar " in $REPOSITORY?"`\""
echo -n "); class=redbutton>"
+ echo -n ""
echo -n ""
# repository sync
- echo -n " \1|;
+ s|\(.*error[[:space:]]*:[[:space:]]*\)\(.*\)|\1\2|i;
+ s|^\(== =.*\)|\1|;
+ s|^[[:cntrl:]]*\([!%?=][!%!=>] .*\)|\1|;" | google_search $1
+}
+
+function google_search() {
+ while read line; do
+ local SEARCH_STRING=`echo "$line" | sed "s|.*%SRCURL%\(.*\)%SRCURLEND%.*|\1|"`
+ if [ "$SEARCH_STRING" = "$line" ]; then
+ echo "$line"
+ else
+ SEARCH_STRING=`echo $SEARCH_STRING | sed "s|\<|<|"`
+ local SEARCH_STRING_ENCODED=`cgi_encodevar "$1 $SEARCH_STRING"`
+ echo "$line" | sed "s|%SRCURL%.*%SRCURLEND%|href=\"http://www.google.com/search?q=$SEARCH_STRING_ENCODED\" target=_new title=\"Search this error on the Web\"|"
+ fi
+ done
+}
diff --git a/webbuild/webbuild-sudo b/webbuild/webbuild-sudo
index c66f4dd..5d1975e 100755
--- a/webbuild/webbuild-sudo
+++ b/webbuild/webbuild-sudo
@@ -4,23 +4,32 @@
MODE=$1
ENVIRONMENT=$2
-PACKAGE=$3
-COMMAND=$4
-TMPFILE=$5
+USER=$3
+PACKAGE=$4
+COMMAND=$5
+TMPFILE=$6
+echo "REQUEST: $@" >> $WEBBUILD_STATEDIR/commands_log
if [ "$MODE" = "killtree" ]; then
KILLPID=$2
- [ $KILLPID -gt 1 ] && kill_tree $KILLPID
+ [ $KILLPID -gt 1 ] && {
+ echo "COMMAND: kill_tree $KILLPID" >> $WEBBUILD_STATEDIR/commands_log
+ kill_tree $KILLPID
+ }
exit $?
elif [ "$MODE" = "finishprocess" ]; then
PROCESSPID=$2
- PROCESSLOG=$3
- RETCODE=`tail -n1 $PROCESSLOG | grep "^# WEBBUILD_EXITCODE=" | sed "s|^# WEBBUILD_EXITCODE=||"`
- [ "$RETCODE" ] || RETCODE=257
- sed -i "s|\(^$PROCESSPID [^[:space:]]* [^[:space:]]* [^[:space:]]* \)[^[:space:]]*|\1$RETCODE|" $WEBBUILD_STATEDIR/processes
+ PROCESSLOG=$4
+ if [ -e $PROCESSLOG ]; then
+ RETCODE=`tail -n1 $PROCESSLOG | grep "^# WEBBUILD_EXITCODE=" | sed "s|^# WEBBUILD_EXITCODE=||"`
+ [ "$RETCODE" ] || RETCODE=257
+ else
+ RETCODE=0
+ fi
+ sed -i "s|\(^$PROCESSPID [^[:space:]]* [^[:space:]]* [^[:space:]]* [^[:space:]]* \)[^[:space:]]*|\1$RETCODE|" $WEBBUILD_STATEDIR/processes
exit $RETCODE
elif [ "$ENVIRONMENT" = "local" ]; then
-# echo "Command: $COMMAND"
+ echo "COMMAND: $COMMAND" >> $WEBBUILD_STATEDIR/commands_log
$COMMAND 2>&1 | sed "s|<|\<|g"
exit 0
fi
@@ -57,7 +66,7 @@ if [ "$WORKINGHOME" ]; then
eval `$SUCMDPREFIX "autospec --eval=tmppath_dir|grep -v '^#'"`
RPMBUILDROOT=$tmppath_dir
SPECFILE=${ENVPREFIX}${WORKINGHOME}/RPM/SPECS/$PACKAGE.spec
- if [ -r "$SPECFILE" ]; then
+ if [ "$PACKAGE" -a -r "$SPECFILE" ]; then
rm -f $SPECFILE.tmp
$SUCMDPREFIX "rpm -q --specfile ${WORKINGHOME}/RPM/SPECS/$PACKAGE.spec --specedit > ${WORKINGHOME}/RPM/SPECS/$PACKAGE.spec.tmp 2>/dev/null"
if [ -e $SPECFILE.tmp ]; then
@@ -76,23 +85,24 @@ COMMAND=`echo $COMMAND | sed "s|@BUILDDIR@|$BUILDDIR|g"`
COMMAND=`echo $COMMAND | sed "s|@BUILDROOT@|$BUILDROOT|g"`
COMMAND=`echo $COMMAND | sed "s|@RPMBUILDDIR@|$RPMBUILDDIR|g"`
COMMAND=`echo $COMMAND | sed "s|@RPMBUILDROOT@|$RPMBUILDROOT|g"`
+COMMAND=`echo $COMMAND | sed "s|@WORKINGHOME@|$WORKINGHOME|g"`
+echo "COMMAND: $COMMAND" >> $WEBBUILD_STATEDIR/commands_log
-cmdtmpfile=`mktemp`
-chgrp nobody $cmdtmpfile
-chmod 640 $cmdtmpfile
+cmdtmpfile=`mktemp --suffix=.webbuildcmd`
+[ "$PACKAGE" ] || PACKAGE=nopackage
if [ "$MODE" = "background" ]; then
if [ "$WORKINGHOME" ]; then
$SUCMDPREFIX ". /etc/profile;cd $WORKINGHOME/RPM/SPECS;$COMMAND;echo \"# WEBBUILD_EXITCODE=\$?\"" 2>&1 | sed "s|<|\<|g" | tr -d '\f' > $cmdtmpfile &
else
$SUCMDPREFIX "$COMMAND;echo \"# WEBBUILD_EXITCODE=\$?\"" 2>&1 | sed "s|<|\<|g" | tr -d '\f' > $cmdtmpfile &
fi
- echo "$! $ENVUSER $ENVIRONMENT $cmdtmpfile 256 $COMMAND" >> $WEBBUILD_STATEDIR/processes
+ echo "$! $USER $ENVIRONMENT $PACKAGE $cmdtmpfile 256 $COMMAND" >> $WEBBUILD_STATEDIR/processes
echo "Started background command: $COMMAND"
RET=0
else
- echo "$$ $ENVUSER $ENVIRONMENT $cmdtmpfile 256 $COMMAND" >> $WEBBUILD_STATEDIR/processes
- rettmpfile=`$SUCMDPREFIX mktemp`
+ echo "$$ $USER $ENVIRONMENT $PACKAGE $cmdtmpfile 256 $COMMAND" >> $WEBBUILD_STATEDIR/processes
+ rettmpfile=`$SUCMDPREFIX "mktemp --suffix=.webbuildret"`
if [ "$WORKINGHOME" ]; then
$SUCMDPREFIX ". /etc/profile;cd $WORKINGHOME/RPM/SPECS;$COMMAND;echo \$? > $rettmpfile" 2>&1 | sed "s|<|\<|g" | tr -d '\f' | tee $cmdtmpfile
else
@@ -101,11 +111,11 @@ else
RET=`cat $ENVPREFIX/$rettmpfile`
[ "$RET" ] || RET=255
$SUCMDPREFIX "rm -f $rettmpfile"
- sed -i "/^$$ $ENVUSER/d" $WEBBUILD_STATEDIR/processes
+ sed -i "/^$$ $USER/d" $WEBBUILD_STATEDIR/processes
if [ "$MODE" != "keeplog" ]; then
rm -f $cmdtmpfile
else
- echo "$$ $ENVUSER $ENVIRONMENT $cmdtmpfile $RET $COMMAND" >> $WEBBUILD_STATEDIR/processes
+ echo "$$ $USER $ENVIRONMENT $PACKAGE $cmdtmpfile $RET $COMMAND" >> $WEBBUILD_STATEDIR/processes
fi
fi
@@ -114,4 +124,8 @@ if [ "$ENVIRONMENT" != "local" ]; then
rm -f /var/autoport/${AUTOPORT_CHROOT[$ENVIRONMENT]}/$TMPFILE
fi
fi
+if [ -e $cmdtmpfile ]; then
+ chmod 666 $cmdtmpfile
+ chown apache.nobody $cmdtmpfile
+fi
exit $RET