mirror of
https://abf.rosa.ru/djam/urpm-tools.git
synced 2025-02-23 09:22:47 +00:00
LOG Added '-b' option to repomanage
This commit is contained in:
parent
4dc0eb3e56
commit
13ebb786de
5 changed files with 1008 additions and 976 deletions
|
@ -20,6 +20,8 @@ show help message and exit
|
|||
print the older packages
|
||||
.IP "\fB\-\-new, -n\fP"
|
||||
print the newest packages (this is the default behavior)
|
||||
.IP "\fB\-\-obsolete, -b\fP"
|
||||
report obsolete packages; packages that obsolete themselves are not taken into account
|
||||
.IP "\fB\-\-remove-old, -r\fP"
|
||||
remove older packages
|
||||
.IP "\fB\-\-space, -s\fP"
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -95,6 +95,8 @@ def parseargs(args):
|
|||
help=_('print the older packages'))
|
||||
group.add_argument("-n", "--new", default=False, action="store_true",
|
||||
help=_('print the newest packages (this is the default behavior)'))
|
||||
group.add_argument("-b", "--obsolete", default=False, action="store_true",
|
||||
help=_('report obsolete packages'))
|
||||
parser.add_argument("-r", "--remove-old", default=False, action="store_true",
|
||||
help=_('remove older packages'))
|
||||
parser.add_argument("-s", "--space", default=False, action="store_true",
|
||||
|
@ -124,6 +126,7 @@ def main(args):
|
|||
rpmList = getFileList(mydir, '.rpm', rpmList)
|
||||
verfile = {}
|
||||
pkgdict = {} # hold all of them - put them in (n,a) = [(e,v,r),(e1,v1,r1)]
|
||||
obsolete = {}
|
||||
|
||||
keepnum = int(options.keep)*(-1) # the number of items to keep
|
||||
|
||||
|
@ -145,6 +148,15 @@ def main(args):
|
|||
errorprint(msg)
|
||||
continue
|
||||
|
||||
if options.obsolete:
|
||||
obsolete_by_pkg = hdr[rpm.RPMTAG_OBSOLETENAME]
|
||||
for obs in obsolete_by_pkg:
|
||||
# Do not count packages obsoleted by themselves - let's leave this for rpmlint
|
||||
if hdr['name'] != obs:
|
||||
if obs not in obsolete:
|
||||
obsolete[obs] = []
|
||||
obsolete[obs].append(hdr['name'])
|
||||
|
||||
pkgtuple = miscutils.pkgDistTupleFromHeader(hdr)
|
||||
(n,a,e,v,r,d) = pkgtuple
|
||||
del hdr
|
||||
|
@ -173,8 +185,17 @@ def main(args):
|
|||
# a flag indicating that old packages were found
|
||||
old_found = 0
|
||||
|
||||
if options.obsolete:
|
||||
for (n,a) in pkgdict.keys():
|
||||
if n in obsolete:
|
||||
print n
|
||||
if options.verbose:
|
||||
print >> sys.stderr, n + " is obsoleted by:"
|
||||
for replacement in obsolete[n]:
|
||||
print >> sys.stderr, " " + replacement
|
||||
|
||||
#if new
|
||||
if not options.old:
|
||||
if options.new:
|
||||
for (n,a) in pkgdict.keys():
|
||||
evrlist = pkgdict[(n,a)]
|
||||
|
||||
|
|
Binary file not shown.
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue