|
|
except KeyError: | except KeyError: |
sys.exit(1) | sys.exit(1) |
| |
|
def have_flags(argv): |
|
"""<root> <category/package> [<use_flag>]+ |
|
Returns 0 if all the matching packages have the requested USE flags, 0 otherwise. |
|
""" |
|
if (len(argv) < 3): |
|
print "ERROR: insufficient parameters!" |
|
sys.exit(2) |
|
myflaglist=argv[2:] |
|
myvdbapi=portage.db[argv[0]]["vartree"].dbapi |
|
try: |
|
mypkglist=myvdbapi.match(argv[1]) |
|
for mypkg in mypkglist: |
|
mypkgflags=string.split(myvdbapi.aux_get(mypkg,['USE'])[0]) |
|
for myflag in myflaglist: |
|
if not (myflag in mypkgflags): |
|
sys.exit(1) |
|
sys.exit(0) |
|
except KeyError: |
|
sys.exit(1) |
|
|
| |
def mass_best_version(argv): | def mass_best_version(argv): |
"""<root> [<category/package>]+ | """<root> [<category/package>]+ |
|
|
fi | fi |
} | } |
| |
|
have_flags() { |
|
# return shell-true/shell-false if all matching pkgs have the requested flags. |
|
# Takes a single depend-type atoms and a USE flag list. |
|
if /usr/lib/portage/bin/portageq 'have_flags' "${ROOT}" "$@"; then |
|
return 0 |
|
else |
|
return 1 |
|
fi |
|
} |
|
|
best_version() { | best_version() { |
# returns the best/most-current match. | # returns the best/most-current match. |
# Takes single depend-type atoms. | # Takes single depend-type atoms. |