Lines 872-878
Link Here
|
872 |
"""Display the filename of the ebuild for a given package |
872 |
"""Display the filename of the ebuild for a given package |
873 |
that would be used by Portage with the current configuration.""" |
873 |
that would be used by Portage with the current configuration.""" |
874 |
def __init__(self): |
874 |
def __init__(self): |
875 |
self.default_opts = {} |
875 |
self.default_opts = { |
|
|
876 |
"includeMasked": True, |
877 |
"baseDirectory": False |
878 |
} |
876 |
|
879 |
|
877 |
def parseArgs(self, args): |
880 |
def parseArgs(self, args): |
878 |
|
881 |
|
Lines 891-896
Link Here
|
891 |
if x in ["-h","--help"]: |
894 |
if x in ["-h","--help"]: |
892 |
need_help = 1 |
895 |
need_help = 1 |
893 |
break |
896 |
break |
|
|
897 |
elif x in ["-m","--exclude-masked"]: |
898 |
opts["includeMasked"] = False |
899 |
elif x in ["-b","--base-directory"]: |
900 |
opts["baseDirectory"] = True |
894 |
else: |
901 |
else: |
895 |
query = x |
902 |
query = x |
896 |
|
903 |
|
Lines 903-923
Link Here
|
903 |
def perform(self, args): |
910 |
def perform(self, args): |
904 |
(query, opts) = self.parseArgs(args) |
911 |
(query, opts) = self.parseArgs(args) |
905 |
|
912 |
|
906 |
matches = gentoolkit.find_packages(query, True) |
913 |
matches = gentoolkit.find_packages(query, opts["includeMasked"]) |
907 |
matches = gentoolkit.sort_package_list(matches) |
914 |
matches = gentoolkit.sort_package_list(matches) |
908 |
|
915 |
|
909 |
if matches: |
916 |
if matches: |
910 |
print_info(0, os.path.normpath(matches[-1].get_ebuild_path())) |
917 |
if opts["baseDirectory"]: |
|
|
918 |
non_overlay_found = False |
919 |
|
920 |
for pkg in matches: |
921 |
if not pkg.is_overlay(): |
922 |
print_info(0, os.path.normpath(pkg.get_package_path())) |
923 |
non_overlay_found = True |
924 |
break |
925 |
|
926 |
if not non_overlay_found: |
927 |
# Package is only in an overlay. Print the path of one of them |
928 |
print_info(0, os.path.normpath(matches[0].get_package_path())) |
929 |
else: |
930 |
print_info(0, os.path.normpath(matches[-1].get_ebuild_path())) |
911 |
else: |
931 |
else: |
912 |
print_error("No masked or unmasked packages found for " + pp.pkgquery(query)) |
932 |
if opts["includeMasked"]: |
|
|
933 |
print_error("No masked or unmasked packages found for " + pp.pkgquery(query)) |
934 |
else: |
935 |
print_error("No unmasked packages found for " + pp.pkgquery(query)) |
913 |
|
936 |
|
914 |
def shortHelp(self): |
937 |
def shortHelp(self): |
915 |
return pp.pkgquery("pkgspec") + " - print full path to ebuild for package " + pp.pkgquery("pkgspec") |
938 |
return pp.localoption("<local-opts> ") + pp.pkgquery("pkgspec") + " - print full path to ebuild for package " + pp.pkgquery("pkgspec") |
916 |
def longHelp(self): |
939 |
def longHelp(self): |
917 |
return "Print full path to ebuild for a given package" + \ |
940 |
return "Print full path to ebuild for a given package" + \ |
918 |
"\n" + \ |
941 |
"\n" + \ |
919 |
"Syntax:\n" + \ |
942 |
"Syntax:\n" + \ |
920 |
" " + pp.command("which ") + pp.pkgquery("pkgspec") |
943 |
" " + pp.command("which") + pp.localoption(" <local-opts> ") + pp.pkgquery("pkgspec") + \ |
|
|
944 |
"\n" + \ |
945 |
pp.localoption("<local-opts>") + " is either of: \n" + \ |
946 |
" " + pp.localoption("-m, --nomasked") + " - exclude masked packages\n" + \ |
947 |
" " + pp.localoption("-b, --base-directory") + " - print base directory instead of path to ebuild\n" |
921 |
|
948 |
|
922 |
class CmdListGLSAs(Command): |
949 |
class CmdListGLSAs(Command): |
923 |
"""List outstanding GLSAs.""" |
950 |
"""List outstanding GLSAs.""" |