#!/bin/bash # $HeadURL$ $LastChangedRevision$ PROGNAME=`basename $0` SANDPIT=`pwd` . $(ade-config ade_share_prefix)/include/adetestsupport.sh ############################################################################## # # Purpose of test: to verify basic paa functions # # Bug id: # ############################################################################## # Ensure dates are consistently formatted export LC_ALL=C # Start of support functions filter_variant_text() { # Note how the variable *width* of a hostname - and therefore of the padding # that follows it in column-aligned output - means that we can't change # just to VARIANT-HOSTNAME but *with* padding to # VARIANT-HOSTNAME with fixed width padding. Another padding issues comes # from that summer and winter timezones have different widths and therefore # different paddings. Although the timezone is devarianted the spacing is # not. This only seems to be a problem on the end of the line because dates # are always in the last column. eval "$@" | sed -e 's/[A-Z][a-z][a-z] [A-Z][a-z][a-z] [1-3 ][0-9] [0-2][0-9]:[0-5][0-9]:[0-5][0-9] [A-Z][A-Z]* [1-2][0-9][0-9][0-9] *$/Fri Dec 31 23:59:59 GMT 1999/g' \ -e 's/^\(pub\)\( *\)\([^ ]*\)\( *\)\([^ ]*\)$/\1\2VARIANT-KEY-ID\4VARIANT-DATE/' \ -e "s@$SANDPIT@VARIANT-SANDPIT@g" \ -e "s/$UNAMEN */VARIANT-HOSTNAME /g" \ -e "s/$UNAMEN\([^ \t]\)/VARIANT-HOSTNAME\1/g" \ -e "s/20[1-9][0-9][0-1][0-9][0-3][0-9][0-2][0-9][0-5][0-9][0-5][0-9]/VARIANT-TIMESTAMP/g" \ -e "s/ *\$//" # return the passed command's return code, not sed's. return ${PIPESTATUS[0]} } launch_shell() { PS1="$PROGNAME> " bash --norc || true } echo "$PROGNAME: configuring environment ..." # Ensure DB is created in sandpit export PAA_RCDIR=$SANDPIT/.paa # Ensure effects on OS (modiying the *OS*'s idea of repos, restarting apache, etc) are not real export PAA_ROOTDIR=$SANDPIT # Force use of non-interactive editor export EDITOR=$SANDPIT/bin/caton # Use a test-specific gpg configuration export GNUPGHOME=$SANDPIT/.gpupg # Don't use any running gpg-agent unset GPG_AGENT_INFO # Don't put the apache config files in $MODROOT/var 'cos they'll contaminate it. export PAA_STATE_PREFIX=$SANDPIT/var # Misc UNAMEN=$(uname -n) echo "$PROGNAME: creating non-interactive editor ..." mkdir -p $SANDPIT/{bin,etc/init.d} echo -e '#!/bin/sh\n\ncat > $1' > $SANDPIT/bin/caton chmod 755 $SANDPIT/bin/caton echo "$PROGNAME: generating a gpg key ..." # Generate a key without a password and without communicating with my agent mkdir $GNUPGHOME chmod 700 $GNUPGHOME # Use a pre-generated key, it means we don't depend on rngtools at buildtime. cp $ADETEST_MODROOT/tests/in/*.gpg $GNUPGHOME chmod 644 $GNUPGHOME/*.gpg # Repos echo "$PROGNAME: creating a repo ..." paa -v repo mirrored-deb-repo deb mirrored true echo "$PROGNAME: configuring repo properly ..." paa -v editrepo mirrored-deb-repo <./" mirror_dir "$SANDPIT/mirrors/" freeze_dir "$SANDPIT/freezes/." indirect_dir "$SANDPIT/indirects/." mirror_cmd "touch \\\$(ls | wc -l)" EOF COUNT=2 for U in $(seq 1 $COUNT); do echo "$PROGNAME: setting up $COUNT freeze(s) (with intention of unfreezing freeze #$U) ..." for X in $(seq 1 $COUNT); do paa mirror ALL-REPOS paa freeze ALL-REPOS sleep 2 done echo "$PROGNAME: unfreezing freeze #$U ..." REPO_FREEZE=$(paa listfreezes | sed -e '1,2d' -e '$d' -e 's/available.*//' | sed -n -e "${U}p") paa unfreeze $REPO_FREEZE echo "$PROGNAME: cleaning up ..." if [ $COUNT != 1 ]; then paa --force unfreeze ALL-REPOS ALL-FREEZES fi paa --force unmirror ALL-REPOS done