1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
|
#!/usr/bin/make -f
# -*- makefile -*-
VERSION = $(shell head -n1 debian/changelog | sed -e 's/.*(//;s/+.*).*//;s/\+/\-/')
PKD = $(abspath $(dir $(MAKEFILE_LIST)))
PKG = $(word 2,$(shell dpkg-parsechangelog -l$(PKD)/changelog | grep ^Source))
DATE = $(shell date +%Y%m%d)
UURL = git://github.com/Instagram/python-instagram.git
UDATE = $(shell date --rfc-3339=seconds --date='TZ="UTC" $(shell echo $(VER) | perl -ne 'print "$$1-$$2-$$3" if m/\+(?:git|svn|hg)(\d{4})(\d{2})(\d{2})/')')
export PYBUILD_NAME=instagram
%:
dh $@ --with python3 --buildsystem=pybuild
get-orig-source:
$(if $(wildcard $(PKG)-$(VERSION)),$(error $(PKG)-$(VERSION) exist, aborting..))
@echo "# Downloading..."
git clone $(UURL) ../$(PKG)-$(VERSION) \
|| $(RM) -r ../$(PKG)-$(VERSION)
cd ../$(PKG)-$(VERSION) \
&& git checkout v$(VERSION) || git checkout $$(git log -n1 --format=%h --before="$(UDATE)") \
&& [ -s ChangeLog ] || ( echo "# Generating ChangeLog..." \
; git log --pretty="format:%ad %aN <%aE>%n%n%x09* %s%n" --date=short > ChangeLog \
; touch -d "$$(git log -1 --format='%ci')" ChangeLog) \
&& echo "# Setting times..." \
&& for F in $$(git ls-tree -r --name-only HEAD); do touch --no-dereference -d "$$(git log -1 --format="%ai" -- $$F)" "$$F"; done
@echo "# Get HEAD ..."
cd ../$(PKG)-$(VERSION) && git rev-parse HEAD | cut -c 1-7 >../head.tmp
get-orig-source_2:
@echo "# Cleaning-up..."
cd ../$(PKG)-$(VERSION) \
&& $(RM) -r -v \
dist \
python_instagram.egg-info \
&& $(RM) -r .git .git*
@echo "# Packing..."
$(eval SH1 = $(shell cat ../head.tmp ))
find -L "../$(PKG)-$(VERSION)" -xdev -type f -print | sort \
| XZ_OPT="-6v" tar -caf "../$(PKG)_$(VERSION)+git$(DATE)~${SH1}.orig.tar.xz" -T- --owner=root --group=root --mode=a+rX
$(RM) -r "../$(PKG)-$(VERSION)"
$(RM) ../head.tmp
|