0

This question has been asked previously here and here, but my question is slightly different. In particular, let's say I want to install the same git version on a machine as my machine. I first run sudo apt-cache policy git, which gives me:

  Installed: 1:2.32.0-1~ppa0~ubuntu20.04.1
  Candidate: 1:2.32.0-1~ppa0~ubuntu20.04.1
  Version table:
 *** 1:2.32.0-1~ppa0~ubuntu20.04.1 500
        500 http://ppa.launchpad.net/git-core/ppa/ubuntu focal/main amd64 Packages
        100 /var/lib/dpkg/status
     1:2.25.1-1ubuntu3.1 500
        500 http://us.archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages
     1:2.25.1-1ubuntu3 500
        500 http://us.archive.ubuntu.com/ubuntu focal/main amd64 Packages

I notice that the version is 2.32.0. If git were a Python package, with pip, I'd just do pip install git==2.32.0 to install it. But with apt-get, I have to do:

sudo apt-get install git=1:2.32.0-1~ppa0~ubuntu20.04.1

In particular, I have to specify 1:2.32.0-1~ppa0~ubuntu20.04.1. Is there no way to just specify that I want 2.32.0 without the other stuff?

EDIT: For some more context, I'm trying to create a Docker image with particular package versions. According to Docker docs, I should be able to do:

RUN apt-get update && apt-get install -y \
    package-bar \
    package-baz \
    package-foo=1.3.*

Notice the part package-foo=1.3.*. I tried this with git on my machine: sudo apt-get install git=2.32.* but I get:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Version '2.32.*' for 'git' was not found

while doing just sudo apt-get install git works

  • "The other stuff" is important. That's the build history of that version in both Debian and Ubuntu, so you can establish the delta from upstream 2.32.0. That delta is generally caused by bugfixes (build failures, security patches, etc.). You generally WANT that delta. That delta is one big reason people choose to use Ubuntu. Bugfixes should not make the resulting data incompatible with the upstream version...if it did, that would be serious bug. – user535733 Aug 13 '21 at 17:46
  • You are correct that choosing a specific version can be non-trivial, though it's still not particularly difficult. Defaulting to the newest version available in apt/snap is deliberate: If (almost) everybody uses the same version of software in a particular release of Ubuntu, then it's much easier for community volunteers to help folks who encounter problems. Ubuntu is intended for general usage by unskilled users; the design reflects that. – user535733 Aug 13 '21 at 17:53

0 Answers0