DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Mercurial (b66b287a2650)

VCS Links

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336
#! /bin/sh 
########################################################################
#
# /u/sonmi/bin/qa_stage - /u/svbld/bin/init/nss/qa_stage
#
# this script is supposed to convert the tinderbox and daily QA files
# for use on mozilla.org
#
# parameters
# ----------
#   nssversion  (supported: 30b, 31, tip)
#   builddate   (default - today)
#
########################################################################

if [ -z "$BUILDNUMBER" ]
then
    BUILDNUMBER=1
fi
if [ `uname` = "Linux" ] ; then
    PATH=".:/u/sonmi/bin:/u/sonmi/bin/linux:/usr/bsd:/usr/ucb/:/bin:/usr/bin:/usr/ccs/bin:/usr/sbin:/usr/bin/X11:/usr/etc:/etc:/usr/demos:/usr/demos/bin:/usr/local/bin:/usr/local/X11/bin:/tools/ns/bin"
    export PATH
fi

Echo()
{
    if [ "$O_SILENT" = "OFF" ] ; then
        echo $*
    fi
}

################################### qa_stage_init ##########################
# 
########################################################################
qa_stage_init()
{
    umask 000

    eval_opts $*

    if [ -z "${QAYEAR}" ] ; then 
        QAYEAR=`date +%Y`
    elif [ "$QAYEAR" = ""  ] ; then
        QAYEAR=`date +%Y`
    fi

    Echo "Init..."
    DAYBUILD=${QAYEAR}${BUILDDATE}.${BUILDNUMBER}
    NSS_D0=/share/builds/mccrel3/nss
    NSS_VER_DIR=${NSS_D0}/nss${NSSVER}
    NTDIST=${NSS_VER_DIR}/builds/${DAYBUILD}/blowfish_NT4.0_Win95/mozilla/dist
    UXDIST=${NSS_VER_DIR}/builds/${DAYBUILD}/booboo_Solaris8/mozilla/dist
    TESTSCRIPTDIR=${NSS_VER_DIR}/builds/${DAYBUILD}/booboo_Solaris8/mozilla/security/nss/tests
    RESULTDIR=${NSS_VER_DIR}/builds/${DAYBUILD}/booboo_Solaris8/mozilla/tests_results/security
    TBX_RESULTDIR=${NSS_D0}/nsstip/tinderbox/tests_results/security

    MOZ_D0=/pub/security/nss
    MOZ_RESULTDIR=${MOZ_D0}/daily_qa/${DAYBUILD}
    MOZ_TBX_RESULTDIR=${MOZ_D0}/tinderbox
    
    export BUILDDATE NSSVER QAYEAR NTDIST UXDIST TESTSCRIPTDIR RESULTDIR 


    IPLANET_TBX_URL="http://cindercone.red.iplanet.com${TBX_RESULTDIR}"
    IPLANET_DQA_URL="http://cindercone.red.iplanet.com${RESULTDIR}"

    MOZ_TBX_URL="ftp://ftp.mozilla.org${MOZ_TBX_RESULTDIR}"
    MOZ_DQA_URL="ftp://ftp.mozilla.org${MOZ_RESULTDIR}"

    export IPLANET_TBX_URL IPLANET_DQA_URL MOZ_TBX_URL MOZ_DQA_URL
    STAGE_1=/u/sonmi/tmp/ftp_stage
    
    if [ ! -d  $STAGE_1 ] ; then
        Echo "Staging area daily QA (DQA): $DQA_STAGE does not exist, exit"
        exit 1
    fi
    cd $STAGE_1 || (Echo "Cant cd to $STAGE_1 , exit"; exit)
    rm all.tar* 2>/dev/null
    TBX_STAGE=$STAGE_1/tinderbox
    DQA_STAGE=$STAGE_1/daily_qa/${DAYBUILD}
    Echo "Staging area tbx: $TBX_STAGE"
    Echo "Staging area daily QA (DQA): $DQA_STAGE"
    Echo "Resultdir (sourcedir) for daily QA (RESULTDIR): $RESULTDIR"
}

