[yum-commits] 4 commits - find-repos-of-install.py Makefile package-cleanup.py plugins/aliases plugins/auto-update-debuginfo plugins/basearchonly plugins/downloadonly plugins/fedorakmod plugins/filter-data plugins/kernel-module plugins/list-data plugins/protect-packages plugins/refresh-updatesd plugins/remove-with-leaves plugins/rpm-warm-cache plugins/skip-broken plugins/tmprepo plugins/verify repoclosure.py repodiff.py repo-graph.py repomanage.py repoquery.py test/yum-utils-pylintrc
Tim Lauridsen
timlau at osuosl.org
Sun Mar 29 10:19:10 UTC 2009
Makefile | 10 -
find-repos-of-install.py | 6
package-cleanup.py | 3
plugins/aliases/aliases.py | 4
plugins/auto-update-debuginfo/auto-update-debuginfo.py | 2
plugins/basearchonly/basearchonly.py | 87 +++++-----
plugins/downloadonly/downloadonly.py | 6
plugins/fedorakmod/fedorakmod.py | 28 +--
plugins/filter-data/filter-data.py | 5
plugins/kernel-module/kernel-module.py | 2
plugins/list-data/list-data.py | 1
plugins/protect-packages/protect-packages.py | 1
plugins/refresh-updatesd/refresh-updatesd.py | 2
plugins/remove-with-leaves/remove-with-leaves.py | 8
plugins/rpm-warm-cache/rpm-warm-cache.py | 6
plugins/skip-broken/skip-broken.conf | 4
plugins/skip-broken/skip-broken.py | 141 -----------------
plugins/tmprepo/tmprepo.py | 6
plugins/verify/verify.py | 3
repo-graph.py | 1
repoclosure.py | 4
repodiff.py | 12 -
repomanage.py | 22 +-
repoquery.py | 12 -
test/yum-utils-pylintrc | 21 +-
25 files changed, 117 insertions(+), 280 deletions(-)
New commits:
commit e55c051526055aa9493e74d4b5d57589bcecd6ec
Author: Tim Lauridsen <timlau at fedoraproject.org>
Date: Sun Mar 29 12:13:31 2009 +0200
* 'make pylint' now check all python files.
* Make the pylint profile more sane and excluded the most stupid warnings
* fix a lot of pylint warning and errors, so 'make pylint' now runs without
any messsages and a 10/10 score. so 'make pylint' can be used to catch syntax
error like in the one fixed in 8ec41e7c3ccbc3ecd74cbc87f2550e330b3b5be3
diff --git a/Makefile b/Makefile
index 1b7168f..9509cbc 100644
--- a/Makefile
+++ b/Makefile
@@ -8,6 +8,8 @@ SRPM_RELEASE=$(shell awk '/Release:/ { split($$2,a,"%"); print a[1] }' ${PKGNAME
SRPM_FILE = ${PKGNAME}-${VERSION}-${SRPM_RELEASE}.src.rpm
WEBHOST = yum.baseurl.org
WEBPATH = /srv/projects/yum/web/download/yum-utils/
+PY_FILES = $(wildcard *.py) $(wildcard plugins/*/*.py)
+
NMPROG=yum-NetworkManager-dispatcher
NMPATH=$(DESTDIR)/etc/NetworkManager/dispatcher.d
@@ -85,12 +87,6 @@ ChangeLog: FORCE
@git log --pretty --numstat --summary | ./tools/git2cl > ChangeLog
pylint:
- @pylint --rcfile=test/yum-utils-pylintrc \
- yumdownloader.py yum-complete-transaction.py yum-debug-dump.py yum-builddep.py \
- debuginfo-install.py package-cleanup.py yum-groups-manager.py verifytree.py \
- repotrack.py reposync.py \
- plugins/remove-with-leaves/remove-with-leaves.py \
- plugins/upgrade-helper/upgrade-helper.py \
- plugins/security/security.py \
+ @pylint --rcfile=test/yum-utils-pylintrc $(PY_FILES)
FORCE:
diff --git a/find-repos-of-install.py b/find-repos-of-install.py
index b3bad60..7a9235b 100644
--- a/find-repos-of-install.py
+++ b/find-repos-of-install.py
@@ -92,9 +92,9 @@ if True:
repo.disable()
if opts.enablerepos:
- for repo_match in opts.enablerepos:
- for repo in my.repos.findRepos(repo_match):
- repo.enable()
+ for repo_match in opts.enablerepos:
+ for repo in my.repos.findRepos(repo_match):
+ repo.enable()
diff --git a/plugins/aliases/aliases.py b/plugins/aliases/aliases.py
index dbbbd2a..7a730e6 100644
--- a/plugins/aliases/aliases.py
+++ b/plugins/aliases/aliases.py
@@ -140,9 +140,7 @@ class AliasCommand(AliasedCommand):
def config_hook(conduit):
- global aliases
- global conffile
- global recursive
+ global aliases, conffile, recursive
conffile = conduit.confString('main', 'conffile',
default='/etc/yum/aliases.conf')
diff --git a/plugins/auto-update-debuginfo/auto-update-debuginfo.py b/plugins/auto-update-debuginfo/auto-update-debuginfo.py
index e1dfa21..1350673 100644
--- a/plugins/auto-update-debuginfo/auto-update-debuginfo.py
+++ b/plugins/auto-update-debuginfo/auto-update-debuginfo.py
@@ -19,7 +19,7 @@
# This plugin enables the debuginfo repos. if you have a debuginfo rpm
# installed.
-from yum.plugins import PluginYumExit, TYPE_CORE
+from yum.plugins import TYPE_CORE
requires_api_version = '2.1'
plugin_type = (TYPE_CORE,)
diff --git a/plugins/basearchonly/basearchonly.py b/plugins/basearchonly/basearchonly.py
index e48bfc0..1acebce 100644
--- a/plugins/basearchonly/basearchonly.py
+++ b/plugins/basearchonly/basearchonly.py
@@ -26,57 +26,56 @@ plugin_type = TYPE_INTERACTIVE
def exclude_hook(conduit):
- """ Only install i386 packages when told to do so """
- if os.uname()[-1] == 'x86_64':
- basearch(conduit, "x86", "i?86$")
-
- """ Only install ppc64 packages when told to do so """
- if os.uname()[-1] == 'ppc64':
- basearch(conduit, "ppc", "ppc64$")
+ # Only install i386 packages when told to do so
+ if os.uname()[-1] == 'x86_64':
+ basearch(conduit, "x86", "i?86$")
+
+ # Only install ppc64 packages when told to do so
+ if os.uname()[-1] == 'ppc64':
+ basearch(conduit, "ppc", "ppc64$")
- """ Only install sparc64 packages when told to do so """
- if os.uname()[-1] == 'sparc64':
- basearch(conduit, "sparc", "sparc64$")
+ # Only install sparc64 packages when told to do so
+ if os.uname()[-1] == 'sparc64':
+ basearch(conduit, "sparc", "sparc64$")
def basearch(conduit, barch, excludearchP):
-
- exclude = []
- whitelist = []
- skippkg = 0
- conf , cmd = conduit.getCmdLine()
-
- if not cmd:
- return
+
+ exclude = []
+ whitelist = []
+ skippkg = 0
+ conf , cmd = conduit.getCmdLine()
+
+ if not cmd:
+ return
- if cmd[0] != "install":
- return
+ if cmd[0] != "install":
+ return
- packageList = conduit.getPackages()
- excludearch = re.compile(excludearchP);
+ packageList = conduit.getPackages()
+ excludearch = re.compile(excludearchP)
- """ get whitelist from config file """
-
- conflist = conduit.confString(barch, 'whitelist')
- if conflist:
- tmp = conflist.split(",")
- for confitem in tmp:
- whitelist.append(confitem.strip())
-
- """ decide which packages we want to exclude """
+ """ get whitelist from config file """
+
+ conflist = conduit.confString(barch, 'whitelist')
+ if conflist:
+ tmp = conflist.split(",")
+ for confitem in tmp:
+ whitelist.append(confitem.strip())
+
+ """ decide which packages we want to exclude """
- for userpkg in cmd:
- skippkg = 0
- for wlpkg in whitelist:
- if fnmatch(userpkg,wlpkg):
- skippkg = 1
- if not skippkg and not excludearch.search(userpkg):
+ for userpkg in cmd:
+ skippkg = 0
+ for wlpkg in whitelist:
+ if fnmatch(userpkg,wlpkg):
+ skippkg = 1
+ if not skippkg and not excludearch.search(userpkg):
exclude.append(userpkg)
- """ exclude the packages """
-
- for pkg in packageList:
- if pkg.name in exclude and excludearch.search(pkg.arch):
- conduit.delPackage(pkg)
- conduit.info(3, "--> excluded %s.%s" % (pkg.name, pkg.arch))
-
+ """ exclude the packages """
+
+ for pkg in packageList:
+ if pkg.name in exclude and excludearch.search(pkg.arch):
+ conduit.delPackage(pkg)
+ conduit.info(3, "--> excluded %s.%s" % (pkg.name, pkg.arch))
diff --git a/plugins/downloadonly/downloadonly.py b/plugins/downloadonly/downloadonly.py
index 8bbf7bb..b3348d6 100644
--- a/plugins/downloadonly/downloadonly.py
+++ b/plugins/downloadonly/downloadonly.py
@@ -32,9 +32,9 @@ def config_hook(conduit):
def postreposetup_hook(conduit):
opts, commands = conduit.getCmdLine()
if opts.dldir:
- repos = conduit.getRepos();
- list = repos.listEnabled();
- for repo in list:
+ repos = conduit.getRepos()
+ rlist = repos.listEnabled()
+ for repo in rlist:
repo.setAttribute('pkgdir',opts.dldir)
diff --git a/plugins/fedorakmod/fedorakmod.py b/plugins/fedorakmod/fedorakmod.py
index d9fcc4b..cfa6022 100644
--- a/plugins/fedorakmod/fedorakmod.py
+++ b/plugins/fedorakmod/fedorakmod.py
@@ -24,7 +24,7 @@ import os
import rpmUtils
from yum import packages
from yum.constants import TS_INSTALL
-from yum.plugins import TYPE_CORE, PluginYumExit
+from yum.plugins import TYPE_CORE
from rpm import RPMPROB_FILTER_OLDPACKAGE
requires_api_version = '2.4'
@@ -52,13 +52,13 @@ def getRunningKernel():
return ('kernel-%s' % os.uname()[4], 'EQ', ('0', v, r))
return None
-def _whatProvides(c, list):
+def _whatProvides(c, provides):
"""Return a list of POs of installed kernels."""
bag = []
rpmdb = c.getRpmDB()
- for i in list:
+ for i in provides:
tuples = rpmdb.whatProvides(i, None, None)
for pkgtuple in tuples:
# XXX: what do we do for duplicate packages?
@@ -115,7 +115,7 @@ def resolveVersions(packageList):
We return a dict of kernel version -> list of kmod POs
where the list contains only one PO for each kmod name"""
- dict = {}
+ pdict = {}
for po in packageList:
kernel = getKernelReqs(po)
if len(kernel) == 0:
@@ -140,21 +140,21 @@ def resolveVersions(packageList):
continue
po.kmodName = name[0]
- if not dict.has_key(kernel):
- dict[kernel] = [po]
+ if not pdict.has_key(kernel):
+ pdict[kernel] = [po]
else:
sameName = None
- for tempPo in dict[kernel]:
+ for tempPo in pdict[kernel]:
if po.name == tempPo.name:
sameName = tempPo
break
if sameName and packages.comparePoEVR(sameName, po) < 0:
- dict[kernel].remove(sameName)
- dict[kernel].append(po)
+ pdict[kernel].remove(sameName)
+ pdict[kernel].append(po)
elif sameName is None:
- dict[kernel].append(po)
+ pdict[kernel].append(po)
- return dict
+ return pdict
def installKernelModules(c, newModules, installedModules):
"""Figure out what special magic needs to be done to install/upgrade
@@ -227,7 +227,7 @@ def pinKernels(c, newKernels, installedKernels, modules):
c.getTsInfo().remove(kpo.pkgtup)
def installAllKmods(c, avaModules, modules, kernels):
- list = []
+ plist = []
names = []
interesting = []
@@ -259,9 +259,9 @@ def installAllKmods(c, avaModules, modules, kernels):
for po in table[kernel]:
if po not in modules:
c.getTsInfo().addTrueInstall(po)
- list.append(po)
+ plist.append(po)
- return list
+ return plist
def tsCheck(te):
"Make sure this transaction element is sane."
diff --git a/plugins/filter-data/filter-data.py b/plugins/filter-data/filter-data.py
index fa525fa..e48d3d9 100644
--- a/plugins/filter-data/filter-data.py
+++ b/plugins/filter-data/filter-data.py
@@ -26,7 +26,8 @@
# yum --filter-groups='App*/Sys*' list updates
from yum.plugins import TYPE_INTERACTIVE
-from yum.misc import to_unicode, to_utf8, to_str
+from yum.misc import to_utf8, to_str
+from optparse import OptionValueError
import fnmatch
@@ -443,7 +444,7 @@ def config_hook(conduit):
rang = val.split("-")
if len(rang) > 2:
msg = "%s was passed an invalid range: %s" % (attrs, val)
- raise OptionValueError, msg
+ raise OptionValueError(msg)
if len(rang) < 2:
rang = (rang[0], rang[0])
else:
diff --git a/plugins/kernel-module/kernel-module.py b/plugins/kernel-module/kernel-module.py
index 211d246..1bae1f6 100644
--- a/plugins/kernel-module/kernel-module.py
+++ b/plugins/kernel-module/kernel-module.py
@@ -17,9 +17,7 @@
#
# by Panu Matilainen <pmatilai at laiskiainen.org>
-from yum.plugins import PluginYumExit
from yum.misc import unique
-from yum.packages import YumInstalledPackage
from yum.plugins import TYPE_CORE
requires_api_version = '2.1'
diff --git a/plugins/list-data/list-data.py b/plugins/list-data/list-data.py
index f0cd8d4..37ea7fc 100755
--- a/plugins/list-data/list-data.py
+++ b/plugins/list-data/list-data.py
@@ -25,7 +25,6 @@
# yum list-groups updates
-import yum
import types
from yum.plugins import TYPE_INTERACTIVE
import logging # for commands
diff --git a/plugins/protect-packages/protect-packages.py b/plugins/protect-packages/protect-packages.py
index 668aa36..f98c290 100644
--- a/plugins/protect-packages/protect-packages.py
+++ b/plugins/protect-packages/protect-packages.py
@@ -35,7 +35,6 @@ use the --override-protection command-line option.
from yum.plugins import TYPE_CORE, TYPE_INTERACTIVE, PluginYumExit
-import sys
import os
import string
import glob
diff --git a/plugins/refresh-updatesd/refresh-updatesd.py b/plugins/refresh-updatesd/refresh-updatesd.py
index d4ffb70..edad67f 100644
--- a/plugins/refresh-updatesd/refresh-updatesd.py
+++ b/plugins/refresh-updatesd/refresh-updatesd.py
@@ -26,7 +26,7 @@ def posttrans_hook(conduit):
Tell yum-updatesd to refresh its state. Run only after an rpm transaction.
"""
if os.geteuid(): # If we aren't root, we _can't_ have updated anything
- return
+ return
try:
bus = dbus.SystemBus()
diff --git a/plugins/rpm-warm-cache/rpm-warm-cache.py b/plugins/rpm-warm-cache/rpm-warm-cache.py
index 93e7243..edabb5a 100644
--- a/plugins/rpm-warm-cache/rpm-warm-cache.py
+++ b/plugins/rpm-warm-cache/rpm-warm-cache.py
@@ -20,7 +20,7 @@
# in order to improve database reads later on.
# Don't use this if you're short on memory, anyways.
-from yum.plugins import PluginYumExit, TYPE_CORE
+from yum.plugins import TYPE_CORE
from os import walk, path
requires_api_version = '2.1'
@@ -37,8 +37,8 @@ def postreposetup_hook(conduit):
cmd.startswith('list') or cmd.startswith('info')):
try:
for root, dirs, files in walk('/var/lib/rpm'):
- for file in files:
- f = open(path.join(root, file))
+ for fn in files:
+ f = open(path.join(root, fn))
d = f.read(1024*1024)
while(len(d) > 0):
d = f.read(1024*1024)
diff --git a/plugins/skip-broken/skip-broken.conf b/plugins/skip-broken/skip-broken.conf
deleted file mode 100644
index f131e95..0000000
--- a/plugins/skip-broken/skip-broken.conf
+++ /dev/null
@@ -1,4 +0,0 @@
-[main]
-enabled = 1
-check_always = 0
-
diff --git a/plugins/skip-broken/skip-broken.py b/plugins/skip-broken/skip-broken.py
deleted file mode 100644
index 50c1180..0000000
--- a/plugins/skip-broken/skip-broken.py
+++ /dev/null
@@ -1,141 +0,0 @@
-# A plugin for yum, there checks each packages in the transaction
-# for depency errors and remove package with errors from transaction
-#
-# the plugin will only be active if yum is started with the '--ignore-broken'
-# Option.
-#
-# Ex.
-# yum --skip-broken install foo
-#
-# 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 General Public License for more details.
-#
-# version 0.25 by Tim Lauridsen <tla at rasmil dot dk>
-
-from yum.constants import *
-from yum.plugins import TYPE_CORE
-import copy
-requires_api_version = '2.1'
-plugin_type = (TYPE_CORE,)
-
-class CheckDependency:
- '''
- This class checks if dependencies can be resolved for each package in
- the yum transaction set
- '''
- def __init__(self,base,log=None):
- self.base = base
- self.logger = log
-
- def resetTs(self):
- '''Clear the current tsInfo Transaction Set'''
- # clear current tsInfo, we want a empty one.
- # FIXME: Dirty Hack, remove it later when then problem dont occour any more.
- # remove depsolver cache.
- if hasattr(self,"dcobj"):
- del self.dcobj
- del self.base.tsInfo
- self.base.tsInfo # make the new one magically appear
- self.base.initActionTs()
-
- def preDepCheck(self):
- '''
- Check if if each member in self.tsInfo can be depsolved
- without errors.
- '''
- # make a copy of the current self.tsInfo
- saveTs = copy.copy(self.base.tsInfo)
- goodlist = []
- badlist = []
- self.resetTs()
- goodTs = copy.copy(self.base.tsInfo)
- for txmbr in saveTs:
- # check if the member already has been marked as ok
- if goodTs.exists(txmbr.po.pkgtup):
- continue
- self.resetTs()
- po = txmbr.po
- state = txmbr.output_state
- self.logger(2,"**** Checking for dep problems : %s " % str(txmbr.po))
- self.base.tsInfo.add(txmbr)
- (rescode, restring) = self.base.resolveDeps()
- # Did the resolveDeps want ok ?
- if rescode == 2:
- # transfer all member in this transaction to a good ts.
- for good in self.base.tsInfo:
- if not goodTs.exists(good.po.pkgtup):
- self.logger(2,"**** OK : %s" % str(good))
- goodTs.add(good)
- goodlist.append(txmbr)
- else:
- self.logger(2,"**** Failed ")
- for err in restring:
- self.logger(2,"**** %s " % err)
- badlist.append([txmbr,restring])
- # Restore self.tsInfo
- self.resetTs()
- self.base.tsInfo = goodTs
- return goodlist,badlist
-
- def dumpTsInfo(self):
- ''' show the packages in self.tsInfo '''
- for txmbr in self.base.tsInfo:
- if self.logger:
- self.logger(3," --> %-50s - action : %s" % (txmbr.po,txmbr.ts_state))
- else:
- print " --> %-50s - action : %s" % (txmbr.po,txmbr.ts_state)
-
-
-
-def config_hook(conduit):
- '''
- Yum Plugin Config Hook:
- Setup the option parser with the '--skip-broken' command line option
- '''
- global check_always
- # Get 'check_always' option from plugin conf
- check_always = conduit.confBool('main', 'check_always', default=False)
-
- parser = conduit.getOptParser()
- if parser:
- parser.add_option("", "--skip-broken", dest="skipbroken",
- action="store_true", default=False,
- help="skip packages with broken dependencies")
-
-def preresolve_hook(conduit):
- '''
- Yum Plugin PreResolve Hook:
- Check and remove packages with dependency problems
- only runs if then '--skip-broken' was set.
- '''
- opts, commands = conduit.getCmdLine()
- if hasattr(opts,'skipbroken'):
- if opts.skipbroken or check_always:
- # get yum base
- conduit.info(2,'**** Checking packages for dependency problems')
- base = conduit._base
- cd = CheckDependency(base,conduit.info)
- cd.dumpTsInfo()
- (good,bad) = cd.preDepCheck()
- #tsInfo = base.tsInfo
- conduit.info(2,"**** Packages with dependency resolving errors ")
-
- for txmbr,err in bad:
- # Removing bad packages for self.tsInfo
- #tsInfo.remove(txmbr.po.pkgtup)
- conduit.info(2,"**** %s " % txmbr.po)
- for e in err:
- conduit.info(2,"**** %s " % 2)
- for txmbr in good:
- conduit.info(3,"**** %s completed dependency resolving " % txmbr.po)
- # Show the current state of y.tsInfo
- conduit.info(2,'**** End Checking packages for dependency problems')
- #cd.dumpTsInfo()
-
diff --git a/plugins/tmprepo/tmprepo.py b/plugins/tmprepo/tmprepo.py
index d35ba19..fd38eed 100644
--- a/plugins/tmprepo/tmprepo.py
+++ b/plugins/tmprepo/tmprepo.py
@@ -21,13 +21,9 @@
#
# yum --tmprepo=http://example.com/foo/bar.repo ...
-import yum
-import types
from yum.plugins import TYPE_INTERACTIVE
import logging # for commands
-from yum import logginglevels
-import logging
import urlgrabber.grabber
import tempfile
import os
@@ -160,6 +156,8 @@ rpgpgcheck = True # Remote
rrgpgcheck = True # Remote
lpgpgcheck = True
lrgpgcheck = False
+def_tmp_repos_cleanup = False
+
def config_hook(conduit):
'''
Yum Plugin Config Hook:
diff --git a/plugins/verify/verify.py b/plugins/verify/verify.py
index 134fa37..23b197c 100644
--- a/plugins/verify/verify.py
+++ b/plugins/verify/verify.py
@@ -26,8 +26,6 @@
# yum verify extras
-import yum
-import types
from yum.plugins import TYPE_INTERACTIVE
import logging # for commands
from yum import logginglevels
@@ -137,6 +135,7 @@ _verify_missing = ['missing', 'permissions-missing','genchecksum']+_verify_none
_verify_low = ['mtime', 'genchecksum', 'permissions-missing'] +_verify_none
_verify_onohi = ['mtime', 'checksum']
_verify_nnohi = ['mtime', 'checksum']
+_verify_configs = False
class VerifyCommand:
diff --git a/repo-graph.py b/repo-graph.py
index 1a4ea4e..e4f0de8 100755
--- a/repo-graph.py
+++ b/repo-graph.py
@@ -19,7 +19,6 @@
# $ ./repo-graph.py --repoid=base > foo.dot
# $ neato -v -Gmaxiter=2000 -x -Gcenter=false -Goverlap=scale -Tps2 -o foo.ps foo.dot
-import sys
import yum
from yum.misc import getCacheDir
from optparse import OptionParser
diff --git a/repoclosure.py b/repoclosure.py
index 0509fd3..a5aed44 100755
--- a/repoclosure.py
+++ b/repoclosure.py
@@ -77,11 +77,11 @@ class RepoClosure(yum.YumBase):
self.repos.sqlite = False
self.repos._selectSackType()
- def evrTupletoVer(self,tuple):
+ def evrTupletoVer(self,tup):
"""convert and evr tuple to a version string, return None if nothing
to convert"""
- e, v,r = tuple
+ e, v,r = tup
if v is None:
return None
diff --git a/repodiff.py b/repodiff.py
index 0ad3544..cad3a35 100755
--- a/repodiff.py
+++ b/repodiff.py
@@ -15,9 +15,8 @@
# (c) 2007 Red Hat. Written by skvidal at fedoraproject.org
import yum
-import rpmUtils
import sys
-import time, datetime
+import datetime
import os
import locale
from yum.misc import to_unicode
@@ -136,7 +135,7 @@ def parseArgs(args):
archlist = ['src']
for a in opts.archlist:
for arch in a.split(','):
- archlist.append(arch)
+ archlist.append(arch)
opts.archlist = archlist
@@ -205,9 +204,9 @@ def main(args):
oldtime = oldlogs[0][0]
clogdelta = []
for (t, author, content) in pkg.changelog:
- if t > oldtime:
- msg += "* %s %s\n%s\n\n" % (datetime.date.fromtimestamp(int(t)).strftime("%a %b %d %Y"),
- to_unicode(author), to_unicode(content))
+ if t > oldtime:
+ msg += "* %s %s\n%s\n\n" % (datetime.date.fromtimestamp(int(t)).strftime("%a %b %d %Y"),
+ to_unicode(author), to_unicode(content))
if opts.size:
sizechange = int(pkg.size) - int(oldpkg.size)
total_sizechange += sizechange
@@ -226,7 +225,6 @@ def main(args):
if __name__ == "__main__":
- import locale
# This test needs to be before locale.getpreferredencoding() as that
# does setlocale(LC_CTYPE, "")
try:
diff --git a/repomanage.py b/repomanage.py
index 1eaffae..e2582ec 100755
--- a/repomanage.py
+++ b/repomanage.py
@@ -25,10 +25,8 @@ import sys
import rpm
import fnmatch
import string
-import getopt
import rpmUtils
from yum import misc
-from exceptions import Exception
from optparse import OptionParser
@@ -59,8 +57,8 @@ def getFileList(path, ext, filelist):
filelist = getFileList(path + '/' + d, ext, filelist)
else:
if string.lower(d[-extlen:]) == '%s' % (ext):
- newpath = os.path.normpath(path + '/' + d)
- filelist.append(newpath)
+ newpath = os.path.normpath(path + '/' + d)
+ filelist.append(newpath)
return filelist
@@ -68,15 +66,15 @@ def getFileList(path, ext, filelist):
def trimRpms(rpms, excludeGlobs):
# print 'Pre-Trim Len: %d' % len(rpms)
badrpms = []
- for file in rpms:
+ for fn in rpms:
for glob in excludeGlobs:
- if fnmatch.fnmatch(file, glob):
- # print 'excluded: %s' % file
- if file not in badrpms:
- badrpms.append(file)
- for file in badrpms:
- if file in rpms:
- rpms.remove(file)
+ if fnmatch.fnmatch(fn, glob):
+ # print 'excluded: %s' % fn
+ if fn not in badrpms:
+ badrpms.append(fn)
+ for fn in badrpms:
+ if fn in rpms:
+ rpms.remove(fn)
# print 'Post-Trim Len: %d' % len(rpms)
return rpms
diff --git a/repoquery.py b/repoquery.py
index 6cbd92c..ee9322b 100755
--- a/repoquery.py
+++ b/repoquery.py
@@ -252,10 +252,10 @@ class repoPkgQuery(pkgQuery):
def files(self, **kw):
fdict = {}
for ftype in self.pkg.returnFileTypes():
- for file in self.pkg.returnFileEntries(ftype):
+ for fn in self.pkg.returnFileEntries(ftype):
# workaround for yum returning double leading slashes on some
# directories - posix allows that but it looks a bit odd
- fdict[os.path.normpath('//%s' % file)] = None
+ fdict[os.path.normpath('//%s' % fn)] = None
files = fdict.keys()
files.sort()
return files
@@ -355,7 +355,7 @@ class groupQuery:
elif t == "all":
pkgs.extend(self.group.packages)
else:
- raise "Unknown group package type %s" % t
+ raise queryError("Unknown group package type %s" % t)
return pkgs
@@ -813,9 +813,9 @@ def main(args):
repo.disable()
if opts.enablerepos:
- for repo_match in opts.enablerepos:
- for repo in repoq.repos.findRepos(repo_match):
- repo.enable()
+ for repo_match in opts.enablerepos:
+ for repo in repoq.repos.findRepos(repo_match):
+ repo.enable()
try:
repoq.doRepoSetup()
diff --git a/test/yum-utils-pylintrc b/test/yum-utils-pylintrc
index 6d0ff89..f790db8 100644
--- a/test/yum-utils-pylintrc
+++ b/test/yum-utils-pylintrc
@@ -53,27 +53,28 @@ disable-msg-cat=C,R
#enable-msg=
# Disable the message(s) with the given id(s).
-# C0324: *Comma not followed by a space*
-# C0301: *Line too long (%s/%s)*
-# C0111: *Missing docstring* (to bad, but off for now)
# E1101: *%s %r has no %r member* (The init-hook for do sys.path manipulation don't, so we cant find the utils module)
# F0401: *Unable to import %r (%s)* (See above)
-# R0201: *Method could be a function* (dont care is self is used inside a function)
# W0704: *Except doesn't do anything* ( Except xxxxxx,e : pass is ok)
# W0612: *Unused variable %r* ( dont care if x,y,z = f() and y,z is not used)
# W0212: *Access to a protected member %s of a client class* (if sucks, but we do that a lot)
-# R0801: *Similar lines in %s files* (this is fine, some utils look alike)
# W0613: *Unused argument %r*
-# R0912: *Too many branches (%s/%s)*
-# R0915: *Too many statements (%s/%s)*
# W0602: *Using global for %r but no assigment is done*
# W0511: Used when a warning note as FIXME or XXX is detected
-# C0321: *More than one statement on a single line*
# W0401: *Wildcard import %s*
# W0614: *Unused import %s from wildcard import*
# W0232: *Class has no __init__ method*
# W0201: *Attribute %r defined outside __init__*
-disable-msg=C0324,C0301,C0111,E1101,F0401,R0201,W0704,W0612,W0212,R0801,W0613,R0912,R0915,W0602,W0511,C0321,W0401,W0614,W0232,W0201
+# W0603: *Using the global statement*
+# W0621: *Redefining name %r from outer scope (line %s)*
+# W0142: *Used * or ** magic*
+# W0102: *Dangerous default value %s as argument*
+# W0105: *String statement has no effect*
+# W0702: *No exception type(s) specified*
+# W0231: *__init__ method from base class %r is not called*
+# E0202: *An attribute inherited from %s hide this method*
+# W0622: *Redefining built-in %r*
+disable-msg=E1101,F0401,W0704,W0612,W0212,W0613,W0602,W0511,W0401,W0614,W0232,W0201,W0603,W0621,W0142,W0102,W0105,W0702,W0231,E0202,W0622
[REPORTS]
commit 93f57712e054875cd8ee4693de4f64f1fab45274
Author: Tim Lauridsen <timlau at fedoraproject.org>
Date: Sun Mar 29 10:24:20 2009 +0200
minor pylint cleanup
diff --git a/plugins/remove-with-leaves/remove-with-leaves.py b/plugins/remove-with-leaves/remove-with-leaves.py
index d7065b7..3b26914 100644
--- a/plugins/remove-with-leaves/remove-with-leaves.py
+++ b/plugins/remove-with-leaves/remove-with-leaves.py
@@ -38,6 +38,8 @@ _requires_cache = {}
ignore_list = ['glibc', 'bash', 'libgcc']
exclude_bin = False
+remove_always = False
+
def _requires_this_package(rpmdb, pkg):
if _requires_cache.has_key(pkg):
@@ -61,8 +63,7 @@ def _requires_this_package(rpmdb, pkg):
def postresolve_hook(conduit):
- global exclude_bin
- global remove_always
+ global exclude_bin, remove_always
opts, commands = conduit.getCmdLine()
if hasattr(opts,'exclude_bin'):
if exclude_bin or opts.exclude_bin:
@@ -105,8 +106,7 @@ def postresolve_hook(conduit):
conduit._base.remove(pkg)
def config_hook(conduit):
- global exclude_bin
- global remove_always
+ global exclude_bin, remove_always
exclude_bin = conduit.confBool('main', 'exclude_bin', default=False)
remove_always = conduit.confBool('main', 'remove_always', default=False)
parser = conduit.getOptParser()
commit 5fad492a355faaeee2e573517f6d36b45fee2c70
Author: Tim Lauridsen <timlau at fedoraproject.org>
Date: Sun Mar 29 09:43:50 2009 +0200
Fix pylint warning:
W:350: Bad indentation. Found 11 spaces, expected 12
W: 32: Unused import Errors
diff --git a/package-cleanup.py b/package-cleanup.py
index 7f9c878..f73061f 100755
--- a/package-cleanup.py
+++ b/package-cleanup.py
@@ -29,7 +29,6 @@ import re
from rpmUtils import miscutils, transaction
from optparse import OptionParser
-from yum import Errors
from yum.misc import getCacheDir
@@ -347,7 +346,7 @@ def removeKernels(my, count, confirmed, keepdevel, qf):
if '-' in runningkernel:
(kver,krel) = runningkernel.split('-')
if krel.split('.')[-1] == os.uname()[-1]:
- krel = ".".join(krel.split('.')[:-1])
+ krel = ".".join(krel.split('.')[:-1])
else:
kver = runningkernel
krel = ""
commit 43273c541a2f55f7506165fe0dda4aa4cca49a5f
Author: Tim Lauridsen <timlau at fedoraproject.org>
Date: Sun Mar 29 09:37:51 2009 +0200
make pylint conf more sane, dont show refactoring and convention errors
diff --git a/test/yum-utils-pylintrc b/test/yum-utils-pylintrc
index 762f217..6d0ff89 100644
--- a/test/yum-utils-pylintrc
+++ b/test/yum-utils-pylintrc
@@ -47,7 +47,7 @@ load-plugins=
#enable-msg-cat=
# Disable all messages in the listed categories.
-#disable-msg-cat=
+disable-msg-cat=C,R
# Enable the message(s) with the given id(s).
#enable-msg=
More information about the Yum-commits
mailing list