def execute(self, server, options_dict, non_option_args): if not server_has_patch_support(server): rctalk.error("Current rcd daemon does not have patch support") sys.exit(1) patches = [] patch_table = [] multiple_channels = 1 query = [] clist = [] for a in non_option_args: cl = rcchannelutils.get_channels_by_name(server, a) if rcchannelutils.validate_channel_list(a, cl): clist = clist + cl if non_option_args and not clist: sys.exit(1) query = map(lambda c: ["channel", "=", c["id"]], clist) if len(clist) > 1: query.insert(0, ["", "begin-or", ""]) query.append(["", "end-or", ""]) if options_dict.has_key("installed-only"): query.append(["name-installed", "=", "true"]) elif options_dict.has_key("uninstalled-only"): query.append(["patch-installed", "=", "false"]) if len(clist) == 1: multiple_channels = 0 patches = server.rcd.you.search(query) if options_dict.has_key("sort-by-channel"): for p in patches: rcchannelutils.add_channel_name(server, p) patches.sort(lambda x,y:cmp(string.lower(x["channel_name"]), string.lower(y["channel_name"])) \ or cmp(string.lower(x["name"]), string.lower(y["name"]))) else: patches.sort(lambda x, y: cmp(string.lower(x["name"]), string.lower(y["name"]))) if multiple_channels: keys = ["installed", "channel", "name", "version", "product"] headers = ["S", "Channel", "Name", "Version", "Product"] else: keys = ["installed", "name", "version", "product"] headers = ["S", "Name", "Version", "Product"] # If we're getting all of the packages available to us, filter out # ones in the "hidden" channels, like the system packages channel. patches = rcpackageutils.filter_visible_channels(server, patches) for p in patches: row = rcformat.package_to_row(server, p, options_dict.has_key("no-abbrev"), keys) patch_table.append(row) if patch_table: rcformat.tabular(headers, patch_table) else: rctalk.message("--- No Patches found ---")
def execute(self, server, options_dict, non_option_args): if len(non_option_args) < 1: self.usage() sys.exit(1) no_abbrev = options_dict.has_key("no-abbrev") plist = [] for a in non_option_args: plist = plist + rcpackageutils.find_package(server, a, 1) if not plist: rctalk.message("--- No packages found ---") sys.exit(1) for pkg in plist: dep_info = server.rcd.packsys.package_dependency_info(pkg) if not dep_info.has_key("children"): continue table = [] row_spec = ["name", "channel"] row_headers = ["Provided By", "Channel"] pad = [] if options_dict.has_key("show-versions"): row_spec.insert(1, "version") row_headers.insert(1, "Version") pad = pad + [""] if options_dict.has_key("all-providers"): row_spec.insert(2, "installed") row_headers.insert(2, "S") pad = pad + [""] for dep in dep_info["children"]: providers = map(lambda x:x[0], server.rcd.packsys.what_provides(dep)) prov_dict = {} name = rcformat.dep_to_str(dep) status = "*" for prov in providers: if prov["installed"]: status = "" if status == "" \ and not options_dict.has_key("all-providers"): providers = filter(lambda x:x["installed"], providers) count = 0 for prov in providers: row = rcformat.package_to_row(server, prov, no_abbrev, row_spec) key = string.join(row) if not prov_dict.has_key(key): table.append([status, name] + row) prov_dict[key] = 1 status = "" name = "" count = count + 1 if count == 0: table.append(["*", name, "(none)", "(none)"] + pad) elif count > 1 and not rctalk.be_terse: table.append(["", "", "", ""] + pad) if len(plist) > 1: rctalk.message("--- %s %s ---" % (pkg["name"], rcformat.evr_to_str(pkg))) if not table: rctalk.message("--- No Children ---") else: rcformat.tabular(["!", "Requirement"] + row_headers, table) if len(plist) > 1: rctalk.message("")
def execute(self, server, options_dict, non_option_args): if not server_has_patch_support (server): rctalk.error ("Current rcd daemon does not have patch support") sys.exit(1) patches = [] patch_table = [] multiple_channels = 1 query = [] clist = [] for a in non_option_args: cl = rcchannelutils.get_channels_by_name(server, a) if rcchannelutils.validate_channel_list(a, cl): clist = clist + cl if non_option_args and not clist: sys.exit(1) query = map(lambda c:["channel", "=", c["id"]], clist) if len(clist) > 1: query.insert(0, ["", "begin-or", ""]) query.append(["", "end-or", ""]) if options_dict.has_key("installed-only"): query.append(["name-installed", "=", "true"]) elif options_dict.has_key("uninstalled-only"): query.append(["patch-installed", "=", "false"]) if len(clist) == 1: multiple_channels = 0 patches = server.rcd.you.search (query) if options_dict.has_key("sort-by-channel"): for p in patches: rcchannelutils.add_channel_name(server, p) patches.sort(lambda x,y:cmp(string.lower(x["channel_name"]), string.lower(y["channel_name"])) \ or cmp(string.lower(x["name"]), string.lower(y["name"]))) else: patches.sort(lambda x,y:cmp(string.lower(x["name"]),string.lower(y["name"]))) if multiple_channels: keys = ["installed", "channel", "name", "version", "product"] headers = ["S", "Channel", "Name", "Version", "Product"] else: keys = ["installed", "name", "version", "product"] headers = ["S", "Name", "Version", "Product"] # If we're getting all of the packages available to us, filter out # ones in the "hidden" channels, like the system packages channel. patches = rcpackageutils.filter_visible_channels(server, patches) for p in patches: row = rcformat.package_to_row(server, p, options_dict.has_key("no-abbrev"), keys) patch_table.append(row) if patch_table: rcformat.tabular(headers, patch_table) else: rctalk.message("--- No Patches found ---")
def execute(self, server, options_dict, non_option_args): if options_dict.has_key("search-descriptions"): key = "text" else: key = "name" if options_dict.has_key("match-words"): op = "contains_word" else: op = "contains" query = [] for s in non_option_args: query.append([key, op, s]) if query and options_dict.has_key("match-any"): query.insert(0, ["", "begin-or", ""]) query.append(["", "end-or", ""]) if options_dict.has_key("installed-only"): query.append(["package-installed", "=", "true"]) elif options_dict.has_key("uninstalled-only"): query.append(["package-installed", "=", "false"]) if options_dict.has_key("channel"): cname = options_dict["channel"] clist = rcchannelutils.get_channels_by_name(server,cname) if not rcchannelutils.validate_channel_list(cname, clist): sys.exit(1) c = clist[0] query.append(["channel", "=", c["id"]]) packages = server.rcd.packsys.search(query) if options_dict.has_key("locked-only") or options_dict.has_key("unlocked-only"): if options_dict.has_key("locked-only"): packages = filter(lambda p:p["locked"], packages) elif options_dict.has_key("unlocked-only"): packages = filter(lambda p:not p["locked"], packages) # Filter out packages which are in "hidden" channels, like the # system packages channel. packages = rcpackageutils.filter_visible_channels(server, packages) package_table = [] no_abbrev = options_dict.has_key("no-abbrev") for p in packages: row = rcformat.package_to_row(server, p, no_abbrev, ["installed", "channel", "name", "version"]) package_table.append(row) if package_table: if options_dict.has_key("sort-by-channel"): package_table.sort(lambda x,y:cmp(string.lower(x[1]), string.lower(y[1])) or\ cmp(string.lower(x[2]), string.lower(y[2]))) else: package_table.sort(lambda x,y:cmp(string.lower(x[2]), string.lower(y[2]))) rcformat.tabular(["S", "Channel", "Name", "Version"], package_table) else: rctalk.message("--- No packages found ---")
def execute(self, server, options_dict, non_option_args): if len(non_option_args) < 1: self.usage() sys.exit(1) plist = [] for a in non_option_args: plist = plist + rcpackageutils.find_package(server, a, 1) if not plist: rctalk.message("--- No packages found ---") sys.exit(1) for pkg in plist: dep_info = server.rcd.packsys.package_dependency_info(pkg) if not dep_info.has_key("obsoletes"): continue table = [] for dep in dep_info["obsoletes"]: provided_by = map(lambda x:x[0], server.rcd.packsys.what_provides(dep)) ob_dict = {} name = rcformat.dep_to_str(dep) status = "" for provider in provided_by: if provider["installed"]: status = "*" count = 0 for provider in provided_by: # skip self-obsoletes if evr_eq(provider, pkg): continue if provider["installed"]: status = "*" else: status = "" row = rcformat.package_to_row(server, provider, 0, ["name", "installed", "channel"]) key = string.join(row) if not ob_dict.has_key(key): table.append([status, name] + row) ob_dict[key] = 1 status = "" name = "" count = count + 1 if count == 0: table.append(["", name, "", "", ""]) elif count > 1: table.append(["", "", "", "", ""]) if len(plist) > 1: rctalk.message("--- %s %s ---" % (pkg["name"], rcformat.evr_to_str(pkg))) if not table: rctalk.message("--- No obsoletes ---") else: rcformat.tabular(["!", "Obsoletes", "Provided by", "S", "Channel"], table) if len(plist) > 1: rctalk.message("")
def execute(self, server, options_dict, non_option_args): if len(non_option_args) < 1: self.usage() sys.exit(1) no_abbrev = options_dict.has_key("no-abbrev") plist = [] for a in non_option_args: plist = plist + rcpackageutils.find_package(server, a, 1) if not plist: rctalk.message("--- No packages found ---") sys.exit(1) for pkg in plist: dep_info = server.rcd.packsys.package_dependency_info(pkg) if not dep_info.has_key("children"): continue table = [] row_spec = ["name", "channel"] row_headers = ["Provided By", "Channel"] pad = [] if options_dict.has_key("show-versions"): row_spec.insert(1, "version") row_headers.insert(1, "Version") pad = pad + [""] if options_dict.has_key("all-providers"): row_spec.insert(2, "installed") row_headers.insert(2, "S") pad = pad + [""] for dep in dep_info["children"]: providers = map(lambda x: x[0], server.rcd.packsys.what_provides(dep)) prov_dict = {} name = rcformat.dep_to_str(dep) status = "*" for prov in providers: if prov["installed"]: status = "" if status == "" \ and not options_dict.has_key("all-providers"): providers = filter(lambda x: x["installed"], providers) count = 0 for prov in providers: row = rcformat.package_to_row(server, prov, no_abbrev, row_spec) key = string.join(row) if not prov_dict.has_key(key): table.append([status, name] + row) prov_dict[key] = 1 status = "" name = "" count = count + 1 if count == 0: table.append(["*", name, "(none)", "(none)"] + pad) elif count > 1 and not rctalk.be_terse: table.append(["", "", "", ""] + pad) if len(plist) > 1: rctalk.message("--- %s %s ---" % (pkg["name"], rcformat.evr_to_str(pkg))) if not table: rctalk.message("--- No Children ---") else: rcformat.tabular(["!", "Requirement"] + row_headers, table) if len(plist) > 1: rctalk.message("")
def execute(self, server, options_dict, non_option_args): if options_dict.has_key("search-descriptions"): key = "text" else: key = "name" if options_dict.has_key("match-words"): op = "contains_word" else: op = "contains" query = [] for s in non_option_args: query.append([key, op, s]) if query and options_dict.has_key("match-any"): query.insert(0, ["", "begin-or", ""]) query.append(["", "end-or", ""]) if options_dict.has_key("installed-only"): query.append(["package-installed", "=", "true"]) elif options_dict.has_key("uninstalled-only"): query.append(["package-installed", "=", "false"]) if options_dict.has_key("channel"): cname = options_dict["channel"] clist = rcchannelutils.get_channels_by_name(server, cname) if not rcchannelutils.validate_channel_list(cname, clist): sys.exit(1) c = clist[0] query.append(["channel", "=", c["id"]]) packages = server.rcd.packsys.search(query) if options_dict.has_key("locked-only") or options_dict.has_key( "unlocked-only"): if options_dict.has_key("locked-only"): packages = filter(lambda p: p["locked"], packages) elif options_dict.has_key("unlocked-only"): packages = filter(lambda p: not p["locked"], packages) # Filter out packages which are in "hidden" channels, like the # system packages channel. packages = rcpackageutils.filter_visible_channels(server, packages) package_table = [] no_abbrev = options_dict.has_key("no-abbrev") for p in packages: row = rcformat.package_to_row( server, p, no_abbrev, ["installed", "channel", "name", "version"]) package_table.append(row) if package_table: if options_dict.has_key("sort-by-channel"): package_table.sort(lambda x,y:cmp(string.lower(x[1]), string.lower(y[1])) or\ cmp(string.lower(x[2]), string.lower(y[2]))) else: package_table.sort( lambda x, y: cmp(string.lower(x[2]), string.lower(y[2]))) rcformat.tabular(["S", "Channel", "Name", "Version"], package_table) else: rctalk.message("--- No packages found ---")
def execute(self, server, options_dict, non_option_args): if len(non_option_args) < 1: self.usage() sys.exit(1) plist = [] for a in non_option_args: plist = plist + rcpackageutils.find_package(server, a, 1) if not plist: rctalk.message("--- No packages found ---") sys.exit(1) for pkg in plist: dep_info = server.rcd.packsys.package_dependency_info(pkg) if not dep_info.has_key("obsoletes"): continue table = [] for dep in dep_info["obsoletes"]: provided_by = map(lambda x: x[0], server.rcd.packsys.what_provides(dep)) ob_dict = {} name = rcformat.dep_to_str(dep) status = "" for provider in provided_by: if provider["installed"]: status = "*" count = 0 for provider in provided_by: # skip self-obsoletes if evr_eq(provider, pkg): continue if provider["installed"]: status = "*" else: status = "" row = rcformat.package_to_row( server, provider, 0, ["name", "installed", "channel"]) key = string.join(row) if not ob_dict.has_key(key): table.append([status, name] + row) ob_dict[key] = 1 status = "" name = "" count = count + 1 if count == 0: table.append(["", name, "", "", ""]) elif count > 1: table.append(["", "", "", "", ""]) if len(plist) > 1: rctalk.message("--- %s %s ---" % (pkg["name"], rcformat.evr_to_str(pkg))) if not table: rctalk.message("--- No obsoletes ---") else: rcformat.tabular( ["!", "Obsoletes", "Provided by", "S", "Channel"], table) if len(plist) > 1: rctalk.message("")