Fast preparation of a source-only upload for Debian

Let’s assume that you find the source code of a software for Debian with a debian/ directory included. How to prepare the .dsc package (Debian source package) used for upload quickly? I will show you here.

  1. Extract the software into a certain directory, let’s say foobar/.
  2. Repack original tarball and exclude debian/ dir using tar. Rename orig tarball as <PKGNAME>_<PKGVER>.orig.tar.{bz2,gz,lzma,xz}. Note that if your package is Debian native, you should skip this step.
  3. cd foobar/
  4. dpkg-source -b .
  5. (cd ..; debsign ./*.dsc -k<YOUR_GPG_KEY_FINGERPRINT>)
  6. dpkg-genchanges -S > ../<PKGNAME>_<PKGVER>.changes
  7. cd ..; debsign ./*.changes -k<YOUR_GPG_KEY_FINGERPRINT>

All done. You may now upload the source package with dput tool.