#DEFAULT=SL #DEFAULT_DIR=../.. #DEBUGINFO_DIR=../../../archive/debuginfo/ #OBSOLETE_DIR=$OBSOLETE_DIR #SRPMS_DIR=../../../SRPMS/vendor/ if [ -s locations.include ] ; then . locations.include else echo "Need locations.include to continue" exit 1 fi echo `date` >> errata.log echo `date` >> new.log if [ -d $DEBUGINFO_DIR ] ; then mv *debuginfo*.rpm $DEBUGINFO_DIR else echo "$DEBUGINFO_DIR does not exist so not moving debuginfo" fi if [ -d $SRPMS_DIR ] ; then /bin/mv -f *src.rpm $SRPMS_DIR else echo "$SRPMS_DIR does not exist so not moving debuginfo" fi for i in *.rpm do if [ -f $DEFAULT_DIR/$DEFAULT/$i ] ; then echo "Already have $i in $DEFAULT, so deleting it." rm $i continue fi if [ -d $DEFAULT_DIR/$SITERPMS/ ] ; then if [ -f $DEFAULT_DIR/$SITERPMS/$i ] ; then echo "Already have $i in $SITERPMS, so deleting it." rm $i continue fi fi if [ -f $OBSOLETE_DIR/$i ] ; then echo "Already have $i in obsolete, so deleting it." rm $i continue fi NEWNAME=`rpm -qp $i --qf "%{name}"` NEWARCH=`rpm -qp $i --qf "%{arch}"` NEWRPMVERSION=`rpm -qp --queryformat "%{epoch}:%{version}-%{release}" $i ` #echo "Looking for Name: $NEWNAME Arch: $NEWARCH" OLDRPM="" if [ ! -d $DEFAULT_DIR/$SITERPMS ] ; then echo "$DEFAULT_DIR/$SITERPMS does not exist, exiting" exit 1 fi cd $DEFAULT_DIR/$SITERPMS/ > /dev/null LIST=`ls -1 ${NEWNAME}* 2> /dev/null` for line in $LIST do OLDNAME=`rpm -qp $line --qf "%{name}"` if [ "${OLDNAME}" == "${NEWNAME}" ] ; then OLDARCH=`rpm -qp $line --qf "%{arch}"` if [ "${OLDARCH}" == "${NEWARCH}" ] ; then OLDRPM="$line" OLDRPMVERSION=`rpm -qp --queryformat "%{epoch}:%{version}-%{release}" $OLDRPM ` #echo "Found a match: $line" fi fi done cd - > /dev/null if [ "$OLDRPM" == "" ] ; then echo "" echo "new: $i" echo "I could not find a match for this. Should I just move it in?" echo "Enter skip if I should skip this one" read new if [ -n "$new" ] ; then if [ $new = "skip" ] ; then new="" echo "... Skipping" fi else echo "Moving it in" mv -v $i $DEFAULT_DIR/$SITERPMS/ echo -e "\t$i" >> new.log fi else echo "" NEWERISNEWER=0 echo "old: $OLDRPM" echo "new: $i" RESULT=`./rpmdev-vercmp $OLDRPMVERSION $NEWRPMVERSION` EXITCODE=$? if [ $EXITCODE -eq 12 ] ; then # right side was newer echo "I think that the NEW rpm is newer , should I go ahead?" NEWERISNEWER=1 else if [ $EXITCODE -eq 11 ] ; then # left side was newer echo "I think that the OLD rpm is newer , should I leave it?" NEWERISNEWER=0 else echo "I do not know which version is newer" echo "RPM Comparision is $RESULT" break fi fi echo "Enter skip if I should skip this one" read new if [ -n "$new" ] ; then if [ $new = "skip" ] ; then new="" echo "... Skipping" fi else if [ $NEWERISNEWER -eq 1 ] ; then echo "Replacing old with new" mv -v $DEFAULT_DIR/$SITERPMS/$OLDRPM $OBSOLETE_DIR mv -v $i $DEFAULT_DIR/$SITERPMS/ echo -e "\t$i" >> errata.log else echo "Leaving old" fi fi fi done