Skip to content

Makesure can not be used to execute two goals with effects that counter each other #171

@koljakube

Description

@koljakube

I sometimes need to implement update tasks.
A basic setup can look like this:

@goal 'x-created'
@reached_if test -f x
  touch x

@goal 'x-deleted'
@reached_if ! test -e x
  rm x

Now the update task would look like this:

@goal 'x-updated'
@depends_on 'x-deleted'
@depends_on 'x-created'

This does not work, since the reached-checks are checked during build graph construction, as far as I can tell.

Workarounds:

  • Calling ./makesure in x-updated instead of dependencies.
  • Simply executing ./makesure x-updated twice.
  • Removing checks (not very useful).

I could think of ways for makesure to support this better:

  • reached_if-checks could happen before goal execution (but I guess that would change too much of makesure's behavior).
  • A variable could be set for goals that were invoked directly from the CLI, and unset for dependencies.
  • More general, a variable that contains the "depenency depth level", à la $SHLVL.
  • Some "always execute" pseudo-parameter that could be passed to every goal.

I'm writing this primarily to start discussion, since I use makesure quite heavily at the moment. What do you think about this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions