Skip to content

Commit 97fdf64

Browse files
author
Sergio Schvezov
committed
repo: set priority to critical for debs
Only show "Questions that you really, really need to see (or else)." LP: #1821313 Signed-off-by: Sergio Schvezov <sergio.schvezov@canonical.com>
1 parent 05913cd commit 97fdf64

3 files changed

Lines changed: 21 additions & 4 deletions

File tree

snapcraft/internal/repo/_deb.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,10 +375,20 @@ def _install_new_build_packages(cls, package_names: List[str]) -> None:
375375
logger.info("Installing build dependencies: %s", " ".join(package_names))
376376
env = os.environ.copy()
377377
env.update(
378-
{"DEBIAN_FRONTEND": "noninteractive", "DEBCONF_NONINTERACTIVE_SEEN": "true"}
378+
{
379+
"DEBIAN_FRONTEND": "noninteractive",
380+
"DEBCONF_NONINTERACTIVE_SEEN": "true",
381+
"DEBIAN_PRIORITY": "critical",
382+
}
379383
)
380384

381-
apt_command = ["sudo", "apt-get", "--no-install-recommends", "-y"]
385+
apt_command = [
386+
"sudo",
387+
"--preserve-env",
388+
"apt-get",
389+
"--no-install-recommends",
390+
"-y",
391+
]
382392
if not is_dumb_terminal():
383393
apt_command.extend(["-o", "Dpkg::Progress-Fancy=1"])
384394
apt_command.append("install")

spread.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ environment:
1919
# Disable all Sentry error reporting
2020
SNAPCRAFT_ENABLE_ERROR_REPORTING: "no"
2121

22+
# Ensure that we have the right debian configuration for legacy
23+
DEBIAN_FRONTEND: noninteractive
24+
DEBIAN_PRIORITY: critical
25+
2226
TOOLS_DIR: /snapcraft/tests/spread/tools
2327

2428
backends:

tests/unit/repo/test_deb.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -477,12 +477,13 @@ def test_install_build_package(self, mock_check_call, mock_is_dumb_terminal):
477477
mock_check_call.assert_has_calls(
478478
[
479479
call(
480-
"sudo apt-get --no-install-recommends -y "
480+
"sudo --preserve-env apt-get --no-install-recommends -y "
481481
"-o Dpkg::Progress-Fancy=1 install".split()
482482
+ sorted(set(installable)),
483483
env={
484484
"DEBIAN_FRONTEND": "noninteractive",
485485
"DEBCONF_NONINTERACTIVE_SEEN": "true",
486+
"DEBIAN_PRIORITY": "critical",
486487
},
487488
)
488489
]
@@ -500,11 +501,12 @@ def test_install_buid_package_in_dumb_terminal(
500501
mock_check_call.assert_has_calls(
501502
[
502503
call(
503-
"sudo apt-get --no-install-recommends -y install".split()
504+
"sudo --preserve-env apt-get --no-install-recommends -y install".split()
504505
+ sorted(set(installable)),
505506
env={
506507
"DEBIAN_FRONTEND": "noninteractive",
507508
"DEBCONF_NONINTERACTIVE_SEEN": "true",
509+
"DEBIAN_PRIORITY": "critical",
508510
},
509511
)
510512
]
@@ -522,6 +524,7 @@ def test_install_buid_package_marks_auto_installed(self, mock_check_call):
522524
env={
523525
"DEBIAN_FRONTEND": "noninteractive",
524526
"DEBCONF_NONINTERACTIVE_SEEN": "true",
527+
"DEBIAN_PRIORITY": "critical",
525528
},
526529
)
527530
]

0 commit comments

Comments
 (0)