webbuild: sync with current alpha development with lots of changes and improvements
This commit is contained in:
parent
4021d4f7a1
commit
0601482f54
File diff suppressed because it is too large
Load Diff
@ -20,7 +20,7 @@ function set_user_state_var() {
|
|||||||
|
|
||||||
[ "$1" ] || return
|
[ "$1" ] || return
|
||||||
|
|
||||||
[ -e $WEBBILD_STATEDIR/users/$stateuser.state ] || touch $WEBBUILD_STATEDIR/users/$stateuser.state
|
[ -e $WEBBUILD_STATEDIR/users/$stateuser.state ] || touch $WEBBUILD_STATEDIR/users/$stateuser.state
|
||||||
sed -i "/^$statevar=/d" $WEBBUILD_STATEDIR/users/$stateuser.state
|
sed -i "/^$statevar=/d" $WEBBUILD_STATEDIR/users/$stateuser.state
|
||||||
[ "$statevalue" ] && echo "$statevar=$statevalue" >> $WEBBUILD_STATEDIR/users/$stateuser.state
|
[ "$statevalue" ] && echo "$statevar=$statevalue" >> $WEBBUILD_STATEDIR/users/$stateuser.state
|
||||||
}
|
}
|
||||||
@ -28,7 +28,7 @@ function set_user_state_var() {
|
|||||||
function social_log() {
|
function social_log() {
|
||||||
local line=$1
|
local line=$1
|
||||||
|
|
||||||
[ "$1" ] || return
|
[ "$line" ] || return
|
||||||
|
|
||||||
if [ ! "$STATE_FAKEUSER" ]; then
|
if [ ! "$STATE_FAKEUSER" ]; then
|
||||||
STATE_SOCIALLOG_ID=0
|
STATE_SOCIALLOG_ID=0
|
||||||
@ -52,7 +52,7 @@ function cgi_encodevar() {
|
|||||||
esac
|
esac
|
||||||
encoded+="${o}"
|
encoded+="${o}"
|
||||||
done
|
done
|
||||||
echo "${encoded}" # You can either set a return variable (FASTER)
|
echo -n "${encoded}" # You can either set a return variable (FASTER)
|
||||||
# REPLY="${encoded}" #+or echo the result (EASIER)... or both... :p
|
# REPLY="${encoded}" #+or echo the result (EASIER)... or both... :p
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,18 +2,35 @@
|
|||||||
. /usr/share/autodist/webbuild-functions
|
. /usr/share/autodist/webbuild-functions
|
||||||
. /etc/sysconfig/autoport
|
. /etc/sysconfig/autoport
|
||||||
|
|
||||||
ENVIRONMENT=$1
|
MODE=$1
|
||||||
PACKAGE=$2
|
ENVIRONMENT=$2
|
||||||
COMMAND=$3
|
PACKAGE=$3
|
||||||
TMPFILE=$4
|
COMMAND=$4
|
||||||
|
TMPFILE=$5
|
||||||
|
|
||||||
if [ "$ENVIRONMENT" = "local" ]; then
|
if [ "$MODE" = "killtree" ]; then
|
||||||
|
KILLPID=$2
|
||||||
|
[ $KILLPID -gt 1 ] && 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
|
||||||
|
exit $RETCODE
|
||||||
|
elif [ "$ENVIRONMENT" = "local" ]; then
|
||||||
# echo "Command: $COMMAND"
|
# echo "Command: $COMMAND"
|
||||||
$COMMAND 2>&1 | sed "s|<|\<|g"
|
$COMMAND 2>&1 | sed "s|<|\<|g"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${AUTOPORT_CHROOT[$ENVIRONMENT]}" ]; then
|
if [ "$ENVIRONMENT" = "local" ]; then
|
||||||
|
ENVPREFIX=
|
||||||
|
ENVUSER=root
|
||||||
|
WORKINGHOME=
|
||||||
|
SUCMDPREFIX=
|
||||||
|
elif [ "${AUTOPORT_CHROOT[$ENVIRONMENT]}" ]; then
|
||||||
ENVPREFIX="/var/autoport/${AUTOPORT_CHROOT[$ENVIRONMENT]}"
|
ENVPREFIX="/var/autoport/${AUTOPORT_CHROOT[$ENVIRONMENT]}"
|
||||||
ENVUSER=${AUTOPORT_CHROOT_USER[$ENVIRONMENT]}
|
ENVUSER=${AUTOPORT_CHROOT_USER[$ENVIRONMENT]}
|
||||||
WORKINGHOME="/usr/src/"
|
WORKINGHOME="/usr/src/"
|
||||||
@ -36,21 +53,23 @@ else
|
|||||||
RPMBUILDROOT="/var/tmp/autodist"
|
RPMBUILDROOT="/var/tmp/autodist"
|
||||||
[ "$TMPFILE" ] && chown autodist $TMPFILE
|
[ "$TMPFILE" ] && chown autodist $TMPFILE
|
||||||
fi
|
fi
|
||||||
eval `$SUCMDPREFIX "autospec --eval=tmppath_dir|grep -v '^#'"`
|
if [ "$WORKINGHOME" ]; then
|
||||||
RPMBUILDROOT=$tmppath_dir
|
eval `$SUCMDPREFIX "autospec --eval=tmppath_dir|grep -v '^#'"`
|
||||||
SPECFILE=${ENVPREFIX}${WORKINGHOME}/RPM/SPECS/$PACKAGE.spec
|
RPMBUILDROOT=$tmppath_dir
|
||||||
if [ -r "$SPECFILE" ]; then
|
SPECFILE=${ENVPREFIX}${WORKINGHOME}/RPM/SPECS/$PACKAGE.spec
|
||||||
rm -f $SPECFILE.tmp
|
if [ -r "$SPECFILE" ]; then
|
||||||
$SUCMDPREFIX "rpm -q --specfile ${WORKINGHOME}/RPM/SPECS/$PACKAGE.spec --specedit > ${WORKINGHOME}/RPM/SPECS/$PACKAGE.spec.tmp 2>/dev/null"
|
|
||||||
if [ -e $SPECFILE.tmp ]; then
|
|
||||||
BUILDDIR=`grep -m1 "^%setup.*-n " $SPECFILE.tmp | sed "s|.*-n \([^[:space:]]*\).*|\1|"`
|
|
||||||
rm -f $SPECFILE.tmp
|
rm -f $SPECFILE.tmp
|
||||||
fi
|
$SUCMDPREFIX "rpm -q --specfile ${WORKINGHOME}/RPM/SPECS/$PACKAGE.spec --specedit > ${WORKINGHOME}/RPM/SPECS/$PACKAGE.spec.tmp 2>/dev/null"
|
||||||
SPECVERSION=`grep -m1 "^Version:" ${SPECFILE} | sed "s|Version:[[:space:]]*||"`
|
if [ -e $SPECFILE.tmp ]; then
|
||||||
BUILDROOT=$PACKAGE-root
|
BUILDDIR=`grep -m1 "^%setup.*-n " $SPECFILE.tmp | sed "s|.*-n \([^[:space:]]*\).*|\1|"`
|
||||||
|
rm -f $SPECFILE.tmp
|
||||||
|
fi
|
||||||
|
SPECVERSION=`grep -m1 "^Version:" ${SPECFILE} | sed "s|Version:[[:space:]]*||"`
|
||||||
|
BUILDROOT=$PACKAGE-root
|
||||||
#`grep ^BuildRoot: ${_tmpfile} | sed "s|BuildRoot:[[:space:]]*||"`
|
#`grep ^BuildRoot: ${_tmpfile} | sed "s|BuildRoot:[[:space:]]*||"`
|
||||||
# SPECSETUP=`grep %setup ${_tmpfile} | sed "s|.*-n ||"`
|
# SPECSETUP=`grep %setup ${_tmpfile} | sed "s|.*-n ||"`
|
||||||
[ "$BUILDDIR" ] || BUILDDIR=$PACKAGE-$SPECVERSION
|
[ "$BUILDDIR" ] || BUILDDIR=$PACKAGE-$SPECVERSION
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
RPMBUILDDIR=${WORKINGHOME}/RPM/BUILD
|
RPMBUILDDIR=${WORKINGHOME}/RPM/BUILD
|
||||||
COMMAND=`echo $COMMAND | sed "s|@BUILDDIR@|$BUILDDIR|g"`
|
COMMAND=`echo $COMMAND | sed "s|@BUILDDIR@|$BUILDDIR|g"`
|
||||||
@ -62,19 +81,37 @@ cmdtmpfile=`mktemp`
|
|||||||
chgrp nobody $cmdtmpfile
|
chgrp nobody $cmdtmpfile
|
||||||
chmod 640 $cmdtmpfile
|
chmod 640 $cmdtmpfile
|
||||||
|
|
||||||
rettmpfile=`$SUCMDPREFIX mktemp`
|
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 "Started background command: $COMMAND"
|
||||||
|
RET=0
|
||||||
|
else
|
||||||
|
echo "$$ $ENVUSER $ENVIRONMENT $cmdtmpfile 256 $COMMAND" >> $WEBBUILD_STATEDIR/processes
|
||||||
|
rettmpfile=`$SUCMDPREFIX mktemp`
|
||||||
|
if [ "$WORKINGHOME" ]; then
|
||||||
|
$SUCMDPREFIX ". /etc/profile;cd $WORKINGHOME/RPM/SPECS;$COMMAND;echo \$? > $rettmpfile" 2>&1 | sed "s|<|\<|g" | tr -d '\f' | tee $cmdtmpfile
|
||||||
|
else
|
||||||
|
$SUCMDPREFIX "$COMMAND;echo \$? > $rettmpfile" 2>&1 | sed "s|<|\<|g" | tr -d '\f' | tee $cmdtmpfile
|
||||||
|
fi
|
||||||
|
RET=`cat $ENVPREFIX/$rettmpfile`
|
||||||
|
[ "$RET" ] || RET=255
|
||||||
|
$SUCMDPREFIX "rm -f $rettmpfile"
|
||||||
|
sed -i "/^$$ $ENVUSER/d" $WEBBUILD_STATEDIR/processes
|
||||||
|
if [ "$MODE" != "keeplog" ]; then
|
||||||
|
rm -f $cmdtmpfile
|
||||||
|
else
|
||||||
|
echo "$$ $ENVUSER $ENVIRONMENT $cmdtmpfile $RET $COMMAND" >> $WEBBUILD_STATEDIR/processes
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
echo "$$ $ENVUSER $ENVIRONMENT $cmdtmpfile $COMMAND" >> $WEBBUILD_STATEDIR/processes
|
if [ "$ENVIRONMENT" != "local" ]; then
|
||||||
|
if [ "$TMPFILE" -a "${AUTOPORT_CHROOT[$ENVIRONMENT]}" ]; then
|
||||||
$SUCMDPREFIX ". /etc/profile;cd $WORKINGHOME/RPM/SPECS;$COMMAND;echo \$? > $rettmpfile" 2>&1 | sed "s|<|\<|g" | tr -d '\f' | tee $cmdtmpfile
|
rm -f /var/autoport/${AUTOPORT_CHROOT[$ENVIRONMENT]}/$TMPFILE
|
||||||
RET=`cat $rettmpfile`
|
fi
|
||||||
$SUCMDPREFIX "rm -f $rettmpfile"
|
|
||||||
|
|
||||||
#echo "Command: $SUCMDPREFIX \"cd $WORKINGHOME/RPM/SPECS;$COMMAND\";RET=$RET" >&2
|
|
||||||
sed -i "/^$$ $ENVUSER/d" $WEBBUILD_STATEDIR/processes
|
|
||||||
rm -f $cmdtmpfile
|
|
||||||
|
|
||||||
if [ "$TMPFILE" -a "${AUTOPORT_CHROOT[$ENVIRONMENT]}" ]; then
|
|
||||||
rm -f /var/autoport/${AUTOPORT_CHROOT[$ENVIRONMENT]}/$TMPFILE
|
|
||||||
fi
|
fi
|
||||||
exit $RET
|
exit $RET
|
||||||
|
Loading…
Reference in New Issue
Block a user