Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I downloaded the files for Mercurial 1.5.2 from (mercurial_1.5.2-1.debian.tar.gz, mercurial_1.5.2-1.dsc and mercurial_1.5.2.orig.tar.gz). How do I get a .deb package out of these? I tried to follow the instructions at but they don't work.

I tried to unpack the two archives and run dpkg-buildpackage or debian/rules build but that fails with:

dh --with quilt clean
   debian/rules override_dh_auto_clean
make[1]: Entering directory `/home/user/packages/mercurial-deb'
cp -a mercurial/ mercurial/
cp: cannot stat `mercurial/': No such file or directory
make[1]: *** [override_dh_auto_clean] Error 1
make[1]: Leaving directory `/home/user/packages/mercurial-deb'
make: *** [clean] Error 2

That's because the directory mercurial is inside mercurial_1.5.2/. Why doesn't the build script cd into the right place? If I try ../debian/rules build, I get

dh --with quilt build
dh: cannot read debian/control: No such file or directory


How do I compile a package for debian???

share|improve this question
Should be on SO? – Fake Name May 21 '10 at 9:01
This isn't about programming but "how do I use software". But it's a grey area, I agree. – Aaron Digulla May 21 '10 at 9:30
up vote 1 down vote accepted

Why would you want to recompile it? Well whatever.
First, grab them with: dget -u --insecure

Then run those commands. This will pack them into a deb like in the archive.

(I would just add a sid.list into my /etc/apt/sources.list.d/ and use apt-pinning since it grabs every needed dependencies, etc etc. You should check apt-pinning out if you just want a newer version.)

share|improve this answer
Thanks, that works. My reason is that I have a patch which I need and I really don't want to pollute my system with unknown packages at this time, so no "sid" for me (whatever that might be - it's my first contact with debian). – Aaron Digulla May 21 '10 at 10:31

You need to get the mercurial_1.5.2-1.debian.tar.gz file as well. Extract this into the right place and you should be good to go.

The orig file is the source code that the Debian people have got hold of. The debian file contains the changes they have made to the package, including all the information on how the .deb file needs to be built.

share|improve this answer
The "right place" was what I was missing. I unpacked the debian directory along with the orig sources instead of inside of it. – Aaron Digulla May 21 '10 at 11:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.