deb-common.mk 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. # common targets and definitions for debian packaging (simple deb packaging and pypi2deb)
  2. # "simplified" deb package files follow s simple filename pattern (e.g. "python3-foo.deb") without
  3. # any version numbers or architectures. They are useful for build artifact uploads.
  4. DIR_DEBIAN_SIMPLIFIED_PACKAGE_FILES ?= $(DIR_DEBIAN_BUILD)/export
  5. # "wildcard" resolves the home directory
  6. DEB_DPUT_CONFIG ?= $(wildcard ~/.dput.cf)
  7. LINTIAN_ARGS ?=
  8. .PHONY: help
  9. help: help-deb-common
  10. .PHONY: help-deb-common
  11. help-deb-common:
  12. @echo "deb-related targets common for all packaging methods:"
  13. @echo " check-dput-config"
  14. @echo " clean-deb-export"
  15. @echo " dist-deb-packages-directory"
  16. @echo " init-deb - prepare a deb package skeleton directory (by using 'dh_make')"
  17. @echo " test-deb - run tests for debian packaging ('lintian')"
  18. @echo
  19. .PHONY: check-dput-config
  20. check-dput-config:
  21. @[ -e "$(DEB_DPUT_CONFIG)" ] || { \
  22. echo "Failed to find 'dput.cf' file ($(DEB_DPUT_CONFIG))."; \
  23. echo "You should provide this file or override its location (DEB_DPUT_CONFIG)."; \
  24. exit 1; } >&2
  25. .PHONY: init-deb
  26. init-deb:
  27. @if [ -d debian ]; then \
  28. echo >&2 "ERROR: cowardly refusing to run 'dh_make' while 'debian/' exists"; \
  29. exit 1; fi
  30. dh_make --copyright gpl3 --createorig \
  31. --packagename "$(notdir $(shell pwd))_$(call get_current_version)"
  32. @echo "An example 'debian/' directory was created. You should verify its content."
  33. @echo "Afterwards you may want to remove all debian/*.ex files (examples)."
  34. @echo "Read the Debian New Maintainer's Guide for more details:"
  35. @echo " https://www.debian.org/doc/manuals/maint-guide"
  36. .PHONY: deb-lintian
  37. deb-lintian:
  38. @if [ -d "$(DIR_DEBIAN_BUILD)" ]; then \
  39. find "$(DIR_DEBIAN_BUILD)" -type f -name "*.changes"; fi \
  40. | xargs --max-args=1 --no-run-if-empty lintian $(LINTIAN_ARGS)
  41. .PHONY: test-deb
  42. test-deb: deb-lintian
  43. .PHONY: test
  44. test: test-deb
  45. .PHONY: clean-deb-export
  46. clean-deb-export:
  47. $(RM) -r "$(DIR_DEBIAN_SIMPLIFIED_PACKAGE_FILES)"
  48. .PHONY: clean
  49. clean: clean-deb-export