################################### qa_stage_dqa ##########################
# 
########################################################################
qa_stage_dqa()
{
    Echo "DQA:..."
    Echo "Resultdir (sourcedir) for daily QA (RESULTDIR): $RESULTDIR"
#set -x
    if [ ! -d  $RESULTDIR ] ; then
        Echo "Resultdir $RESULTDIR does not exist, can't push daily QA"
        return
    fi
    cd $RESULTDIR || return
    #for w in `find . -name "result*html"`
    for w in `find . -name "result.html"`
    do
        if [ ! -d $DQA_STAGE/`dirname $w` ] ; then
            mkdir -p $DQA_STAGE/`dirname $w`
        fi
        rm $DQA_STAGE/$w 2>/dev/null
        cat $w | reformat_qa >$DQA_STAGE/$w
    done
    for w in `find . -name "output.log" -o  -name "results.html"`
    do
#echo $w
        if [ ! -d $DQA_STAGE/`dirname $w` ] ; then
            mkdir -p $DQA_STAGE/`dirname $w`
        fi
        cp $w $DQA_STAGE/$w
    done
}


################################### qa_stage_tbx ##########################
# 
########################################################################
qa_stage_tbx()
{
    Echo "tbx: "
    if [ ! -d  $TBX_RESULTDIR ] ; then
        Echo "TBX_RESULTDIR $TBX_RESULTDIR does not exist"
        return
    fi
    cd $TBX_RESULTDIR || return
    Echo "find from $TBX_FIND_FROM"
    for w in `find $TBX_FIND_FROM  -name "result.html"`
    do
        if [ ! -d "$TBX_STAGE/`dirname $w`" ] ; then
            mkdir -p $TBX_STAGE/`dirname $w`
        fi
        rm $TBX_STAGE/$w 2>/dev/null
        cat $w | reformat_qa >$TBX_STAGE/$w
    done
    for w in `find $TBX_FIND_FROM -name "output.log" -o  -name "results.html"`
    do
        if [ ! -d $TBX_STAGE/`dirname $w` ] ; then
            mkdir -p $TBX_STAGE/`dirname $w`
        fi
        cp $w $TBX_STAGE/$w
    done
}

match_tbxdirs()
{
    YY=`date +%Y`
    DD=`date +%d`
    MM=`date +%m`
    HH=`date +%H`

    TBX_FIND_FROM="*-$YY$MM$DD-$HH.*"
    i=$1
    while [ $i -gt 0 ] ; do
        i=`expr $i - 1`
        HH=`expr $HH - 1`
        if [ $HH -lt 0 ] ; then
            HH=23
            DD=`expr $DD - 1`
            if [ $DD  -eq 0 ] ; then
                MM=`expr $MM - 1`
                case $MM in
                    0)
                        YY=`expr $YY - 1`
                        MM=12
                        DD=31
                        ;;
                    [13578]|10|12)
                        DD=31
                        ;;
                    2)
                        DD=28
                        ;;
                    [469]|11)
                        DD=30
                        ;;
                esac
            fi
        fi
        case $MM in
            [123456789])
               MM=0$MM
               ;;
        esac
        case $DD in
            [123456789])
               DD=0$DD
               ;;
        esac
        case $HH in
            [0123456789])
               HH=0$HH
               ;;
        esac
        TBX_FIND_FROM="$TBX_FIND_FROM *-$YY$MM$DD-$HH.*"
    done
}

################################### eval_opts ##########################
# global shell function, evapuates options and parameters, sets flags
# variables and defaults
########################################################################
eval_opts()
{
  DO_TBX=OFF
  DO_DQA=OFF
  DO_CLEAN=OFF
  O_SILENT=OFF
  O_INCREMENTAL=OFF
  O_MAIL=OFF
  BUILDDATE=`date +%m%d`
  NSSVER=tip

  TBX_FIND_FROM="."

  while [ -n "$1" ]
  do
    case $1 in
        -d)
            DO_DQA=ON
            ;;
        -m)
            O_MAIL=ON
            shift
            MAILINGLIST=$1
            if [ -z "$MAILINGLIST" ]
            then
                echo "Error: -m requires a mailinglist to follow, for example sonmi@iplanet.com"
                exit
            fi
            ;;
        -ti)
            DO_TBX=ON
            match_tbxdirs 2
            O_INCREMENTAL=ON
            ;;
        -t)
            DO_TBX=ON
            ;;
        -c)
            DO_CLEAN=ON
            ;;
        -s)
            O_SILENT=ON
            ;;

        tip|3[0-9]*)
            NSSVER=$1
            ;;
        [01][0-9][0-3][0-9])
            BUILDDATE=$1
            ;;
    esac
    shift
  done
}

