#!/bin/bash # $HeadURL$ $LastChangedRevision$ PROGNAME=`basename $0` SANDPIT=`pwd` . $(ade-config ade_share_prefix)/include/adetestsupport.sh ############################################################################## # # Purpose of test: to verify it is not possible to configure access to a repo # whose pkgtype/release/section don't match. # # 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. 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" # return the passed command's return code, not sed's. return ${PIPESTATUS[0]} } launch_shell() { PS1="$PROGNAME> " bash --norc || true } # Start of support functions # End of support functions # Set variables used in this test export PAA_STATE_PREFIX=$SANDPIT/var # Set up editor mkdir -p $SANDPIT/{bin,repos,mirrors,freezes,indirects} echo -e '#!/bin/sh\n\ncat > $1' > $SANDPIT/bin/caton chmod 755 $SANDPIT/bin/caton export EDITOR=$SANDPIT/bin/caton # 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 UNAMEN=$(uname -n) # Put something in the repo so that the other ops all work. mkdir $SANDPIT/repos/debrepo ls > $SANDPIT/repos/debrepo/dummy-content # Okay, get started for PKGTYPE in deb rpm; do for ISDISTRO in true false; do for DISTRO in debian notdebian; do for RELEASE in lenny notlenny; do for ARCH in i386 noti386; do echo "$PROGNAME: initialising ($PKGTYPE, $ISDISTRO, $DISTRO, $RELEASE, $ARCH) ..." rm -fr $PAA_RCDIR paa host $UNAMEN deb debian lenny i386 echo "$PROGNAME: configuring repo ..." paa repo debrepo $PKGTYPE owned $ISDISTRO { echo "release $RELEASE" echo "port $RELEASE i386" if [ $PKGTYPE = deb ]; then echo "section $RELEASE main" else echo "layout $RELEASE not/used" fi echo "path $SANDPIT/repos/debrepo" echo "url http://something.not.used" echo "origin \"Joe Bloggs\"" echo "label \"Joe Bloggs\"" echo "signer jbloggs" echo "mirror_dir $SANDPIT/mirrors/debrepo" echo "freeze_dir $SANDPIT/freezes/debrepo" echo "indirect_dir $SANDPIT/indirects/debrepo" if $ISDISTRO; then echo "distro $DISTRO" else echo "compat $RELEASE $PKGTYPE $DISTRO $RELEASE" fi } > xxx.repo paa editrepo debrepo < xxx.repo rm -f xxx.repo # Client-side operation echo "$PROGNAME: trying to access repo for host ..." paa access debrepo || true filter_variant_text "paa listaccesses" # Server-side operation echo "$PROGNAME: trying to indirect repo for host ..." paa mirror debrepo paa freeze debrepo paa indirect debrepo $UNAMEN NEWEST-FREEZE || true filter_variant_text "paa listindirects" echo done done done done done echo "all done"