def execute(self, server, options_dict, non_option_args): no_abbrev = options_dict.has_key("no-abbrev") or \ options_dict.has_key("terse") min_importance = None if options_dict.has_key("importance"): if not rcpackageutils.update_importances.has_key( options_dict["importance"]): rctalk.warning("Invalid importance: " + options_dict["importance"]) else: min_importance = rcpackageutils.update_importances[ options_dict["importance"]] update_list = rcpackageutils.get_updates(server, non_option_args, allow_dups=1) if min_importance != None: up = [] for u in update_list: # higher priorities have lower numbers... i know, i know... if u[1]["importance_num"] <= min_importance: up.append(u) else: up = update_list if not up: if non_option_args: rctalk.message( "No updates are available in the specified channels.") else: rctalk.message("No updates are available.") if not filter(lambda x: x["subscribed"], rcchannelutils.get_channels(server)): rctalk.message("") rctalk.warning( "Updates are only visible when you are subscribed to a channel." ) sys.exit(0) if rctalk.show_verbose: verbose_updates_list(server, up) elif rctalk.be_terse: terse_updates_table(server, up) else: exploded_updates_table(server, up, no_abbrev)
def execute(self, server, options_dict, non_option_args): min_importance = None if options_dict.has_key("importance"): if not rcpackageutils.update_importances.has_key( options_dict["importance"]): rctalk.error("Invalid importance: " + options_dict["importance"]) sys.exit(1) else: min_importance = rcpackageutils.update_importances[ options_dict["importance"]] update_list = rcpackageutils.get_updates(server, non_option_args) if min_importance != None: up = [] for u in update_list: # higher priorities have lower numbers... i know, i know... if u[1]["importance_num"] <= min_importance: up.append(u) else: up = update_list # x[1] is the package to be updated packages_to_install = map(lambda x: x[1], up) if not packages_to_install: rctalk.message("--- No packages to update ---") sys.exit(0) if not options_dict.has_key("download-only"): install_deps, remove_deps, dep_info = \ resolve_dependencies(server, packages_to_install, [], []) else: install_deps = [] remove_deps = [] self.transact(server, options_dict, packages_to_install, install_deps, [], remove_deps)
def execute(self, server, options_dict, non_option_args): no_abbrev = options_dict.has_key("no-abbrev") or \ options_dict.has_key("terse") min_importance = None if options_dict.has_key("importance"): if not rcpackageutils.update_importances.has_key(options_dict["importance"]): rctalk.warning("Invalid importance: " + options_dict["importance"]) else: min_importance = rcpackageutils.update_importances[options_dict["importance"]] update_list = rcpackageutils.get_updates(server, non_option_args, allow_dups=1) if min_importance != None: up = [] for u in update_list: # higher priorities have lower numbers... i know, i know... if u[1]["importance_num"] <= min_importance: up.append(u) else: up = update_list if not up: if non_option_args: rctalk.message("No updates are available in the specified channels.") else: rctalk.message("No updates are available.") if not filter(lambda x:x["subscribed"], rcchannelutils.get_channels(server)): rctalk.message("") rctalk.warning("Updates are only visible when you are subscribed to a channel.") sys.exit(0) if rctalk.show_verbose: verbose_updates_list(server, up) elif rctalk.be_terse: terse_updates_table(server, up) else: exploded_updates_table(server, up, no_abbrev)
def execute(self, server, options_dict, non_option_args): min_importance = None if options_dict.has_key("importance"): if not rcpackageutils.update_importances.has_key(options_dict["importance"]): rctalk.error("Invalid importance: " + options_dict["importance"]) sys.exit(1) else: min_importance = rcpackageutils.update_importances[options_dict["importance"]] update_list = rcpackageutils.get_updates(server, non_option_args) if min_importance != None: up = [] for u in update_list: # higher priorities have lower numbers... i know, i know... if u[1]["importance_num"] <= min_importance: up.append(u) else: up = update_list # x[1] is the package to be updated packages_to_install = map(lambda x:x[1], up) if not packages_to_install: rctalk.message("--- No packages to update ---") sys.exit(0) if not options_dict.has_key("download-only"): install_deps, remove_deps, dep_info = \ resolve_dependencies(server, packages_to_install, [], []) else: install_deps = [] remove_deps = [] self.transact(server, options_dict, packages_to_install, install_deps, [], remove_deps)
def execute(self, server, options_dict, non_option_args): no_abbrev = options_dict.has_key("no-abbrev") update_list = rcpackageutils.get_updates(server, []) if not update_list: rctalk.message("There are no available updates at this time.") sys.exit(0) count = len(update_list) necessary_count = 0 urgent_count = 0 seen_channels = {} seen_importance = {} tally = {} tally_by_urgency = {} for update_item in update_list: old_pkg, new_pkg, descriptions = update_item imp = new_pkg["importance_str"] if imp == "necessary": necessary_count = necessary_count + 1 if imp == "urgent": urgent_count = urgent_count + 1 ch = rcchannelutils.channel_id_to_name(server, new_pkg["channel"]) seen_channels[ch] = 1 seen_importance[imp] = new_pkg["importance_num"] key = ch + "||" + imp if tally.has_key(key): tally[key] = tally[key] + 1 else: tally[key] = 1 if tally_by_urgency.has_key(imp): tally_by_urgency[imp] = tally_by_urgency[imp] + 1 else: tally_by_urgency[imp] = 1 rctalk.message("") rctalk.message("There %s %d update%s available at this time." \ % ((count != 1 and "are") or "is", count, (count != 1 and "") or "s")) if necessary_count: rctalk.message("%d update%s marked as 'necessary'." \ % (necessary_count, (necessary_count != 1 and "s are") or " is")) if urgent_count: rctalk.message("%d update%s marked as 'urgent'." \ % (urgent_count, (urgent_count != 1 and "s are") or " is")) rctalk.message("") channels = seen_channels.keys() channels.sort(lambda x,y:cmp(string.lower(x), string.lower(y))) importances = seen_importance.keys() importances.sort(lambda x,y,f=seen_importance:cmp(f[x], f[y])) header = ["Channel"] if no_abbrev or len(importances) <= 4: header = header + importances else: header = header + map(rcformat.abbrev_importance, importances) header = header + ["total"] table = [] for ch in channels: if no_abbrev: row = [ch] else: row = [rcformat.abbrev_channel_name(ch)] row_count = 0 for imp in importances: key = ch + "||" + imp if tally.has_key(key): row.append(string.rjust(str(tally[key]), 3)) row_count = row_count + tally[key] else: row.append("") if count: row.append(string.rjust(str(row_count), 3)) else: row.append("") table.append(row) row = ["total"] for imp in importances: row.append(string.rjust(str(tally_by_urgency[imp]), 3)) row.append(string.rjust(str(count), 3)) table.append(row) rcformat.tabular(header, table) rctalk.message("")
def execute(self, server, options_dict, non_option_args): no_abbrev = options_dict.has_key("no-abbrev") update_list = rcpackageutils.get_updates(server, []) if not update_list: rctalk.message("There are no available updates at this time.") sys.exit(0) count = len(update_list) necessary_count = 0 urgent_count = 0 seen_channels = {} seen_importance = {} tally = {} tally_by_urgency = {} for update_item in update_list: old_pkg, new_pkg, descriptions = update_item imp = new_pkg["importance_str"] if imp == "necessary": necessary_count = necessary_count + 1 if imp == "urgent": urgent_count = urgent_count + 1 ch = rcchannelutils.channel_id_to_name(server, new_pkg["channel"]) seen_channels[ch] = 1 seen_importance[imp] = new_pkg["importance_num"] key = ch + "||" + imp if tally.has_key(key): tally[key] = tally[key] + 1 else: tally[key] = 1 if tally_by_urgency.has_key(imp): tally_by_urgency[imp] = tally_by_urgency[imp] + 1 else: tally_by_urgency[imp] = 1 rctalk.message("") rctalk.message("There %s %d update%s available at this time." \ % ((count != 1 and "are") or "is", count, (count != 1 and "") or "s")) if necessary_count: rctalk.message("%d update%s marked as 'necessary'." \ % (necessary_count, (necessary_count != 1 and "s are") or " is")) if urgent_count: rctalk.message("%d update%s marked as 'urgent'." \ % (urgent_count, (urgent_count != 1 and "s are") or " is")) rctalk.message("") channels = seen_channels.keys() channels.sort(lambda x, y: cmp(string.lower(x), string.lower(y))) importances = seen_importance.keys() importances.sort(lambda x, y, f=seen_importance: cmp(f[x], f[y])) header = ["Channel"] if no_abbrev or len(importances) <= 4: header = header + importances else: header = header + map(rcformat.abbrev_importance, importances) header = header + ["total"] table = [] for ch in channels: if no_abbrev: row = [ch] else: row = [rcformat.abbrev_channel_name(ch)] row_count = 0 for imp in importances: key = ch + "||" + imp if tally.has_key(key): row.append(string.rjust(str(tally[key]), 3)) row_count = row_count + tally[key] else: row.append("") if count: row.append(string.rjust(str(row_count), 3)) else: row.append("") table.append(row) row = ["total"] for imp in importances: row.append(string.rjust(str(tally_by_urgency[imp]), 3)) row.append(string.rjust(str(count), 3)) table.append(row) rcformat.tabular(header, table) rctalk.message("")