ZOSOpenTools / meta

Meta repository to tie together the various underlying z/OS Open Source tools repositories here
https://zosopentools.github.io/meta/
Apache License 2.0
37 stars 25 forks source link

Adjusting --all option #718

Open emanuelhaine opened 4 months ago

emanuelhaine commented 4 months ago

The --all option should handle all the tasks below:

It is not only a good practice but this adjusment will also match the standard of other package manager, such as yum/dnf.

emanuelhaine commented 4 months ago

So, what if I add an exit 0 on this block

  "--all")
    all=true
    unused=true
    dangling=true
    cache=true
    meta=true
    cleanUnused
    cleanDangling
    cleanPackageCache
    cleanMetadata

And adjust the code to acomodate the --allpackages?

Let me know if this is a good approach or if you have something different in mind, so I can work on that.

DevonianTeuchter commented 4 months ago

That'd work :-)
Note that the reluctance to have a generic "run all cleanup commands" was that the "dangling" check is really slow as it has to analyse all symlinks in the zopen filesystem for existence; and since symlinks are heavily used by design, that's a lot of checks! A handful of packages it'd be bearable but with all packages (or even just some of the bigger packages like ncurses & perl) things grind to a halt. Something to contemplate... :-)

emanuelhaine commented 4 months ago

I got it. I noticed the dangling find is using -exec and test to validate the symlinks. If we had the -xtype option available on find, we could use something like that:

find ./ -type l -xtype l | xargs rm

And it would be all the logic. This way, dangling would be faster.

But for now, I'll work on adding the exit 0 and the --allpackages option and we can iterate and improve from this.

DevonianTeuchter commented 3 months ago

I got it. I noticed the dangling find is using -exec and test to validate the symlinks. If we had the -xtype option available on find, we could use something like that:

find ./ -type l -xtype l | xargs rm

And it would be all the logic. This way, dangling would be faster.

But for now, I'll work on adding the exit 0 and the --allpackages option and we can iterate and improve from this.

Yeah, welcome to zos versions of utils like find that are quite old in support so are missing useful options 🙂