webbuild: improve patch management and minor bash code changes
This commit is contained in:
parent
74876ce852
commit
56923432c9
@ -208,9 +208,9 @@ if [ "$REQUEST" = "refresh" -o ! "$USER" ]; then
|
||||
count=0
|
||||
if [ ! "$FROMID" -o "$FROMID" = "0" -o "$FROMID" = "NaN" ]; then
|
||||
if [ "$USER" ]; then
|
||||
line=`tac $WEBBUILD_STATEDIR/social_log 2>/dev/null | grep -v " SUSER=$USER " 2>/dev/null | head -n 25 | tail -n 1`
|
||||
line=`tail -n 500 $WEBBUILD_STATEDIR/social_log | grep -v " SUSER=$USER " 2>/dev/null | tail -n 25 | head -n 1`
|
||||
else
|
||||
line=`tac $WEBBUILD_STATEDIR/social_log 2>/dev/null | grep -v " STARGET=developers " 2>/dev/null | head -n 25 | tail -n 1`
|
||||
line=`tail -n 500 $WEBBUILD_STATEDIR/social_log | grep -v " STARGET=developers " 2>/dev/null | tail -n 25 | head -n 1`
|
||||
fi
|
||||
eval $line
|
||||
FROMID=$SID
|
||||
@ -240,7 +240,7 @@ if [ "$REQUEST" = "refresh" -o ! "$USER" ]; then
|
||||
fi
|
||||
echo -n "<div style=\"position:relative;margin-left:24px;height:auto;padding:0;\"><b>$SUSER</b> $STEXT <i><span name=socialtime time=$STIME></span></i></div>"
|
||||
echo -n "</div><div style=\"clear:both;\"><hr></div>]]></add>"
|
||||
count=`expr $count + 1`
|
||||
count=$(($count + 1))
|
||||
done
|
||||
echo -n "</socialbox>"
|
||||
fi
|
||||
@ -353,7 +353,7 @@ if [ "$REQUEST" = "refresh" -o "$REQUEST" = "refreshjobs" ]; then
|
||||
set -- $line
|
||||
RETCODE=$6
|
||||
# if [ -e /proc/$1 -o $5 -lt 256 ]; then
|
||||
numprocess=`expr $numprocess + 1`
|
||||
numprocess=$(($numprocess + 1))
|
||||
cmdline=`echo $line | sed "s|$1 $2 $3 $4 $5 $RETCODE ||"`
|
||||
cmdline=`echo $cmdline | sed "s| --colors web||"`
|
||||
PACKAGE_ENCODED=`cgi_encodevar $4`
|
||||
@ -1319,6 +1319,7 @@ if [ "$MAINTAINERMODE" != "true" ]; then
|
||||
echo -n "<hr><b>Add patches:</b>"
|
||||
echo -n "<input type=button id=addpatchbutton value=\"submit\" onclick=ajax_getvalues(\""
|
||||
echo -n "REQUEST=addpatch&ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
|
||||
echo -n "SPECTEXT=\"+encodeURIComponent(editor.getValue())+\"&"
|
||||
echo -n "ADDPATCHURL=\"+encodeURIComponent(getElementById('addpatchurl').value)+\"&"
|
||||
echo -n "ADDPATCHNAME=\"+encodeURIComponent(getElementById('addpatchname').value));>"
|
||||
echo -n " <a href=\"http://pastebin.com\" target=_new>pastebin</a><br>"
|
||||
@ -1344,11 +1345,12 @@ if [ "$MAINTAINERMODE" != "true" ]; then
|
||||
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&REQUEST=showpatchfile&"
|
||||
echo -n "PATCHFILE=\"+getSelectedValueById('patchfile'));>"
|
||||
echo -n "<option value=\"\">-- select a patch to display --</option>"
|
||||
for f in ${SPECVAR_Patch[*]}; do
|
||||
for i in `seq 1 ${#SPECVAR_Patch[*]}`; do
|
||||
f=${SPECVAR_Patch[$i-1]}
|
||||
patchname=${f/*\/}
|
||||
patchname=${patchname/.patch}
|
||||
patchname=${patchname/$PACKAGE-}
|
||||
echo -n "<option value=\"$f\">$patchname</option>"
|
||||
echo -n "<option value=\"$f\">${SPECVAR_Patch_idx[$i-1]}: $patchname</option>"
|
||||
done
|
||||
echo -n "</select>"
|
||||
# list build dir files
|
||||
@ -1617,9 +1619,13 @@ case $REQUEST in
|
||||
RET=$?
|
||||
[ $RET -eq 0 ] && {
|
||||
echo -n "Patch added with name <b>$PACKAGE-${SPECVAR_Version}-$ADDPATCHNAME.patch</b>."
|
||||
echo -n "<br><br><font color=gold>HINT: add the following lines to the .spec file in the appropriate sections (fix indexes if needed):</font><br>"
|
||||
NEWPATCHNUM=`expr ${#SPECVAR_Patch[*]} + 1`
|
||||
echo -ne "<br><pre>Patch$NEWPATCHNUM: $PACKAGE-${SPECVAR_Version}-$ADDPATCHNAME.patch\n\n%patch$NEWPATCHNUM -p1</pre>"
|
||||
echo -n "<br><br><font color=gold>HINT: add the following lines in the appropriate sections:</font><br><br>"
|
||||
echo -n "<font color=gold>1) in the header after Source[0-9]: and Patch[0-9]: lines:</font><br>"
|
||||
NEWPATCHNUM=$((${SPECVAR_Patch_idx[${#SPECVAR_Patch_idx[@]}-1]}+1))
|
||||
echo "<br>${SPECVAR_Version}: ${SPECVAR_Patch_idx[*]} : ${SPECVAR_Patch[*]}<br>"
|
||||
echo -ne "<br><pre>Patch$NEWPATCHNUM: $PACKAGE-${SPECVAR_Version}-$ADDPATCHNAME.patch</pre>"
|
||||
echo -n "<font color=gold>2) in %prep section after %setup:</font><br>"
|
||||
echo -ne "<br><pre>%patch$NEWPATCHNUM -p1</pre>"
|
||||
RET=-1
|
||||
}
|
||||
else
|
||||
|
@ -33,7 +33,7 @@ function social_log() {
|
||||
if [ ! "$STATE_FAKEUSER" ]; then
|
||||
STATE_SOCIALLOG_ID=0
|
||||
. $WEBBUILD_STATEDIR/users/webbuild.state
|
||||
STATE_SOCIALLOG_ID=`expr $STATE_SOCIALLOG_ID + 1`
|
||||
STATE_SOCIALLOG_ID=$(($STATE_SOCIALLOG_ID + 1))
|
||||
set_user_state_var STATE_SOCIALLOG_ID $STATE_SOCIALLOG_ID webbuild
|
||||
echo "SID=$STATE_SOCIALLOG_ID SPRIVACY=$STATE_PRIVACYMODE $line" >> $WEBBUILD_STATEDIR/social_log
|
||||
fi
|
||||
|
@ -94,10 +94,12 @@ if [ "$MODE" = "specinfo" ]; then
|
||||
[ "$1" = "%package" -o "$1" = "%description" ] && break
|
||||
if [[ "$1" =~ ^[a-zA-Z]*[0-9]*:.* ]]; then
|
||||
line="$(echo ${line/$1})"
|
||||
specvar="SPECVAR_${1/:*}"
|
||||
specvar="${specvar/[0-9]*}"
|
||||
[ "$specvar" = "$lastspecvar" ] && varidx=`expr $varidx + 1` || varidx=0
|
||||
specvarfull="SPECVAR_${1/:*}"
|
||||
specvar="${specvarfull/[0-9]*}"
|
||||
specvaridx="${specvarfull/$specvar}"
|
||||
[ "$specvar" = "$lastspecvar" ] && varidx=$(($varidx + 1)) || varidx=0
|
||||
echo "$specvar[$varidx]=\"${line//\"/}\""
|
||||
[ "$specvaridx" != "" ] && echo "${specvar}_idx[$varidx]=$specvaridx"
|
||||
[ "$specvar" = "SPECVAR_Version" -a ! "$BUILDDIR" ] && BUILDDIR="$PACKAGE-${line}"
|
||||
fi
|
||||
lastspecvar=$specvar
|
||||
|
Loading…
Reference in New Issue
Block a user