ubuntu-bugcontrol team mailing list archive
-
ubuntu-bugcontrol team
-
Mailing list archive
-
Message #04602
[Merge] ~sbeattie/ubuntu-qa-tools:unembargo-milestone-fixups into ubuntu-qa-tools:master
Steve Beattie has proposed merging ~sbeattie/ubuntu-qa-tools:unembargo-milestone-fixups into ubuntu-qa-tools:master.
Commit message:
unembargo: separate out milestone lookup into function
The recent change
0c2430a ("unembargo: Check and warn for any pending milestones")
ended up re-assigning to the same `series` variable, breaking package
publications for multiple source packges:
$UQT/security-tools/unembargo -n --ppa=ubuntu-security-proposed/ppa openjdk-8 openjdk-lts openjdk-17 openjdk-18
Loading Ubuntu Distribution ...
Loading Ubuntu Archive ...
Loading ubuntu-security-proposed 'ppa' PPA ...
Locating openjdk-8 ...
WARNING: jammy is approaching milestone ubuntu-22.04.1 (due 2022-08-04)
NOTE: Please coordinate with the #ubuntu-release team before releasing.
NOTE: To override this check and publish anyway please use the --force.
NOTE: unembargo for jammy will be skipped.
Want to publish openjdk-8 8u342-b07-0ubuntu1~20.04 to ubuntu/primary focal (Security)...
Want to publish openjdk-8 8u342-b07-0ubuntu1~18.04 to ubuntu/primary bionic (Security)...
Locating openjdk-lts ...
Traceback (most recent call last):
File "/home/steve/git/ubuntu-qa-tools/security-tools/unembargo", line 146, in <module>
if len(series) > 0:
TypeError: object of type 'Entry' has no len()
Fix this by moving the lookup of milestones to a separate function, so
that any variables set there won't pollute the global namespace. Also it
makes it easier to isolate the milestone lookup for future improvements.
Requested reviews:
Ubuntu Bug Control (ubuntu-bugcontrol)
For more details, see:
https://code.launchpad.net/~sbeattie/ubuntu-qa-tools/+git/ubuntu-qa-tools-1/+merge/427845
See commit message.
Note that this does not address the issue the Marc raised, where a milestone blocker in release will still publish for non-milestone-blocked releases, leading to a half-fixed / half-not state.
--
Your team Ubuntu Bug Control is requested to review the proposed merge of ~sbeattie/ubuntu-qa-tools:unembargo-milestone-fixups into ubuntu-qa-tools:master.
diff --git a/security-tools/unembargo b/security-tools/unembargo
index 433fc2e..de192d1 100755
--- a/security-tools/unembargo
+++ b/security-tools/unembargo
@@ -113,6 +113,31 @@ if opt.esm or opt.esm_apps or opt.esm_infra:
else:
opt.ppa = UBUNTU_SECURITY_PPA if opt.ppa is None else opt.ppa
+# given an archive + release name, find any milestones that are upcoming.
+# return either the first milestone within the window or None.
+def find_milestone(ubuntu, release):
+
+ # number of days within a milestone deadline to be considered as frozen
+ MILESTONE_WINDOW = 7
+
+ milestone = None
+ now = datetime.datetime.utcnow()
+ series = ubuntu.getSeries(name_or_version=release)
+
+ for _milestone in series.all_milestones:
+ if _milestone.date_targeted is None:
+ continue
+ # add one extra day since the milestone may be released at any
+ # time
+ milestone_date = _milestone.date_targeted + datetime.timedelta(days=1)
+ if now < milestone_date and milestone_date < now + datetime.timedelta(days=MILESTONE_WINDOW):
+ milestone = _milestone
+ break
+
+ return milestone
+
+
+
print("Loading Ubuntu Distribution ...")
lp_version = "devel"
@@ -159,29 +184,23 @@ for pkg_name in args:
if len(seen[series_name]) > 1:
seen[series_name] = sorted(seen[series_name], cmp=lambda x, y: apt_pkg.version_compare(
x.source_package_version, y.source_package_version), reverse=True)
+
# lookup series milestones and warn if any are approaching
- series = ubuntu.getSeries(name_or_version=series_name)
- now = datetime.datetime.utcnow()
- frozen = False
- for milestone in series.all_milestones:
- if milestone.date_targeted is None:
- continue
- # add one extra day since the milestone may be released at any
- # time
- milestone_date = milestone.date_targeted + datetime.timedelta(days=1)
- if now < milestone_date and milestone_date < now + datetime.timedelta(days=7):
- print("WARNING: %s is approaching milestone %s (due %s)" %
- (series_name, milestone.name,
- time.strftime("%Y-%m-%d", milestone.date_targeted.timetuple())))
- print("NOTE: Please coordinate with the #ubuntu-release team before releasing.")
- if not opt.force:
- print("NOTE: To override this check and publish anyway please use the --force.")
- print("NOTE: unembargo for %s will be skipped." % (series_name))
- frozen = True
- else:
- print("NOTE: unembargo for %s will continue due to use of --force." % (series_name))
- if not frozen:
+ milestone = find_milestone(ubuntu, series_name)
+ if milestone is None:
unembargo.append(seen[series_name][0])
+ else:
+ print("WARNING: %s is approaching milestone %s (due %s)" %
+ (series_name, milestone.name,
+ time.strftime("%Y-%m-%d", milestone.date_targeted.timetuple())))
+ print("NOTE: Please coordinate with the #ubuntu-release team before releasing.")
+ if opt.force:
+ print("NOTE: unembargo for %s will continue due to use of --force." % (series_name))
+ unembargo.append(seen[series_name][0])
+ else:
+ print("NOTE: To override this check and publish anyway please use the --force.")
+ print("NOTE: unembargo for %s will be skipped." % (series_name))
+
# Publish
for source_item in unembargo:
Follow ups