Browse Source

bin/sde-reschedule-new: Implemented normal mode, soft and dry run. dependers and smarter config detection still missing

karasz/new-early
Alejandro Mery 16 years ago
parent
commit
d9149e9aa3
1 changed files with 66 additions and 1 deletions
  1. +66
    -1
      bin/sde-reschedule-new

+ 66
- 1
bin/sde-reschedule-new

@ -71,6 +71,51 @@ while [ $# -gt 0 ]; do
done
. "$SDEROOT/lib/sde-config.in"
. "$SDEROOT/lib/sde-package.in"
# receives a list of sandboxes, and returns a list of unique packages involved
reschedule_packages_list()
{
local x=
for x; do
( cd "$SDEROOT/$x/var/adm/packages" &&
ls -1d * ) 2> /dev/null
done | sort -u
}
# compares the package's chksum on a given config/sandbox to the current
# and reschedule if it's different
#
reschedule_new()
{
local pkg="$1" cksum1="$2" cksum2= config="$3" sandbox="$4"
local pkgfile="$SDEROOT/$sandbox/var/adm/packages/$pkg"
local dependers= x=
if [ -s "$pkgfile" ]; then
cksum2=$( grep -R '^\(ROCK Linux\|T2\|OpenSDE\) Package Source Checksum: ' \
"$pkgfile" | cut -d: -f2 )
if [ " $cksum1" != "$cksum2" ]; then
if [ "$reschedule_dependers" = "yes" ]; then
# TODO: Implement dependers detection
dependers=
fi
for x in $pkg $dependers; do
echo "$config: $x"
if [ "$reschedule_dry" != "yes" ]; then
if [ "$reschedule_soft" != "yes" ]; then
mine -rf -R "$SDEROOT/$sandbox/" "$x"
fi
rm -f "$SDEROOT/$sandbox/var/adm"/*/?-$x.* 2> /dev/null
fi
done
fi
fi
}
# which configs?
#
@ -93,4 +138,24 @@ if [ -z "$reschedule_configs" ]; then
done
fi
echo_abort 2 'Not Implemented'
tuples=
sandboxes=
for x in $reschedule_configs; do
y=$( config_id "$x" )
if [ -z "$y" ]; then
echo_warning "$x: Broken config."
elif [ -d "$SDEROOT/build/$y/" ]; then
tuples="$tuples $x:build/$y"
sandboxes="$sandboxes build/$y"
fi
done
for pkg in $( reschedule_packages_list $sandboxes ); do
cksum1=$( sh $SDEROOT/lib/sde-package/pkgchksum.sh \
`package_confdir $pkg` )
for x in $tuples; do
( reschedule_new $pkg $cksum1 ${x/:/ } ) &
done
wait
done

Loading…
Cancel
Save