Paul Varner wrote:
Instead of hardcoding the nice value, use PORTAGE_NICENESS. Here is how
it is done in revdep-rebuild
# Obey PORTAGE_NICENESS
PORTAGE_NICENESS=$(portageq envvar PORTAGE_NICENESS)
[ ! -z "$PORTAGE_NICENESS" ] && renice $PORTAGE_NICENESS $$ > /dev/null
Good point. Is this patch better? Or should it rather be _exactly_ as it
is in revdep-rebuild?
- Johannes.
--- /usr/sbin/emerge-webrsync 2005-12-28 11:49:18.000000000 +0100
+++ emerge-webrsync 2005-12-28 17:33:50.179723896 +0100
@@ -18,9 +18,19 @@
cd "$DISTDIR"
found=0
+rsyncops="-av --progress"
+
+PORTAGE_NICENESS=$(portageq envvar PORTAGE_NICENESS)
+if [ -z "$PORTAGE_NICENESS" ] ; then
+ PORTAGE_NICENESS=0
+fi
+
if [ "$1" == "-v" ] ; then
wgetops=
else
+ if [ "$1" == "-q" ] ; then
+ rsyncops="-aq"
+ fi
#this sucks. probably better to do 1> /dev/null
#that said, waiting on the refactoring.
if [ "${FETCHCOMMAND/wget}" != "${FETCHCOMMAND}" ]; then
@@ -42,7 +52,7 @@
sync_local() {
echo Syncing local tree...
- if ! tar jxf $FILE; then
+ if ! nice -n $PORTAGE_NICENESS tar jxf $FILE; then
echo "Tar failed to extract the image. Please review the output."
echo "Executed command: tar jxf $FILE"
exit 1
@@ -51,14 +61,14 @@
# Make sure user and group file ownership is root
chown -R 0:0 portage
cd portage
- rsync -av --progress --stats --delete --delete-after \
+ nice -n $PORTAGE_NICENESS rsync ${rsyncops} --stats --delete --delete-after \
--exclude='/distfiles' --exclude='/packages' \
--exclude='/local' . ${PORTDIR%%/}
cd ..
echo "cleaning up"
rm -rf portage
echo "transferring metadata/cache"
- emerge metadata
+ nice -n $PORTAGE_NICENESS emerge metadata
}
echo "Fetching most recent snapshot"