launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #29822
[Merge] ~pelpsi/launchpad:oval-data-ajust-indexing-code into launchpad:master
Simone Pelosi has proposed merging ~pelpsi/launchpad:oval-data-ajust-indexing-code into launchpad:master.
Commit message:
Adjusted indexing code to include OVAL files
Now _writeSuite function supports OVAL data in various formats.
Added new test case for that functionality.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~pelpsi/launchpad/+git/launchpad/+merge/439832
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~pelpsi/launchpad:oval-data-ajust-indexing-code into launchpad:master.
diff --git a/lib/lp/archivepublisher/publishing.py b/lib/lp/archivepublisher/publishing.py
index 877ca78..105a393 100644
--- a/lib/lp/archivepublisher/publishing.py
+++ b/lib/lp/archivepublisher/publishing.py
@@ -1468,6 +1468,15 @@ class Publisher:
extra_files.add(cnf_path)
except FileNotFoundError:
pass
+ oval_dir = os.path.join(suite_dir, component, "oval")
+ try:
+ for oval_file in os.listdir(oval_dir):
+ if ".oval.xml" in oval_file:
+ oval_path = os.path.join(component, "oval", oval_file)
+ extra_files.add(remove_suffix(oval_path))
+ extra_files.add(oval_path)
+ except FileNotFoundError:
+ pass
for architecture in all_architectures:
for contents_path in get_suffixed_indices(
"Contents-" + architecture
diff --git a/lib/lp/archivepublisher/tests/test_publisher.py b/lib/lp/archivepublisher/tests/test_publisher.py
index 46556e3..e9034ef 100644
--- a/lib/lp/archivepublisher/tests/test_publisher.py
+++ b/lib/lp/archivepublisher/tests/test_publisher.py
@@ -2483,6 +2483,54 @@ class TestPublisher(TestPublisherBase):
release, "Contents-i386.gz", contents_file.read()
)
+ def testReleaseFileForOval(self):
+ # Test Release file writing for Oval metadata.
+ publisher = Publisher(
+ self.logger,
+ self.config,
+ self.disk_pool,
+ self.ubuntutest.main_archive,
+ )
+
+ # Put some Oval metadata files in place, and force the publisher
+ # to republish that suite.
+ series_path = os.path.join(self.config.distsroot, "breezy-autotest")
+ oval_path = os.path.join(series_path, "main", "oval")
+ oval_names = (
+ "data1.oval.xml.gz",
+ "data2.oval.xml.bz2",
+ "data3.oval.xml",
+ "data4.oval.xml.bz2",
+ )
+ os.makedirs(oval_path)
+ for name in oval_names:
+ if name.endswith(".gz"):
+ with gzip.GzipFile(os.path.join(oval_path, name), "wb") as f:
+ f.write(six.ensure_binary(name))
+ elif name.endswith(".bz2"):
+ with bz2.open(os.path.join(oval_path, name), "wb") as f:
+ f.write(six.ensure_binary(name))
+ else:
+ with open(os.path.join(oval_path, name), "wb") as f:
+ f.write(six.ensure_binary(name))
+
+ publisher.markSuiteDirty(
+ self.ubuntutest.getSeries("breezy-autotest"),
+ PackagePublishingPocket.RELEASE,
+ )
+
+ publisher.A_publish(False)
+ publisher.C_doFTPArchive(False)
+ publisher.D_writeReleaseFiles(False)
+
+ # The metadata files are listed correctly in Release.
+ release = self.parseRelease(os.path.join(series_path, "Release"))
+ for name in oval_names:
+ with open(os.path.join(oval_path, name), "rb") as f:
+ self.assertReleaseContentsMatch(
+ release, os.path.join("main", "oval", name), f.read()
+ )
+
def testReleaseFileForDEP11(self):
# Test Release file writing for DEP-11 metadata.
publisher = Publisher(