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

* Re: [gentoo-dev] [PATCH] USE aware emerge
  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
  2003-01-06  5:34 ` [gentoo-dev] " news.gmane.org.
  1 sibling, 1 reply; 8+ messages in thread
From: Terje Kvernes @ 2002-12-28 21:06 UTC (permalink / raw
  To: gentoo-dev

Martin Svenningsson <e01msv@efd.lth.se> writes:

> Well, semi use aware anyway.
> 
> What do you think?

  I personally think you forgot to include the emergehelp-module.  :-)

x200 bin # emerge --pretend mozilla
Traceback (most recent call last):
  File "/usr/bin/emerge", line 6, in ?
    import os,sys,portage,emergehelp,xpak,string,re,commands,time,threading,shutil,traceback
ImportError: No module named emergehelp

-- 
Terje

--
gentoo-dev@gentoo.org mailing list


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

* Re: [gentoo-dev] [PATCH] USE aware emerge
  2002-12-28 21:06 ` Terje Kvernes
@ 2002-12-28 21:36   ` Martin Svenningsson
  2002-12-28 22:04     ` Terje Kvernes
  0 siblings, 1 reply; 8+ messages in thread
From: Martin Svenningsson @ 2002-12-28 21:36 UTC (permalink / raw
  To: Terje Kvernes; +Cc: gentoo-dev



On 28 Dec 2002, Terje Kvernes wrote:

> > Well, semi use aware anyway.
> > What do you think?
>
>   I personally think you forgot to include the emergehelp-module.  :-)
>
> x200 bin # emerge --pretend mozilla
> Traceback (most recent call last):
>   File "/usr/bin/emerge", line 6, in ?
>     import os,sys,portage,emergehelp,xpak,string,re,commands,time,threading,shutil,traceback
> ImportError: No module named emergehelp


Well, you can't patch /usr/bin/emerge, you have to patch the source (in
/var/tmp...) and merge it with ebuild.

Martin


--
gentoo-dev@gentoo.org mailing list


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

* Re: [gentoo-dev] [PATCH] USE aware emerge
  2002-12-28 21:36   ` Martin Svenningsson
@ 2002-12-28 22:04     ` Terje Kvernes
  2002-12-29 14:52       ` Christian "cycloon" Gut
  0 siblings, 1 reply; 8+ messages in thread
From: Terje Kvernes @ 2002-12-28 22:04 UTC (permalink / raw
  To: gentoo-dev

Martin Svenningsson <e01msv@efd.lth.se> writes:

> On 28 Dec 2002, Terje Kvernes wrote:
> 
> > x200 bin # emerge --pretend mozilla
> > Traceback (most recent call last):
> >   File "/usr/bin/emerge", line 6, in ?
> >     import os,sys,portage,emergehelp,xpak,string,re,commands,time,threading,shutil,traceback
> > ImportError: No module named emergehelp
> 
> Well, you can't patch /usr/bin/emerge, you have to patch the source
> (in /var/tmp...) and merge it with ebuild.

  ah.  right.  that helped.  rather nifty, but some linewrapping
  should be done for the USE flags:

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

  of course, wrapping at the window width is a good thing.  :-)

  anyhow, way cool and very nifty!  thanks!


-- 
Terje

--
gentoo-dev@gentoo.org mailing list


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

* Re: [gentoo-dev] [PATCH] USE aware emerge
  2002-12-28 22:04     ` Terje Kvernes
@ 2002-12-29 14:52       ` Christian "cycloon" Gut
  0 siblings, 0 replies; 8+ messages in thread
From: Christian "cycloon" Gut @ 2002-12-29 14:52 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 459 bytes --]

On Sat, 2002-12-28 at 23:04, Terje Kvernes wrote:
> Martin Svenningsson <e01msv@efd.lth.se> writes:

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

wohooow. was always searching for something like that!
would be extremely nice to have this in portage.

-- 
Christian "cycloon" Gut <cycloon@is-root.org>

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

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

* [gentoo-dev] Re: [PATCH] USE aware emerge
  2002-12-28 20:03 [gentoo-dev] [PATCH] USE aware emerge Martin Svenningsson
  2002-12-28 21:06 ` Terje Kvernes
@ 2003-01-06  5:34 ` news.gmane.org.
  2003-01-06 21:27   ` Martin Svenningsson
  1 sibling, 1 reply; 8+ messages in thread
From: news.gmane.org. @ 2003-01-06  5:34 UTC (permalink / raw
  To: gentoo-dev



After applying the patch, and trying to search for a package i get..

korn root # emerge search xml2
Searching...
[ Results for search key : xml2 ]
[ Applications found : 1 ]

Traceback (most recent call last):
  File "/usr/bin/emerge", line 1404, in ?
    searchinstance.output()
  File "/usr/bin/emerge", line 289, in output
    desc, homepage = 
portage.portdb.aux_get(full_package,["DESCRIPTION","HOMEPAGE","IUSE"])
ValueError: unpack list of wrong size

is anyone else getting this ?



--
gentoo-dev@gentoo.org mailing list


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

* Re: [gentoo-dev] Re: [PATCH] USE aware emerge
  2003-01-06  5:34 ` [gentoo-dev] " news.gmane.org.
@ 2003-01-06 21:27   ` Martin Svenningsson
  0 siblings, 0 replies; 8+ messages in thread
From: Martin Svenningsson @ 2003-01-06 21:27 UTC (permalink / raw
  To: news.gmane.org.; +Cc: gentoo-dev



On Sun, 5 Jan 2003, news.gmane.org. wrote:

> After applying the patch, and trying to search for a package i get..

You did patch the source in /var/tmp... (and not /usr/bin/emerge) against
portage 2.0.46-r4?

Martin


--
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