When I build a snapcraft from a yaml file the packages are pulled from http://security.ubuntu.com
and http://archive.ubuntu.com
.
This makes sense, as I am using the core24
base snap and this is coming from its config in /etc/apt/sources.list.d/ubuntu.sources
.
Now how do I change this so that during the phases Fetching stage-packages
another server is used?
Here is an example config:
name: app-simplebase: core24grade: develconfinement: strictapps: test: command: usr/bin/testparts: test: plugin: nil source: test source-type: local build-packages: - clang - cmake - ninja-build - libfmt-dev stage-packages: - libfmt9 override-build: cmake ${CRAFT_PROJECT_DIR} -G Ninja ninja test mkdir -p "${CRAFT_PART_INSTALL}/usr/bin/" cp test "${CRAFT_PART_INSTALL}/usr/bin/test"
Then I run it with lxd
and the command:
snapcraft --verbosity debug --debug
This eventually runs:
2024-06-12 22:53:38.005 :: 2024-06-12 22:48:35.023 Fetching stage-packages 2024-06-12 22:53:38.005 :: 2024-06-12 22:48:35.023 Requested stage-packages: ['clang', 'cmake', 'ninja-build', 'libfmt-dev'] 2024-06-12 22:53:38.005 :: 2024-06-12 22:48:35.025 Executing: ['apt-get', 'update'] 2024-06-12 22:53:38.005 :: 2024-06-12 22:48:39.356 :: Hit:1 http://security.ubuntu.com/ubuntu noble-security InRelease 2024-06-12 22:53:38.005 :: 2024-06-12 22:49:28.433 :: Ign:2 http://archive.ubuntu.com/ubuntu noble InRelease 2024-06-12 22:53:38.005 :: 2024-06-12 22:49:28.434 :: Ign:3 http://archive.ubuntu.com/ubuntu noble-updates InRelease 2024-06-12 22:53:38.005 :: 2024-06-12 22:49:28.434 :: Ign:4 http://archive.ubuntu.com/ubuntu noble-backports InRelease
I know I can overwrite the different stages, but all seem to come after the fetch stage.