I'm posting this because I've lost too many hours figuring it out myself, the documentation is missing several important notes and I haven't found any forum posts that really relate to this:
Question: How do I prioritize specific package versions for multiple architectures? In particular, I have a number of different packages which I would like to download for multiple architectures, and I would like to prioritize the versions so that if they're not explicitly provided, apt will try to get a version matching my arbitrary requirements (in my case, the current git branch name) and fall back to our develop branch versions.
eg. I would like to download package my-package for both i386 and amd64 architectures and I would like to pull the latest version that includes my-git-branch-name before falling back to the latest that includes develop.
Answer:
The official documentation is here.
1. In order to support multiple architectures, all packages being pinned must have their architecture specified, and there must be an entry for each architecture. A pinning for the package name without the architecture specified will only influence the default (platform) architecture:
Package: my-package
Pin: version /your regex here/
Pin-Priority: 1001
2. The entries are whitespace-sensitive, although no errors will be reported if you have whitespace. The following pinning will be silently disregarded:
Package: my-package:amd64
Pin: version /your regex here/
Pin-Priority: 1001
3. apt update must be called after updating the preferences file in order for them to be respected and after adding additional architectures using (for example) dpkg --add-architecture i386
The following excerpt from /etc/apt/preferences solves the stated problem:
Package: my-package:amd64
Pin: version /-my-git-branch-name-/
Pin-Priority: 1001
Package: my-package:i386
Pin: version /-my-git-branch-name-/
Pin-Priority: 1001
Package: my-package:amd64
Pin: version /-develop-/
Pin-Priority: 900
Package: my-package:i386
Pin: version /-develop-/
Pin-Priority: 900
It may be worthwhile noting that to download or install a package with a specified architecture and version use the command apt download package-name:arch=version
No comments:
Post a Comment