Search code examples
debianaptcpack

How to define the target (apt install -t") of a built package to distinguish when with the same name


I am working on a cmake project where we create a .deb package with cpack containing a C++ library. The goal is to have a pipeline running at the main branch which generates the package and places it at our local repository, same under the dev branch.

Now, to distinguish the packages that would have the same name I would like to use the -t option from the apt install -t target packagename to decide if I install the package from main that is at a local repository, for e.g., "/stable" or the package from dev that is located at the local repository "unstable".

So far I have not figured out how to achieve this. When I have a package with the same name on different local repositories, how can I uniquely identify which one to install?


Solution

  • I figured it out, so I post here in case anyone finds it useful.

    In sum:

    At sources.list I added my local sources:

    deb [trusted=yes] myrep/unstable ./
    deb [trusted=yes] myrep/stable./
    

    At at each repository folder I have at the beginning of the "Release" file the following:

    Archive: unstable
    Version: 1.0
    Codename: unstable
    Date: 2024
    Architectures: amd64 i386
    Components: main
    Description: Unstable Local APT Repository with packages built from the dev branch 
    

    And the same for the "stable" repository.

    Then by doing sudo apt-get install -t unstable packagename it installs from the unstable repository, if I do sudo apt-get install packagename it installs from the stable repository.