--- bin/portageq.orig 2004-01-23 10:09:58.000000000 +0100 +++ bin/portageq.orig 2004-01-23 11:07:49.587331955 +0100 @@ -61,6 +61,26 @@ except KeyError: sys.exit(1) +def have_flags(argv): + """ []+ + 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): """ []+ --- bin/ebuild.sh.orig 2004-01-23 10:28:28.000000000 +0100 +++ bin/ebuild.sh.orig 2004-01-23 10:31:15.590854112 +0100 @@ -202,6 +202,16 @@ 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() { # returns the best/most-current match. # Takes single depend-type atoms.