ionenwks / iwdevtools

Small tools to aid with Gentoo development, primarily intended for QA
BSD 2-Clause "Simplified" License
21 stars 4 forks source link

bashrc: add IWDEVTOOLS environment variable to disable iwdevtools #9

Closed Flowdalic closed 2 years ago

Flowdalic commented 2 years ago

This allows to selective disable iwdevtools by setting IWDEVTOOLS=false in portage's environment.

Signed-off-by: Florian Schmaus flow@gentoo.org

ionenwks commented 2 years ago

Does IWDT_ALL=n not already do what you want? mentioned in the --help text as the "global" disable switch:

bashrc environment options (export/make.conf/package.env):
  QA_VDB=y | =n         Enable or disable, can also use IWDT_ALL=y | =n
Flowdalic commented 2 years ago

Does IWDT_ALL=n not already do what you want?

Looks like it does and I simply missed it. Thanks for pointing this out ionen.

Flowdalic commented 2 years ago

That written, what do you think of changing this PR to something like

if [[ ${IWDT_ALL:-y} == y
    && ! ${PKGCORE_PKG_REPO}  ]] && |

? That would prevent unnecessary souring the iwdevtools rc files.

ionenwks commented 2 years ago

This bashrc is just a drop-in "example" if you need nothing else (given bashrc could all all sort of things, including already defined hooks), it's meant to be edited as needed. If anything I'd veer more toward moving the pkgcore check out of it to make it simpler than add a new one that does the same check twice. Edit: actually I'll add that to my todo, not particularly liking that I put that there, plus there is at least qa-sed that should work with pkgcore

Flowdalic commented 2 years ago

it's meant to be edited as needed.

Sure, but that doesn't mean that I can't come with sane defaults. I currently simply source /usr/share/iwdevtools/bashrc in my /etc/portage/bashrc and it works like a charm (although, it, of course, would break if something else also defines post_pkg_preinst() and/or post_pkg_postinst()).

ionenwks commented 2 years ago

But it's already sane? Loading a few bashrc files isn't exactly crazy that it needs an additional guard, and typically people do not even disable it if went through the trouble of sourcing it.

ionenwks commented 2 years ago

Think I'll leave it as-is (beside removing the pkgcore check entirely), thanks for the contribution still. Do add any checks you like to your own bashrc, using as-is (symlink) is really just for the most common use.