[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Is there an easy way to get the latest version number of a source package that is available?



Hi,

apt-get --only-source --download-only source <package>

will download the latest version of the source package.

Is there a one liner that will give me the version of the package
(including the epoch) without downloading the package and parsing the
dsc?


------
Everything below here is what I've tried and problems I've encountered -
feel free to comment on this but the above is the question that I'm
particularly interested in whether there's a simple answer to.


The filename doesn't include the epoch so I can't parse the output of
--print-uris.

apt-cache showsrc <package> lists all of the versions available. I can
(and am) parsing that to find the highest version number.

The manpage says --no-all-versions to turn off the default -a but
that doesn't seem to work with showsrc.

apt-cache policy <package> appears to only work with .deb, not sources.

apt-cache also seems to ignore -t and the results are not ordered by
version number:

$ apt-cache -t bullseye showsrc dpkg | grep ^Version:
Version: 1.20.9
Version: 1.20.10
Version: 1.18.24
Version: 1.18.25
Version: 1.19.5
Version: 1.19.7
Version: 1.21.7
Version: 1.21.8


This is also annoying:
$ apt-get -t bullseye --print-uris --only-source source dpkg
Reading package lists... Done
Selected version '1.20.9' (bullseye) for dpkg
NOTICE: 'dpkg' packaging is maintained in the 'Git' version control system at:
https://git.dpkg.org/git/dpkg/dpkg.git
Please use:
git clone https://git.dpkg.org/git/dpkg/dpkg.git
to retrieve the latest (possibly unreleased) updates to the package.
Need to get 4957 kB of source archives.
'http://ftp.uk.debian.org/debian/pool/main/d/dpkg/dpkg_1.20.9.dsc' dpkg_1.20.9.dsc 2120 SHA256:87f21320f3165d1c57dae2314b7fd1849b49da9416fee3fb57c4b1e4192b4285
'http://ftp.uk.debian.org/debian/pool/main/d/dpkg/dpkg_1.20.9.tar.xz' dpkg_1.20.9.tar.xz 4954428 SHA256:5ce242830f213b5620f08e6c4183adb1ef4dc9da28d31988a27c87c71fe534ce


In order to get that 1.20.10 version I have to use -t bullseye-updates.


In buster you don't need to do that: (The list above of the versions was
generated without the buster/updates Suite being added)
after I add it this works:

$ apt-get -t buster --print-uris --only-source source dpkg
Reading package lists... Done
Selected version '1.19.8' (buster) for dpkg
NOTICE: 'dpkg' packaging is maintained in the 'Git' version control system at:
https://git.dpkg.org/git/dpkg/dpkg.git
Please use:
git clone https://git.dpkg.org/git/dpkg/dpkg.git
to retrieve the latest (possibly unreleased) updates to the package.
Need to get 4703 kB of source archives.
'http://security.debian.org/pool/updates/main/d/dpkg/dpkg_1.19.8.dsc' dpkg_1.19.8.dsc 2103 SHA256:3b0220b111044754f8620ce53b1ba67cad9458cab6dde39d299dbb2f27c5528d
'http://security.debian.org/pool/updates/main/d/dpkg/dpkg_1.19.8.tar.xz' dpkg_1.19.8.tar.xz 4701260 SHA256:2632c00b0cf0ea19ed7bd6700e6ec5faca93f0045af629d356dc03ad74ae6f10



(What I'm actually doing now to work around this issue is generate a
separate apt config that only contains one release and then I don't need
to use the -t at all. I run patched versions of some things and my
scripts are supposed to notice that there's a new source but they were
missing the bullseye updates until the weekend)


Tim.



Reply to: