Store the email in lower case and do the comparison in lower case as well

Otherwise we end up trying to update a component just because the case
is different while the account on the bugzilla is the same.

Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
This commit is contained in:
Pierre-Yves Chibon 2020-01-12 21:22:19 +01:00
parent ef002f091e
commit 2e58bc1f96

View file

@ -331,7 +331,7 @@ class BugzillaProxy:
for watcher in cclist:
bz_email = self._get_bugzilla_email(watcher)
if bz_email:
initial_cc_emails.append(bz_email)
initial_cc_emails.append(bz_email.lower())
initial_cc_fasnames.append(watcher)
else:
self.errors.append(
@ -346,7 +346,7 @@ class BugzillaProxy:
# have to do this manually
owner_email = self._get_bugzilla_email(owner)
if owner_email not in initial_cc_emails:
initial_cc_emails.append(owner_email)
initial_cc_emails.append(owner_email.lower())
initial_cc_fasnames.append(owner)
# Lookup product
@ -377,20 +377,20 @@ class BugzillaProxy:
data = {}
# Check for changes to the owner, qacontact, or description
if product[pkg_key]['initialowner'] != owner_email:
if product[pkg_key]['initialowner'].lower() != owner_email.lower():
data['initialowner'] = owner_email
if description and product[pkg_key]['description'] != description:
data['description'] = description
if qacontact and product[pkg_key]['initialqacontact'] != qacontact_email:
if qacontact and product[pkg_key]['initialqacontact'].lower() != qacontact_email.lower():
data['initialqacontact'] = qacontact_email
if len(product[pkg_key]['initialcclist']) != len(initial_cc_emails):
data['initialcclist'] = initial_cc_emails
else:
for cc_member in product[pkg_key]['initialcclist']:
if cc_member not in initial_cc_emails:
if cc_member.lower() not in initial_cc_emails:
data['initialcclist'] = initial_cc_emails
break