qa_stage_init $*

if [ "$DO_CLEAN" = "ON" ] ; then
    Echo "Cleaning old stuff"
    if [ ! -d  $STAGE_1 ] ; then
        Echo "Staging area daily QA (DQA): $DQA_STAGE does not exist, exit"
        exit 1
    fi
    cd $STAGE_1 || (Echo "Cant cd to $STAGE_1 , exit"; exit)
    if [ -n "$TBX_STAGE" -a -d "$TBX_STAGE" ] ; then
        rm -rf $TBX_STAGE/*
    else
        Echo "nothing here to clean..."
    fi
fi
if [ "$DO_DQA" = "ON" ] ; then
    qa_stage_dqa 
    if [ "$O_MAIL" = "ON" -a -f "$DQA_STAGE/result.html" ] ; then
         cat $DQA_STAGE/result.html | /usr/sbin/sendmail $MAILINGLIST 
    fi
fi
if [ "$DO_TBX" = "ON" ] ; then
    qa_stage_tbx
fi
if [ ! -d  $STAGE_1 ] ; then
    Echo "Staging area daily QA (DQA): $DQA_STAGE does not exist, exit"
    exit 1
fi
cd $STAGE_1 || (Echo "Cant cd to $STAGE_1 , exit"; exit)
Echo "tar..."
if [ "$O_SILENT" = "ON" ] ; then
    TARPARAM=cf
else
    TARPARAM=cvf
fi


if [ "$DO_DQA" = "ON" -a "$DO_TBX" = "ON" ] ; then
        Echo "tar $TARPARAM all.tar daily_qa        tinderbox"
        tar $TARPARAM all.tar daily_qa        tinderbox
elif [ "$DO_DQA" = "ON" ] ; then
        Echo "tar $TARPARAM all.tar daily_qa"
        tar $TARPARAM all.tar daily_qa
else
        Echo "tar $TARPARAM all.tar tinderbox"
        tar $TARPARAM all.tar tinderbox
fi
gzip all.tar
# ssh-agent > /u/sonmi/.ssh/ssh-agent.info
# setenv like it says in that file
# ssh-add

SSH_AUTH_SOCK=`grep SSH_AUTH_SOCK /u/sonmi/.ssh/ssh-agent.info | sed -e 's/setenv SSH_AUTH_SOCK //' -e 's/;//'`
SSH_AGENT_PID=`grep SSH_AGENT_PID /u/sonmi/.ssh/ssh-agent.info | sed -e 's/setenv SSH_AGENT_PID //' -e 's/;//'`
export SSH_AUTH_SOCK SSH_AGENT_PID
if [ "$O_SILENT" = "OFF" ] ; then
   set -x
   scp all.tar.gz sonmi@stage.mozilla.org:/home/ftp/pub/security/nss
   ssh -l sonmi stage.mozilla.org '/home/sonmi/bin/nssqa_stage '
else
   scp all.tar.gz sonmi@stage.mozilla.org:/home/ftp/pub/security/nss >/dev/null 2>/dev/null 
   ssh -l sonmi stage.mozilla.org '/home/sonmi/bin/nssqa_stage ' >/dev/null 2>/dev/null 
fi

#" rlogin huey "
#" sftp  sonmi@stage.mozilla.org"
#" cd /home/ftp/pub/security/nss"
#" lcd tmp/ftp_stage"
#" put all.tar.gz"
#" quit "
#" ssh -l sonmi stage.mozilla.org"
#" cd /home/ftp/pub/security/nss"
#" gunzip all.tar.gz"
#" tar xvf all.tar"
#" rm all.tar"