repodiff: new option '--no-release'

This commit is contained in:
icedphoenix 2012-09-13 19:03:17 +04:00
parent 657f8173b6
commit 04909f493a
9 changed files with 3516 additions and 2357 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
*~
*.mo

View file

@ -16,6 +16,8 @@ repositories.
"New" repository or list of "new" repositories if several present.
.IP "\fB\-\-quiet, -q\fP"
Quiet mode: hide service messages.
.IP "\fB\-\-no-release, -r\fP"
Ignore release during package compare.
.PP
.SH "USUAL OUTPUT OPTIONS"
.IP "\fB\-\-size, -s\fP"

File diff suppressed because it is too large Load diff

Binary file not shown.

File diff suppressed because it is too large Load diff

View file

@ -97,6 +97,8 @@ def ParseCommandLine():
help=_("Output in HTML format, if --output is not present\
\"%s\" will be created in current directory. \
--size, --simple and --changelog options are ignored.") % htmlname)
parser.add_argument("--no-release", "-r", action="store_true",
help=_("Ignore release during package compare."))
parser.add_argument("--output", "-out", action="store", nargs=1, default='',
metavar="OUTPUT_FILE", help=_("Change standart output to \"OUTPUT_FILE\"."))
return parser.parse_args()
@ -346,6 +348,7 @@ def ParseSynthesis(synthfile, pkgdict, arg):
s2[] - is list of obsoleted packages
"""
ifnotquiet = arg.quiet
ifreleaseignore = arg.no_release
if not os.path.isfile(synthfile):
print _("Error: Synthesis file %s was not found.") % synthfile
@ -368,9 +371,10 @@ def ParseSynthesis(synthfile, pkgdict, arg):
tmp[1] = '@'.join(tmpline[2:])
elif tag == synthtags[6]:
tmp[0] = tmpline[2:]
disttagepoch = ChkTagEpoch(tmp[0])
disttagepoch = ChkTagEpoch(tmp[0]) #disttag + distepoch
tmp[2] = ParseVersion(tmp[2])
(name, version, release) = RPMNameFilter(tmp[0][0], disttagepoch) #disttag + distepoch
(name, version, release) = RPMNameFilter(tmp[0][0],
disttagepoch, ifreleaseignore)
verrel = (version, release, tmp[0][1])
if(not name in pkgdict):
pkgdict[name]=(verrel, (tmp[0], tmp[1], tmp[2]))
@ -411,7 +415,7 @@ def ChkTagEpoch(i):
else:
print _("REPODIFF-Warning: strange <info>: ") + str(i)
def RPMNameFilter(rpmname, disttagepoch):
def RPMNameFilter(rpmname, disttagepoch, ifreleaseignore):
"""Parse name and verrel.
Function that parses name, version and release of a package.
@ -432,6 +436,8 @@ def RPMNameFilter(rpmname, disttagepoch):
name = '-'.join(string[:-2])
ver = string[-2]
rel = string[-1]
if ifreleaseignore:
rel = ""
return (name, ver, rel)
def compare_versions(first_entry, second_entry):
@ -1138,7 +1144,8 @@ def HTML_OutputHead(file_output):
'</head>\n' +\
'<body>\n\n')
def GetRepoInfo(dict_packages, packagename, lenold, lennew, list_dict_old, list_dict_new):
def GetRepoInfo(dict_packages, packagename, lenold, lennew, list_dict_old,
list_dict_new, ifreleaseignore):
"""Generate package-specific information.
Generates class and name to be displayed in the table.
@ -1146,10 +1153,13 @@ def GetRepoInfo(dict_packages, packagename, lenold, lennew, list_dict_old, list_
result1 = []
result2 = []
flag = 0
tmpstr = ""
for i in range(lenold):
if packagename in list_dict_old[i]:
result1.append(list_dict_old[i][packagename][0][0] + '-' +\
list_dict_old[i][packagename][0][1])
tmpstr = list_dict_old[i][packagename][0][0]
if not ifreleaseignore:
tmpstr = tmpstr + '-' + list_dict_old[i][packagename][0][1]
result1.append(tmpstr)
else:
result1.append("N/A")
result2.append('')
@ -1157,7 +1167,10 @@ def GetRepoInfo(dict_packages, packagename, lenold, lennew, list_dict_old, list_
tmplist = dict_packages[packagename]
tmpdict = {}
for (entry, reponum, entry_type) in dict_packages[packagename]:
tmpdict[reponum] = (entry[0][0] + '-' + entry[0][1], entry_type)
tmpstr = entry[0][0]
if not ifreleaseignore:
tmpstr = tmpstr + '-' + entry[0][1]
tmpdict[reponum] = (tmpstr, entry_type)
for i in range(lennew):
if(i not in tmpdict):
@ -1194,6 +1207,7 @@ def HTML_OutputBody(dict_packages, list_dict_old, list_dict_new, arg):
old = arg.old
new = arg.new
file_output = arg.output
ifreleaseignore = arg.no_release
file_output.write('<h1>Difference between repositories.</h1>\n' +\
'<p class="bold">The use of color coding in tables:</p>\n' +\
@ -1269,7 +1283,7 @@ def HTML_OutputBody(dict_packages, list_dict_old, list_dict_new, arg):
tmp_string = tmp_string + '<tr class="' + strtype + '">'
tmp_string = tmp_string + '<td>' + packagename + '</td>'
(repo_name, repo_class, flag) = GetRepoInfo(dict_packages, packagename,
lenold, lennew, list_dict_old, list_dict_new)
lenold, lennew, list_dict_old, list_dict_new, ifreleaseignore)
if flag:
if(repo_name[lenold] == "Removed"):
res = 0

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff