Debian buildd have always used dpkg-buildpackage to build Debian packages but this tool largely relies on debian/rules. Only debian/rules interface is codified by the Debian Policy (see section 4.9). The debian/rules interface is frequently used by developers to test some part of their rules file without doing a full build. However, by calling debian/rules directly, they might miss some environment variables setup by dpkg-buildpackage. This could lead to (unexpected) difference of behaviors.

Environment variables setup by dpkg-buildpackage

What controls the build environment

During discussions, it appeared that having dpkg-buildpackage mess with the build environment is not always well accepted. Some people would rather let debian/rules handle everything and have dpkg-buildpackage stay out of the story. I tried to summarize below the advantages/disadvantages of each approach. Feel free to complete. -- RaphaelHertzog

Choice 1: have the debian/rules caller setup the standard build environment

We modify Debian policy so that debian/rules files can rely on the set of environment variables exported by dpkg-buildpackage (the list can be hardcoded, it won't evolve much over time). Calling debian/rules directly is still possible but it doesn't guaranty that the result will be the same as a package built with the various environment variables set to the default value chosen by their respective distributions (those are exported by dpkg-buildpackage). To avoid the difference, people can use dpkg-buildpackage --target target instead of debian/rules target (a debian-rules wrapper script can be created to further ease the conversion if needed).

Advantages

Disadvantages

Choice 2: ensure that only debian/rules modifies the build environment

We don't accept that the debian/rules caller plays a role in preparing the build environment and as such progressively remove the code that does so in dpkg-buildpackage. Each rules files has full control on environment variables. If we want to try to standardize the build environment anyway, we have to provide a Makefile snippet and try to have as many packages as possible to use it.

Advantages

Disadvantages