Skip to content

Commit 10269ce

Browse files
committed
Merge branch '37454066_dnf5_packageManager_support' of https://github.com/Azure/LinuxPatchExtension into 37454066_dnf5_packageManager_support
2 parents a8aff6d + 7521976 commit 10269ce

2 files changed

Lines changed: 19 additions & 12 deletions

File tree

src/core/src/package_managers/AptitudePackageManager.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ def __read_one_line_style_list_format(self, file_path, max_patch_published_date,
183183

184184
for line in sources_content_lines:
185185
if len(line.strip()) != 0 and not line.strip().startswith("#"):
186-
if base_classification == Constants.PackageClassification.SECURITY and "security" not in line:
186+
if base_classification == Constants.PackageClassification.SECURITY and "security" not in line and "fips-updates" not in line:
187187
continue
188188
std_source_list_content += "\n" + self.__apply_max_patch_publish_date(sources_content=line, max_patch_publish_date=max_patch_published_date)
189189

@@ -207,7 +207,7 @@ def __read_deb882_style_format(self, file_path, max_patch_published_date, base_c
207207

208208
if len(line.strip()) == 0: # stanza separating line
209209
if stanza != str():
210-
if base_classification == str() or (base_classification == Constants.PackageClassification.SECURITY and "security" in stanza):
210+
if base_classification == str() or (base_classification == Constants.PackageClassification.SECURITY and ("security" in stanza or "fips-updates" in stanza)):
211211
std_source_parts_content += self.__apply_max_patch_publish_date(sources_content=stanza, max_patch_publish_date=max_patch_published_date) + '\n'
212212
stanza = str()
213213
continue

src/core/tests/Test_AptitudePackageManagerCustomSources.py

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ def __lib_test_custom_sources_with(self, include_sources_list=False, include_sou
9999
# Checks swapping and caching: All -> Security -> All -> All
100100
for i in range(3):
101101
# All
102-
expected_debstyle_entry_count = 2 if include_source_parts_debstyle else 0 # 2 entries in the debstyle mock
103-
expected_sources_list_entry_count = (4 if include_sources_list else 0) + (5 if include_source_parts_list else 0) # 4 in regular file, 3 in mock folder
102+
expected_debstyle_entry_count = 3 if include_source_parts_debstyle else 0 # 3 entries in the debstyle mock(incl. fips-updates)
103+
expected_sources_list_entry_count = (4 if include_sources_list else 0) + (6 if include_source_parts_list else 0) # 4 in regular file, 6 in mock folder (incl. fips-updates)
104104
sources_dir, sources_list = package_manager._AptitudePackageManager__get_custom_sources_to_spec(include_max_patch_publish_date)
105105
self.__check_custom_sources(sources_dir, sources_list,
106106
sources_debstyle_expected=include_source_parts_debstyle,
@@ -115,8 +115,8 @@ def __lib_test_custom_sources_with(self, include_sources_list=False, include_sou
115115
continue
116116

117117
# Security
118-
expected_debstyle_entry_count = 1 if include_source_parts_debstyle else 0 # 1 security entry in the debstyle mock
119-
expected_sources_list_entry_count = (1 if include_sources_list else 0) + (1 if include_source_parts_list else 0) # 1 security entry in regular file, 1 security entry in mock folder
118+
expected_debstyle_entry_count = 2 if include_source_parts_debstyle else 0 # 2 security entries in the debstyle mock (security + fips-updates)
119+
expected_sources_list_entry_count = (1 if include_sources_list else 0) + (2 if include_source_parts_list else 0) # 1 security entry in regular file, 2 security entries in mock folder (security + fips-updates)
120120
sources_dir, sources_list = package_manager._AptitudePackageManager__get_custom_sources_to_spec(include_max_patch_publish_date, "Security")
121121
self.__check_custom_sources(sources_dir, sources_list,
122122
sources_debstyle_expected=include_source_parts_debstyle,
@@ -146,8 +146,8 @@ def __check_custom_sources(self, sources_dir, sources_list, sources_debstyle_exp
146146
self.assertEqual(len(data), sources_debstyle_entry_count)
147147
for entry in data:
148148
if security_only:
149-
self.assertTrue("security" in entry)
150-
if max_patch_publish_date != str():
149+
self.assertTrue("security" in entry or "fips-updates" in entry)
150+
if max_patch_publish_date != str() and "fips-updates" not in entry: # exception for unsupported repo:
151151
self.assertTrue(max_patch_publish_date in entry)
152152
else:
153153
self.assertFalse(os.path.isdir(sources_dir))
@@ -159,8 +159,8 @@ def __check_custom_sources(self, sources_dir, sources_list, sources_debstyle_exp
159159
self.assertEqual(len(data), sources_list_entry_count)
160160
for entry in data:
161161
if security_only:
162-
self.assertTrue("security" in entry)
163-
if max_patch_publish_date != str() and "ppa" not in entry: # exception for unsupported repo
162+
self.assertTrue("security" in entry or "fips-updates" in entry)
163+
if max_patch_publish_date != str() and "ppa" not in entry and "fips-updates" not in entry: # exception for unsupported repo
164164
self.assertTrue(max_patch_publish_date in entry)
165165

166166
# region - Mock sources preparation and clean up
@@ -212,7 +212,8 @@ def __get_sources_data_one_line_style_ext():
212212
"deb http://ppa.launchpad.net/upubuntu-com/web/ubuntu focal main\n" + \
213213
"deb http://azure.archive.ubuntu.com/ubuntu/ focal-security universe\n" + \
214214
"deb http://in.archive.ubuntu.com/ubuntu/ focal multiverse\n" + \
215-
"deb http://cn.archive.ubuntu.com/ubuntu/ focal main\n"
215+
"deb http://cn.archive.ubuntu.com/ubuntu/ focal main\n" + \
216+
"deb https://esm.ubuntu.com/fips-updates/ubuntu jammy-updates main\n"
216217

217218
@staticmethod
218219
def __get_sources_data_debstyle():
@@ -229,7 +230,13 @@ def __get_sources_data_debstyle():
229230
"URIs: http://azure.archive.ubuntu.com/ubuntu/ \n" + \
230231
"Suites: noble-security \n" + \
231232
"Components: main universe restricted multiverse \n" + \
232-
"Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg \n"
233+
"Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg \n" + \
234+
"\n" + \
235+
"Types: deb \n" + \
236+
"URIs: https://esm.ubuntu.com/fips-updates/ubuntu \n" + \
237+
"Suites: jammy-updates \n" + \
238+
"Components: main \n" + \
239+
"Signed-By: /usr/share/keyrings/ubuntu-pro-fips-updates.gpg \n"
233240
# endregion
234241

235242
if __name__ == '__main__':

0 commit comments

Comments
 (0)