[yum-commits] 2 commits - cli.py output.py yumcommands.py yum/packages.py

Ville Skyttä scop at osuosl.org
Mon Jan 9 16:37:40 UTC 2012


 cli.py          |    4 -
 output.py       |    1 
 yum/packages.py |   17 ++---
 yumcommands.py  |  189 +++++++++++++++++++++++++++-----------------------------
 4 files changed, 101 insertions(+), 110 deletions(-)

New commits:
commit 9c3d1818a44f5c4bce65c2e806c8ed5f3a9c0fd3
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Sun Jan 8 16:32:10 2012 +0200

    Clean up some old "patch smallness" indentation hacks.

diff --git a/yum/packages.py b/yum/packages.py
index 15316c8..6bc909e 100644
--- a/yum/packages.py
+++ b/yum/packages.py
@@ -534,15 +534,14 @@ class RpmBase(object):
             if prcotuple in self._prco_lookup[prcotype]:
                 return 1
 
-        if True: # Keep indentation for patch smallness...
-            # make us look it up and compare
-            (reqn, reqf, (reqe, reqv ,reqr)) = prcotuple
-            if reqf is not None:
-                return self.inPrcoRange(prcotype, prcotuple)
-            else:
-                for (n, f, (e, v, r)) in self.returnPrco(prcotype):
-                    if i18n.str_eq(reqn, n):
-                        return 1
+        # make us look it up and compare
+        (reqn, reqf, (reqe, reqv ,reqr)) = prcotuple
+        if reqf is not None:
+            return self.inPrcoRange(prcotype, prcotuple)
+        else:
+            for (n, f, (e, v, r)) in self.returnPrco(prcotype):
+                if i18n.str_eq(reqn, n):
+                    return 1
 
         return 0
 
diff --git a/yumcommands.py b/yumcommands.py
index 2526fda..d503585 100644
--- a/yumcommands.py
+++ b/yumcommands.py
@@ -1731,111 +1731,108 @@ class RepoListCommand(YumCommand):
                 ui_enabled = dhibeg + _('disabled') + hiend
                 ui_endis_wid = utf8_width(_('disabled'))
 
-            if True: # Here to make patch smaller, TODO: rm
-                if not verbose:
-                    rid = str(repo)
-                    if enabled and repo.metalink:
-                        mdts = repo.metalink_data.repomd.timestamp
-                        if mdts > repo.repoXML.timestamp:
-                            rid = '*' + rid
-                    cols.append((rid, repo.name,
-                                 (ui_enabled, ui_endis_wid), ui_num))
+            if not verbose:
+                rid = str(repo)
+                if enabled and repo.metalink:
+                    mdts = repo.metalink_data.repomd.timestamp
+                    if mdts > repo.repoXML.timestamp:
+                        rid = '*' + rid
+                cols.append((rid, repo.name,
+                             (ui_enabled, ui_endis_wid), ui_num))
+            else:
+                if enabled:
+                    md = repo.repoXML
                 else:
+                    md = None
+                out = [base.fmtKeyValFill(_("Repo-id      : "), repo),
+                       base.fmtKeyValFill(_("Repo-name    : "), repo.name)]
+
+                if force_show or extcmds:
+                    out += [base.fmtKeyValFill(_("Repo-status  : "),
+                                               ui_enabled)]
+                if md and md.revision is not None:
+                    out += [base.fmtKeyValFill(_("Repo-revision: "),
+                                               md.revision)]
+                if md and md.tags['content']:
+                    tags = md.tags['content']
+                    out += [base.fmtKeyValFill(_("Repo-tags    : "),
+                                               ", ".join(sorted(tags)))]
+
+                if md and md.tags['distro']:
+                    for distro in sorted(md.tags['distro']):
+                        tags = md.tags['distro'][distro]
+                        out += [base.fmtKeyValFill(_("Repo-distro-tags: "),
+                                                   "[%s]: %s" % (distro,
+                                                   ", ".join(sorted(tags))))]
+
+                if md:
+                    out += [base.fmtKeyValFill(_("Repo-updated : "),
+                                               time.ctime(md.timestamp)),
+                            base.fmtKeyValFill(_("Repo-pkgs    : "),ui_num),
+                            base.fmtKeyValFill(_("Repo-size    : "),ui_size)]
+
+                if hasattr(repo, '_orig_baseurl'):
+                    baseurls = repo._orig_baseurl
+                else:
+                    baseurls = repo.baseurl
+                if baseurls:
+                    out += [base.fmtKeyValFill(_("Repo-baseurl : "),
+                                               ", ".join(baseurls))]
+
+                if enabled:
+                    # This needs to be here due to the mirrorlists are
+                    # metalinks hack.
+                    repo.urls
+                if repo.metalink:
+                    out += [base.fmtKeyValFill(_("Repo-metalink: "),
+                                               repo.metalink)]
                     if enabled:
