Score:0

how to programatically find a lower version of a given package version?

tr flag

I'm finding the dependency (with version) programmatically by reading the control file of the Debian packages. I noticed that some dependencies need a strictly lesser version (<< ). How to idea how to find a lower version programmatically?

user535733 avatar
cn flag
This seems like an [XY Question](https://en.wikipedia.org/wiki/XY_problem): Why would a competent user want to deliberately install wrong-version (and therefore likely incompatible) packages? And why would they want to automate such a terrible mistake?
Score:1
us flag

One way to do this programmatically is by getting it from the changelog of the package.

Say the package name is $PACKAGE and the version right after the one you're looking for is $VERSION, then this would work:

apt-get -qq changelog "$PACKAGE" |
dpkg-parsechangelog -l - -u "$VERSION" -S Version
Score:0
cn flag

You could scan your package database for known previous versions, but that doesn't guarantee that the older package is still in your local /var/cache/apt/archive. It might be as simple as grepping the output of dpkg -l

You could also scan the 'pool' section of your favorite Ubuntu repository. This takes longer, but you know that the package exists. This may be much slower than checking your local database.

Of course, a fancy solution might use elements of both.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.