Skip to content

Fixes/shellcheck

sc0ttj requested to merge fixes/shellcheck into master

Shellcheck fixes

This PR has lots of fixes based on running shellcheck on Pkg:

shellcheck --color=always --exclude=SC2086,SC1090,SC1091,SC2155,SC2002,SC2162,SC2006 /usr/sbin/pkg | less

Add and remove the SC stuff as needed when fixing different things...

Fixes in this PR:

  • fixes in getting package information:
    • package installed or not
    • package repo
    • package contents
    • package filename (new function get_pkg_filename, respects repo fallback order)
    • package versions
  • slightly better error checking
    • should be a little bit more reliable
  • faster search commands: pkg s <term>, pkg sa <term>, pkg ss <term>, pkg ssa <term>
  • faster installation and uninstallation of packages
  • pkg what-needs <pkgname> now much better (faster and more accurate)
    • therefore pkg rm <pkgname will be much faster
  • fixed output for pkg PS <pkgname> (nicely align all deps, not only first 10 lines)
  • fixes in setting up and running petbuild

Other changes

  • fixed various code errors/typos
  • fewer sub-shells, a little bit faster
  • removed some old code
  • simplified some code
  • cleaned up long lines, made them < 80 chars

TODO

  • fix pkg_update, still not reporting final versions quite right
    • it's kind of respecting fall back order, and also not ..

In a future PR

Go through again and reduce number of sub-shells, but keep the code simple - no exotic, unreadable stuff.

Edited by sc0ttj

Merge request reports