fix: retain exact APT configure action without pending package repair
Rust development slice / linux (push) Failing after 6s

This commit is contained in:
2026-11-13 16:09:03 +01:00
parent 12557394fa
commit a430de7bf0
6 changed files with 205 additions and 2 deletions
+15 -1
View File
@@ -38,7 +38,8 @@ def protocol(old=None):
'DPkg::Tools::Options::' + apt.HOOK + '::Version=3\n'
'DPkg::Tools::Options::' + apt.HOOK + '::InfoFD=0\n'
'Dir::Bin::dpkg=/usr/bin/dpkg\nDir::State::status=/var/lib/dpkg/status\n'
'DPkg::ConfigurePending=false\n\n' + action + transaction()['packages'][0]['archive_path'] +
'DPkg::ConfigurePending=false\nDPkg::TriggersPending=false\n'
'dpkg::selection::remove::approved=false\n\n' + action + transaction()['packages'][0]['archive_path'] +
'\n' + action + '**CONFIGURE**\n').encode('ascii')
@@ -84,6 +85,16 @@ class ProtocolTests(unittest.TestCase):
with self.assertRaises(apt.Veto):
apt.check_hook_config(config)
def test_explicit_configure_and_no_pending_settings_are_required_in_actual_hook(self):
original = protocol()
for setting in (b'DPkg::ConfigurePending', b'DPkg::TriggersPending',
b'dpkg::selection::remove::approved'):
for changed in (original.replace(setting + b'=false\n', b''),
original.replace(setting + b'=false', setting + b'=true')):
config, _ = apt.parse_protocol3(changed)
with self.subTest(setting=setting), self.assertRaises(apt.Veto):
apt.check_hook_config(config)
def test_entire_action_set_dependency_change_remove_configure(self):
tx = apt.ResolvedAptTransaction.parse(transaction())
original = protocol()
@@ -277,6 +288,9 @@ print('FILTER_LOADED')
self.assertEqual((ROOT / 'tools/apt-transaction/hook').read_bytes(), apt.hook_script())
self.assertIn(b'Dir::Etc::parts', apt.apt_config())
self.assertIn(b'APT::Get::Download "true";', apt.apt_config())
self.assertIn(b'dpkg::selection::remove::approved "false";', apt.apt_config())
self.assertIn(b'DPkg::ConfigurePending "false";', apt.apt_config())
self.assertIn(b'DPkg::TriggersPending "false";', apt.apt_config())
def test_ip_socket_denials_are_required_for_both_families(self):
with patch.object(apt.socket, 'socket', side_effect=OSError(errno.EAFNOSUPPORT, 'synthetic')) as make: