freebsd / pkg

Package management tool for FreeBSD. Help at #pkg on Libera Chat or pkg@FreeBSD.org
Other
754 stars 281 forks source link

Add Blacklist Option #2325

Open vermaden opened 1 month ago

vermaden commented 1 month ago

I have tried to find it - but failed ...

Does pkg(8) has an option to blacklist a list of packages?

This alone is a perfect example for need of such option:

For example 'mask' any kernel* packages to not install/update them - to ignore them - as a blacklist option in pkg(8)?

I know that having some additional kernel and kernel modules does not 'hurt' on Jails - but there would probable are other use cases for such option.

Regards, vermaden

arrowd commented 1 month ago

You can prevent a package from updating using pkg lock.

vermaden commented 1 month ago

You can prevent a package from updating using pkg lock.

Yes - but that is only AFTER it has been installed.

I want to PREVENT packages from being installed.

arrowd commented 1 month ago

You mean, you don't want to explicitly list packages you want to install, but instead do pkg install -x FreeBSD and let pkg filter out some of them?

vermaden commented 1 month ago

I was thinking of something similar to pkg lock actually.

A default pkg(8) bootstrap will have 'empty' lock list and 'empty' blacklist list.

Then you can add - for example pkg blacklist lsblk and the lsblk will never be installed - and pkg unblacklist lsblk to allow its installation. Same for kernel packages for PKGBASE.

arrowd commented 1 month ago

I still don't get it. If you don't want some package to be installed - just don't install it. A blacklist only makes sense if you want to install by a glob or regex pattern, but filter some packages out of it.

vermaden commented 1 month ago

Is it possible to do the same with PKGBASE as described in the message I linked to in the first message?

arrowd commented 1 month ago

pkgbase is no different from any other set of packages. Having read the Mastodon post, I still fail to understand the problem. Create a text file and list all packages you want to have installed/upgraded. Then feed it to pkg install/pkg upgrade.

vermaden commented 1 month ago

Good idea, will share that with the author of the post.

jeffpc commented 1 month ago

Author of the mastodon post here...

The only reason I wish for something (not necessarily a blacklist option) to exclude packages during fresh install is simple:

I want to use pkgbase for FreeBSD jails. All the docs out there just install * from pkgbase which includes kernel, debuginfo, source, etc. This is overkill for all my jails (and I suspect the same is true for other people's jails).

Create a text file and list all packages you want to have installed/upgraded. Then feed it to pkg install/pkg upgrade.

This is the obvious way, but it has a problem - I don't know which packages are necessary for a well function jail. Sure, I know to exclude the kernel, source, whatever, but I don't really want to figure out what is needed and what isn't every time there is a new release. (That's with a user/sysadmin hat on; with a wanna be fbsd dev hat on, I could figure it out but it still feels a bit like waste of time.)

IMO, the ideal solution would be for pkgbase to include some kind of metapackage for "jail stuff" subset of the system. Then it would be as easy as pkg install jail-stuff-package. That, of course, would be something for the people working on pkgbase to do (and not for pkg(8) itself). This is my opinion, and I definitely don't have all the ins/outs/nuance of pkg(8) in my head, so it may not be workable for some reason.

Just my 2 cents.

bapt commented 1 month ago

the doc is working around a missing feature which is pkg group, half backed so far... a pkg group is kind of a metapackage, but more clever, at the moment we will have finished the pkg groups, one would be able to say pkg install FreeBSD-userland or something like that to just install the userland without the kernel. I don't like this idea of a list of package whish will be automagically marked in order for them not be excluded from any request, this makes things very hard to debug when things goes wrong, and is usually very fragile by design, for this case, imho what we need is someone to motivate me into finishing pkg groups.