# Convenience targets for the python3-site24x7-agent Debian source package.
#
# The Debian build is offline (dpkg-buildpackage / cowbuilder shouldn't reach
# the network). `make getsrc` fetches the upstream inputs ahead of time so
# they sit alongside debian/ in the source tree; `dpkg-buildpackage` then
# picks them up from the working dir.
#
# `make orig` builds the .orig.tar.gz that 3.0 (quilt) requires. Run it once
# the bundled inputs are in place; rerun whenever they change.

include getsrc.mk

UPSTREAM_VERS = 22.1.0
PKG           = python3-site24x7-agent
ORIG_TARBALL  = ../$(PKG)_$(UPSTREAM_VERS).orig.tar.gz

.PHONY: orig
orig: getsrc
	tar -czf $(ORIG_TARBALL) \
	    --transform='s,^\./,$(PKG)-$(UPSTREAM_VERS)/,' \
	    --exclude='./debian' \
	    --exclude='./.git' \
	    --exclude='./Python-$(PY_VERS)' \
	    --exclude='./monagent' \
	    .

.PHONY: source-package
source-package: orig
	dpkg-buildpackage -us -uc -S

.PHONY: binary-package
binary-package: getsrc
	dpkg-buildpackage -us -uc -b

.PHONY: clean
clean:
	rm -rf Python-$(PY_VERS) monagent debian/python3-site24x7-agent \
	       debian/.debhelper debian/files debian/debhelper-build-stamp \
	       debian/*.substvars debian/*.log
