I'm trying to recompile nginx with some extra modules and packetize it again. I want to change the package name to avoid package upgrades that could break the server. So far I downloaded the source with apt-get source nginx, changed the rules section to add the module and rebuilded it with debuild but I have no clue about how to change the package name. Any ideas?
The names of resulting packages are configured in debian/control file. You will have to change both Package names and things referring to them (Depends/Conflicts/Provies/etc.).
Additionally, in debian/ there are multiple files which are named after packages using them (ending with .install/postint/prerm/dirs/init/...) (they are used by various dh_* scripts during package build). You will have to rename those files as well.
Looking at nginx's debian/rules, it looks like there are some hardcoded pacakge names in binary-indep and build-dbg rules as well which need fixing as well.
to make it easy and avoid hacking with debian/packages, use
be sure to read the man-file carefully, because you'll need some cli-switches be present lilke package-maintainer, package-version etc, but once it is setup it works like charme.
we use it to script our build-prozesses anbd create rpm/deb - packages from one build.