Ok, here's the patch for emerge-delta-webrync to use PORTAGE_NICENESS.
Brian, I hope this is what you had in mind.
I didn't alter the emerge-webrsync patch again, I think it's OK the way
I altered it in the last patch I posted,
but I attached it again anyway.
- Johannes.
--- /usr/bin/emerge-delta-webrsync 2006-01-04 09:26:07.000000000 +0100
+++ emerge-delta-webrsync 2006-01-04 09:25:43.068355800 +0100
@@ -7,8 +7,12 @@
#-------------------
#initialization
#------------------
+PORTAGE_NICENESS=$(portageq envvar PORTAGE_NICENESS)
+if [ -z "$PORTAGE_NICENESS" ] ; then
+ PORTAGE_NICENESS=0
+fi
-f=$(python -c'import portage; print "|".join([portage.settings[x] for x in ("GENTOO_MIRRORS", "PORTDIR", "FETCHCOMMAND", "USERLAND", "DISTDIR", "PORTAGE_TMPDIR")])')
+f=$(nice -n $PORTAGE_NICENESS python -c'import portage; print "|".join([portage.settings[x] for x in ("GENTOO_MIRRORS", "PORTDIR", "FETCHCOMMAND", "USERLAND", "DISTDIR", "PORTAGE_TMPDIR")])')
IFS='|'
GENTOO_MIRRORS="${f%%|*}" ; f="${f#*|}"
@@ -183,7 +187,7 @@
echo Syncing local tree...
if type -p tarsync &> /dev/null; then
echo "apparently you have tarsync installed. using it."
- if ! tarsync "${FILE}" "${PORTDIR}" -v -s 1 -o portage -g portage -e /distfiles -e /packages -e /local; then
+ if ! nice -n $PORTAGE_NICENESS tarsync "${FILE}" "${PORTDIR}" -v -s 1 -o portage -g portage -e /distfiles -e /packages -e /local; then
echo "ok, tarsync failed. that's teh suck :/"
exit 6
fi
@@ -201,7 +205,7 @@
# 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 -av --progress --stats --delete --delete-after \
--exclude='/distfiles' --exclude='/packages' \
--exclude='/local' . ${PORTDIR%%/}
cd ..
--- /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"