2

I'm asking 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 other questions that really relate to this:

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 the 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.

1 Answer 1

6

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
    
2
  • For point 2 you said The following pinning will be silently disregarded why it will be disregarded? I don't understand. Commented Mar 4, 2024 at 9:20
  • 1
    If you look at the example in point 1, you'll see that all of the text is aligned left and there's no whitespace - no spaces or tabs - before any of the lines. In the example for point 2, the Pin and Pin-Priority lines are indented and that's why the pinning will be ignored, and it won't throw any warnings. Commented Mar 5, 2024 at 13:17

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.