Re: [gentoo-portage-dev] emerge-webrsync patch

2006-01-11 Thread Brian Harring
On Wed, Jan 11, 2006 at 10:15:00AM +0100, Johannes Fahrenkrug wrote:
> if [[ -n $PORTAGE_NICENESS ]] && ! [[ -z $WE_ARE_NICED ]]; then

Haven't looked at the patch yet, but a bit of bash fu for ya-

[[ -n $VAR ]] == ! [[ -z $VAR ]]

-z is zero length or unset, -n is length >= 1 (thus must be set).

~harring


pgpYYLVtoPlnG.pgp
Description: PGP signature


Re: [gentoo-portage-dev] making aux_get more usable for vardbapi

2006-01-11 Thread Brian Harring
On Tue, Jan 10, 2006 at 07:53:04PM +0100, Marius Mauch wrote:
> Currently vardbapi.aux_get only works for a subset of all auxdbkeys, as
> some like KEYWORDS or DESCRIPTIOn aren't stored in vdb directly.
> They are however stored in environment.bz2, but not accessible
> there.
> This is unintuitive and limits tools like equery or my own auxget
> and metascan tools in their usability.
> 
> There are two solutions to this problem:
> a) enhance vardbapi.aux_get so it can use environment.bz2
> b) store more keys in vdb
> 
> Now there is a tradeoff to made: a) doesn't need space but is slow
> while b) is fast but needs space, both in non-trivial amounts (runtime
> increased from 1s to 9s for a metascan -i run and from 0.5s to 0.8s
> for auxget -i, haven't actually checked the size increase, expect
> somewhere between 1 and 10 megabytes on a typical install).
> 
> I'm attaching a patch that implements both (each in it's own hunk) as
> well as a new emaint option to create the missing entries offline.
> 
> A not so obvious issue with a) is that due to the recent
> storage optimizations (empty entries not being stored) it's worse than
> I originally expected, as any entry missing a file will be looked up in
> env.bz2 instead. Only way to avoid that would be to add special casing
> in aux_get which I really dislike.
> 
> Opinions?
Use filter-env to pull the var out.

Regex you've got there allows for pulling the wrong text- recall, ebd 
originally was doing grep based filtering (regex).  Had to rewrite 
that in a major hurry since bash syntax (specifically here ops) forces 
you to track state/constructs rather then just a regex...

Aside from that, while it's annoying, should do a one time pull- if a 
var is in a whitelist of "can be pulled from env", we pull all missing 
vars *once*.  My opinion, at least.
~harring


pgpPpYlagEdYF.pgp
Description: PGP signature


Re: [gentoo-portage-dev] emaint and handling of user editable files

2006-01-11 Thread Simon Stelling

Christian Hoenig wrote:
On the other hand it would be very nice to allow comments in the world file, 
too, as I very often don't remember why I installed a package (a lib which 
for example was just a dependency for lokaly installed stuff).
As I'm writing this I get the idea, that this probalby should not be part of 
the world file but of portage itself with a --comment TEXT parameter :-).


That sounds awkward. Why introduce a new option to portage if you could just 
fire up your preferred text editor and create a whyiinstalledthisstuff file? 
Really, this is not the purpose of a package manager IMO.



So, finally, how should emaint --fix deal with comments in files?
(a) Only give a recommendation what / how to fix?
(b) Fix if there are no comments contained, otherwise only do (a)?
(c) make emaint --fix comment the lines out instead of removing them entirely. 
That way, you could just ignore comments and it would be a lot safer too.. I 
simply don't like the idea very much of having a tool removing lines from my 
config files. You could use ## or #@ (or whatever) to comment the lines out, 
which should be easy to recognize for the user. It would take a few seconds to 
cut the lines starting with said prefix out of the file, and the user could 
remove old comments in the same go.


Regards,

--
Simon Stelling
Gentoo/AMD64 Operational Co-Lead
[EMAIL PROTECTED]
--
gentoo-portage-dev@gentoo.org mailing list



Re: [gentoo-portage-dev] emerge-webrsync patch

2006-01-11 Thread Johannes Fahrenkrug

Brian Harring wrote:

Looks good; game to do the same for emerge-webrsync, and add in 
support for tarsync if it's available?
 


Done. Please look at the patches, I hope this is what you had in mind.
I basically copied it from emerge-delta-webrsync.


Users will feed you cookies for the faster emerge-webrsync ;)
 


Hmmm... I like cookies ;-)

Offhand... one option, minimal diff (although untested, so might have 
args wrong)-

if [[ -n $PORTAGE_NICENESS ]] && ! [[ -z $WE_ARE_NICED ]]; then
export WE_ARE_NICED=1
exec nice -n "$PORTAGE_NICENESS" "$0" "$@"
fi
 


Ok, put it in emerge-delta-webrsync and emerge-webrsync. I had to change

if [[ -n $PORTAGE_NICENESS ]] && ! [[ -z $WE_ARE_NICED ]]; then

to

if [[ -n $PORTAGE_NICENESS ]] && [[ -z $WE_ARE_NICED ]]; then

(otherwise it would have read AND NOT $WE_ARE_NICED is NOT set...)


Icky re-execing, but is the usual trick...
 


Seems to work for me.
If these patches should get accepted and I should get credited, please 
say "Johannes Fahrenkrug (jfahrenkrug_gmail_com)".

Thank you and I'm looking forward to hearing what you think.

- Johannes.
--- /usr/bin/emerge-delta-webrsync	2006-01-04 09:26:07.0 +0100
+++ emerge-delta-webrsync	2006-01-11 10:04:14.551773368 +0100
@@ -7,8 +7,18 @@
 #---
 #initialization
 #--
+PORTAGE_NICENESS=$(portageq envvar PORTAGE_NICENESS)
 
-f=$(python -c'import portage; print "|".join([portage.settings[x] for x in ("GENTOO_MIRRORS", "PORTDIR", "FETCHCOMMAND", "USERLAND", "DISTDIR", "PORTAGE_TMPDIR")])')
+if [[ -n $PORTAGE_NICENESS ]] && [[ -z $WE_ARE_NICED ]]; then
+	export WE_ARE_NICED=1
+	exec nice -n "$PORTAGE_NICENESS" "$0" "$@"
+fi
+
+if [ -z "$PORTAGE_NICENESS" ] ; then
+PORTAGE_NICENESS=0
+fi
+
+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 +193,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 +211,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.0 +0100
+++ emerge-webrsync	2006-01-11 09:28:54.378088760 +0100
@@ -18,9 +18,25 @@
 cd "$DISTDIR"
 
 found=0
+rsyncops="-av --progress"
+
+PORTAGE_NICENESS=$(portageq envvar PORTAGE_NICENESS)
+
+if [[ -n $PORTAGE_NICENESS ]] && [[ -z $WE_ARE_NICED ]]; then
+	export WE_ARE_NICED=1
+	exec nice -n "$PORTAGE_NICENESS" "$0" "$@"
+fi
+
+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,23 +58,31 @@
 
 sync_local() {
 	echo Syncing local tree...
-	if ! tar jxf $FILE; then
-		echo "Tar failed to extract the image. Please review the output."
-		echo "Executed command: tar jxf $FILE"
-		exit 1
-	fi
+	if type -p tarsync &> /dev/null; then
+	echo "apparently you have tarsync installed.  using it."
+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
+else
+		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
+		fi
+	fi	
 	rm -f $FILE
 	# 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"