Skip to content

master does not parse — orphan else: in dispatch.py breaks every ebuild command #87

Description

@srpatcha

ebuild/build/dispatch.py on master does not parse. The package cannot be
imported, so no ebuild command runs at all.

$ git show origin/master:ebuild/build/dispatch.py > /tmp/d.py
$ python3 -c "import ast; ast.parse(open('/tmp/d.py').read())"
  File "dispatch.py", line 133
        else:
        ^^^^
SyntaxError: invalid syntax

The line:

128         raise ValueError(
129             f"Unknown build backend '{backend}'. "
130             f"Supported backends: {', '.join(sorted(ALL_BACKENDS))}"
131         )
132
133         else:                        <-- no `if` to attach to
134             raise RuntimeError(
135                 f"BackendDispatcher cannot configure backend '{backend}'. "

An else: with nothing to bind to, immediately after a completed raise.

Cause

Two different designs for the unknown-backend error path — one raising
ValueError, one raising RuntimeError — were each green on their own branch
and squash-merged onto a base that had moved. The merge kept the first raise and
the second's else:, producing a file that no version of the code ever looked
like. Nothing recompiled the result before it became master.

Identical in shape to eos#92, where sync.c ended up referencing original_prio
from one priority-inheritance design and g_blocked_on from another. Same root
cause, different repository.

Impact

Total. dispatch.py is imported by the CLI, so ebuild build, ebuild configure, ebuild info — every command — fails at import. The suite reports
11 failures / 190 passed on master once the file is made parseable by hand;
until then it does not collect.

Why nothing caught it

$ gh api repos/embeddedos-org/ebuild/branches/master/protection
{"checks": null, "reviews": 1, "sigs": false}

required_status_checks is null. Nothing builds or imports the merge result
before it lands. This is the third repository in the organisation with the same
gap — none has a required status check — and the second where it has already
allowed a non-compiling master.

Fixes already open

PR parses after?
#66 yes — also unifies the two error paths behind one _unknown_backend() helper. Already approved.
#78 yes
#75 no — despite the title. Its dispatch.py still fails at line 133 with the identical error. Its toolchain-flag validation is real and worth keeping, but it does not repair the syntax.

#66 is the one to take: it removes the duplication that caused this rather than
just deleting the stray else:.

The durable fix

Once #66 lands, make the existing workflow a required status check on master.
A PR whose merge result does not import then cannot merge, which is precisely
what did not happen here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions