public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH] USE aware emerge
@ 2002-12-28 20:03 Martin Svenningsson
  2002-12-28 21:06 ` Terje Kvernes
  2003-01-06  5:34 ` [gentoo-dev] " news.gmane.org.
  0 siblings, 2 replies; 8+ messages in thread
From: Martin Svenningsson @ 2002-12-28 20:03 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1150 bytes --]

Well, semi use aware anyway.

What do you think?


$ ./emerge -p mozilla

These are the packages that I would merge, in order:

Calculating dependencies ...done!
[ebuild   R  ] net-www/mozilla-1.2.1-r4


The following USE flags for this action are:

[enabled] java crypt gtk2 ssl gnome
[disabled] ipv6
[unset] ldap mozsvg mozcalendar mozaccess mozinterfaceinfo mozp3p
mozxmlterm moznoirc moznomail moznocompose moznoxft


------


$ ./emerge -s 'mplayer$'
Searching...
[ Results for search key : mplayer$ ]
[ Applications found : 1 ]

*  media-video/mplayer
      Latest version available: 0.90_rc2
      Latest version installed: [ Not Installed ]
      Size of downloaded files: 3,728 kB
      Homepage:    http://www.mplayerhq.hu/
      Description: Media Player for Linux
      Uses:        dga oss jpeg 3dfx sse matrox sdl X svga ggi oggvorbis
3dnow aalib gnome xv opengl truetype dvd gtk gif esd fbcon encode alsa
directfb arts


Where the use variables is color coded:
red: not specified in USE  [unset]
purple: specified not to be used (ie -kde) [disabled]
green: specified and used  [enabled]


Patched against portage-2.0.46-r4.

// Martin

[-- Attachment #2: Type: TEXT/PLAIN, Size: 2537 bytes --]

--- emerge.old	2002-12-24 21:14:01.000000000 +0100
+++ emerge	2002-12-28 20:39:27.000000000 +0100
@@ -286,7 +286,7 @@
 					catpack=portage.pkgsplit(match)[0]
 				if full_package:
 					try:
-						desc, homepage = portage.portdb.aux_get(full_package,["DESCRIPTION","HOMEPAGE"])
+						desc, homepage, uses = portage.portdb.aux_get(full_package,["DESCRIPTION","HOMEPAGE","IUSE"])
 					except KeyError:
 						print "emerge: search: aux_get() failed, skipping"
 						continue
@@ -295,6 +295,20 @@
 					else:
 						print green("*")+"  "+white(match)
 					myversion = self.getVersion(full_package, search.VERSION_RELEASE)
+					
+
+					# red: not specified in USE
+					# purple: specified not to be used (ie -kde)
+					# green: specified and used
+
+					myuse = ""
+					for x in string.split(uses, " "):
+						if "-"+x in portage.settings["USE"].split():
+								myuse = myuse + purple(x) + " "
+						elif not x in portage.settings["USE"].split():
+ 							myuse = myuse + red(x) + " "
+						else:
+							myuse = myuse + green(x) + " "
 
 					mysum = [0,0]
 					mycat = match.split("/")[0]
@@ -323,6 +337,7 @@
 					print "     ", darkgreen("Size of downloaded files:"),mysum[0]
 					print "     ", darkgreen("Homepage:   "),homepage
 					print "     ", darkgreen("Description:"),desc
+					print "     ", darkgreen("Uses:       "),myuse
 					print
 		
 	#
@@ -1537,6 +1552,34 @@
 		print "\b\b ...done!"
 	if ("--pretend" in myopts) and not ("--fetchonly" in myopts):
 		mydepgraph.display(mydepgraph.altlist())
+
+		
+		enabled = ""
+		disabled = ""
+		unset = ""
+
+		for x in mydepgraph.altlist():
+			if x[2]:
+				try:
+						uses = portage.portdb.aux_get(x[2],["IUSE"])
+				except KeyError:
+						print "emerge: search: aux_get() failed, skipping"
+						continue
+
+				for y in string.split(uses[0], " "):
+					if "-"+y in portage.settings["USE"].split() and string.find(disabled, y) < 0:
+						disabled = disabled + purple(y) + " "
+					elif not y in portage.settings["USE"].split() and string.find(unset, y) < 0:
+ 						unset = unset + red(y) + " "
+					elif string.find(enabled, y) < 0:
+						enabled = enabled + green(y) + " "
+
+		print darkgreen("\n\nThe following USE flags for this action are:\n")
+
+		print "[enabled]", enabled 
+		print "[disabled]", disabled
+		print "[unset]", unset
+
 	else:
 		mydepgraph.merge(mydepgraph.altlist())
 		if portage.settings["AUTOCLEAN"] and "yes"==portage.settings["AUTOCLEAN"]:

[-- Attachment #3: Type: text/plain, Size: 37 bytes --]

--
gentoo-dev@gentoo.org mailing list

^ permalink raw reply	[flat|nested] 8+ messages in thread
* [gentoo-dev] Re: [PATCH] USE aware emerge
@ 2003-01-11  7:02 J.D. McGregor
  0 siblings, 0 replies; 8+ messages in thread
From: J.D. McGregor @ 2003-01-11  7:02 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: TEXT/PLAIN, Size: 849 bytes --]

May I suggest this minor modification.  With the original code, if the
same flag comes up twice as either 'disabled' or 'unset' it gets added as
'enabled', since it fails the string.find() duplicate check, and there's
only a dup check on the fallthrough to 'enabled'.  The simple patch
enclosed fixes this.

Other than that, this is a great idea, works well, I'd love to see it
included.

-J.D.
>Well, semi use aware anyway.
>
>What do you think?
>
>
>$ ./emerge -p mozilla
>
>These are the packages that I would merge, in order:
>
>Calculating dependencies ...done!
>[ebuild   R  ] net-www/mozilla-1.2.1-r4
.
>
>The following USE flags for this action are:
>
>[enabled] java crypt gtk2 ssl gnome
>[disabled] ipv6
>[unset] ldap mozsvg mozcalendar mozaccess mozinterfaceinfo mozp3p
>mozxmlterm moznoirc moznomail moznocompose moznoxft
>
<etc etc etc>

[-- Attachment #2: code diff --]
[-- Type: TEXT/PLAIN, Size: 589 bytes --]

--- /work/portage-2.0.46-r4/bin/emerge.old	2003-01-10 23:45:28.000000000 +0000
+++ /work/portage-2.0.46-r4/bin/emerge	2003-01-10 23:46:20.000000000 +0000
@@ -1571,7 +1571,7 @@
 						disabled = disabled + purple(y) + " "
 					elif not y in portage.settings["USE"].split() and string.find(unset, y) < 0:
 						unset = unset + red(y) + " "
-					elif string.find(enabled, y) < 0:
+					elif y in portage.settings["USE"].split() and string.find(enabled, y) < 0:
 						enabled = enabled + green(y) + " "
 
 		print darkgreen("\n\nThe following USE flags for this action are:\n")

[-- Attachment #3: Type: text/plain, Size: 37 bytes --]

--
gentoo-dev@gentoo.org mailing list

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2003-01-11  7:04 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-12-28 20:03 [gentoo-dev] [PATCH] USE aware emerge Martin Svenningsson
2002-12-28 21:06 ` Terje Kvernes
2002-12-28 21:36   ` Martin Svenningsson
2002-12-28 22:04     ` Terje Kvernes
2002-12-29 14:52       ` Christian "cycloon" Gut
2003-01-06  5:34 ` [gentoo-dev] " news.gmane.org.
2003-01-06 21:27   ` Martin Svenningsson
  -- strict thread matches above, loose matches on Subject: below --
2003-01-11  7:02 J.D. McGregor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox