MageSlayer / paludis-gentoo-patches

Unofficial Gentoo patches for Paludis package manager
GNU General Public License v2.0
14 stars 7 forks source link

action: add reset() to PretendAction and reset the state for each pretend run. #47

Closed Ionic closed 1 year ago

Ionic commented 1 year ago

This one is a bit tricky. I'll explain it more verbosely.

Usually, all states are sticky. This makes sense, since it means we can easily resume operations without having to re-execute steps that were already executed once (think of cave resume for instance). Re-execution is slow at best and would break things at worst, like unpacking the source tree again after a successful build.

The original description above was bogus. States aren't usually sticky, as far as I can see, it's just that the PretendAction state is only set to failed if a pretend operation fails. The state starts out as non-failed, but having one pretend operation fail means that the PretendAction state can only ever stay on failed.

Unfortunately, this also means that we cannot execute pretend actions for the same package multiple times and correctly check the new state. I'd like to do that, though, in our test suite, for testing different USE flag variations/combinations for USE restrictions.

There are multiple ways to have that working:

I've decided to go with the first method, but the third one would also be viable. It didn't make sense to implement it this way, though.

Keeping this PR open for a bit for others to chime in.

This should be rather safe, so merging directly after all.

Ionic commented 1 year ago

The initial description was bogus, rewritten and going to just merge.