diff --git a/autoinstall-schema.json b/autoinstall-schema.json index 0e89c79c..a331f065 100644 --- a/autoinstall-schema.json +++ b/autoinstall-schema.json @@ -306,6 +306,28 @@ "non-free" ] } + }, + "preferences": { + "type": "array", + "items": { + "type": "object", + "properties": { + "package": { + "type": "string" + }, + "pin": { + "type": "string" + }, + "pin-priority": { + "type": "integer" + } + }, + "required": [ + "package", + "pin", + "pin-priority" + ] + } } } }, diff --git a/examples/autoinstall.yaml b/examples/autoinstall.yaml index 6f17aff7..de7d4d20 100644 --- a/examples/autoinstall.yaml +++ b/examples/autoinstall.yaml @@ -22,6 +22,9 @@ apt: disable_components: - non-free - restricted + preferences: + - {package: "python3-*", pin: "origin *ubuntu.com*", pin-priority: 200} + - {package: "python-*", pin: "origin *ubuntu.com*", pin-priority: -1} packages: - package1 - package2 diff --git a/scripts/runtests.sh b/scripts/runtests.sh index c4f76a58..c60df759 100755 --- a/scripts/runtests.sh +++ b/scripts/runtests.sh @@ -168,7 +168,11 @@ timeout --foreground 60 sh -c "LANG=C.UTF-8 python3 -m subiquity.cmd.tui --autoi --source-catalog=examples/install-sources.yaml" validate python3 scripts/check-yaml-fields.py .subiquity/var/log/installer/subiquity-curtin-apt.conf \ - apt.disable_components='[non-free, restricted]' + apt.disable_components='[non-free, restricted]' \ + apt.preferences[0].pin-priority=200 \ + apt.preferences[0].pin='"origin *ubuntu.com*"' \ + apt.preferences[1].package='"python-*"' \ + apt.preferences[1].pin-priority=-1 python3 scripts/check-yaml-fields.py .subiquity/var/log/installer/subiquity-curtin-install.conf \ debconf_selections.subiquity='"eek"' \ storage.config[-1].options='"errors=remount-ro"' diff --git a/subiquity/server/controllers/mirror.py b/subiquity/server/controllers/mirror.py index e51268ee..bbe4a38b 100644 --- a/subiquity/server/controllers/mirror.py +++ b/subiquity/server/controllers/mirror.py @@ -50,6 +50,28 @@ class MirrorController(SubiquityController): 'enum': ['universe', 'multiverse', 'restricted', 'contrib', 'non-free'] } + }, + "preferences": { + "type": "array", + "items": { + "type": "object", + "properties": { + "package": { + "type": "string", + }, + "pin": { + "type": "string", + }, + "pin-priority": { + "type": "integer", + }, + }, + "required": [ + "package", + "pin", + "pin-priority", + ], + } } } }