build-system: Introduce "bags" as an intermediate representation.