-                        md = repo.repoXML
-                    else:
-                        md = None
-                    out = [base.fmtKeyValFill(_("Repo-id      : "), repo),
-                           base.fmtKeyValFill(_("Repo-name    : "), repo.name)]
-
-                    if force_show or extcmds:
-                        out += [base.fmtKeyValFill(_("Repo-status  : "),
-                                                   ui_enabled)]
-                    if md and md.revision is not None:
-                        out += [base.fmtKeyValFill(_("Repo-revision: "),
-                                                   md.revision)]
-                    if md and md.tags['content']:
-                        tags = md.tags['content']
-                        out += [base.fmtKeyValFill(_("Repo-tags    : "),
-                                                   ", ".join(sorted(tags)))]
-
-                    if md and md.tags['distro']:
-                        for distro in sorted(md.tags['distro']):
-                            tags = md.tags['distro'][distro]
-                            out += [base.fmtKeyValFill(_("Repo-distro-tags: "),
-                                                       "[%s]: %s" % (distro,
-                                                       ", ".join(sorted(tags))))]
-
-                    if md:
-                        out += [base.fmtKeyValFill(_("Repo-updated : "),
-                                                   time.ctime(md.timestamp)),
-                                base.fmtKeyValFill(_("Repo-pkgs    : "),ui_num),
-                                base.fmtKeyValFill(_("Repo-size    : "),ui_size)]
-
-                    if hasattr(repo, '_orig_baseurl'):
-                        baseurls = repo._orig_baseurl
-                    else:
-                        baseurls = repo.baseurl
-                    if baseurls:
-                        out += [base.fmtKeyValFill(_("Repo-baseurl : "),
-                                                   ", ".join(baseurls))]
-
-                    if enabled:
-                        #  This needs to be here due to the mirrorlists are
-                        # metalinks hack.
-                        repo.urls
-                    if repo.metalink:
-                        out += [base.fmtKeyValFill(_("Repo-metalink: "),
-                                                   repo.metalink)]
-                        if enabled:
-                            ts = repo.metalink_data.repomd.timestamp
-                            out += [base.fmtKeyValFill(_("  Updated    : "),
-                                                       time.ctime(ts))]
-                    elif repo.mirrorlist:
-                        out += [base.fmtKeyValFill(_("Repo-mirrors : "),
-                                                   repo.mirrorlist)]
-                    if enabled and repo.urls and not baseurls:
-                        url = repo.urls[0]
-                        if len(repo.urls) > 1:
-                            url += ' (%d more)' % (len(repo.urls) - 1)
-                        out += [base.fmtKeyValFill(_("Repo-baseurl : "),
-                                                   url)]
-
-                    if not os.path.exists(repo.metadata_cookie):
-                        last = _("Unknown")
-                    else:
-                        last = os.stat(repo.metadata_cookie).st_mtime
-                        last = time.ctime(last)
+                        ts = repo.metalink_data.repomd.timestamp
+                        out += [base.fmtKeyValFill(_("  Updated    : "),
+                                                   time.ctime(ts))]
+                elif repo.mirrorlist:
+                    out += [base.fmtKeyValFill(_("Repo-mirrors : "),
+                                               repo.mirrorlist)]
+                if enabled and repo.urls and not baseurls:
+                    url = repo.urls[0]
+                    if len(repo.urls) > 1:
+                        url += ' (%d more)' % (len(repo.urls) - 1)
+                    out += [base.fmtKeyValFill(_("Repo-baseurl : "), url)]
+
+                if not os.path.exists(repo.metadata_cookie):
+                    last = _("Unknown")
+                else:
+                    last = os.stat(repo.metadata_cookie).st_mtime
+                    last = time.ctime(last)
 
