  We produce the general solution of the Wess-Zumino consistency condition for
gauge theories of the Yang-mills type, for any ghost number and form degree. We
resolve the problem of the cohomological independence of these solutions. In
other words we fully describe the local version of the cohomology of the BRS
operator, modulo the differential on space--time. This in particular includes
the presence of external fields and non--trivial topologies of space--time.
