Path: csiph.com!fu-berlin.de!bofh.it!news.nic.it!robomod From: Sven Joachim Newsgroups: linux.debian.user Subject: Re: apt policy / listing packages from repo Date: Thu, 10 Aug 2023 20:00:01 +0200 Message-ID: References: X-Mailbox-Line: From debian-user-request@lists.debian.org Thu Aug 10 17:54:55 2023 Old-Return-Path: X-Amavis-Spam-Status: No, score=-5.897 tagged_above=-10000 required=5.3 tests=[ATTENDEES_DBSPAM_BODY3=1, ATTENDEES_DBSPAM_HEADER3=1, BAYES_00=-2, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, LDO_WHITELIST=-5, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001] autolearn=no autolearn_force=no X-Ui-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Mail-Followup-To: debian-user@lists.debian.org User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:xAK+77ZypK+ikTBLMoe7rM6tTN5R8qzArwI1cReDBpQn31xDocN fXlRWabMFQFolKP0xofALqooFtkVkF4ITwxMHZhGh+kAlKChqaZfYcrV7NhNjKCF8c4hVfY k/+OofP7hNbWL2S3nsL36peHd3tsmQwP6O1RQER9ljNlDmLZM6qUdoSq7bzwbC4NpwPOLEs 4okNjhVO6Wui5WZ5gvQMA== Ui-Outboundreport: notjunk:1;M01:P0:DBhKO0N9ZhQ=;2sVEYLyavfgVr2HsMjfXVfoyzur KAYcKUdkHUSjNwtZ3Zq1GuEJ5I94rez0sLyDb/+th9zykqiuWM0pv6aZ3dE8pwglvSFFIzX6E f9N9Ut69Mb8smW6kf5c3UVpVPXj4D0kJHLhq65sTwk3mujrPhmNZul/fLMkUD5cRBOmuDljq9 6VHe6yFT+9Du3jxOOXxIdwr3jfke+aam0TZlGHxJVWRRmSz2zHIGUEGcvRa82Bcl2Njkh/+tI oBXmPzpfy0FLzSnk9IgQLPepKd/frorwS720o4GIWQ6Y7ElE2pNZv2ngKgEiWsqHL7Nm7hSG/ WAasmbfa81Re9bsZd8yOeQs2kX4lO4xKMYtpjrIC25EpVp/DBRI2tUtsK+XuAyphHuxjSp/NO MwOcXfx7l5h8l41G9MhVwOf8hyrpm4KwlurMCLw0TCCcRlY/LoDd5eXdU/6yElsf4Z2sdoVTQ wgI2sUbPKVHfKG9tvxHPpnmmdE8tnvoipgYidVmW2L9+XUMNbIH/pq45xPmXEM7YMr1SUUwbm 3iXIt/As+Ue3aaTSMYD5JcA7wOmtFjHEKpKfjDKVMx5eOUCJOFLyIgC2rEKrW1Ngtzy38kFvp 8LNp7F5c0sf0zknQGVUMefKpBiw54Hih3Oim/blaRpXImQ2IdHifT4dywOaZg3lSSv10uonIy debake+7Z4FweuyYYNtxq2Sv/zi0uqi32Kmr1jh6hk6qnCEglUB4FgIarRpAYx42YOMLwVfYa ahgJuh/qXJJZ3C7rpCf3AZB6BPPhdnMoFY5vztWqJij3kWRtmAyJjyuvP6mR/q+VYl1wwQ+hz UgixnLuXnuBymyS3ZupMqscCVMEUtE0lEevXeT04m9NHm1ziDb3bR/edkvQakHoi+vJxuyxcv v5oDhr+FftpLOPZt8GLuW7XBMQgf+IOqCKyL1+dkTrIIWUyObHFX6rdt7yUyIcSE1hm10Bk5d Meku/TcqsAGwKv9xsU5Sn3JWU4w= X-Mailing-List: archive/latest/802410 List-ID: List-URL: List-Archive: https://lists.debian.org/msgid-search/87msyyvl4c.fsf@turtle.gmx.de Approved: robomod@news.nic.it Lines: 46 Organization: linux.* mail to news gateway Sender: robomod@news.nic.it X-Original-Date: Thu, 10 Aug 2023 19:54:27 +0200 X-Original-Message-ID: <87msyyvl4c.fsf@turtle.gmx.de> X-Original-References: Xref: csiph.com linux.debian.user:260813 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). >>=20 >> 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 > [ =E2=80=A6 =E2=80=A6 ] > Package: xtoolwait Version: 1.3-6.2 File: /var/lib/dpkg/status > [ =E2=80=A6 =E2=80=A6 ] > 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