ostree/packaging/Makefile.dist-packaging
2014-06-02 15:27:40 -04:00

34 lines
1.1 KiB
Makefile

# -*- mode: Makefile -*-
GITREV = $$(git describe --always --tags)
GITREV_FOR_PKG = $(shell echo "$(GITREV)" | sed -e 's,-,\.,g' -e 's,^v,,')
srcdir=$(shell pwd)
PACKAGE=ostree
PKG_VER = $(PACKAGE)-$(GITREV_FOR_PKG)
dist-snapshot:
set -x; \
echo "PACKAGE=$(PACKAGE)"; \
TARFILE_TMP=$(PKG_VER).tar.tmp; \
echo "Archiving $(PACKAGE) at $(GITREV)"; \
(cd ..; git archive --format=tar --prefix=$(PKG_VER)/ $(GITREV)) > $${TARFILE_TMP}; \
(cd $$(git rev-parse --show-toplevel); git submodule status) | while read line; do \
rev=$$(echo $$line | cut -f 1 -d ' '); path=$$(echo $$line | cut -f 2 -d ' '); \
echo "Archiving $${path} at $${rev}"; \
(cd $(srcdir)/$$path; git archive --format=tar --prefix=$(PKG_VER)/$$path/ $${rev}) > submodule.tar; \
tar -A -f $${TARFILE_TMP} submodule.tar; \
rm submodule.tar; \
done; \
mv $(PKG_VER).tar{.tmp,}; \
rm -f $(PKG_VER).tar.xz; \
xz $(PKG_VER).tar
srpm: dist-snapshot
sed -e "s,^Version:.*,Version: $(GITREV_FOR_PKG)," $(PACKAGE).spec.in > $(PACKAGE).spec; \
./rpmbuild-cwd -bs $(PACKAGE).spec
rpm: srpm
$(srcdir)/rpmbuild-cwd --rebuild $(PKG_VER)*.src.rpm