Devuan deployment of britney2
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

104 lines
3.4 KiB

  1. # -*- coding: utf-8 -*-
  2. # Copyright (C) 2001-2004 Anthony Towns <ajt@debian.org>
  3. # Andreas Barth <aba@debian.org>
  4. # Fabio Tranchitella <kobold@debian.org>
  5. # This program is free software; you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation; either version 2 of the License, or
  8. # (at your option) any later version.
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU General Public License for more details.
  13. import re
  14. import string
  15. class Excuse:
  16. reemail = re.compile(r"<.*?>")
  17. def __init__(self, name):
  18. self.name = name
  19. self.ver = ("-", "-")
  20. self.maint = None
  21. self.pri = None
  22. self.date = None
  23. self.urgency = None
  24. self.daysold = None
  25. self.mindays = None
  26. self.section = None
  27. self.dontinvalidate = 0
  28. self.invalid_deps = []
  29. self.deps = []
  30. self.break_deps = []
  31. self.bugs = []
  32. self.htmlline = []
  33. def set_vers(self, tver, uver):
  34. if tver: self.ver = (tver, self.ver[1])
  35. if uver: self.ver = (self.ver[0], uver)
  36. def set_maint(self, maint):
  37. self.maint = self.reemail.sub("", maint)
  38. def set_section(self, section):
  39. self.section = section
  40. def set_priority(self, pri):
  41. self.pri = pri
  42. def set_date(self, date):
  43. self.date = date
  44. def set_urgency(self, date):
  45. self.urgency = date
  46. def add_dep(self, name):
  47. if name not in self.deps: self.deps.append(name)
  48. def add_break_dep(self, name, arch):
  49. if (name, arch) not in self.break_deps:
  50. self.break_deps.append( (name, arch) )
  51. def invalidate_dep(self, name):
  52. if name not in self.invalid_deps: self.invalid_deps.append(name)
  53. def setdaysold(self, daysold, mindays):
  54. self.daysold = daysold
  55. self.mindays = mindays
  56. def addhtml(self, note):
  57. self.htmlline.append(note)
  58. def html(self):
  59. res = "<a id=\"%s\" name=\"%s\">%s</a> (%s to %s)\n<ul>\n" % \
  60. (self.name, self.name, self.name, self.ver[0], self.ver[1])
  61. if self.maint:
  62. res = res + "<li>Maintainer: %s\n" % (self.maint)
  63. if self.section and string.find(self.section, "/") > -1:
  64. res = res + "<li>Section: %s\n" % (self.section)
  65. if self.daysold != None:
  66. if self.daysold < self.mindays:
  67. res = res + ("<li>Too young, only %d of %d days old\n" %
  68. (self.daysold, self.mindays))
  69. else:
  70. res = res + ("<li>%d days old (needed %d days)\n" %
  71. (self.daysold, self.mindays))
  72. for x in self.htmlline:
  73. res = res + "<li>" + x + "\n"
  74. for x in self.deps:
  75. if x in self.invalid_deps:
  76. res = res + "<li>Depends: %s <a href=\"#%s\">%s</a> (not considered)\n" % (self.name, x, x)
  77. else:
  78. res = res + "<li>Depends: %s <a href=\"#%s\">%s</a>\n" % (self.name, x, x)
  79. for (n,a) in self.break_deps:
  80. if n not in self.deps:
  81. res += "<li>Ignoring %s depends: <a href=\"#%s\">%s</a>\n" % (a, n, n)
  82. res = res + "</ul>\n"
  83. return res