# Obsolete all other builds with the same name to track updates.
build.obsolete_others()
- # Search for possible bug IDs in the commit message.
- build.search_for_bugs()
-
return build
def create_from_source_package(self, filename, distro, commit=None, type="release",
# Create a new build object from the package
build = self.create(pkg, type=type, owner=owner, distro=distro)
+ if commit:
+ # Import any fixed bugs
+ for bug in commit.fixed_bugs:
+ build.add_bug(bug)
+
# Create all automatic jobs
build.create_autojobs(arches=arches)
if log:
self.log("bug_removed", user=user, bug_id=bug_id)
- def search_for_bugs(self):
- if not self.commit:
- return
-
- pattern = re.compile(r"(bug\s?|#)(\d+)")
-
- for txt in (self.commit.subject, self.commit.message):
- for bug in re.finditer(pattern, txt):
- try:
- bugid = int(bug.group(2))
- except ValueError:
- continue
-
- # Check if a bug with the given ID exists in BZ.
- bug = self.backend.bugzilla.get_bug(bugid)
- if not bug:
- continue
-
- self.add_bug(bugid)
-
def get_bugs(self):
bugs = []
for bug_id in self.get_bug_ids():
Returns the message without any Git tags
"""
# Compile regex
- r = re.compile("^(%s):" % "|".join(VALID_TAGS), re.IGNORECASE)
+ r = re.compile("^(%s):?" % "|".join(VALID_TAGS), re.IGNORECASE)
message = []
for line in self.body.splitlines():
raise ValueError("Unknown tag: %s" % tag)
# Compile regex
- r = re.compile("^%s: (.*)$" % tag, re.IGNORECASE)
+ r = re.compile("^%s:? (.*)$" % tag, re.IGNORECASE)
values = []
for line in self.body.splitlines():
return self.backend.users.find_maintainers(users)
+ @property
+ def fixed_bugs(self):
+ """
+ Returns a list of all fixed bugs
+ """
+ return self.get_tag("Fixes")
+
@property
def date(self):
return self.data.date