dpkg-deb: Remove trailing ‘/’ and ‘/.’ from the directory name on -b
When using “dpkg-deb -b” and specifiyng only the directory name to be
used as the base name for the package name, remove any trailing
characters that would make dpkg-deb create the destination file inside
the directory.
Closes: #218018, #373602