Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.user > #260805 > unrolled thread
| Started by | "Gareth Evans" <donotspam@fastmail.fm> |
|---|---|
| First post | 2023-08-10 11:50 +0200 |
| Last post | 2023-08-11 06:10 +0200 |
| Articles | 4 — 3 participants |
Back to article view | Back to linux.debian.user
apt policy / listing packages from repo "Gareth Evans" <donotspam@fastmail.fm> - 2023-08-10 11:50 +0200
Re: apt policy / listing packages from repo David Wright <deblis@lionunicorn.co.uk> - 2023-08-10 16:40 +0200
Re: apt policy / listing packages from repo Sven Joachim <svenjoac@gmx.de> - 2023-08-10 20:00 +0200
Re: apt policy / listing packages from repo "Gareth Evans" <donotspam@fastmail.fm> - 2023-08-11 06:10 +0200
| From | "Gareth Evans" <donotspam@fastmail.fm> |
|---|---|
| Date | 2023-08-10 11:50 +0200 |
| Subject | apt policy / listing packages from repo |
| Message-ID | <H1asN-NlW-5@gated-at.bofh.it> |
There seems to be no mention of apt policy in either man apt or apt --help. I was looking for a way to list packages installed from a particular repo and/or sub-repo or whatever it's called (eg. main, non-free). Does anyone know of a way to do this, with apt policy or otherwise? Thanks, Gareth
[toc] | [next] | [standalone]
| From | David Wright <deblis@lionunicorn.co.uk> |
|---|---|
| Date | 2023-08-10 16:40 +0200 |
| Message-ID | <H1eZr-Q5x-7@gated-at.bofh.it> |
| In reply to | #260805 |
On Thu 10 Aug 2023 at 10:46:27 (+0100), Gareth Evans wrote: > There seems to be no mention of > > apt policy > > in either man apt or apt --help. As man apt says: "Much like apt itself, its manpage is intended as an end user interface and as such only mentions the most used commands and options partly to not duplicate information in multiple places and partly to avoid overwhelming readers with a cornucopia of options and details." > I was looking for a way to list packages installed from a particular repo and/or sub-repo or whatever it's called (eg. main, non-free). > > Does anyone know of a way to do this, with apt policy or otherwise? What I do in this situation is to type "apt" and press TAB twice. Look at the resulting list of commands and check the man page for the most likely looking, in this case apt-cache. An alternative method of course is to type apt policy into any search engine. This will typically tell you not only how to invoke the command, but also more about what it produces. As for your listing, I've done this in the past with a script that runs apt-cache dump, grepping the Package/Version/File lines, concatenating and sorting them, then filtering that list against the output of dpkg-query -W -f to include only installed packages. This yields a list like: Package: acl Version: 2.2.53-10 File: /var/lib/apt/lists/deb.debian.org_debian_dists_bullseye_main_binary-amd64_Packages Package: adduser Version: 3.118 File: /var/lib/apt/lists/deb.debian.org_debian_dists_bullseye_main_binary-amd64_Packages [ … … ] Package: xtoolwait Version: 1.3-6.2 File: /var/lib/dpkg/status [ … … ] Package: yt-dlp Version: 2023.03.04-1~bpo11+1 File: /var/lib/dpkg/status which you can grep for particular subsets, though I'm usually more interested in grep -v for packages originating from elsewhere, like xtoolwait (squeeze) and yt-dlp (backports) there. There may well be better ways. Cheers, David.
[toc] | [prev] | [next] | [standalone]
| From | Sven Joachim <svenjoac@gmx.de> |
|---|---|
| Date | 2023-08-10 20:00 +0200 |
| Message-ID | <H1i6Z-RUJ-1@gated-at.bofh.it> |
| In reply to | #260808 |
On 2023-08-10 09:30 -0500, David Wright wrote:
>> I was looking for a way to list packages installed from a particular
>> repo and/or sub-repo or whatever it's called (eg. main, non-free).
>>
>> Does anyone know of a way to do this, with apt policy or otherwise?
>
> What I do in this situation is to type "apt" and press TAB twice.
> Look at the resulting list of commands and check the man page for
> the most likely looking, in this case apt-cache.
>
> An alternative method of course is to type apt policy into any
> search engine. This will typically tell you not only how to invoke
> the command, but also more about what it produces.
>
> As for your listing, I've done this in the past with a script that
> runs apt-cache dump, grepping the Package/Version/File lines,
> concatenating and sorting them, then filtering that list against
> the output of dpkg-query -W -f to include only installed packages.
> This yields a list like:
>
> Package: acl Version: 2.2.53-10 File: /var/lib/apt/lists/deb.debian.org_debian_dists_bullseye_main_binary-amd64_Packages
> Package: adduser Version: 3.118 File: /var/lib/apt/lists/deb.debian.org_debian_dists_bullseye_main_binary-amd64_Packages
> [ … … ]
> Package: xtoolwait Version: 1.3-6.2 File: /var/lib/dpkg/status
> [ … … ]
> Package: yt-dlp Version: 2023.03.04-1~bpo11+1 File: /var/lib/dpkg/status
>
> which you can grep for particular subsets, though I'm usually more
> interested in grep -v for packages originating from elsewhere,
> like xtoolwait (squeeze) and yt-dlp (backports) there.
>
> There may well be better ways.
I would probably use "apt list" with a search pattern described in
apt-patterns(7), e.g. the following command lists all installed packages
from non-free:
$ apt list '~i ~snon-free/'
Lots of interesting possibilities one can toy with. :-)
Cheers,
Sven
[toc] | [prev] | [next] | [standalone]
| From | "Gareth Evans" <donotspam@fastmail.fm> |
|---|---|
| Date | 2023-08-11 06:10 +0200 |
| Message-ID | <H1rDj-XVp-3@gated-at.bofh.it> |
| In reply to | #260813 |
On Thu 10 Aug 2023, at 18:54, Sven Joachim <svenjoac@gmx.de> wrote: > On 2023-08-10 09:30 -0500, David Wright wrote: > >>> I was looking for a way to list packages installed from a particular >>> repo and/or sub-repo or whatever it's called (eg. main, non-free). >>> >>> Does anyone know of a way to do this, with apt policy or otherwise? >> >> What I do in this situation is to type "apt" and press TAB twice. >> Look at the resulting list of commands and check the man page for >> the most likely looking, in this case apt-cache. >> >> An alternative method of course is to type apt policy into any >> search engine. This will typically tell you not only how to invoke >> the command, but also more about what it produces. >> >> As for your listing, I've done this in the past with a script that >> runs apt-cache dump, grepping the Package/Version/File lines, >> concatenating and sorting them, then filtering that list against >> the output of dpkg-query -W -f to include only installed packages. >> This yields a list like: >> >> Package: acl Version: 2.2.53-10 File: /var/lib/apt/lists/deb.debian.org_debian_dists_bullseye_main_binary-amd64_Packages >> Package: adduser Version: 3.118 File: /var/lib/apt/lists/deb.debian.org_debian_dists_bullseye_main_binary-amd64_Packages >> [ … … ] >> Package: xtoolwait Version: 1.3-6.2 File: /var/lib/dpkg/status >> [ … … ] >> Package: yt-dlp Version: 2023.03.04-1~bpo11+1 File: /var/lib/dpkg/status >> >> which you can grep for particular subsets, though I'm usually more >> interested in grep -v for packages originating from elsewhere, >> like xtoolwait (squeeze) and yt-dlp (backports) there. >> >> There may well be better ways. > > I would probably use "apt list" with a search pattern described in > apt-patterns(7), e.g. the following command lists all installed packages > from non-free: > > $ apt list '~i ~snon-free/' > > Lots of interesting possibilities one can toy with. :-) I will look into both approaches - my thanks to you and David. G
[toc] | [prev] | [standalone]
Back to top | Article view | linux.debian.user
csiph-web