zorkian / nagios-api

A REST-like, JSON interface to Nagios
BSD 3-Clause "New" or "Revised" License
586 stars 173 forks source link

Trouble building Debian package as there are no test available #72

Closed gregoo closed 8 years ago

gregoo commented 8 years ago

Environnement: Debian 7.10 + Sloppy backports (for dh-virtualenv package, 0.10-1~bpo70+1) + libffi-dev required for building as well

At the end of ./build_deb.sh, dh-virtualenv (which is ran by dpkg-buildpackage) tries to launch the tests (setup.py test) but there aren't any and the command exits with a non-zero return code, thus aborting the build process.

Successfully installed nagios-api
Cleaning up...
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
   or: setup.py --help [cmd1 cmd2 ...]
   or: setup.py --help-commands
   or: setup.py cmd --help

error: invalid command 'test'
Traceback (most recent call last):
  File "/usr/bin/dh_virtualenv", line 106, in <module>
    sys.exit(main() or 0)
  File "/usr/bin/dh_virtualenv", line 92, in main
    deploy.run_tests()
  File "/usr/lib/python2.7/dist-packages/dh_virtualenv/deployment.py", line 153, in run_tests
    subprocess.check_call([python, 'setup.py', 'test'], cwd=self.sourcedirectory)
  File "/usr/lib/python2.7/subprocess.py", line 511, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/home/gregory/git/nagios-api/debian/nagios-api/usr/share/python/nagios-api/bin/python', 'setup.py', 'test']' returned non-zero exit status 1
make: *** [binary] Error 1
dpkg-buildpackage: error: fakeroot debian/rules binary gave error exit status 2

Adding --no-test to debian/rules seems to solve the problem

$ cat debian/rules
#!/usr/bin/make -f

%:
        dh $@ --with python-virtualenv --no-test
Successfully installed nagios-api
Cleaning up...
   dh_usrlocal -O--no-test
   dh_link -O--no-test
   dh_compress -O--no-test
[...]
$ file dist/nagios-api_1.2.2-1_amd64.deb
dist/nagios-api_1.2.2-1_amd64.deb: Debian binary package (format 2.0)
zorkian commented 8 years ago

Pull request just landed to fix this!