-                    if repo.metadata_expire <= -1:
-                        num = _("Never (last: %s)") % last
-                    elif not repo.metadata_expire:
-                        num = _("Instant (last: %s)") % last
-                    else:
-                        num = _num2ui_num(repo.metadata_expire)
-                        num = _("%s second(s) (last: %s)") % (num, last)
+                if repo.metadata_expire <= -1:
+                    num = _("Never (last: %s)") % last
+                elif not repo.metadata_expire:
+                    num = _("Instant (last: %s)") % last
+                else:
+                    num = _num2ui_num(repo.metadata_expire)
+                    num = _("%s second(s) (last: %s)") % (num, last)
 
-                    out += [base.fmtKeyValFill(_("Repo-expire  : "), num)]
+                out += [base.fmtKeyValFill(_("Repo-expire  : "), num)]
 
-                    if repo.exclude:
-                        out += [base.fmtKeyValFill(_("Repo-exclude : "),
-                                                   ", ".join(repo.exclude))]
+                if repo.exclude:
+                    out += [base.fmtKeyValFill(_("Repo-exclude : "),
+                                               ", ".join(repo.exclude))]
 
-                    if repo.includepkgs:
-                        out += [base.fmtKeyValFill(_("Repo-include : "),
-                                                   ", ".join(repo.includepkgs))]
+                if repo.includepkgs:
+                    out += [base.fmtKeyValFill(_("Repo-include : "),
+                                               ", ".join(repo.includepkgs))]
 
-                    if ui_excludes_num:
-                        out += [base.fmtKeyValFill(_("Repo-excluded: "),
-                                                   ui_excludes_num)]
+                if ui_excludes_num:
+                    out += [base.fmtKeyValFill(_("Repo-excluded: "),
+                                               ui_excludes_num)]
 
-                    if repo.repofile:
-                        out += [base.fmtKeyValFill(_("Repo-filename: "),
-                                                   repo.repofile)]
+                if repo.repofile:
+                    out += [base.fmtKeyValFill(_("Repo-filename: "),
+                                               repo.repofile)]
 
-                    base.verbose_logger.log(logginglevels.DEBUG_3,
-                                            "%s\n",
-                                            "\n".join(map(misc.to_unicode, out)))
+                base.verbose_logger.log(logginglevels.DEBUG_3, "%s\n",
+                                        "\n".join(map(misc.to_unicode, out)))
 
         if not verbose and cols:
             #  Work out the first (id) and last (enabled/disalbed/count),
commit 1f8acbd233bbd4e586d533a251fdfe46d4ecafdf
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Sun Jan 8 16:21:24 2012 +0200

    Remove some unused variables.

diff --git a/cli.py b/cli.py
index d5dcfaf..62705ad 100755
--- a/cli.py
+++ b/cli.py
@@ -512,7 +512,6 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
         rmpkgs = []
         stuff_to_download = False
         install_only = True
-        remove_only  = True
         for txmbr in self.tsInfo.getMembers():
             if txmbr.ts_state not in ('i', 'u'):
                 install_only = False
@@ -520,7 +519,6 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
                 if po:
                     rmpkgs.append(po)
             else:
-                remove_only = False
                 stuff_to_download = True
                 po = txmbr.po
                 if po:
@@ -868,7 +866,6 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
         else:
             # go through the userlist - look for items that are local rpms. If we find them
             # pass them off to installLocal() and then move on
-            localupdates = []
             for item in userlist:
                 if (item.endswith('.rpm') and (yum.misc.re_remote_url(item) or
                                                os.path.exists(item))):
@@ -1015,7 +1012,6 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
             1 = we've errored, exit with error string
             2 = we've got work yet to do, onto the next stage
         """
-        oldcount = len(self.tsInfo)
 
         all_rms = []
         for arg in userlist:
diff --git a/output.py b/output.py
index 01f0c40..d8af2fd 100755
--- a/output.py
+++ b/output.py
@@ -2528,7 +2528,6 @@ to exit.
         for old in self.history.old(tids, limit=limit):
             if limit is not None and num and (num +len(old.trans_data)) > limit:
                 break
-            last = None
 
             for hpkg in old.trans_data: # Find a pkg to go with each cmd...
                 if limit is None:


More information about the Yum-commits mailing list