mirror of
https://abf.rosa.ru/djam/urpm-tools.git
synced 2025-02-23 17:32:46 +00:00
Merge conflicts
This commit is contained in:
commit
0e2998b3a1
9 changed files with 3943 additions and 2890 deletions
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
*~
|
||||
*.mo
|
||||
urpm-tools.pot
|
|
@ -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"
|
||||
|
@ -33,6 +35,15 @@ If \fB--output, -o\fP option is not present, page will be output to file 'repodi
|
|||
.SH "OUTPUT OPTION"
|
||||
.IP "\fB\-\-output, -o OUTPUT_FILE\fP"
|
||||
Change standart output to OUTPUT_FILE.
|
||||
.SH "FILTER OPTION"
|
||||
.IP "\fB\-\-show-new, -N\fP"
|
||||
Show new packages.
|
||||
.IP "\fB\-\-show-removed, -R\fP"
|
||||
Show removed packages.
|
||||
.IP "\fB\-\-show-updated, -U\fP"
|
||||
Show updated packages.
|
||||
.IP "\fB\-\-show-downgraded, -D\fP"
|
||||
Show downgraded packages.
|
||||
.SH "EXAMPLES"
|
||||
.IP "Compare packages in two local repositories:"
|
||||
\fBurpm-repodiff --old /tmp/repo-old --new /tmp/repo-new\fP
|
||||
|
|
File diff suppressed because it is too large
Load diff
1267
urpm-repoclosure.pl
1267
urpm-repoclosure.pl
File diff suppressed because it is too large
Load diff
453
urpm-repodiff.py
453
urpm-repodiff.py
|
@ -81,24 +81,49 @@ def ParseCommandLine():
|
|||
"""
|
||||
parser = argparse.ArgumentParser(
|
||||
description=_("Tool for comparing sets of repositories."))
|
||||
parser.add_argument("--old", "-o", action="store", nargs='+', required="True",
|
||||
group = parser.add_argument_group(_('global parameters'),
|
||||
description=_("Parameters used in all cases."))
|
||||
group.add_argument("--old", "-o", action="append", nargs='+', required="True",
|
||||
metavar="OLD_REPO", help=_("URL or PATH to old repositories"))
|
||||
parser.add_argument("--new", "-n", action="store", nargs='+', required="True",
|
||||
group.add_argument("--new", "-n", action="append", nargs='+', required="True",
|
||||
metavar="NEW_REPO", help=_("URL or PATH to new repositories"))
|
||||
parser.add_argument("--size", "-s", action="store_true",
|
||||
help=_("Show differences in package sizes."))
|
||||
parser.add_argument("--simple", action="store_false",
|
||||
help=_("Simple output format."))
|
||||
parser.add_argument("--quiet", "-q", action="store_false",
|
||||
group.add_argument("--quiet", "-q", action="store_false",
|
||||
help=_("Hide service messages."))
|
||||
parser.add_argument("--changelog", "-c", action="store_true",
|
||||
group.add_argument("--no-release", "-r", action="store_true",
|
||||
help=_("Ignore release during package compare."))
|
||||
group.add_argument("--show-summary", action="store_true",
|
||||
help=_("Output summary."))
|
||||
group.add_argument("--output", "-out", action="store", nargs=1, default='',
|
||||
metavar="OUTPUT_FILE", help=_("Change standart output to \"OUTPUT_FILE\"."))
|
||||
group.add_argument("--ignore", "-i", action="store", nargs=1, default='',
|
||||
metavar="IGNORELIST", help=_("File with list of ignored packages"))
|
||||
group = parser.add_argument_group(_('text mode parameters'),
|
||||
description=_("Parameters used only in text mode. (--html not present)"))
|
||||
group.add_argument("--size", "-s", action="store_true",
|
||||
help=_("Show differences in package sizes."))
|
||||
group.add_argument("--simple", action="store_false",
|
||||
help=_("Simple output format."))
|
||||
group.add_argument("--changelog", "-c", action="store_true",
|
||||
help=_("Show changelog difference."))
|
||||
parser.add_argument("--html", action="store_true",
|
||||
group = parser.add_argument_group(_('HTML mode parameters'),
|
||||
description=_("Parameters used only in HTML mode. (--html is present)"))
|
||||
group.add_argument("--html", action="store_true",
|
||||
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("--output", "-out", action="store", nargs=1, default='',
|
||||
metavar="OUTPUT_FILE", help=_("Change standart output to \"OUTPUT_FILE\"."))
|
||||
group.add_argument("--reponames", action="store", nargs='+', default='',
|
||||
metavar="REPONAME", help=_("Repository names for output."))
|
||||
group = parser.add_argument_group(_('Filters'),
|
||||
description=_("Filters for output. If none selected then every type will\
|
||||
be shown"))
|
||||
group.add_argument("--show-new", "-N", action="store_true",
|
||||
help=_("Show new packages"))
|
||||
group.add_argument("--show-removed", "-R", action="store_true",
|
||||
help=_("Show removed packages"))
|
||||
group.add_argument("--show-updated", "-U", action="store_true",
|
||||
help=_("Show updated packages"))
|
||||
group.add_argument("--show-downgraded", "-D", action="store_true",
|
||||
help=_("Show downgraded packages"))
|
||||
return parser.parse_args()
|
||||
|
||||
def exit_proc(arg):
|
||||
|
@ -200,12 +225,18 @@ def CheckOutput(arg):
|
|||
def CheckParam(arg):
|
||||
"""Check parameters.
|
||||
|
||||
Ignore some parameters in HTML-case.
|
||||
Ignore some parameters in HTML-mode. Ignore some parameters in text-mode.
|
||||
"""
|
||||
if arg.html:
|
||||
arg.size = 0
|
||||
arg.simple = 0
|
||||
arg.changelog = 0
|
||||
if (arg.reponames != '') and (len(arg.old) + len(arg.new) != len(arg.reponames)):
|
||||
print _("Error: number of REPONAME's(%s) are not equal to number of groups(%s)") % \
|
||||
(str(len(arg.reponames)), str(len(arg.old) + len(arg.new)))
|
||||
exit_proc(arg)
|
||||
else:
|
||||
arg.repnames = ''
|
||||
|
||||
def GetFile(urlpath, filename, localdir, arg):
|
||||
"""Donwload archive.
|
||||
|
@ -241,26 +272,77 @@ def GetFiles(arg):
|
|||
file_name = []
|
||||
file_path = []
|
||||
for i in range(len(arg.old)):
|
||||
for j in range(len(arg.old[i])):
|
||||
file_name.append(synthesis_arch)
|
||||
file_dir.append(arg.temp_old[i])
|
||||
file_path.append(arg.old[i] + "media_info/")
|
||||
file_dir.append(arg.temp_old[i][j])
|
||||
file_path.append(arg.old[i][j] + "media_info/")
|
||||
if ifchangelog:
|
||||
file_name.append(changelog_arch)
|
||||
file_dir.append(arg.temp_old[i])
|
||||
file_path.append(arg.old[i] + "media_info/")
|
||||
file_dir.append(arg.temp_old[i][j])
|
||||
file_path.append(arg.old[i][j] + "media_info/")
|
||||
|
||||
for i in range(len(arg.new)):
|
||||
for j in range(len(arg.new[i])):
|
||||
file_name.append(synthesis_arch)
|
||||
file_dir.append(arg.temp_new[i])
|
||||
file_path.append(arg.new[i] + "media_info/")
|
||||
file_dir.append(arg.temp_new[i][j])
|
||||
file_path.append(arg.new[i][j] + "media_info/")
|
||||
if ifchangelog:
|
||||
file_name.append(changelog_arch)
|
||||
file_dir.append(arg.temp_new[i])
|
||||
file_path.append(arg.new[i] + "media_info/")
|
||||
file_dir.append(arg.temp_new[i][j])
|
||||
file_path.append(arg.new[i][j] + "media_info/")
|
||||
|
||||
for i in range(len(file_name)):
|
||||
GetFile(file_path[i], file_name[i], file_dir[i], arg)
|
||||
|
||||
def ReadIgnoreList(arg):
|
||||
ignorefile = arg.ignore
|
||||
ignorelist = []
|
||||
if not os.path.isfile(ignorefile):
|
||||
print _("Error: file %s does not exist.") % ignorefile
|
||||
exit_proc(arg)
|
||||
try:
|
||||
ifile = open(ignorefile)
|
||||
for string in ifile:
|
||||
if string == '\n':
|
||||
continue
|
||||
if string.endswith('\n'):
|
||||
string = string[:-1]
|
||||
ignorelist.append(string)
|
||||
ifile.close()
|
||||
ignorelist.sort()
|
||||
except:
|
||||
print _("Error: file %s cannot be read.") % ignorefile
|
||||
exit_proc(arg)
|
||||
return ignorelist
|
||||
|
||||
def RemoveIgnored(dict_in, ignorelist):
|
||||
dict_out = {}
|
||||
sorted_list = sorted(dict_in)
|
||||
i = 0
|
||||
imax = len(sorted_list)
|
||||
j = 0
|
||||
jmax = len(ignorelist)
|
||||
while (i < imax) and (j < jmax):
|
||||
if ignorelist[j].endswith('*'):
|
||||
comp_str = ignorelist[j][:-1]
|
||||
while (i < imax) and (sorted_list[i] < comp_str):
|
||||
dict_out[sorted_list[i]] = dict_in[sorted_list[i]]
|
||||
i = i + 1
|
||||
while (i < imax) and sorted_list[i].startswith(comp_str):
|
||||
i = i + 1
|
||||
else:
|
||||
comp_str = ignorelist[j]
|
||||
while (i < imax) and (sorted_list[i] < comp_str):
|
||||
dict_out[sorted_list[i]] = dict_in[sorted_list[i]]
|
||||
i = i + 1
|
||||
if (i < imax) and (sorted_list[i] == comp_str):
|
||||
i = i + 1
|
||||
j = j + 1
|
||||
if (i < imax) and (j == jmax):
|
||||
for i in range(i, imax):
|
||||
dict_out[sorted_list[i]] = dict_in[sorted_list[i]]
|
||||
return dict_out
|
||||
|
||||
def RenameSynthFile(localdir, arg):
|
||||
"""Rename.
|
||||
|
||||
|
@ -346,6 +428,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
|
||||
|
@ -356,6 +439,8 @@ def ParseSynthesis(synthfile, pkgdict, arg):
|
|||
synth = open(synthfile)
|
||||
tmp = ['', '', '']
|
||||
for synthline in synth:
|
||||
if not synthline.startswith('@'):
|
||||
continue
|
||||
if synthline.endswith('\n'):
|
||||
synthline = synthline[:-1]
|
||||
tmpline = synthline.split('@')
|
||||
|
@ -366,9 +451,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]))
|
||||
|
@ -409,7 +495,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.
|
||||
|
@ -417,10 +503,14 @@ def RPMNameFilter(rpmname, disttagepoch):
|
|||
string = rpmname.split('-')
|
||||
lastpart = string.pop()
|
||||
tmp = lastpart.split('.')
|
||||
issrc = (tmp.pop() == "src")
|
||||
ismageia = 0
|
||||
if tmp[-1].startswith("mga"):
|
||||
tmp.pop()
|
||||
ismageia = 1
|
||||
lastpart = '.'.join(tmp)
|
||||
if (lastpart[0].isdigit() or (not lastpart.startswith(disttagepoch))) and\
|
||||
(not lastpart.isdigit()):
|
||||
((not lastpart.isdigit()) or issrc or ismageia):
|
||||
name = '-'.join(string[:-1])
|
||||
ver = string[-1]
|
||||
rel = lastpart
|
||||
|
@ -428,6 +518,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):
|
||||
|
@ -458,16 +550,23 @@ def ParsePackage(arg):
|
|||
"""
|
||||
ifchangelog = arg.changelog
|
||||
ifnotquiet = arg.quiet
|
||||
ignorelist = arg.ignorelist
|
||||
pkgdict_old = {}
|
||||
for directory in arg.temp_old:
|
||||
for tmp_list in arg.temp_old:
|
||||
for directory in tmp_list:
|
||||
RenameSynthFile(directory, arg)
|
||||
UnpackFiles(directory, ifchangelog, ifnotquiet)
|
||||
ParseSynthesis(directory + synthesis_file, pkgdict_old, arg)
|
||||
pkgdict_new = {}
|
||||
for directory in arg.temp_new:
|
||||
for tmp_list in arg.temp_new:
|
||||
for directory in tmp_list:
|
||||
RenameSynthFile(directory, arg)
|
||||
UnpackFiles(directory, ifchangelog, ifnotquiet)
|
||||
ParseSynthesis(directory + synthesis_file, pkgdict_new, arg)
|
||||
pkgdict_old = RemoveIgnored(pkgdict_old, ignorelist)
|
||||
pdkdict_new = RemoveIgnored(pkgdict_new, ignorelist)
|
||||
ignorelist = ""
|
||||
arg.ignorelist = ""
|
||||
return pkgdict_old, pkgdict_new
|
||||
|
||||
def CreateDicts(dict_old, dict_new):
|
||||
|
@ -625,6 +724,7 @@ def ParseLogfile(dict_log, logfile, dict_upd_packages, mode, arg):
|
|||
[(verler,(s0,s1,s2)),(verrel,(s0,s1,s2)),ifdowngraded]
|
||||
"""
|
||||
ifnotquiet = arg.quiet
|
||||
ifreleaseignore = arg.no_release
|
||||
|
||||
if ifnotquiet:
|
||||
print _("Reading changelog")
|
||||
|
@ -665,7 +765,7 @@ def ParseLogfile(dict_log, logfile, dict_upd_packages, mode, arg):
|
|||
disttagepoch = disttag + distepoch
|
||||
if (disttagepoch == ''):
|
||||
disttagepoch = '-'
|
||||
(result_key, version, release) = RPMNameFilter(pkgname, disttagepoch)
|
||||
(result_key, version, release) = RPMNameFilter(pkgname, disttagepoch, ifreleaseignore)
|
||||
verrel = (version, release, "-1")
|
||||
# skip entry if it wasn't updated
|
||||
if result_key not in dict_upd_packages:
|
||||
|
@ -680,12 +780,6 @@ def ParseLogfile(dict_log, logfile, dict_upd_packages, mode, arg):
|
|||
if(result_key in dict_log) and (dict_log[result_key][mode]):
|
||||
tag_changelog = tag_changelog.next
|
||||
continue
|
||||
# if "old" repository do not have changelog of the package
|
||||
if(mode == 1) and (not result_key in dict_log):
|
||||
dict_log[result_key] = []
|
||||
dict_log[result_key].append([])
|
||||
dict_log[result_key].append([])
|
||||
dict_log[result_key][0] = (verrel, [])
|
||||
|
||||
log_current = tag_changelog.children
|
||||
result_changelog = []
|
||||
|
@ -700,6 +794,7 @@ def ParseLogfile(dict_log, logfile, dict_upd_packages, mode, arg):
|
|||
entry_time = 0
|
||||
|
||||
if(mode == 1) and (not ifdowngraded) and\
|
||||
(result_key in dict_log) and\
|
||||
(entry_time <= dict_log[result_key][0][1][0]):
|
||||
break
|
||||
log_child = log_current.children
|
||||
|
@ -710,6 +805,16 @@ def ParseLogfile(dict_log, logfile, dict_upd_packages, mode, arg):
|
|||
entry_text = log_child.content
|
||||
log_child = log_child.next
|
||||
result_changelog.append((entry_time, entry_name, entry_text))
|
||||
# if "old" repository do not have changelog of the package
|
||||
if(mode == 1) and (not result_key in dict_log):
|
||||
dict_log[result_key] = []
|
||||
dict_log[result_key].append([])
|
||||
dict_log[result_key].append([])
|
||||
dict_log[result_key][0] = (verrel, [])
|
||||
if not ifdowngraded:
|
||||
dict_log[result_key][0] = (verrel, result_changelog[0])
|
||||
else:
|
||||
dict_log[result_key][0] = (verrel, result_changelog)
|
||||
if(mode == ifdowngraded):
|
||||
break
|
||||
log_current = log_current.next
|
||||
|
@ -757,9 +862,11 @@ def GenerateLogfileDiff(dict_upd_packages, arg):
|
|||
dict_logfile_diff = {}
|
||||
dict_log = {}
|
||||
|
||||
for old_dir in temp_old:
|
||||
for i in temp_old:
|
||||
for old_dir in temp_old[i]:
|
||||
ParseLogfile(dict_log, old_dir + changelog_file, dict_upd_packages, 0, arg)
|
||||
for new_dir in temp_new:
|
||||
for i in temp_new:
|
||||
for new_dir in temp_new[i]:
|
||||
ParseLogfile(dict_log, new_dir + changelog_file, dict_upd_packages, 1, arg)
|
||||
|
||||
for name in dict_upd_packages:
|
||||
|
@ -783,9 +890,12 @@ def ChangelogPrint(changes_list, file_output):
|
|||
changes_list is list with format:
|
||||
changes_list = [(time,author,text)]
|
||||
"""
|
||||
if len(changes_list) > 0:
|
||||
for entry in changes_list:
|
||||
file_output.write("* " + str(date.fromtimestamp(float(entry[0]))) +\
|
||||
" " + entry[1] + '\n' + entry[2] + '\n\n')
|
||||
else:
|
||||
file_output.write('\n')
|
||||
|
||||
def PrintLogfileDiff(package_name, dict_logfile_diff, file_output):
|
||||
"""Changelog difference.
|
||||
|
@ -814,17 +924,29 @@ def ProcessUpdPackages(dict_upd_packages, dict_logfile_diff, arg):
|
|||
file_output = arg.output
|
||||
ifchangelog = arg.changelog
|
||||
ifsizes = arg.size
|
||||
ifup = arg.show_updated
|
||||
ifdown = arg.show_downgraded
|
||||
|
||||
file_output.write(_("\n\nUpdated packages:\n\n"))
|
||||
sorted_list = sorted(dict_upd_packages)
|
||||
for name in sorted_list:
|
||||
package = dict_upd_packages[name][1][1][0][0]
|
||||
if ifnotsimple:
|
||||
file_output.write(package + '\n' + '-'*len(package) + '\n')
|
||||
if dict_upd_packages[name][2]:
|
||||
if ifdown:
|
||||
file_output.write(package + '\n' + '-'*len(package) + '\n')
|
||||
file_output.write(_(" ***DOWNGRADED***\n"))
|
||||
else:
|
||||
continue
|
||||
else:
|
||||
if ifup:
|
||||
file_output.write(package + '\n' + '-'*len(package) + '\n')
|
||||
else:
|
||||
continue
|
||||
if ifchangelog:
|
||||
PrintLogfileDiff(name, dict_logfile_diff, file_output)
|
||||
else:
|
||||
file_output.write('\n')
|
||||
else:
|
||||
old_package = dict_upd_packages[name][0][1][0][0]
|
||||
file_output.write(name + ": " + old_package + " -> " + package + '\n')
|
||||
|
@ -833,18 +955,33 @@ def ProcessUpdPackages(dict_upd_packages, dict_logfile_diff, arg):
|
|||
int(dict_upd_packages[name][0][1][0][2])
|
||||
file_output.write(_("Size Change: %d bytes\n\n") % sizediff)
|
||||
|
||||
def PrintSummary(dict_new_packages, dict_del_packages, dict_upd_packages, file_output):
|
||||
def PrintSummary(dict_new_packages, dict_del_packages, dict_upd_packages, arg):
|
||||
"""Output summary.
|
||||
|
||||
Output summary: numbers of new/removew/updated packages at all.
|
||||
"""
|
||||
file_output.write("Summary:\n")
|
||||
file_output = arg.output
|
||||
ifhtml = arg.html
|
||||
|
||||
if ifhtml:
|
||||
endstr = '<br />'
|
||||
else:
|
||||
endstr = '\n'
|
||||
|
||||
tmp_str = _("Summary:")
|
||||
if ifhtml:
|
||||
tmp_str = '<p class="bold">' + tmp_str + '</p>'
|
||||
else:
|
||||
tmp_str = tmp_str + endstr
|
||||
if arg.show_new:
|
||||
length = len(dict_new_packages)
|
||||
if length:
|
||||
file_output.write(_(" Total added packages: ") + str(length) + '\n')
|
||||
tmp_str = tmp_str + (_(" Total added packages: ") + str(length) + endstr)
|
||||
if arg.show_removed:
|
||||
length = len(dict_del_packages)
|
||||
if length:
|
||||
file_output.write(_(" Total removed packages: ") + str(length) + '\n')
|
||||
tmp_str = tmp_str + (_(" Total removed packages: ") + str(length) + endstr)
|
||||
if arg.show_updated or arg.show_downgraded:
|
||||
length = 0
|
||||
length_d = 0
|
||||
for packagename in dict_upd_packages:
|
||||
|
@ -852,10 +989,17 @@ def PrintSummary(dict_new_packages, dict_del_packages, dict_upd_packages, file_o
|
|||
length = length + 1
|
||||
else:
|
||||
length_d = length_d + 1
|
||||
if arg.show_updated:
|
||||
if length:
|
||||
file_output.write(_(" Total updated packages: ") + str(length) + '\n')
|
||||
tmp_str = tmp_str + (_(" Total updated packages: ") + str(length) + endstr)
|
||||
if arg.show_downgraded:
|
||||
if length_d:
|
||||
file_output.write(_(" Total downgraded packages: ") + str(length_d) + '\n')
|
||||
tmp_str = tmp_str + (_(" Total downgraded packages: ") + str(length_d) + endstr)
|
||||
|
||||
if ifhtml:
|
||||
return tmp_str
|
||||
else:
|
||||
file_ouput.write(tmp_str)
|
||||
|
||||
def HTML_ParsePackage(arg):
|
||||
"""Parse hdlist.
|
||||
|
@ -864,39 +1008,44 @@ def HTML_ParsePackage(arg):
|
|||
"""
|
||||
ifchangelog = arg.changelog
|
||||
ifnotquiet = arg.quiet
|
||||
ignorelist = arg.ignorelist
|
||||
|
||||
html_old_dict_list = []
|
||||
html_new_dict_list = []
|
||||
|
||||
for directory in arg.temp_old:
|
||||
for tmp_list in arg.temp_old:
|
||||
tmp_dict = {}
|
||||
for directory in tmp_list:
|
||||
RenameSynthFile(directory, arg)
|
||||
UnpackFiles(directory, 0, ifnotquiet)
|
||||
ParseSynthesis(directory + synthesis_file, tmp_dict, arg)
|
||||
html_old_dict_list.append(tmp_dict)
|
||||
for directory in arg.temp_new:
|
||||
html_old_dict_list.append(RemoveIgnored(tmp_dict, ignorelist))
|
||||
for tmp_list in arg.temp_new:
|
||||
tmp_dict = {}
|
||||
for directory in tmp_list:
|
||||
RenameSynthFile(directory, arg)
|
||||
UnpackFiles(directory, 0, ifnotquiet)
|
||||
ParseSynthesis(directory + synthesis_file, tmp_dict, arg)
|
||||
html_new_dict_list.append(tmp_dict)
|
||||
html_new_dict_list.append(RemoveIgnored(tmp_dict, ignorelist))
|
||||
ignorelist = ""
|
||||
arg.ignorelist = ""
|
||||
return html_old_dict_list, html_new_dict_list
|
||||
|
||||
def HTML_UniteOld(list_dict_old):
|
||||
def HTML_UniteDicts(list_dict):
|
||||
"""Union of dictionaries.
|
||||
|
||||
HTML-specific.
|
||||
"""
|
||||
dict_old = list_dict_old[0]
|
||||
i = 1
|
||||
while(i < len(list_dict_old)):
|
||||
for name in list_dict_old[i]:
|
||||
if name not in dict_old:
|
||||
dict_old[name] = list_dict_old[i][name]
|
||||
elif(compare_versions(dict_old[name][0], list_dict_old[i][name][0]) == -1):
|
||||
dict_old[name] = list_dict_old[i][name]
|
||||
dict_all = {}
|
||||
i = 0
|
||||
while(i < len(list_dict)):
|
||||
for name in list_dict[i]:
|
||||
if name not in dict_all:
|
||||
dict_all[name] = list_dict[i][name]
|
||||
elif(compare_versions(dict_all[name][0], list_dict[i][name][0]) == -1):
|
||||
dict_all[name] = list_dict[i][name]
|
||||
i = i + 1
|
||||
return dict_old
|
||||
return dict_all
|
||||
|
||||
def HTML_CreateDicts(dict_old, list_dict_new):
|
||||
"""Create dictionary of packages.
|
||||
|
@ -1121,20 +1270,23 @@ def HTML_OutputHead(file_output):
|
|||
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n' +\
|
||||
'<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">\n' +
|
||||
'<head>\n' +\
|
||||
'<title>Differences between Mandriva / Rosa releases</title>\n' +\
|
||||
'<meta name="keywords" content="Mandriva,Rosa,RPM,changes"/>\n' +\
|
||||
'<meta name="description" content="List of changes between Mandriva / Rosa releases"/>\n' +\
|
||||
'<title>Differences between repositories</title>\n' +\
|
||||
'<meta name="keywords" content="Mandriva,Rosa,RPM,repository,difference,changes"/>\n' +\
|
||||
'<meta name="description" content="List of changes between repositories"/>\n' +\
|
||||
'<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>\n' +\
|
||||
'<style type="text/css">' +\
|
||||
CssOutput() +\
|
||||
'</style>\n' +\
|
||||
'<script language="JavaScript" type="text/javascript">' +\
|
||||
'<script type="text/javascript">' +\
|
||||
'/* <![CDATA[ */' +\
|
||||
JavaScriptOutput() +\
|
||||
'/* ]]> */' +\
|
||||
'</script>\n' +\
|
||||
'</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.
|
||||
|
@ -1142,10 +1294,14 @@ def GetRepoInfo(dict_packages, packagename, lenold, lennew, list_dict_old, list_
|
|||
result1 = []
|
||||
result2 = []
|
||||
flag = 0
|
||||
show_filter = [0,0,0,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('')
|
||||
|
@ -1153,7 +1309,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):
|
||||
|
@ -1161,26 +1320,32 @@ def GetRepoInfo(dict_packages, packagename, lenold, lennew, list_dict_old, list_
|
|||
result1.append("N/A")
|
||||
result2.append("")
|
||||
else:
|
||||
result1.append(list_dict_new[i][packagename][0][0] + '-' +\
|
||||
list_dict_new[i][packagename][0][1])
|
||||
tmpstr = list_dict_new[i][packagename][0][0]
|
||||
if not ifreleaseignore:
|
||||
tmpstr = tmpstr + '-' + list_dict_new[i][packagename][0][1]
|
||||
result1.append(tmpstr)
|
||||
result2.append("")
|
||||
else:
|
||||
(name, entry_type) = tmpdict[i]
|
||||
if entry_type == 1:
|
||||
result1.append(name)
|
||||
result2.append('class = "new"')
|
||||
show_filter[0] = 1
|
||||
elif entry_type == 2:
|
||||
result1.append("Removed")
|
||||
result2.append('class = "removed"')
|
||||
flag = 1
|
||||
show_filter[1] = 1
|
||||
elif entry_type == 3:
|
||||
result1.append(name)
|
||||
result2.append('class = "updated"')
|
||||
show_filter[2] = 1
|
||||
elif entry_type == 4:
|
||||
result1.append(name)
|
||||
result2.append('class = "downgraded"')
|
||||
show_filter[3] = 1
|
||||
|
||||
return (result1, result2, flag)
|
||||
return (result1, result2, flag, show_filter)
|
||||
|
||||
def HTML_OutputBody(dict_packages, list_dict_old, list_dict_new, arg):
|
||||
"""Output table.
|
||||
|
@ -1190,6 +1355,10 @@ 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
|
||||
reponames = arg.reponames
|
||||
show_summary = arg.show_summary
|
||||
show_mask = [arg.show_new, arg.show_removed, arg.show_updated, arg.show_downgraded]
|
||||
|
||||
file_output.write('<h1>Difference between repositories.</h1>\n' +\
|
||||
'<p class="bold">The use of color coding in tables:</p>\n' +\
|
||||
|
@ -1198,58 +1367,69 @@ def HTML_OutputBody(dict_packages, list_dict_old, list_dict_new, arg):
|
|||
'<td class="updated">Updated</td></tr>\n' +\
|
||||
'<tr><td class="downgraded">Downgraded</td>\n' +\
|
||||
'<td class="removed">Removed</td></tr>\n' +\
|
||||
'</tbody></table>\n\n')
|
||||
'</tbody></table>\n\n' +\
|
||||
'<div>' + arg.summary + '</div>\n')
|
||||
repo_list = []
|
||||
|
||||
all_list = []
|
||||
all_list.extend(old)
|
||||
all_list.extend(new)
|
||||
for tmp_list in old:
|
||||
all_list.extend(tmp_list)
|
||||
for tmp_list in new:
|
||||
all_list.extend(tmp_list)
|
||||
lenold = len(old)
|
||||
lennew = len(new)
|
||||
length = lenold + lennew
|
||||
|
||||
reptext = 'repositories' if lenold > 1 else 'repository'
|
||||
tmp_string = '<h2>Old ' + reptext + ':</h2>\n<ul>\n'
|
||||
for i in range(lenold):
|
||||
tmp_string = tmp_string + '<li>Repository ' + str(i) + ' : <a href="' +\
|
||||
old[i] + '">' + old[i] + '</a></li>\n'
|
||||
i = 0
|
||||
for k in range(lenold):
|
||||
if reponames == '':
|
||||
tmp_string = 'Repository group A' + str(i)
|
||||
else:
|
||||
tmp_string = reponames[i]
|
||||
tmp_string = '<h2>' + tmp_string + ':</h2>\n<ul>\n'
|
||||
for z in range(len(old[k])):
|
||||
tmp_string = tmp_string + '<li><a href="' +\
|
||||
old[k][z] + '">' + old[k][z] + '</a></li>\n'
|
||||
tmp_string = tmp_string + '</ul>\n'
|
||||
file_output.write(tmp_string)
|
||||
|
||||
reptext = 'repositories' if lennew > 1 else 'repository'
|
||||
tmp_string = '<h2>New ' + reptext + ':</h2>\n<ul>\n'
|
||||
for k in range(lennew):
|
||||
i = i + 1
|
||||
tmp_string = tmp_string + '<li>Repository ' + str(i) + ' : <a href="' +\
|
||||
new[k] + '">' + new[k] + '</a></li>\n'
|
||||
|
||||
i = 0
|
||||
for k in range(lennew):
|
||||
if reponames == '':
|
||||
tmp_string = 'Repository group B' + str(i)
|
||||
else:
|
||||
tmp_string = reponames[i + lenold]
|
||||
tmp_string = '<h2>' + tmp_string + ':</h2>\n<ul>\n'
|
||||
for z in range(len(new[k])):
|
||||
tmp_string = tmp_string + '<li><a href="' +\
|
||||
new[k][z] + '">' + new[k][z] + '</a></li>\n'
|
||||
tmp_string = tmp_string + '</ul>\n'
|
||||
file_output.write(tmp_string)
|
||||
i = i + 1
|
||||
|
||||
tmp_string = '<h2>Difference between '
|
||||
i = 0
|
||||
while(i < length):
|
||||
if(i < length - 2):
|
||||
delimeter = " , "
|
||||
elif(i == length - 2):
|
||||
delimeter = " and "
|
||||
else:
|
||||
delimeter = ''
|
||||
temp = '<a href="' + all_list[i] + '">' + \
|
||||
'Repository ' + str(i) + '</a>'
|
||||
if i < lenold:
|
||||
repo_list.append('<th>Repository ' + str(i) + '</th>')
|
||||
if reponames == '':
|
||||
temp = 'Group A' + str(i)
|
||||
else:
|
||||
temp = reponames[i]
|
||||
repo_list.append('<th>' + temp + '</th>')
|
||||
else:
|
||||
ii = i + 1
|
||||
repo_list.append('<th id="sortCelldiff'+str(ii)+'"><a id="sortCellLinkdiff'+str(ii)+'" title="Sort Ascending" href="javascript:sort_diff('+str(ii)+', \'className\')">Repository '+str(i)+'</a></th>')
|
||||
tmp_string = tmp_string + temp + delimeter
|
||||
if reponames == '':
|
||||
temp = 'Group B' + str(i - lenold)
|
||||
else:
|
||||
temp = reponames[i]
|
||||
repo_list.append('<th id="sortCelldiff'+str(ii)+'"><a id="sortCellLinkdiff'+str(ii)+'" title="Sort Ascending" href="javascript:sort_diff('+str(ii)+', \'className\')">'+temp+'</a></th>')
|
||||
i = i + 1
|
||||
tmp_string = tmp_string + ".</h2>\n"
|
||||
file_output.write(tmp_string)
|
||||
|
||||
tmp_string = '<table id="table_diff">\n<tbody>\n<tr><th id="sortCelldiff0"><a id="sortCellLinkdiff0" title="Sort Ascending" href="javascript:sort_diff(0, \'string\')">Package name</a></th>'
|
||||
for reponame in repo_list:
|
||||
tmp_string = tmp_string + reponame
|
||||
tmp_string = tmp_string + '</tr>\n'
|
||||
file_output.write(tmp_string)
|
||||
|
||||
strnum = 1
|
||||
resrange = []
|
||||
|
@ -1258,16 +1438,16 @@ def HTML_OutputBody(dict_packages, list_dict_old, list_dict_new, arg):
|
|||
|
||||
sorted_list = sorted(dict_packages, key=str.lower)
|
||||
for packagename in sorted_list:
|
||||
if strnum % 2:
|
||||
strtype = "odd"
|
||||
else:
|
||||
strtype = "even"
|
||||
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)
|
||||
(repo_name, repo_class, flag, show_filter) = GetRepoInfo(dict_packages, packagename,
|
||||
lenold, lennew, list_dict_old, list_dict_new, ifreleaseignore)
|
||||
res = 0
|
||||
for i in range(4):
|
||||
if show_filter[i]*show_mask[i] == 1:
|
||||
res = 1
|
||||
if res == 0:
|
||||
continue
|
||||
|
||||
if flag:
|
||||
if(repo_name[lenold] == "Removed"):
|
||||
res = 0
|
||||
for k in resrange:
|
||||
if(repo_name[k] != "Removed"):
|
||||
|
@ -1277,20 +1457,20 @@ def HTML_OutputBody(dict_packages, list_dict_old, list_dict_new, arg):
|
|||
if(repo_name[k] == "Removed"):
|
||||
repo_name[k] = "N/A"
|
||||
repo_class[k] = ''
|
||||
else:
|
||||
for k in resrange:
|
||||
if(repo_name[k] == "Removed"):
|
||||
repo_name[k] = "N/A"
|
||||
repo_class[k] = ''
|
||||
|
||||
if strnum % 2:
|
||||
strtype = "odd"
|
||||
else:
|
||||
strtype = "even"
|
||||
tmp_string = '<tr class="' + strtype + '">'
|
||||
tmp_string = tmp_string + '<td>' + packagename + '</td>'
|
||||
for i in range(length):
|
||||
tmp_string = tmp_string + '<td ' + repo_class[i] + '>' +\
|
||||
repo_name[i] + '</td>'
|
||||
tmp_string = tmp_string + '</tr>\n'
|
||||
strnum = strnum + 1
|
||||
tmp_string = tmp_string + '</tbody>\n</table>\n'
|
||||
|
||||
file_output.write(tmp_string)
|
||||
strnum = strnum + 1
|
||||
file_output.write('</tbody>\n</table>\n')
|
||||
|
||||
def HTML_OutputTail(file_output):
|
||||
"""Output end of document.
|
||||
|
@ -1298,8 +1478,10 @@ def HTML_OutputTail(file_output):
|
|||
Outputs static text.
|
||||
"""
|
||||
file_output.write('''
|
||||
<script language='JavaScript' type='text/javascript'>
|
||||
<script type='text/javascript'>
|
||||
/* <![CDATA[ */
|
||||
init_diff();
|
||||
/* ]]> */
|
||||
</script>
|
||||
''');
|
||||
file_output.write('</body>\n</html>\n')
|
||||
|
@ -1329,13 +1511,19 @@ def main(args):
|
|||
tmp_output = arg.output[0]
|
||||
else:
|
||||
tmp_output = default_output
|
||||
if (arg.ignore):
|
||||
arg.ignore = arg.ignore[0]
|
||||
arg.output = None;
|
||||
for i in range(len(arg.old)):
|
||||
arg.old[i] = CheckArgs(arg.old[i], arg)
|
||||
arg.temp_old.append(head_old + str(i) + '/')
|
||||
arg.temp_old.append([])
|
||||
for j in range(len(arg.old[i])):
|
||||
arg.old[i][j] = CheckArgs(arg.old[i][j], arg)
|
||||
arg.temp_old[i].append(head_old + str(i) + '-' + str(j) + '/')
|
||||
for i in range(len(arg.new)):
|
||||
arg.new[i] = CheckArgs(arg.new[i], arg)
|
||||
arg.temp_new.append(head_new + str(i) + '/')
|
||||
arg.temp_new.append([])
|
||||
for j in range(len(arg.new[i])):
|
||||
arg.new[i][j] = CheckArgs(arg.new[i][j], arg)
|
||||
arg.temp_new[i].append(head_new + str(i) + '-' + str(j) + '/')
|
||||
arg.output = tmp_output
|
||||
CheckOutput(arg)
|
||||
CheckParam(arg)
|
||||
|
@ -1346,7 +1534,17 @@ def main(args):
|
|||
ifnotquiet = arg.quiet
|
||||
ifhtml = arg.html
|
||||
ifchangelog = arg.changelog
|
||||
if (not arg.show_new) and (not arg.show_removed) and\
|
||||
(not arg.show_updated) and (not arg.show_downgraded):
|
||||
arg.show_new=True
|
||||
arg.show_removed=True
|
||||
arg.show_updated=True
|
||||
arg.show_downgraded=True
|
||||
|
||||
if arg.ignore:
|
||||
arg.ignorelist = ReadIgnoreList(arg)
|
||||
else:
|
||||
arg.ignorelist = []
|
||||
|
||||
GetFiles(arg)
|
||||
|
||||
|
@ -1355,22 +1553,37 @@ def main(args):
|
|||
|
||||
(dict_new_packages, dict_del_packages, dict_upd_packages) = CreateDicts(
|
||||
dict_old, dict_new)
|
||||
dict_old = ''
|
||||
|
||||
dict_obsoleted = GenerateDictObsoleted(dict_new, ifnotquiet)
|
||||
dict_new = ''
|
||||
if(dict_upd_packages) and (ifnotsimple) and (ifchangelog):
|
||||
dict_logfile_diff = GenerateLogfileDiff(dict_upd_packages, arg)
|
||||
if not ifnotsimple or not ifchangelog:
|
||||
dict_logfile_diff = {}
|
||||
|
||||
if arg.show_new:
|
||||
ProcessNewPackages(dict_new_packages, arg.output)
|
||||
if arg.show_removed:
|
||||
ProcessDelPackages(dict_del_packages, dict_obsoleted, arg.output)
|
||||
if dict_upd_packages:
|
||||
if dict_upd_packages and (arg.show_updated or arg.show_downgraded):
|
||||
ProcessUpdPackages(dict_upd_packages, dict_logfile_diff, arg)
|
||||
PrintSummary(dict_new_packages, dict_del_packages, dict_upd_packages, arg.output)
|
||||
if arg.show_summary:
|
||||
PrintSummary(dict_new_packages, dict_del_packages, dict_upd_packages, arg)
|
||||
else:
|
||||
(list_dict_old, list_dict_new) = HTML_ParsePackage(arg)
|
||||
dict_old = HTML_UniteOld(list_dict_old)
|
||||
dict_old = HTML_UniteDicts(list_dict_old)
|
||||
if arg.show_summary:
|
||||
dict_new = HTML_UniteDicts(list_dict_new)
|
||||
(dict_new_packages, dict_del_packages, dict_upd_packages) = CreateDicts(
|
||||
dict_old, dict_new)
|
||||
arg.summary = PrintSummary(dict_new_packages, dict_del_packages, dict_upd_packages, arg)
|
||||
dict_new = ''
|
||||
dict_new_packages = ''
|
||||
dict_del_packages = ''
|
||||
dict_upd_packages = ''
|
||||
dict_packages = HTML_CreateDicts(dict_old, list_dict_new)
|
||||
dict_old = ''
|
||||
HTML_Output(dict_packages, list_dict_old, list_dict_new, arg)
|
||||
|
||||
exit_proc(arg)
|
||||
|
|
|
@ -188,7 +188,7 @@ def main(args):
|
|||
for dropped in evrlist[:keepnum]:
|
||||
(e,v,r,d) = dropped
|
||||
pkg = str(verfile[(n,a,e,v,r,d)]).replace("['","").replace("']","")
|
||||
subprocess.call(["rm", pkg])
|
||||
subprocess.call(["rm", "-f", pkg])
|
||||
if options.verbose:
|
||||
for dropped in evrlist[:keepnum]:
|
||||
(e,v,r,d) = dropped
|
||||
|
|
1101
urpm-tools.pot
1101
urpm-tools.pot
File diff suppressed because it is too large
Load diff
BIN
urpm-tools/locale/ru/LC_MESSAGES/urpm-tools.mo
Normal file
BIN
urpm-tools/locale/ru/LC_MESSAGES/urpm-tools.mo
Normal file
Binary file not shown.
1518
urpm-tools/locale/ru/LC_MESSAGES/urpm-tools.po
Normal file
1518
urpm-tools/locale/ru/LC_MESSAGES/urpm-tools.po
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue