-for d in $DISTS; do
- eval NEW_SOURCES_$d=`stat -c "%Y" $base/buildd/$d/Sources.gz`
- eval NEW_PACKAGES_$d=`stat -c "%Y" $base/buildd/$d/Packages.gz`
- old=SOURCES_$d
- new=NEW_$old
- if [ ${!new} -gt ${!old} ]; then
- if [ -z "$dists" ]; then
- dists="$d"
- else
- dists="$dists $d"
- fi
- continue
- fi
- old=PACKAGES_$d
- new=NEW_$old
- if [ ${!new} -gt ${!old} ]; then
- if [ -z "$dists" ]; then
- dists="$d"
- else
- dists="$dists $d"
- fi
- continue
- fi
+now=$(date +%s)
+check=$(( now - 3*60 ))
+
+for dist in $DISTS; do
+ smodtime=$(stat -c "%Y" $base/buildd/$dist/Sources.gz)
+ pmodtime=$(stat -c "%Y" $base/buildd/$dist/Packages.gz)
+
+ if [ ${smodtime} -gt ${check} ] || [ ${pmodtime} -gt ${check} ]; then
+ # Packages/Sources changed in the last minutes
+ dists="${dists} ${dist}"
+ else
+ continue
+ fi