Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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 have made some debian packages to ease deployment of configurations on new servers and want to put them in SVN source control. The problem is that SVN creates a .svn directory for each subdirectory in the source tree, so I can't build packages on the source tree 'dpkg-deb --build ' because the '.svn' directories will be included in the resulting package. So far when I want to build a package I have to export the directory to a different place and build from there.

Is there a quick way to making 'dpkg-deb --build' ignore the .svn directories?

share|improve this question
up vote 4 down vote accepted

My understanding is that you should not be building a debian package with dpkg-deb --build in the first place. If you use dpkg-buildpackage instead, you won't have to worry about .svn directories being included in your package.


There may be a better method, but here's one I haven't thoroughly tested:

Use dh_make to create a skeleton debian package. Put your files in the directory above the debian directory.

edit the resulting dirs file, and put the paths you are going to move files into, eg:


Then in your rules file, remove the $(MAKE) code and set your install: build section to something like this:

install: build
  dh_clean -k 

  # Copy files into staging area
  rsync --exclude .svn -a mypackage/ debian/tmp/opt/mypackage/
share|improve this answer
Note: this is "old school" debhelper. Since debhelper has migrated to dh $@ and the new targets like override_dh_auto_build-indep – Franklin Piat Aug 17 '15 at 6:19
@FranklinPiat is correct – chrishiestand Aug 18 '15 at 23:59

It's worth documenting here that if you're going to use dpkg-buildpackage that it has a -i switch to ignore things. IE, use -i.svn to ignore the .svn directory.

share|improve this answer

To exclude files to be put in the source debian package, you should create the file:


and enter the options you want to pass to dpkg-source, in your case:

tar-ignore = ".svn/*"

See the man for dpkg-source.

share|improve this answer

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.