Changeset 14472 for trunk/base


Ignore:
Timestamp:
Oct 8, 2005, 5:40:18 AM (19 years ago)
Author:
pguyot (Paul Guyot)
Message:

Update of the script (as it is on my opendarwin ~).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/base/src/portmgr/IndexRegen.sh

    r14470 r14472  
    11#!/bin/bash
    2 
    32
    43####
     
    109####
    1110
    12 
    1311# Configuration
    1412# ROOT directory, where everything is. This must exist.
     
    1917DP_USER=paul
    2018# DP group.
    21 DP_GROUP=paul
     19DP_GROUP=admin
    2220# CVS user.
    2321CVS_USER=pguyot
    2422# e-mail address to spam in case of failure.
    25 SPAM_LOVERS=pguyot@kallisys.net
     23SPAM_LOVERS=portmgr@opendarwin.org
    2624
    2725# Other settings (probably don't need to be changed).
     
    6462        echo "/usr/bin/ssh -i ${SSH_KEY} \$*" >> $SSH_WRAPPER 1 && \
    6563        chmod +x $SSH_WRAPPER \
    66                 || (echo "Creation of wrapper failed" ; exit 1)
     64                || { echo "Creation of wrapper failed" ; exit 1 ; }
    6765fi
    6866
     
    7270        cd ${TREE} && \
    7371        CVS_RSH=${SSH_WRAPPER} cvs -q -d $CVS_ROOT co darwinports > $FAILURE_LOG 2>&1 \
    74                 || (echo "CVS checkout failed" >> $FAILURE_LOG ; FAILED=1)
     72                || { echo "CVS checkout failed" >> $FAILURE_LOG ; FAILED=1 ; }
    7573else
    7674        cd ${TREE}/${CVS_MODULE} && \
    7775        CVS_RSH=${SSH_WRAPPER} cvs -q update -dP > $FAILURE_LOG 2>&1 \
    78                 || (echo "CVS update failed" >> $FAILURE_LOG ; FAILED=1)
     76                || { echo "CVS update failed" >> $FAILURE_LOG ; FAILED=1 ; }
    7977fi
    8078
    8179# (re)configure.
    82 if [ ${FAILED} -eq 0 ]; then
     80if [ $FAILED -eq 0 ]; then
    8381        cd ${TREE}/${CVS_MODULE}/base/ && \
    8482        mkdir -p ${TCLPKG} && \
     
    8886                --with-install-user=${DP_USER} \
    8987                --with-install-group=${DP_GROUP} > $FAILURE_LOG 2>&1 \
    90                 || (echo "./configure failed" >> $FAILURE_LOG ; FAILED=1)
     88                || { echo "./configure failed" >> $FAILURE_LOG ; FAILED=1 ; }
    9189fi
    9290
    93 # (re)build and (re)install
    94 if [ ${FAILED} -eq 0 ]; then
    95         cd ${TREE}/${CVS_MODULE}/base/ && \
    96         (make && make install) > $FAILURE_LOG 2>&1 \
    97                 || (echo "make && make install failed" >> $FAILURE_LOG ; FAILED=1)
     91# (re)build
     92if [ $FAILED -eq 0 ]; then
     93        { cd ${TREE}/${CVS_MODULE}/base/ && \
     94        make > $FAILURE_LOG 2>&1 ; } \
     95                || { echo "make failed" >> $FAILURE_LOG ; FAILED=1 ; }
    9896fi
    9997
    100 # re-index
    101 if [ ${FAILED} -eq 0 ]; then
    102         cd ${TREE}/${CVS_MODULE}/dports/ && \
    103         ${PREFIX}/bin/portindex | tee ${PORTINDEX_LOG} | \
    104                 grep -A2 Failed > ${COMMIT_MSG} \
    105                 || (cat ${PORTINDEX_LOG} > $FAILURE_LOG; \
    106                         echo "portindex failed" >> $FAILURE_LOG; FAILED=1)
     98# (re)install
     99if [ $FAILED -eq 0 ]; then
     100        { cd ${TREE}/${CVS_MODULE}/base/ && \
     101        make install > $FAILURE_LOG 2>&1 ; } \
     102                || { echo "make install failed" >> $FAILURE_LOG ; FAILED=1 ; }
    107103fi
    108104
    109 # commit the file.
    110 # (COMMIT_MSG contains the list of ports that failed (from grep -A2 Failed))
    111 if [ ${FAILED} -eq 0 ]; then
    112         # Append the last 5 lines of the log.
    113         tail -n 5 ${PORTINDEX_LOG} >> ${COMMIT_MSG}
     105# (re)index
     106if [ $FAILED -eq 0 ]; then
     107        { cd ${TREE}/${CVS_MODULE}/dports/ && \
     108        ${PREFIX}/bin/portindex | tee $PORTINDEX_LOG > $FAILURE_LOG 2>&1 ; } \
     109                || { echo "portindex failed" >> $FAILURE_LOG ; FAILED=1 ; }
     110fi
     111
     112# check all ports were indexed.
     113if [ $FAILED -eq 0 ]; then
     114        grep Failed $FAILURE_LOG \
     115                && { echo "some ports couldn\'t be indexed" >> $FAILURE_LOG ; FAILED=1 ; }
     116fi
     117
     118# commit the file if and only if all ports were successfully indexed.
     119if [ $FAILED -eq 0 ]; then
     120        # Use the last 5 lines of the log for the commit message.
     121        tail -n 5 $PORTINDEX_LOG > $COMMIT_MSG
    114122       
    115         # Commit the file.
    116         cd ${TREE}/${CVS_MODULE}/dports/ && \
    117         cvs commit PortIndex -F ${COMMIT_MSG} > $FAILURE_LOG 2>&1 \
    118                 || (echo "cvs commit failed" >> $FAILURE_LOG ; FAILED=1)
     123        # Actually commit the file.
     124        { cd ${TREE}/${CVS_MODULE}/dports/ && \
     125        cvs commit -F $COMMIT_MSG PortIndex > $FAILURE_LOG 2>&1 ; } \
     126                || { echo "cvs commit failed" >> $FAILURE_LOG ; FAILED=1 ; }
    119127fi
    120128
    121129# spam if something went wrong.
    122 if [ ${FAILED} -eq 1 ]; then
    123 #       mail -s "AutoIndex Failure on ${DATE}" ${SPAM_LOVERS} < $FAILURE_LOG
    124         cat $FAILURE_LOG
     130if [ $FAILED -ne 0 ]; then
     131        mail -s "AutoIndex Failure on ${DATE}" $SPAM_LOVERS < $FAILURE_LOG
     132else
     133        # trash log files
     134        rm -f $PORTINDEX_LOG $COMMIT_MSG $FAILURE_LOG
    125135fi
    126136
    127 # trash log files
    128 rm -f ${PORTINDEX_LOG} ${COMMIT_MSG} $FAILURE_LOG
Note: See TracChangeset for help on using the changeset viewer.