Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is dh_usrlocal throwing a build error?

I am trying to compile a deb package for my server. When I go to build, everything looks good until it gets to dh_usrlocal The build stops and make returns an error. The problem is I am trying this for the first time and I really don't know where to look for the problem.

This is the output from my terminal, I also included the command I ran at the bottom of the output.

make[2]: Leaving directory `/home/ian/Desktop/scst-2.1.0/src'
make[1]: Leaving directory `/home/ian/Desktop/scst-2.1.0'
   dh_install
   dh_installdocs
   dh_installchangelogs
   dh_installexamples
   dh_installman
   dh_installcatalogs
   dh_installcron
   dh_installdebconf
   dh_installemacsen
   dh_installifupdown
   dh_installinfo
   dh_pysupport
   dh_installinit
   dh_installmenu
   dh_installmime
   dh_installmodules
   dh_installlogcheck
   dh_installlogrotate
   dh_installpam
   dh_installppp
   dh_installudev
   dh_installwm
   dh_installxfonts
   dh_bugfiles
   dh_lintian
   dh_gconf
   dh_icons
   dh_perl
   dh_usrlocal
dh_usrlocal: debian/scst/usr/local/include/scst/scst.h is not a directory
dh_usrlocal: debian/scst/usr/local/include/scst/scst_user.h is not a directory
dh_usrlocal: debian/scst/usr/local/include/scst/Module.symvers is not a directory
dh_usrlocal: debian/scst/usr/local/include/scst/scst_debug.h is not a directory
dh_usrlocal: debian/scst/usr/local/include/scst/scst_const.h is not a directory
dh_usrlocal: debian/scst/usr/local/include/scst/scst_sgv.h is not a directory
rmdir: failed to remove `debian/scst/usr/local/include/scst': Directory not empty
dh_usrlocal: rmdir debian/scst/usr/local/include/scst returned exit code 1
make: *** [binary] Error 1
dpkg-buildpackage: error: debian/rules binary gave error exit status 2
ian@vm01:~/Desktop/scst-2.1.0$ sudo dpkg-buildpackage -rfakeroot

Any help would be appreciated.

like image 409
ianc1215 Avatar asked Sep 18 '11 05:09

ianc1215


3 Answers

you should skip running dh_usrlocal. to do it you just add this to debian/rules file: override_dh_usrlocal:

In general manner if you have a problem with a specific target, you just override it by adding override_{target} in your debian/rules file.
example, you have a problem with dh_icons. you just add this in your debian/rules file.

override_dh_icons:
    {insert your processing commands or do nothing to skip it when building package}
like image 128
elhadi dp ıpɐɥןǝ Avatar answered Oct 05 '22 15:10

elhadi dp ıpɐɥןǝ


A proper Debian package is not allowed to generate stuff there but empty directories.That is why it is complaining that it can not delete the directory. It doesnt expect files to be there.the only thing you can have is a directory in /usr/local and that's what dh_usrlocal tries to handle but you shouldn't have files

Users only put files in /usr/local/.

Also i think if you have usr/local name in your directory path it will cause the error also like even though it is not the correct usr/local. An example of what could cause the problem also. I think the regex in build software looks for usr/local.

/var/tmp/usr/local/

I know this is an old post but it is ranked #1 on google so needs a good answer so people solve this problem quickly.

like image 31
Martin Naughton Avatar answered Oct 05 '22 16:10

Martin Naughton


IMPORTANT: This error ONLY occurs when you try to install to /usr/local/

I moved my package to install from /usr/local/lib/python3/dist-packages/ to /usr/lib/python3/dist-packages and the error disappeared. dh_usrlocal seems to be broken or my package is not abiding by rules it expects.


I started getting the error after adding a package.install file to my debian package so it would copy the package contents to the filesystem. (I was installing to /usr/local/ at the time)

Contents of my install file when it failed:

usr/* usr/

Contents when it works correctly:

usr/ usr/

File structure of debian package:

packagename-0.1/
  debian/
  usr/
    local/
      lib/
        python3/
          packagename/

Edit: This seems only to work when copying root directories. Once I try to specify copying past usr/, it breaks with the same error. See top of answer to find my solution.

like image 30
NuclearPeon Avatar answered Oct 05 '22 17:10

NuclearPeon