#! /usr/bin/python -tt # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. import os import sys sys.path.insert(0, '/usr/share/yum-cli') import yum import output from urlgrabber.progress import TextMeter from cli import YumBaseCli from yumcommands import _list_cmd_calc_columns # A lot of this is from the same name in output.py def listPkgs(self, lst, description, highlight_na={}, columns=None): """outputs based on whatever outputType is. Current options: 'list' - simple pkg list 'info' - similar to rpm -qi output ...also highlight_na can be passed, and we'll highlight pkgs with (names, arch) in that set.""" print '%s' % description for pkg in sorted(lst): key = (pkg.name, pkg.arch) highlight = False if key not in highlight_na or pkg.verLE(highlight_na[key]): continue self.simpleList(pkg, ui_overflow=True, highlight=highlight, columns=columns) yb = YumBaseCli() if os.geteuid() != 0: cachedir = yum.misc.getCacheDir() if cachedir is None: yb.logger.error("Error: Could not make cachedir, exiting") sys.exit(50) yb.repos.setCacheDir(cachedir) yb.repos.setProgressBar(TextMeter(fo=sys.stdout)) yb.repos.callback = output.CacheProgressCallback() for repo in yb.repos.findRepos('*'): if repo.id in ('fedora', 'updates', 'updates-testing'): repo.disable() continue if repo.id == 'rawhide': repo.enable() ypl = yb.returnPkgLists(['installed'] + sys.argv[1:], installed_available=True) columns = _list_cmd_calc_columns(yb, ypl) update_pkgs = {} for pkg in (ypl.hidden_available + ypl.reinstall_available + ypl.old_available): key = (pkg.name, pkg.arch) if key not in update_pkgs or pkg.verGT(update_pkgs[key]): update_pkgs[key] = pkg listPkgs(yb, ypl.installed, 'Newer Packages', update_pkgs, columns)