GithubHelp home page GithubHelp logo

'pkgin rm *' behaves unexpectedly about pkgin HOT 6 OPEN

0-wiz-0 avatar 0-wiz-0 commented on June 26, 2024 1
'pkgin rm *' behaves unexpectedly

from pkgin.

Comments (6)

0-wiz-0 avatar 0-wiz-0 commented on June 26, 2024

When I ran it, it did indeed delete 77 packages.
The next call to pkgin rm \* only offers deleting of two packages, libreoffice and zxing-cpp.
The next one says it will remove 51, some leaf packages, but also (most? all? of) qt5.
The next run offered only zsh-autosuggestions; I tried pkgin ar at that point and it offered to delete 281 packages.
I don't see the pattern.

from pkgin.

0-wiz-0 avatar 0-wiz-0 commented on June 26, 2024

After the pkgin ar, pkgin rm still offered only to delete zsh-autosuggestion; after that, zsh, then 1-6 packages each time I started it.

from pkgin.

sskras avatar sskras commented on June 26, 2024

Wow.

from pkgin.

jperkin avatar jperkin commented on June 26, 2024

Firstly, what's happening here is that pkgin operates on package matches, not globs. If you ask to install or remove *, it will try to find the best package match for your pattern, there's no concept of expanding globs. The package it chooses will be dependent on the ordering in the local package repository but likely reverse alphabetical (hence picking z* in your case), and the numbering will be based on how many dependent packages it will have to remove along with the one that matched.

I think that fundamentally we can't support globs like this, due to the way pkgsrc pattern matching works. Consider patterns like vim{,-xaw}: in pkgsrc context that means either vim or vim-xaw, but not both. While we could add hacky hardcoding of * to mean all packages, I'm not sure it makes for a orthogonal user experience, and I'm leaning more towards adding a clear paragraph or two about this in the man page.

Finally, trying to perform a hypothetical pkgin rm '*' wouldn't necessarily work anyway, or be desirable, as there will be packages such pkg_install that cannot be removed, as well as preserve packages that will not be auto-removed. Plus, you'd end up with removing pkgin itself and being unable to recover without resorting to pkg_add (along with potential for issues on platforms where the binary has been removed from out underneath you), and if you are a user who is comfortable doing that then you're probably going to be using pkg_delete -f '*' or similar instead anyway.

I'll leave this open though until the docs are clearer, and if there are a lot of strong opinions that * should work, along with clarity on what should be expected if used for e.g. pkgin install, then I'm happy to reevaluate.

from pkgin.

0-wiz-0 avatar 0-wiz-0 commented on June 26, 2024

Thanks for the explanation. That makes it a bit clearer what happens, though I'm still baffled by the amount of packages deleted each time - if it chooses the 'best match' as you say, why doesn't it always just delete one?
I think documenting this in more detail is probably enough to close this issue, otherwise.

Just to give some bigger view: My use case was reinstalling all packages after an OS upgrade, using a pre-existing package list (that can be used to pkgin import), to make sure only the wanted packages are installed (and not other packages that were installed for testing and forgotten), and they are at the newest version and for the right operating system version, while leaving the changed configuration files alone.

Now that the pkgdb is inside PREFIX, the best method I have for this is to move the old PREFIX aside and install in a new one, but then I have to copy the configuration files manually.

If you have a better suggestion, please let me know. Thanks.

from pkgin.

jperkin avatar jperkin commented on June 26, 2024

Thanks for the explanation. That makes it a bit clearer what happens, though I'm still baffled by the amount of packages deleted each time - if it chooses the 'best match' as you say, why doesn't it always just delete one?

It only chooses one, but the list of packages will also include any packages that are reverse dependencies of that package, and will also be removed to ensure consistency.

I'm hoping to make this clearer in future releases by separating out packages and dependencies.

If you have a better suggestion, please let me know. Thanks.

pkgin list | awk '{print $1}' | xargs pkgin rm or so should work for now. In the future it might be interesting to have a similar command to import but one that ensures that only the listed packages and their dependencies are installed.

from pkgin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.