On 2022-06-27 at 10:31, Tim Woodall wrote:
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?
I'm not aware of one, just offhand; it'd be easy enough, except for the
problem that version number comparison gets complicated in corner cases
such as '+' and '~', and I'm not aware of a way to ensure that the
version number comparison is done correctly without making it no longer
a one-liner.
(Well, short of putting the more complicated logic into a script and
just running that script, but if you want a one-liner I assume that's
not an option.)
------
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.
So... what is it that still needs to be done?
I was putting together a possibly-kludgy easy-enough solution, and was
running into the wall of needing to do pairwise comparisons (with 'dpkg
--compare-versions') of the versions produced by 'apt-cache showsrc
--only-source <package>', since any other comparison method isn't
guaranteed to produce the same highest-version result as dpkg would use
- but if you're already doing this, that looks like it solves the
problem, for me.
Is it just that your parsing makes this no longer a one-liner?