aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfuzzyray <fuzzyray@gentoo.org>2009-04-30 21:52:45 +0000
committerfuzzyray <fuzzyray@gentoo.org>2009-04-30 21:52:45 +0000
commit86eaf5e03289e45a95514b4f6011157972016e9d (patch)
treec16903693f2030c7b01b346b29b265dc1a473888 /src/old-scripts/ewhich
parentFix has_key() deprecation message. (Bug #232797) (diff)
downloadgentoolkit-86eaf5e03289e45a95514b4f6011157972016e9d.tar.gz
gentoolkit-86eaf5e03289e45a95514b4f6011157972016e9d.tar.bz2
gentoolkit-86eaf5e03289e45a95514b4f6011157972016e9d.zip
Tagging the gentoolkit-0.2.4 releasegentoolkit-0.2.4
svn path=/tags/gentoolkit-0.2.4/; revision=564
Diffstat (limited to 'src/old-scripts/ewhich')
-rwxr-xr-xsrc/old-scripts/ewhich44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/old-scripts/ewhich b/src/old-scripts/ewhich
new file mode 100755
index 0000000..345ec34
--- /dev/null
+++ b/src/old-scripts/ewhich
@@ -0,0 +1,44 @@
+#!/usr/bin/python
+# Copyright 1999-2003 Gentoo Technologies, Inc.
+# Distributed under the terms of the GNU General Public License v2
+# $Header$
+#
+# Author: Marius Mauch <genone@gentoo.org>
+#
+# ewhich is a tool to get the ebuild filename for a given package name
+
+import portage,sys,os
+from output import *
+
+sys.stderr.write("\n" + red("!!!") + " As of Gentoolkit 0.2.0 this tool is deprecated\n")
+sys.stderr.write(red("!!!") + " Refer to 'equery which' for a replacement\n\n")
+
+def print_help():
+ print
+ print fuscia(os.path.basename(sys.argv[0])), "is a tool to get the filename of the ebuild for a given package"
+ print ' '*len(os.path.basename(sys.argv[0])), "that would be used by portage with the current configuration"
+ print
+ print yellow("Syntax:"), os.path.basename(sys.argv[0]), teal("<package>")
+ print
+ print teal("<package>"), "is either a simple package name (like "+green("xfree")+"),"
+ print " a package name with category (like "+green("x11-base/xfree")+")"
+ print " or a DEPEND style atom as defined in ebuild(5) (like "+green(">=x11-base/xfree-4.3.0")+")"
+ print
+
+if len(sys.argv) <= 1 or sys.argv[1] == "-h" or sys.argv[1] == "--help":
+ print_help()
+ sys.exit(0)
+
+p = portage.db[portage.root]["porttree"].dbapi.xmatch("bestmatch-visible", sys.argv[1])
+if len(p) <= 1:
+ print
+ print red("*"), "\""+sys.argv[1]+"\" is not a valid package name or a masked package"
+ print
+ sys.exit(1)
+pv = portage.catpkgsplit(p)
+ebuild = "/"+pv[0]+"/"+pv[1]+"/"+p.split("/")[1]+".ebuild"
+for ov in portage.settings["PORTDIR_OVERLAY"].split():
+ if os.path.exists(ov+ebuild):
+ print os.path.normpath(ov+ebuild)
+ sys.exit(0)
+print os.path.normpath(portage.settings["PORTDIR"]+ebuild)