launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #31325
[Merge] ~juliank/launchpad:valid-until into launchpad:master
Julian Andres Klode has proposed merging ~juliank/launchpad:valid-until into launchpad:master.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #716535 in Launchpad itself: "Please support Valid-Until in release files for security.ubuntu.com"
https://bugs.launchpad.net/launchpad/+bug/716535
For more details, see:
https://code.launchpad.net/~juliank/launchpad/+git/launchpad/+merge/471638
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~juliank/launchpad:valid-until into launchpad:master.
diff --git a/lib/lp/archivepublisher/publishing.py b/lib/lp/archivepublisher/publishing.py
index 6a2a080..5a38089 100644
--- a/lib/lp/archivepublisher/publishing.py
+++ b/lib/lp/archivepublisher/publishing.py
@@ -92,6 +92,13 @@ FORMAT_TO_SUBCOMPONENT = {
# Number of days before unreferenced files are removed from by-hash.
BY_HASH_STAY_OF_EXECUTION = 1
+# Pockets to set Valid-Until for
+VALID_UNTIL_POCKETS = [PackagePublishingPocket.SECURITY]
+# Time delta that Valid-Until must still be valid for
+VALID_UNTIL_REFRESH = timedelta(days=7)
+# Time delta to add to Valid-Until from current date
+VALID_UNTIL_ADD = timedelta(days=14)
+
def reorder_components(components):
"""Return a list of the components provided.
@@ -440,6 +447,19 @@ class Publisher:
"""True if a publication has happened in this release and pocket."""
return distroseries.getSuite(pocket) in self.dirty_suites
+ def isExpired(self, pocket, release_path):
+ """Check if this release file's Valid-Until has expired."""
+ if pocket not in VALID_UNTIL_POCKETS:
+ return False
+ with open(release_path) as release_file:
+ release_data = Release(release_file)
+ if "Valid-Until" not in release_data:
+ return True
+ expiry = datetime.strptime(
+ release_data["Valid-Until"], "%a, %d %b %Y %H:%M:%S UTC"
+ )
+ return expiry <= datetime.utcnow() + VALID_UNTIL_REFRESH
+
def markSuiteDirty(self, distroseries, pocket):
"""Mark a suite dirty only if it's allowed."""
if self.isAllowed(distroseries, pocket):
@@ -929,8 +949,18 @@ class Publisher:
self.release_files_needed.add(suite)
write_release = suite in self.release_files_needed
+ is_expired = self.isExpired(pocket, release_path)
+ if is_expired:
+ self.log.debug(
+ "Valid-Until needs refresh in release files for %s/%s"
+ % (distroseries.name, pocket.name)
+ )
+ write_release = True
if not is_careful:
- if not self.isDirty(distroseries, pocket):
+ if (
+ not self.isDirty(distroseries, pocket)
+ and not is_expired
+ ):
self.log.debug(
"Skipping release files for %s/%s"
% (distroseries.name, pocket.name)
@@ -1523,9 +1553,13 @@ class Publisher:
release_file["Snapshots"] = metadata_overrides["Snapshots"]
release_file["Version"] = distroseries.version
release_file["Codename"] = distroseries.name
- release_file["Date"] = datetime.utcnow().strftime(
- "%a, %d %b %Y %k:%M:%S UTC"
- )
+
+ now = datetime.utcnow()
+ release_file["Date"] = now.strftime("%a, %d %b %Y %k:%M:%S UTC")
+ if pocket in VALID_UNTIL_POCKETS:
+ release_file["Valid-Until"] = (now + VALID_UNTIL_ADD).strftime(
+ "%a, %d %b %Y %k:%M:%S UTC"
+ )
release_file["Architectures"] = " ".join(sorted(all_architectures))
release_file["Components"] = " ".join(
reorder_components(all_components)
diff --git a/utilities/soyuz-sampledata-setup.py b/utilities/soyuz-sampledata-setup.py
index 21e1636..84d115b 100755
--- a/utilities/soyuz-sampledata-setup.py
+++ b/utilities/soyuz-sampledata-setup.py
@@ -321,9 +321,11 @@ def create_sample_series(original_series, log):
("Hirsute Hippo", SeriesStatus.OBSOLETE, "21.04"),
("Impish Indri", SeriesStatus.OBSOLETE, "21.10"),
("Jammy Jellyfish", SeriesStatus.SUPPORTED, "22.04"),
- ("Kinetic Kudu", SeriesStatus.SUPPORTED, "22.10"),
- ("Lunar Lobster", SeriesStatus.CURRENT, "23.04"),
- ("Mantic Minotaur", SeriesStatus.DEVELOPMENT, "23.10"),
+ ("Kinetic Kudu", SeriesStatus.OBSOLETE, "22.10"),
+ ("Lunar Lobster", SeriesStatus.OBSOLETE, "23.04"),
+ ("Mantic Minotaur", SeriesStatus.OBSOLETE, "23.10"),
+ ("Noble Numbat", SeriesStatus.CURRENT, "24.04"),
+ ("Oracular Oriole", SeriesStatus.DEVELOPMENT, "24.10"),
]
parent = original_series
Follow ups