When creating a Debian package with dpkg-buildpackage (and debhelper), I am using the following entry in debian/rules for assigning ownership of my-config to my-user (instead of root):
override_dh_fixperms:
dh_fixperms
chown my-user:my-user $(CURDIR)/debian/my-package/etc/my-config
dpkg-buildpackage runs as part of a build pipeline where the package name may be chosen as either my-package or my-package-n (n is an integer). It currently fails in the case of my-package-n because of the mismatch to the constant directory name my-package in the path for chown.
Is there mechanism in dpkg_buildpackage (and debhelper in particular) that gives access to the package name (my-package or my-package-n in my case) or the package build directory ($(CURDIR)/debian/my-package or $(CURDIR)/debian/my-package-n in my case)?
I've printed "ordinary" environment variables with set between in dh_fixperms and chown: apparently none such holds the desired information.